This project is developed for SBU Compiler Design Course - Fall 2021
It has 3 Phases that in each phase the focus is on a specific part of a real compiler.
- Phase 1 (Scanner)
- Phase 2 (Parser)
- Phase 3 (Code Generator)
This project is not a full compiler at all! It is just a simple implementation of a compiler (with many bugs :) ) based on lessons of the course and course assistant team's rules
In this project, we use some useful libraries and projects to make implementation easier.
- Jflex - Lexical Analyzer Generator
- PGen - Graphical LL(1) Parser Generator
- SPIM - Simulator For Programs Written For MIPS R2000/R3000 Processors
In Each Phase, There Are Some Necessary Tasks For Running The Program.
-
Phase 1 : test.txt Is The Input File For Scanner. You Just Need To Change This File For Testing More Inputs. You Can Also See The Result In output.html
-
Phase 2 : In This Phase We need InputCoolFilePath And OutputFilePath And TablePath You Can Change Each Of Them For Different Tests. To Run The Program, You Should Run Main.java Like Below java [javaClassFile] --input [inputCoolFilePath] --output [outputFilePath] --table [tablePath]
-
Phase 3 : You Should Just Run Main.java. The SPIM Output Will Be Created In code.s. You Can Also Change Input File (Cool Program) test.cool
- Fix Scanner Problems (Phase 1)
- Change Graph For Accepting All Declarartions And Assignments In Any Order (Phase 2)
- Add Array Support (Phase 3)
- Fix Logical Computations (Phase 3)
- Clean The Project :) (All Phases)
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.