Consider the grammar:
For a sentence , the handles in the right-sentential form of the reduction are:
View worked solution
Answer: D
In bottom-up parsing, a handle is a substring that matches the right-hand side of a production rule, and whose reduction to the non-terminal on the left-hand side represents one step along the reverse of a rightmost derivation.
To find the handles, let us first construct the rightmost derivation (RMD) for the input string using the grammar:
The rightmost derivation is as follows:
- (replacing the start symbol with )
- (replacing the rightmost non-terminal with )
- (replacing the rightmost non-terminal with )
The bottom-up reduction process is the exact reverse of the rightmost derivation:
| Step | Right-Sentential Form | Handle | Production Used for Reduction |
|---|---|---|---|
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | - | - |
Thus, the handles in the successive reduction steps are , , and .
Free practice · Your answers on this page are not saved.
