GATE Computer ScienceEasyGATE CS (PYQ pattern)

A table-driven LL(1) parser for S → A B C; A → a | ε; B → b | ε; C → c | ε parses "a c". Each pop of a non-terminal (expanding it) and each match of a terminal is one move. How many moves does it make before reaching $ on both stack and input?

  1. A. 4
  2. B. 6
  3. C. 7
  4. D. 5

Correct answer: B. 6

4 expansions and 2 terminal matches (including expansions to ε) give 6 moves.

More Compiler Design questions

Exams that ask this topic