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

Discussion

The handle in bottom-up parsing is

  • A.whichever symbol happens to be sitting on top of the parser stack
  • B.the next input token that the parser is about to shift
  • C.the start symbol of the grammar being used by the parser
  • D.the substring matching a right side whose reduction is the correct step

Answer: D

Correct answer: the substring matching a right side whose reduction is the correct step

A handle is not merely something that matches a right side but one whose reduction leads towards a successful parse, so identifying handles correctly is the whole problem of bottom-up parsing. LR parsing solves it by tracking, in its state, every production of which a prefix has been seen.

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

Post your comment

Please log in or register to post a comment.