GATE Computer ScienceEasyGATE CS (PYQ pattern)

Compute FIRST of every non-terminal of S → X Y Z; X → a X | ε; Y → b Y | X; Z → c | ε, treating ε as a member of FIRST when the non-terminal is nullable. What is the sum of the sizes of the FIRST sets?

  1. A. 13
  2. B. 8
  3. C. 11
  4. D. 9

Correct answer: C. 11

FIRST(S)={a,b,c,ε}, FIRST(X)={a,ε}, FIRST(Y)={a,b,ε}, FIRST(Z)={c,ε}; total 11.

More Compiler Design questions

Exams that ask this topic