Your parser should handle all of the grammar described in the
handout and should construct and print
the corresponding abstract syntax tree.
Java definitions for the abstract tree classes can be found
in assign4.zip
. This also
includes a print visitor for the trees.
METHOD:
The program in CUPdemo.zip
(which
we've discussed in class) should help you get started. You'll
need to use your scanner from Assignment #3 to produce tokens
for the parser.
The "assign4" folder has AbSyn and VisitorPkg
defined, but no ParsePkg yet. Like in
CUPdemo, you'll need to create a ParsePkg
folder with the .cup and .flex files in
it.
Remember
to add the "package ParsePkg;
" line to the top of any files you add to the ParsePkg
directory.
There are a lot of little details to trip over here. Start early and don't be afraid to ask questions!
TEAMS: You may work in teams of 1 or 2 people - that is, by yourself or with one other friend. Each team should just hand in one assignment for grading.
HAND-IN:
You should submit all source files needed and a makefile to build
your parser and test driver. This particularly includes the .cup
file, but should include any other files (e.g. Main.java
,
a .lex
file to generate the scanner, etc.) required
to compile and run your parser.