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

Discussion

Synthesised attributes fit bottom up parsing naturally because

  • A.the parser builds the tree from the root toward the leaves
  • B.the value of a left side is computed from those of its right side
  • C.attributes must be passed downward as the tree is expanded
  • D.bottom up parsers are unable to execute any semantic actions at all

Answer: B

Correct answer: the value of a left side is computed from those of its right side

A synthesised attribute flows upward, and a bottom up parser reduces a right side only once all its symbols are complete - so their values are already on the value stack when the action runs. The fit is exact, which is why Yacc-style tools support synthesised attributes with no machinery beyond the value stack.

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

Post your comment

Please log in or register to post a comment.