shivansh / gogo

Go to MIPS compiler, written in Go. Course project for Compiler Design (CS335).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gogo

Build Status

Go to MIPS compiler, written in Go.

Logo

Gopher vector imported from egonelbre/gophers .


Components

Component Demo
Token generation / Lexer test1.out
Parser struct.go ➡️ struct.html
IR generation scope.go ➡️ scope.ir
Code generation pascalTriangle.ir ➡️ pascalTriangle.asm

Setting up

Run ./scripts/setup.sh from the root directory of the project to set up the pre-commit git hooks.

Dependencies

Build

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.

Testing

The tests can be built via -

make test

About

Go to MIPS compiler, written in Go. Course project for Compiler Design (CS335).

License:MIT License


Languages

Language:Go 70.8%Language:Assembly 20.2%Language:HTML 6.0%Language:Shell 2.6%Language:Makefile 0.5%