COSC 170 Compiler Construction
Spring 2007
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 26, 2:00PM CST.
Submit: E-mail electronic copy to professor, with a subject header
"COSC 170 P1".
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.
Submit the file Interpreter.java. Your interpreter
should work with the unaltered abstract syntax tree classes provided,
and with any proper Program.java file provided for testing.
Back
[Rev 1.2 2007 Jan 17 11:50 DWB]