Machine-translated by Google. Questions are authored in English.
Top

Discussion

Consider the following statements about merging states in LALR construction.
1. It can introduce a reduce-reduce conflict.
2. It never introduces a shift-reduce conflict.
3. It always reduces the number of states below the SLR count.

  • A.1 only
  • B.All of them
  • C.1 and 2 only
  • D.3 only

Answer: C

Correct answer: 1 and 2 only

Statements 1 and 2 are correct: merging states with the same core unions their lookahead sets, which can put two reductions in competition on one lookahead, but it cannot affect the shift actions. Statement 3 misstates the comparison - LALR has exactly as many states as SLR, both being built on the LR(0) automaton. The saving is against canonical LR(1), not against SLR.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.