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

Discussion

The number of states in an LALR table compared with a canonical LR table for the same grammar is

  • A.larger, since the lookaheads are all carried separately
  • B.always exactly the same for every grammar
  • C.unrelated, as the two methods work from different item sets
  • D.smaller, since every pair of states sharing a core is merged

Answer: D

LALR merges canonical LR states sharing a core, which cuts the table greatly. The merge can introduce reduce-reduce conflicts, though never shift-reduce ones. That guarantee is what makes LALR a safe default for a parser generator.

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

Post your comment

Please log in or register to post a comment.