Consider the grammar G S → pSqS / qSpS / ε G is:

Consider the grammar G
S → pSqS / qSpS / ε
G is:

Answer: D. AmbiguousThe grammar is ambiguous as it generates two parse tree for the string “ppqqpq” S->pSqS | qSpS |

  1. A.

    LL(1)

  2. B.

    CLR(1)

  3. C.

    LL(1) and CLR(1)

  4. D.

    Ambiguous

Attempted by 101 students.

Show answer & explanation

Correct answer: D

The grammar is ambiguous as it generates two parse tree for the string “ppqqpq”
S->pSqS | qSpS |

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…