Homework Assignment 3
- Published Sunday, December 15, 00:00.
- Due Thursday, December 26, 2013, 13:00. Extension: 30/12/2013, 13:00
- For updates to the assignment, please check Mark Bloch's page, which monitors the assignment at 10 minute intervals and notes any changes. How clever, Mark!
- Assignment 3 definition.
- A Java Project for generating a parser for ADTL via CUP updated on Dec. 22.
- An example ADTL input program and the output of the pretty-printer. Two more examples: Iterator.adt/Iterator.out.adt, GSet.adt/GSet.out.adt added on Dec. 24.
F.A.Q for Exercise 4
- Q: CUP doesn't support Kleene closure so how can I implement lists? A: Context-free grammars can easily express all regular expressions so just express lists by appropriate grammar rules.
- Q: What about the associativity of the various operators? A: The operators +, -, *, /, ||, && all associate to the left. All other operators are non-associative. The priority between operators is given by the following list, starting from the weakest: choose, ||, &&, !, <, <=, >, >= , ==, !=, +, -, *, /, unary -, in.
- Please notice the minor change in the grammar of ADTL for
- For some reason the parsing project is unable to locate the templates file on some platforms. Also, I've added a template for INT so that now you have two ways of treating integer terminals - either returning a Java Integer or constructing an INT object. You downloaded the updated project (make sure to save a copy of your ADTL.cup file to avoid overwriting it and losing your work).
ForumUse the forum below to discuss this assignment.
Note: Please start the subject of your post by stating the exercise you refer to.
10 last forum topics
Show all 30 forum topics