Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaCompiler

A small compiler front end built with Java, JFlex, and CUP. It lexes and parses a simple imperative language with variables, expressions, control flow, functions, and nested scopes.

Prerequisites

  • Java
  • JFlex
  • CUP

Structure

.
├── README.md
├── cup
│   └── Parser.cup                  CUP parser specification
├── flex
│   └── Scanner.flex                JFlex scanner specification
└── src
    ├── lexer
    │   └── Lexer.java              generated lexer
    ├── parser
    │   ├── BooleanExpression.java
    │   ├── Expression.java
    │   ├── MyObject.java
    │   ├── Parser.java             generated parser
    │   ├── Program.java
    │   ├── Scope.java
    │   ├── Statement.java
    │   ├── Subprogram.java
    │   ├── Symbols.java            generated symbol table
    └── Main.java

Language

Keywords

if else while for func return

Operators

= == != < > <= >=
&& ||
+ - * / % ++ --

Usage

Usage: <main class> [-dp] [--help] FILE...
  FILE...       source files
  -d, --debug   print debugging information
  -p, --parse   parse the file instead of only lexing it
      --help    display help and exit

Built by Mahdi Khodabandeh.

About

Small Java compiler front end built with JFlex and CUP for a simple imperative language.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages