CIT 594 Changes to the Bugs Parser
Spring 2008, David Matuszek

I have made a few (mostly very minor) changes to the Bugs Parser assignment. These are corrections, clarifications, and simplifications. Here they are:


In the Parser.java and ParserTest.java starter code that I gave you, there are methods called isExpression() and testIsExpression(). These methods don't handle the comparison operators ("<", "<=", etc.), so they should be renamed isArithmeticExpression() and testIsArithmeticExpression(), respectively.

The (new) isExpression() method should recognize arithmetic expressions combined with comparisons, in accordance with:
      <expression> ::= <arithmetic expression> { <comparator> <arithmetic expression> }

If you have done the Recognizer class correctly, the methods in it should already be correctly named.


My drawing for the <bug definition> syntax tree had the positions of { <var declaration> } and <initialization block> reversed. This has been corrected in the picture.


I drew the syntax tree for <function definition> with a parameters child. This has been changed to a var child.


I drew the syntax tree for <exit if statement > with an exit if child. Since it was ambiguous how to represent this with a single token, I changed it to be just exit.


In the grammar that I gave you, I didn't allow for the possibility of a unary plus or a unary minus. However, the code I supplied for isFactor() and testIsFactor() does allow for unary plus and unary minus. This should be obvious when you build the syntax tree for <factor>, but now it is also in the grammar. (I didn't, however, fix the Javadoc for isFactor() to show the corrected grammar.)