Error Recovery
. An error is detected when an entry in the action table is found to be empty.
. Panic mode error recovery can be implemented as follows:
- scan down the stack until a state S with a goto on a particular nonterminal A is found.
- discard zero or more input symbols until a symbol a is found that can legitimately follow A.
- stack the state goto[S,A] and resume parsing.
. Choice of A: Normally these are non terminals representing major program pieces such as an expression, statement or a block. For example if A is the nonterminal stmt, a might be semicolon or end.