HW3 FAQ



Here are a few examples.  Don't add any white space, and only include the
names of the AST nodes.
If an item is represented in the AST by a Token
or something else that is not a subclass of AST, don't include it.


h x
Program,VarExpr

h @x.f(x,0)
Program,InvokeMethodExpr,VarExpr,VarExpr,IntLitExpr



/* error in class, x must be field or method */
h class x extends y {x} class z extends y {} 1
[RBRACE char 22 in line 1 cop5555.SyntaxException:  expected token IDENT]

(As in HW2, your error message does not need to match this one)

-------------------------

If there is an error while parsing, we need to continue parsing with the next class.  What will happen to the AST formed while parsing?  Do we need to maintain it?

If any error occurs, you will return an ErrorAST which contains the list of ErrorExceptions and any
AST that your parser constructed will be discarded.  The specification does not define what the
AST should be if there are errors.  It is easiest to just let the parser continue to construct it however it does, and test once at the end of parsing for existence of errors.


-----------------
In the grammar in HW2, there is an rule expr ::= (expr) but in HW3, nothing is mentioned for (expr).
Is this a mistake?  

You will construct the AST for whatever sort of expr is inside the parentheses.  The parentheses are
part of the concrete syntax that is no longer needed in the abstract syntax.