Go to MIPS compiler, written in Go.
Gopher vector imported from egonelbre/gophers .
| Component | Demo |
|---|---|
| Token generation / Lexer | test1.out |
| Parser | struct.go ➡️ struct.html |
| IR generation | scope.go ➡️ scope.ir |
| Code generation | pascalTriangle.ir ➡️ pascalTriangle.asm |
Run ./scripts/setup.sh from the root directory of the project to set up the pre-commit git hooks.
The following should generate relevant binaries inside the directory bin -
make
The generated binary bin/gogo can be used as follows -
Usage: gogo (-r | -r2s | -s) <filename>
-p Generates rightmost derivations used in bottom-up parsing
-r Generates IR instructions from go program
-r2s Generates the MIPS assembly from IR
-s Generates MIPS assembly from go program
NOTE: The generated MIPS assembly has been tested to work on SPIM MIPS32 simulator.
The tests can be built via -
make test