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

Discussion

A predictive parser accepts the input when

  • A.the end marker is on top of the stack and the input is exhausted
  • B.the stack becomes empty regardless of the remaining input
  • C.the last token of the input has finally been shifted onto the stack
  • D.no further production can be applied to the current stack

Answer: A

Both conditions must hold together. Reaching the marker with input remaining, or exhausting the input with symbols still on the stack, are both errors rather than acceptance. Checking both conditions costs nothing and catches a whole class of mistakes.

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

Post your comment

Please log in or register to post a comment.