CS 6013 - Modern Compilers, Theory and Practice

Assignment 4: Loop Transformations.

This assignment is the fourth part of a multi part project to write an optimizing compiler for Minijava. We start with LoopyTACoJava programs and after doing loop transformations generate programs back in TACoJava2 programs.

Use JTB and JavaCC, to write in Java one or more visitors which implement different loop transformations (provided they are legal). Your main file should be called P4.java, if P.java contains a program to be optimized in LoopyTACoJava form, then

java P4 < P.java > Pl.java

should create Pl.java in TACoJava2 form and is semantically equivalent to P.java with some loop transformations applied. Each loop may have an optional annotation, giving the details of the requested loop transformation. You are expected to apply the specified transformation only if it is "safe" to do so.

Note, your program must take input program from standard input and write to standard output (so that we can use redirection).

Grading policy
Your homework will be graded for a total of 100 marks.