COSC 170 Compiler Construction

Spring 2007

Project #4

Type Checker

Implement a Type Checker for our dialect of the MiniJava programming language, as detailed below.

Project may be completed in teams of two.

Due date: 2007 Mar 23 (Fri) 2:00PM CST.

Submit: E-mail compressed archive of Java source to professor, with a subject header "COSC 170 P4".
Directions

  • Read Chapter 5 of Appel.
  • Implement a semantic analysis (type checking) pass for our dialect of MiniJava.
  • Run the reference implementation of the type checker on Morbius with the command: ~brylow/cosc170/Projects/checker program.java
  • Create your checker in a package called "Semant" with a main program in class "Main". My grading protocol will assume that your project can be compiled and run with the following command line: cd Project4; make; java Semant.Main inputfile.java.
  • Build a decent set of MiniJava testcases. Several exist in the book, and on the web. Having a good set of test inputs will be critical to your success in later phases of the project. The majority of project points will be assigned by running diff to compare your output against mine.
  • Debug until done.
  • Specification
    You will need to represent two type environments -- one for the set of class descriptors, and a second scoped symbol table to be used during checking of the expressions and statements in the program. Implement this is a class Table in a package Symbol. The Table class will need methods put, get, beginScope, and endScope, as discussed in class. I will test your Symbol.Table implementation separately, so please make sure that this works properly. A complete list of errors that the reference implementation produces can be found here . Please match them as exactly as possible. Implement the classes of the Types package as outlined in class. (Types API can be found here.)
    Turn in

    E-mail compressed archive of Java source to professor, with a subject header "COSC 170 P4". My grading protocol will assume that your project can be compiled and run with the following command line: cd Project4; make; java Semant.Main inputfile.java. Please do not send .class files or other detritus.

    A listing of project ERRATA.


    Back

    [Rev 1.02 2007 Feb 23 13:35 DWB]