What is handle pruning in compiler design?
Answers
Answered by
134
HANDLE PRUNING is the general approach used in shift-and-reduce parsing.
A Handle is a substring that matches the body of a production. Handle reduction is a step in the reverse of rightmost derivation. A rightmost derivation in reverse can be obtained by handle pruning.
The implementation of handle pruning involves the following data-structures:- a stack - to hold the grammar symbols; an input buffer that contains the remaining input and a table to decide handles.
A Handle is a substring that matches the body of a production. Handle reduction is a step in the reverse of rightmost derivation. A rightmost derivation in reverse can be obtained by handle pruning.
The implementation of handle pruning involves the following data-structures:- a stack - to hold the grammar symbols; an input buffer that contains the remaining input and a table to decide handles.
Answered by
37
In computer design handle pruning is used to obtain a rightmost derivation in reverse.
For example, start with a string of terminals w that is to parse. In case, w is a sentence of grammar, then w = γn, where γn is the nth right sentential form of some as yet unknown rightmost derivation.
Similar questions