Project for Compiler course at SBU
Decaf is a simple small object-oriented language similar to C/C++/Java languages, so it isn't hard to understand.
This program has been simplified for easier implementation, you can see project description in ProjcetDcsp pdf file and learn more about decaf in pdf file.
- JFlex : lexer/scanner generator
- CUP : LALR parser generator
- SPIM : simulator for the MIPS R2000/R3000 RISC computers
sudo apt-get install -y spim
First add java-cup-runtime-11b-20160615.jar
to project.
Project Structure -> Modules -> Compile -> Dependencies -> Add...
If you have installed JFlex on your OS:
jflex src/scanner/Scanner.flex
or you can use jar file in the project
cd src/scanner/
java -jar ../../libraries/jflex-1.8.2.jar Scanner.flex
then add Scanner.java to scanner package by writing
package scanner;
on the first line of Scanner.java
file.
cd src/parser/
java -jar ../../libraries/java-cup-11b.jar parser.cup
Change tests/manual/test.d
file to whatever decaf code you want then run src/Compiler.main
.
cd tests/
./run.sh