Consider the following grammar 𝐺 𝑆 β†’ 𝐹 | 𝐻 𝐹 β†’ 𝑝 | 𝑐 𝐻 β†’ 𝑑 | 𝑐 where…

GATE Β· 2015 Β· CS Β· Set 3 Β· Computer Science & IT

Consider the following grammar 𝐺

𝑆 β†’ 𝐹 | 𝐻

𝐹 β†’ 𝑝 | 𝑐

𝐻 β†’ 𝑑 | 𝑐

where 𝑆, 𝐹, and 𝐻 are non-terminal symbols, 𝑝, 𝑑, and 𝑐 are terminal symbols. Which of the following statement(s) is/are correct?

S1. LL(1) can parse all strings that are generated using grammar 𝐺

S2. LR(1) can parse all strings that are generated using grammar 𝐺

  1. A.

    Only S1

  2. B.

    Only S2

  3. C.

    Both S1 and S2

  4. D.

    Neither S1 nor S2

Attempted by 237 students.

Show answer

Correct answer: D

The worked solution is available to enrolled students.

Video solution available to enrolled students.

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

Loading lesson…