Among simple LR (SLR) , canonical LR, and look-ahead LR (LALR), which of the…

2015

Among simple LR (SLR) , canonical LR, and look-ahead LR (LALR), which of the following pairs identify the method that is very easy to implement and the method that is the most powerful , in that order?

Answer: C. SLR, canonical LRAnswer: SLR, canonical LR Why SLR is very easy to implement: builds an LR(0) automaton and uses follow sets to decide reductions, so the algorithm and tables…

  1. A.

    SLR, LALR

  2. B.

    Canonical LR, LALR

  3. C.

    SLR, canonical LR

  4. D.

    LALR, canonical LR

Attempted by 173 students.

Show answer & explanation

Correct answer: C

Answer: SLR, canonical LR

  • Why SLR is very easy to implement: builds an LR(0) automaton and uses follow sets to decide reductions, so the algorithm and tables are simpler and smaller to construct.

  • Why canonical LR is the most powerful: uses full LR(1) items with one-symbol lookahead attached to each item so it distinguishes more contexts, avoiding conflicts that SLR and sometimes LALR cannot; it can recognize all deterministic LR(1) grammars.

Note: LALR is a practical compromise (it merges canonical LR states to reduce table size) and is often sufficient in practice, but it is not strictly as powerful as canonical LR.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…