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

Discussion

Panic mode error recovery in an LR parser typically

  • A.inserts the token the table expected and then continues parsing
  • B.reduces by an arbitrary production to make progress possible
  • C.pops states until one with a goto on a chosen nonterminal is found
  • D.throws away everything and begins the whole parse again from scratch

Answer: C

The parser scans down the stack for a state that can accept a major construct such as a statement, discards input until a token in that nonterminal's FOLLOW set appears, and resumes. Choosing statement as the recovery nonterminal is the usual practice.

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

Post your comment

Please log in or register to post a comment.