GATE Computer ScienceHardGATE CSE

For the grammar S → A B; A → a A | b | ε; B → a B | b A | ε, how many cells of the LL(1) parsing table contain more than one production?

  1. A. 2
  2. B. 3
  3. C. 1
  4. D. 4

Correct answer: A. 2

A → ε is predicted on FOLLOW(A) = FIRST(B) ∪ {$} = {a, b, $}, which clashes with A → a A on a and A → b on b, so the cells (A, a) and (A, b) hold two productions each: 2 cells.

More Compiler Design questions

Exams that ask this topic