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

Discussion

An attribute grammar in which all the attributes are..........is called an.......attributed grammar.

  • A.Synthesized, S
  • B.Inherited, S
  • C.Synthesized, L
  • D.Inherited, L

Answer: A

The blanks are Synthesized, S: an attribute grammar in which all attributes are synthesized is S-attributed.

A synthesized attribute of a node is computed from the attributes of its children, so an S-attributed grammar can be evaluated bottom-up, during LR parsing, in one pass.

An L-attributed grammar is the wider class that also allows inherited attributes, but only those depending on the parent and on siblings to the left. So 'Synthesized, L' and 'Inherited, L' mismatch the definition, and 'Inherited, S' contradicts it, since S-attributed grammars have no inherited attributes at all.

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

Post your comment

Please log in or register to post a comment.