This project presents the development of a compiler made from scratch. It has been carried out during the Compilers course by the team formed by JSf98, JCC1998 and me.
-
Generate the lexical file using JFlex:
- open lib/jflex-full.jar
- select the .flex file and generate the output (Scanner.java)
-
Generate the syntactic files using CUP:
# execute just one option java -jar java-cup-11b.jar -parser parser Parser.cup # option 1 java -jar java-cup-11b.jar Parser.cup # option 2
It will generate Parser.java and ParserSym.java files.
-
Add the generated files to the CAVA project (CAVA/src/cava).
-
Execute java project. The program reads the input under the file input.txt to generate the corresponding machine code (if no errors detected).
-
Execute makeExec.sh or makeExecOpt.sh (optimized version of the code) to compile and run the machine code generated.
- JFLex 1.7
- Java CUP 11b