Which of the following statements is false?

2001

Which of the following statements is false?

Answer: A. An unambiguous grammar has the same leftmost and rightmost derivationThe correct answer is Option A. In an unambiguous grammar, every valid string has exactly one parse tree. Equivalently, it has a unique leftmost derivation…

  1. A.

    An unambiguous grammar has the same leftmost and rightmost derivation

  2. B.

    An LL(1) parser is a top-down parser

  3. C.

    LALR parsing is more powerful than SLR parsing

  4. D.

    An ambiguous grammar can never be LR(k) for any k

Attempted by 91 students.

Show answer & explanation

Correct answer: A

The correct answer is Option A. In an unambiguous grammar, every valid string has exactly one parse tree. Equivalently, it has a unique leftmost derivation and a unique rightmost derivation. This does not mean that the leftmost derivation and the rightmost derivation are the same sequence of steps; they usually expand non-terminals in different orders. The other statements are true: LL(1) is a top-down parser, LALR is more powerful than SLR, and an LR(k) grammar must be unambiguous.

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

Loading lesson…