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

Discussion

An attribute of a grammar symbol is

  • A.the position of the symbol within the right side of a production
  • B.a value associated with an occurrence of that symbol in a tree
  • C.a terminal that may appear immediately after the symbol
  • D.one of the productions in which the symbol appears on the left

Answer: B

Correct answer: a value associated with an occurrence of that symbol in a tree

An attribute belongs to a node rather than to the symbol in the abstract, so the same nonterminal appearing twice in a tree carries two independent sets of values. Attributes hold whatever the translation needs - a type, a value, a piece of generated code, an address.

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

Post your comment

Please log in or register to post a comment.