COSC 170 Compiler Construction

Spring 2009

Project #1: Interpreter

Project 1 is intended to serve as a quick review of Java, and a gentle introduction to the first few concepts in the textbook.
Project 1 is to be completed individually.
Due: Friday, January 23, 11:59PM CST.
Submit: Interpreter.java source file through turnin command on Morbius.

Directions

  • Read Chapter 1 of Appel.
  • Download Java code for "straight-line" language abstract syntax trees, here.
  • Download skeleton code for "straight-line" language interpreter, here.
  • In working directory, compile the abstract syntax tree classes. (javac StraightLine.java.)
  • In Interpreter.java, implement the rest of the interpreter code where indicated by comments, as explained in textbook and in lecture.
  • Compile and run interpreter. (javac Interpreter.java; java Interpreter.)
    You will need manually built AST's (abstract syntax trees) stored in a class called Program.
    A couple of example programs are provided here and here.
    You would do well to construct additional testcases.
  • Debug until done.

  • Back
    [Rev 1.2 2009 Jan 16 12:38 DWB]