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

Discussion

The parse of a program has succeeded when

  • A.every token has been shifted onto the parser stack
  • B.the first complete statement has been recognised
  • C.no further reduction at all is possible in the current parser state
  • D.the input is exhausted and the stack holds only the start symbol

Answer: D

Acceptance requires both conditions together. Exhausting the input with symbols left on the stack, or reaching the start symbol with input remaining, are both errors. The end marker in the augmented grammar is what makes the test straightforward.

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

Post your comment

Please log in or register to post a comment.