Syntax Analysis35

0. Consider the following two sets of LR(1) items of LR(1) grammar.
X → c.X, c/dX → c.X, $
X →.cX, c/dX → .cX, $
X → .d, c/d X → .d, $
Which of the following statement related to merging of the two sets in the corresponding parser is/are FALSE?
1. Cannot be merged since look aheads are different.
2. Can be merged but will result in S-R conflict.
3. Can be merged but will result in R-R conflict.
4. Cannot be merged since goto on c will lead to two different sets.

  • Option : D
  • Explanation :
    (1) false, as merging has been done because lookahead were different.
    (2) false, Shift-Reduce conflict never occur at the time of merging.
    (3) false, In the merged set, we can’t see any Reduce-Reduce conflict (no reduction even possible, so no chances of R-R conflict )
    (4) false, because goto is carried on Non-Terminals symbols, not on terminal symbols, and c is a terminal symbol.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *