Next: Where to put error
Up: No Title
Previous: Error Recovery in Bottom-Up
- If the parser encounters an error, it will pop the stack
until it gets into a state, where error is legal.
- At this point it shifts error onto the stack.
- Then, the input tokens are skipped, until the next
input token is one that can legally follow the new state.
- This scheme is very dependent on a good choice of
error productions.
- Assume a production Statement = error ";"
- The parser encounters error inside a statement.
It will pop the stack until it expects a statement.
- At this point it shifts error onto the stack.
- Then, the input tokens are skipped, until ";"
is found.
Christoph Zenger
4/6/2000