First, copy the chap2 directory of files that Appel provides into the directory you are going to work in and look at them. You can access the chap2 directory off of this web page or copy it from ~max/www-docs/courses/S1999/MC97/tiger/chap2. The simplest way to do this would be using the command
cp -pr ~max/www-docs/courses/S1999/MC97/tiger/chap2 .which will give you your very own chap2 directory tree, just like mine. Note that I have fixed a couple bugs in Appel's code; if you for some reason want to use the code from his web site instead of mine, you'll need to make those same fixes.
Next, compile the program as it stands. To do this, change directory to the chap2 directory, set your CLASSPATH environment variable so that java can find JLex and java_cup, and then run the make command:
cd chap2 setenv CLASSPATH ~max/JavaLib:. makeTo test this initial minimal version of the lexical analyzer, make a file (called commas.tig, for instance) containing nothing but commas, spaces, and newlines. Then give the command
java Parse.Main commas.tigThis should report the position in your file of each comma and of the end of file.
Here are some tips for extending this lexical analyzer to the full Tiger language:
err("illegal character");Of course, it would be preferable to be more specific.
make clean makeThis deletes all the output files and then reproduces them all from scratch, rather than trying to only make those that need it.
Your lab report should include documentation of design and testing as well as your code.
Instructor: Max Hailperin