CS 3310 - Language Translators

Assignment 6: Code Generation.

This assignment is the last part of a multi part project to write an optimizing compiler for Minijava. In this assignment, we start with programs in miniRA format and translate them to MIPS assembly.

Use JTB and JavaCC and write in Java one or more visitors which translate miniRA programs to assembly form. Your main file should be called P6.java, if P.miniRA contains a program to be assembled then

java P6 < P.miniRA > P.s

should create P.s in MIPS assembly form and is semantically equivalent to P.miniRA. 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 miniRA form, you could tie the miniRA.jj and Main.java to build a parser. To ensure that your generated .s program is semantically equivalent to the miniRA program, you can use the MIPS interpreter (download) to compare the output of P.miniRA with the output of the .s program generated by your code generator. A sample Main.java can be found here.

Grading policy
Your homework will be graded for a total of 100 marks.
[ under development ]