NOTICE: We will frequently modify this instruction page as questions arise. A correct version of Grm.cup will be posted soon. You can start by using your own Grm.cup.

IMPORTANT:
Download correct Grm.cup here.


IDleft & IDright
IDleft and IDright .. or the left and right appended to any name associated with non-terminals should be the left and the right position of the tokens.. in the abstract tree, they will use the left position of the ID to specify the position of the token. In an expression such as a PLUS, they will use the position of the PLUS to specify the position of the expression.

Thus, the position associated with something like

a + b should be the position of the '+'.


In this project, you need to construct the abstract syntax tree for the tiger grammer. You need to modify the Grm.cup and add semantic action code at end of each of your grammar rule. See P85. Notice that all the abstract syntax tree class definitions for this project is in Absyn/* directory. The classes have been complied for you. All you need to do is to call the class constructor properly and return the right value for each Tiger grammar rules.

We will give you a correct Grm.cup by end of this week. So please check back at the WEB page later.

To start:

make a directory Project3 in your home directory, and copy all the files from /home/champion/q/ramakrip/proj3/ to your Project3 directory.

Set up your CLASSPATH so /your-home-directory/Project3 is in your CLASSPATH. (similar to how you set up your enviornment in Project 2)

The makefile is the same for project3 as for project2.

Similarly, compile and run your project as "java Parse.Main test.tig".

To test:

Make use of the Print class in Print.java to print out your abstract syntax tree. By examining the output structure of your abstract syntax tree, you will know if your Grm.cup is correct or not.