Tiger Compiler

Written in Standard Markup Language (SML) for the compiler class in my master's degree program at the University of Minnesota, Twin Cities.

Follows along with Modern Compiler Implementation in ML by Andrew W. Appel.

I agreed with my Professor to not make the project publicly accessible so that future students could implement it themselves. It is hosted on GitHub. For access to the full source code, please contact me directly.

Contains the following steps:

  1. Lexical analysis using ML-Lex
  2. Parsing using ML-Yacc
  3. Semantic analysis
  4. Escaping variable calculation
  5. Translation to intermediate code
  6. Conversion to canonical form
  7. Instruction selection within the MIPS architecture
  8. Liveness analysis
  9. Register allocation

Testing

At each compiler phase I used a set of test Tiger programs to validate against expected output which I outputted to files. The full testing/ directory below contains all the test programs under testing/tests/. The expected output files for each phase are under the testing/output-files/$PHASE_NAME/ directory. Steps after parsing, starting with semantic analysis, also validate against program output to standard out, which are under the testing/script-outputs/$PHASE_NAME/ directory. Steps after escaping variable calculation, starting with the translation to intermediate code, only generate output files for those programs which pass semantic analysis. The last two steps, liveness analysis and register allocation, are tested in the final phas under the full-compiler-tests/ directory.

testing/