CS 3310 - Language Translators

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 P2.java, and if P.java contains a program to be type checked, then

java P2 < 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.
[ under development ]