Machine-translated by Google. Questions are authored in English.
Top

Discussion

An LR parser reduces by a production whose right side has 4 symbols. How many entries does it pop from the stack?

  • A.3
  • B.8
  • C.4
  • D.5

Answer: C

One stack entry is popped per symbol of the right side, so four are removed. The state beneath them is then exposed and used to index the goto table for the left side nonterminal. Popping the wrong number of entries is a classic bug in a hand written driver.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.