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.
The minijava grammar can be found both in javaCC and html
format. A sample Main.java can be found here. A set of sample testcases can be found here.
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.
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 instructors testcases.
Students can get upto 10 bonus points by contributing good testcases. Details can be found
here.