CS 6013 - Modern Compilers, Theory and Practice

Assignment 2: Java Type Checker

This assignment is the first part of a multi part project to write an optimizing compiler for Minijava. We start with the LL(k) grammar for minijava and follow simplification and optimization phases, similar to what is seen in a standard optimizing compiler. In this assignment, we will implement a type checker for the minijava compiler.

Use JTB and JavaCC and write in Java one or more visitors which type check a MiniJava program. Your main file should be called Typecheck.java, and if P.java contains a program to be type checked, then

java Typecheck < P.java

should print either "Program type checked successfully" or "Type error". Note, your program must take input from standard input and write to standard output (so that we can use redirection).

A sample Main.java can be found here.

Grading policy
Your homework will be graded for a total of 100 marks. Of these 50 marks will be for the public testcases, 10 marks for the contributed testcases and 40 marks for the TA testcases. Students can get upto 10 bonus points by contributing good testcases. Details can be found here.
[ under development ]