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

Discussion

The grammar is augmented before the LR item sets are constructed in order to

  • A.remove left recursion from the productions of the start symbol
  • B.eliminate the epsilon productions that would otherwise cause trouble
  • C.reduce the number of states in the resulting parsing automaton
  • D.give acceptance a unique reduction of a single new production

Answer: D

Adding S prime going to S means the parser accepts exactly when it reduces that one production with the input exhausted. Without it, acceptance would need an awkward special case. The cost is one extra state and one extra production.

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

Post your comment

Please log in or register to post a comment.