MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Substring that matches the RHS of a production and is replaced by LHS is termed as
A
Handle
B
Parse tree
C
Sequence
D
Pattern
Explanation: 

Detailed explanation-1: -Reduce step : When the parser finds a complete grammar rule (RHS) and replaces it to (LHS), it is known as reduce-step. This occurs when the top of the stack contains a handle. To reduce, a POP function is performed on the stack which pops off the handle and replaces it with LHS non-terminal symbol.

Detailed explanation-2: -A handle of a string is a substring that matches the right side of a production, and whose reduction to the nonterminal on the left side of the production represents one step along the reverse of a rightmost derivation.

Detailed explanation-3: -Removing the children of the left-hand side non-terminal from the parse tree is called Handle Pruning. A rightmost derivation in reverse can be obtained by handle pruning.

There is 1 question to complete.