LL grammar for the language L = { aⁿ bᵐ cⁿ⁺ᵐ | m ≥ 0, n ≥ 0 } is
2013
LL grammar for the language
L = { aⁿ bᵐ cⁿ⁺ᵐ | m ≥ 0, n ≥ 0 } is
- A.
S → aSc | S₁
S₁ → bS₁c | λ - B.
S → aSc | S₁ | λ
S₁ → bS₁c - C.
S → aSc | S₁ | λ
S₁ → bS₁c | λ - D.
S → aSc | λ
S₁ → bS₁c | λ - E.
A and C both
Attempted by 42 students.
Show answer & explanation
Correct answer: E
The language L = { aⁿ bᵐ cⁿ⁺ᵐ } requires matching n 'a's with the last n 'c's and m 'b's with the intermediate c's. We construct S → aSc | B to handle 'a' and outer 'c', while B → bBc | ε handles the 'b's. This ensures LL(1) compliance by distinguishing start symbols.
A video solution is available for this question — log in and enroll to watch it.