GATE Computer ScienceEasyGATE CS (PYQ pattern)

For the grammar E → T E'; E' → + T E' | ε; T → F T'; T' → * F T' | ε; F → ( E ) | id, what is FOLLOW(T)?

  1. A. {), +}
  2. B. {$, ), *, +}
  3. C. {$, ), +}
  4. D. {(, id}

Correct answer: C. {$, ), +}

T appears before E′, so FOLLOW(T) contains FIRST(E′) minus ε = {+}, plus FOLLOW(E′) = FOLLOW(E) = {), $} because E′ is nullable.

More Compiler Design questions

Exams that ask this topic