
Parsing 119
method recoverFromError() and try to recover to the nearest semicolon (SEMI) or
to the end of file (EOF). We pass to this method the instance of ParseException so
that the method can report a meaningful error message.
As another example, let us see how we specify the non-terminal statement,
statement ::= block
| <identifier> : statement
| if parExpression statement [else statement]
| while parExpression statement
| return [expression] ;
| ;
| statementExpression ;
for parsing statements in j--.
private JS t a t e ment statement (): {
int line = 0;
JStateme n t stat e m e n t = null ;
JExpres s i on test = null ;
JStateme n t co n s e q uent = nu