Question:

In Syntax Directed Translation (SDT), an attribute is called "inherited" if its value at a node in the parse tree is defined in terms of attributes at:

Show Hint

A grammar where every attribute is synthesized is called an S-Attributed grammar. A grammar that allows both synthesized and certain types of inherited attributes (usually from the left sibling) is called an L-Attributed grammar.
Updated On: Jul 4, 2026
  • Its children only.
  • Its parent and/or its siblings.
  • Its left child only.
  • Its descendants only.
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Concept: Syntax Directed Translation involves attaching rules to grammar productions to compute values (attributes) for nodes in a parse tree.
Synthesized Attributes: Values are computed from the attributes of the node's children. These flow "up" the tree.
Inherited Attributes: Values are computed from the attributes of the node's parent and/or its siblings. These flow "down" or "across" the tree.

Step 1:
Defining the flow of information.
Attributes allow the compiler to pass information during the parsing process. Inherited attributes are useful for passing context-dependent information.

Step 2:
Identifying the source of Inherited values.
When a value comes from above, it is provided by the parent. When a value comes from the same level, it is provided by a sibling. This is typical for type checking and identifying variable declarations.

Step 3:
Conclusion.
Because the definition excludes children and descendants. Option (B) is the only choice that matches the "top-down" or "lateral" nature of inherited attributes.
Was this answer helpful?
0
0