Contents
Page-10
Prev
Next
Page+10
Index
Shift-Reduce Parser
Based on the current state and current input, action[ Sm , aj ]
gives one of four possible actions:
- Shift s: Shift the current input aj onto the stack
and go to the specified next state s.
- Reduce r: Given the production r: A → β , remove
enough items from the stack to match β, produce output structure
from those items, and put the resulting structure A back on the stack.
The next state is found from the goto table.
- Accept: Parsing is completed; return top of stack as result.
- Error: The input cannot be parsed according to the grammar;
call an error recovery routine. Error entries are denoted by blanks
in the parsing table.