HW4 CS 451-651
Due: Monday Oct 5
Warning: there is a lot of
typing to do this week. Don't leave it till the last
minute! Don't get behind now!!
Note: You
must provide the typescript from a test run as part of the submission
(from now on, though always a good idea).
This will, of
course, include both the input and output.
It's up to you to
figure out test cases that exercise what you've done. (That's
part of the learning experience). It's not expected that the
testing will be perfect; but points will be deducted if it's
really deficient, i.e. doesn't touch on a whole area.
Basic story:
Take the grammar from last week, and add:
- class definitions for class Node and various subclasses
- action routines to build an Abstract Syntax Tree
- (appropriate constructors in the Node subclasses)
Here are some files to start with -- take them (put them in the "src"
directory) and build on them.
Also:
- my version of the
grammar from hw 3 (filename Parser4.cup) -- contains action
routines
to build ScalarVblRefNode and AssignStmtNode, which you should help
yourself to.
- (This will be useful in case you have any questions about what
grammar we should be using!)
- <you should be able to keep your grammar from HW 3 and modify
it as we move forward>
Note: on Monday, we did not get around to discussing how to
handle stmt_list. We'll pick that up on Wednesday.
Resolution: you can use either an ArrayList (provided by
Java) or a threaded double-ended list.