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

Discussion

A unit production such as E goes to T is undesirable in a bottom up parser chiefly because

  • A.it introduces a shift-reduce conflict in every state
  • B.it costs a reduction that accomplishes no useful work
  • C.it makes the grammar ambiguous wherever it appears
  • D.it prevents the FOLLOW sets from being computed

Answer: B

Correct answer: it costs a reduction that accomplishes no useful work

A unit production replaces one symbol by another with no structural change and no semantic content, yet the parser must still pop, consult the goto table and push. In a layered expression grammar these reductions can be a substantial fraction of the total, which is why generators offer to eliminate them and why precedence declarations are preferred.

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

Post your comment

Please log in or register to post a comment.