All mock tests are FREE till 31 December — register to save your progress
Unit 8 · Theory of Computation and Compilers Paper 2 CS · December 2018

Consider the grammar G: S → A | B, A → a | c, B → b | c, with non-terminals {S, A, B} and terminals {a, b, c}. S₁: LR(1) can parse all strings generated by G. S₂: LL(1) can parse all strings generated by G.

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: D. Neither 1 nor 2 S → (S)|SS|ε

Explanation

The string c has two derivations (S ⇒ A ⇒ c and S ⇒ B ⇒ c), so G is ambiguous. No ambiguous grammar is LL(1) or LR(1).

More Theory of Computation and Compilers questions