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

Discussion

Arrange these stages of a single reduce action in the order they occur.
1. the goto table is consulted for the exposed state and left side
2. the action table reports a reduction by a chosen production
3. the left side and its new state are pushed onto the stack
4. the right side symbols are popped from the parsing stack

  • A.2 - 4 - 1 - 3
  • B.3 - 1 - 4 - 2
  • C.4 - 2 - 1 - 3
  • D.2 - 1 - 4 - 3

Answer: A

Correct answer: 2 - 4 - 1 - 3

The order is fixed by what each step needs from the last. The action table, indexed by the state on top and the lookahead, says which production to reduce by; the right side symbols and their states are then popped, exposing the state beneath; the goto table is consulted with that exposed state and the left side; and the left side with its new state is pushed. The input pointer never moves.

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

Post your comment

Please log in or register to post a comment.