This GitHub Repo is about our semester long project under the course CSN-352 Compiler Design
Source Language - C
Target Machine/Arch - "RISC-V"
Intermediate Representation - "Three Address Code"
Implementation Language - C++
- Implement arithmetic and logical operators
- Implement
if-else - Implement
forloop - Implement
whileloop - Implement
do-whileloop - Implement
switchcases - Implement
intandchararrays - Work with pointers
- Create and use
struct - Use
printfandscanf| A custom version since we are not able to link the standard library - Implement function calls with arguments
- Use
goto,break, andcontinue - Use the
statickeyword
- Implement recursive function calls
- Use
typedef - Implement an
untilloop - Implement multi-dimensional arrays
- Work with multi-level pointers
- Extended to all type of arrays
- Any Combination of array, pointer, function levels
constkeyword supported
Here's your usage instruction converted into a clean and readable Markdown format:
| Option | Description |
|---|---|
| (No Arguments) | Output will be printed to stdout (terminal). |
-o [<output_file>] |
Send output to a file to <output_file> else same name as input create a output with input_file's base + (.s) |
-t |
Testing Mode - Appends output to <input_file>. |
| Option | Description |
|---|---|
-d1 <dot_file> |
Outputs Parse Tree to <dot_file> |
-d2 <dot_file> |
Outputs Annotated Parse Tree to <dot_file> |
-ir |
Stops at the IR (Intermediate Representation) Phase only |
-
Lvalue(Modifiable or Non-Modifiable) & Rvalue
-
Backpatching used for control-flow
-
Space Change logic for array/pointer derefrencing to accomodate limitations of TAC
-
Register allocation (sub-optimal)
-
Stack allocation
-
Function call
-
Function return
-
Function arguments
-
Live variable analysis
-
Dead code elimination
-
Constant folding and more Optimizations
Don't panic for sucide message 👻