A compiler for a subset of the C programming language (written in C++).
See the grammar here.
This project is an abomination LOL, especially the ICG.
-
- Lexical Analyzer
-
- Syntax Analyzer
-
- Semantic Analyzer
-
- Intermediate Code Generator (SPIM, ish-done)
-
- Machine-Independent Code Optimizer
-
- Code Generator
-
- Machine-Dependent Code Optimizer
- C++17 (preferably g++)
- Clone the project into your computer.
- Launch the project by running the
main.cpp
file. It would be easier to run the project using JetBrain's CLION IDE. - The test files are found in the
tests
folder.- To switch from one testcase to another, you can:
- Use the Makefile i.e.
make o f=tests/submitted.c && spim -file out.asm
- or, when directly running the executable,
./main tests/submitted.c && spim -file out.asm
- or, change the name in the test file specifier on the
main.cpp
file
- Use the Makefile i.e.
- To switch from one testcase to another, you can: