Consider the following CFG S→aSbS | bSaS | ϵ Select the wrong option

Consider the following CFG S→aSbS | bSaS | ϵ Select the wrong option

Answer: D. The grammar can be parsed by CLR(1) parserThe grammar is ambiguous, as it has two parse tree for string “abab”, So it cannot be parsed by CLR(1) and LL(1) parser

  1. A.

    The grammar cannot be parsed by LL(1) parser

  2. B.

    The grammar is ambiguous

  3. C.

    The grammar generate DCFL

  4. D.

    The grammar can be parsed by CLR(1) parser

Attempted by 91 students.

Show answer & explanation

Correct answer: D

The grammar is ambiguous, as it has two parse tree for string “abab”, So it cannot be parsed by CLR(1) and LL(1) parser

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…