COMPUTER SCIENCE AND ENGINEERING
COMPILER DESIGN
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Delete symbols from the stack
|
|
Insert symbols onto the stack
|
|
Inserting or deleting symbols from the input
|
|
All of these
|
Detailed explanation-1: -Which of the following actions an operator-precedence parser may take to recover from an error? a)Insert symbols onto the stackb)Delete symbols from the stackc)Insert or delete symbols from the inputd)All of the aboveCorrect answer is option āDā.
Detailed explanation-2: -Error Recovery in operator-precedence parsing: If no precedence relation holds between the terminal on top of the stack and the current input. If a handle has been found, but there is no production with this handle as a right side.
Detailed explanation-3: -There are two types of operator precedence parsing errors, namely character pair errors and reducibility errors.
Detailed explanation-4: -Which of the following is true for operator precedence parsing? Explanation: There are two important properties for these operator precedence parsers is that it does not appear on the right side of any production and no production has two adjacent non-terminals.
Detailed explanation-5: -An operator-precedence parser is a simple shift-reduce parser that is capable of parsing a subset of LR(1) grammars. More precisely, the operator-precedence parser can parse all LR(1) grammars where two consecutive nonterminals and epsilon never appear in the right-hand side of any rule.