CS 6013 - Modern Compilers, Theory and Practice

Assignment 2: Intermediate Code Generation

This assignment is the first part of a multi part project to write an optimizing compiler for BuritoJava. We start with typechecked BuritoJava programs and generate programs in TACoJava format. Akin to a standard optimizing compiler, in this assignment, we will implement a module that translates programs in a high level language (BuritoJava) to programs in intermediate form (TacoJava).

Use JTB and JavaCC and write in Java one or more visitors which translate BuritoJava programs to TACoJava form. Your main file should be called P2.java, if P.java contains a program to be simplified then

java P2 < P.java > P1.java

should create P1.java in TACoJava form and is semantically equivalent to P.java. Note, your program must take input from standard input and write to standard output (so that we can use redirection).

To check that a program is in BuritoJava form, you could tie the BuritoJava.jj and Main.java to build a parser. After that compile and execute the generated code to ensure that the output of the generated code matches that of the input code. A sample Main.java can be found here.

Grading policy
Your homework will be graded for a total of 100 marks. Of these 40 marks will be for the public testcases, and 60 marks for the TA testcases.
[ under development ]