Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shivansh/gogo
Go to MIPS compiler, written in Go. Course project for Compiler Design (CS335).
https://github.com/shivansh/gogo
compiler garbage-collection go gocc mips peephole reaching-definitions
Last synced: 5 days ago
JSON representation
Go to MIPS compiler, written in Go. Course project for Compiler Design (CS335).
- Host: GitHub
- URL: https://github.com/shivansh/gogo
- Owner: shivansh
- License: mit
- Created: 2018-01-11T12:17:55.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-12T11:08:34.000Z (almost 6 years ago)
- Last Synced: 2024-06-20T03:37:31.982Z (5 months ago)
- Topics: compiler, garbage-collection, go, gocc, mips, peephole, reaching-definitions
- Language: Go
- Homepage:
- Size: 1.01 MB
- Stars: 27
- Watchers: 6
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gogo
[![Build Status](https://travis-ci.org/shivansh/gogo.svg?branch=master)](https://travis-ci.org/shivansh/gogo)Go to MIPS compiler, written in Go.
*Gopher vector imported from [egonelbre/gophers
](https://github.com/egonelbre/gophers).*- - -
## Components
| Component | Demo |
|:------------------------:|:----------------------------------------------------------------------------------------------------------------------------------:|
| Token generation / Lexer | [`test1.out`](test/lexer/test1.out) |
| Parser | [`struct.go`](test/parser/struct.go) :arrow_right: [`struct.html`](https://shivanshrai84.gitlab.io/staticPages/assets/struct.html) |
| IR generation | [`scope.go`](test/codegen/scope.go) :arrow_right: [`scope.ir`](test/codegen/scope.ir) |
| Code generation | [`pascalTriangle.ir`](test/ir/pascalTriangle.ir) :arrow_right: [`pascalTriangle.asm`](test/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
* [gocc](https://github.com/goccmack/gocc)## 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)
-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](http://spimsimulator.sourceforge.net/) MIPS32 simulator.
## Testing
The [tests](test) can be built via -
```
make test
```