Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sunchao/tiger
Tiger Compiler from "Modern Compiler Implementation in ML" by Andrew W. Appel
https://github.com/sunchao/tiger
compiler sml
Last synced: about 2 hours ago
JSON representation
Tiger Compiler from "Modern Compiler Implementation in ML" by Andrew W. Appel
- Host: GitHub
- URL: https://github.com/sunchao/tiger
- Owner: sunchao
- Created: 2013-01-16T22:54:11.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-05-15T05:03:01.000Z (over 9 years ago)
- Last Synced: 2024-04-16T11:12:09.412Z (7 months ago)
- Topics: compiler, sml
- Language: Standard ML
- Size: 369 KB
- Stars: 96
- Watchers: 5
- Forks: 22
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Tiger Compiler
=====Tiger Compiler from "Modern Compiler Implementation in ML" by Andrew
W. Appel### Introduction
This is a Tiger compiler with all modules completed until Chapter 12
in the book. Basically I followed all the instructions from the book
without much alternation. I also tried to
adhere to the functional style as much as possible, that means,
minimize the usage of mutable data structures.### Requirement
So far the compiler works with either mac or linux. Besides that,
you need to have Standard ML and spim installed. Both of them can be
fetched via homebrew.Standard ML is obviously need to compile the programs. Since the
compiler generates spim code, you'll need the
[SPIM simulator](http://spimsimulator.sourceforge.net/) to actually
run the executables.### Build
To build the compiler, simply run```
make main
```This will build the image using `sources.cm`. Note that it currently
doesn't support windows.### Compile
Given a tiger source program `foo.tig`, to compile it, you'll need to first copy
the file to the project directory, and run```
make foo.spim
```This will compile the file, append `runtime.s` to it, and generate a
output SPIM program called `foo.spim`. Then to execute the program,
run```
spim -file foo.spim
```If `foo.spim` exists, make will not overwrite it. You must remove the file before running make again.
### Future Work
The second half of the book covers a lot of interesting stuff, and I'm
thinking about extending the compile with the following features:* Garbage Collection
* OO Features
* Functional Features
* Polymorphism and Type Inference
* Optimizations