This is a homework project for compiler principle course of Sun Yat-sen University. ROSE stands for Reverse Oberon Software Engineering, which is the main purpose of the project - design and implement a tool that is used for analysing oberon programs.
The project contains four parts:
- ex1: Oberon-0 programming: Write several simple programs in Oberon-0 language
- ex2: Lexical analysis: Write a lexical analyzer for Oberon-0 language
- ex3: Semantic translation with JavaCup: Write a syntax analyzer for Oberon-0 language using JavaCup
- ex4: Semantic translation from scratch: Write a Predictive Recursive Descent Parser for Oberon-0 language, and plot the flow chart of the program
.
├── dependencies # Dependencies (JFlex, JavaCup, etc.)
| ├── graphs
| | ├── callgraph.jar
| | ├── jgraph.jar
| | └── flowchart.jar
| ├── jflex
| └── javacup
├── ex1 # Oberon-0 programming
| └── testcases # Programs in Oberon-0
├── ex2 # Lexical analysis
| ├── bin # Compiled classes
| ├── src # Source codes
| └── testcases # Test cases
├── ex3 # Syntax analysis with JavaCup
| ├── bin # Compiled classes
| ├── src # Source codes
| └── testcases # Test cases
└── ex4 # Syntax analysis from scratch
├── bin # Compiled classes
├── src # Source codes
└── testcases # Test cases
The batch files in each ex folder have been designed with care. You can run them from any directory you like. Additionally for build.bat
files, you can specify the very class you want to (re)-compile.
Here are some examples of using the batch files:
# Assume you are in the root folder of the project
# Generate lexer
ex4\generate
# Compile all the classes in ex4
ex4\build
# Run with test case in ex4\testcases\pow.obr
ex4\run .\ex4\testcases\pow.obr
# Assume you suddenly found a bug in the codes and modified Parser.java and Main.java, now you need to recompile them
ex4\build Parser Main
The dependencies that are used in this project are listed below:
The codes under the src\
folder are licensed under MIT License.
This license does not apply to any code that is directly relevant with or generated by the dependencies.