0
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ 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 $\endgroup$ – Maharaj Jul 2 '16 at 12:32
  • $\begingroup$ @Maharaj, it seems ok to post original question. $\endgroup$ – Mithlesh Upadhyay Jul 2 '16 at 12:33
  • $\begingroup$ 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! $\endgroup$ – Raphael Jul 3 '16 at 15:14
-1
$\begingroup$

Indeed option (2) is true.

Synthesized attributes contain those attributes which inherit properties from their children.

Inherited attributes are those which inherit properties from their parents or their left siblings.

L-attributed definitions contain both synthesized and inherited attributes.

So for an SDT to evaluate inherited attributes, it must follow L-attributed definition.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.