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

Discussion

A recursive descent parser with backtracking

  • A.tries alternatives in turn and undoes work when one fails
  • B.chooses each production from the lookahead with no retrying
  • C.cannot handle grammars containing more than one alternative
  • D.is faster than a predictive parser on every possible input

Answer: A

Correct answer: tries alternatives in turn and undoes work when one fails

With backtracking the parser attempts each alternative in turn, and on failure restores the input position and tries the next. It handles a larger class of grammars than a predictive parser, but it can take exponential time and it makes semantic actions awkward, since work already done may have to be undone.

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

Post your comment

Please log in or register to post a comment.