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

Discussion

An implementation that stores only states on the parsing stack is possible because

  • A.the goto table can be indexed by state number alone
  • B.the parser can recompute the symbols from the input stream
  • C.each state determines the grammar symbol that led into it
  • D.the grammar symbols are never needed after they are pushed

Answer: C

Correct answer: each state determines the grammar symbol that led into it

Every transition into a given state is on the same symbol, so the symbol is recoverable from the state and need not be stored separately. Implementations therefore push states alone, halving the stack, and reconstruct the symbols only when something - an error message, say - actually needs them.

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

Post your comment

Please log in or register to post a comment.