GATE Computer ScienceModerateGATE CS (PYQ pattern)

In the LL(1) table of S → A B C; A → a | ε; B → b | ε; C → c | ε, how many cells hold an ε-production, and how many cells of the $ column are filled?

  1. A. 6 ε-cells; 1 cell in the $ column
  2. B. 3 ε-cells; 4 cells in the $ column
  3. C. 6 ε-cells; 4 cells in the $ column
  4. D. 7 ε-cells; 3 cells in the $ column

Correct answer: C. 6 ε-cells; 4 cells in the $ column

FOLLOW(A) = {b, c, $}, FOLLOW(B) = {c, $}, FOLLOW(C) = {$}. A → ε fills 3 cells, B → ε 2, C → ε 1: 6. In the $ column, S → A B C (S is nullable and $ ∈ FOLLOW(S)) and all three ε-productions appear: 4 cells.

More Compiler Design questions

Exams that ask this topic