From Java to MIPS in Five Nifty Steps

The Hundred Hour Wood



MiniJava grammar minijava.jj specification [javac+java] programs Factorial.java
Piglet grammar piglet.jj specification interpreter programs Factorial.pg
Spiglet grammar spiglet.jj specification interpreter programs Factorial.spg
Kanga grammar kanga.jj specification interpreter programs Factorial.kg
MIPS grammar mips.jj specification SPIM programs Factorial.s

This project (and this web page) is based on the CS 132 project at UCLA. Thanks to Jens Palsberg and Todd Millstein at UCLA.

The grammars for MiniJava, Piglet, Spiglet, Kanga, and MIPS are needed for PA 1–5. Notice that the grammars are available both in HTML and in JavaCC notation.

The compiler project consists of Programming Assignments 1–5. Solutions to PA 1–5 can be combined into a Java-to-MIPS compiler.

PA 1: Type checking of MiniJava

PA 2: MiniJava -> Piglet

PA 3: Piglet -> Spiglet

PA 4: Spiglet -> Kanga

PA 5: Kanga -> MIPS