MC97 Lab 1: Warm-Up Interpreter (Spring 1999)

Due: February 17, 1999

For this lab, you are to do the two problems listed on page 12 of the textbook.

First, copy the three files that Appel provides into the directory you are going to work in and look at them. They are

You can access these three files off of this web page or copy them from the directory ~max/www-docs/courses/S1999/MC97/labs/lab1/.

Next, compile and run the program as it stands. This will print out a 0, because the maxargs procedure is a stub that pretends the answer is always 0 and the interp is a stub that does nothing. Once you have written maxargs, you will get a real answer in place of 0, and once you have written interp, that count will be followed by the sample program's output. In order to compile the program, you need to give the following three commands:

javac slp.java
javac prog.java
javac interp.java
Because of the way in which Appel packaged the program into files, you need to give the three javac commands separately and in the order shown. Once the program is compiled, you can run it as follows:
java interp

Now you should write maxargs and interp, testing your work as you go. Here are some pointers:

Your lab report should include the tests you used as well as your code.


Instructor: Max Hailperin