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

Discussion

A shift-reduce parser performs a shift when

  • A.it detects that the input contains a syntax error
  • B.it reaches the end of the input token stream
  • C.it pushes the next input token onto the stack
  • D.it replaces a right side on the stack by its left side

Answer: C

Shifting moves a token from the input to the stack. Reduction is the complementary action, replacing the symbols of a matched right side by the nonterminal on its left. Shifting and reducing are the only two actions a bottom-up parser ever performs.

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

Post your comment

Please log in or register to post a comment.