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

Discussion

In an L-attributed grammar, synthesized attributes are calculated using attributes from :

  • A.The same non-terminal
  • B.The parent non-terminal in the parse tree
  • C.The child non-terminal in the parse tree
  • D.The sibling non-terminal in the parse tree

Answer: C

Synthesized attributes are computed from attributes of the child non-terminals in the parse tree.

A synthesized attribute at a node is defined in terms of attributes of its children (and of the node itself), so values flow upward in the parse tree. This is true in L-attributed grammars as in any syntax-directed definition.

Attributes taken from the parent or from left siblings are inherited attributes, and the L-attributed restriction concerns these: an inherited attribute may depend only on the parent and on siblings to its left.

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

Post your comment

Please log in or register to post a comment.