# In a bottom-up evaluation of a syntax directed definition, inherited attributes can

In a bottom-up evaluation of a syntax directed definition, inherited attributes can

1. always be evaluated
2. be evaluated only if the definition is L-attributed
3. be evaluated only if the definition has synthesized attributes
4. never be evaluated

My attempt:

Option $(3)$ should be true, since ,

Synthesized Attributes: They are computed from the values of the attributes of the children nodes.

Inherited Attributes: They are computed from the values of the attributes of both the siblings and the parent nodes.

But, one of my friends commented that "Your explanation is correct, but option C says "has" not "is"." (In fact, I did not get this comment).

Somewhere it explain as below:

A Syntax Directed Definition (SDD) is called S Attributed if it has only synthesized attributes.

L-Attributed Definitions contain both synthesized and inherited attributes but do not need to build a dependency graph to evaluate them. So, option $(2)$ is true.

Can you explain it in a formal way, please?

• You should not simply copy and paste a 'gate" question along with comments given on some website.You should take some efforts later if you have some douts then you can post them here Jul 2 '16 at 12:32
• @Maharaj, it seems ok to post original question. Jul 2 '16 at 12:33
• The title you have chosen is not well suited to representing your question. Please take some time to improve it; we have collected some advice here. Thank you!
– Raphael
Jul 3 '16 at 15:14