It pops symbols from the stack and replaces them with a non-terminal.
It accepts the input string.
It generates an error.
Questions & Step-by-Step Solutions
What does the 'reduce' action do in an LR parser?
Step 1: Understand that an LR parser uses a stack to keep track of symbols while parsing.
Step 2: Know that a production rule defines how a non-terminal can be replaced by a sequence of symbols.
Step 3: When the parser encounters a situation where a sequence of symbols on the stack matches the right side of a production rule, it performs a 'reduce' action.
Step 4: The 'reduce' action means that the parser will remove (pop) those symbols from the stack.
Step 5: After popping the symbols, the parser will push (replace) a non-terminal onto the stack that corresponds to the left side of the production rule.