Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  In a bottom-up evaluation of a syntax directe... Start Learning for Free
In a bottom-up evaluation of a syntax directed definition, inherited attributes can
  • a)
    Always be evaluated
  • b)
    Be evaluated only if the definition is L-attributed
  • c)
    Be evaluated only if the definition has synthesized attributes
  • d)
    Never be evaluated
Correct answer is option 'C'. Can you explain this answer?
Verified Answer
In a bottom-up evaluation of a syntax directed definition, inherited a...
Every S(Synthesized) - attributed definition is L- attributed. For implementing inherited attributed during bottom-up parsing, extends to some, but not LR grammars. Consider the following example

In the example above the nonterminal L in L → E inherits the count of the number of 1 ’s generated by S. Since the production L → E is the first that a bottom- up parser would reduce by, the translator at the time can't know the number of 1 ’s in the input. So in a bottom-up evaluation of a syntax directed definition, inherits attributes can’t be evaluated if the definition is L-attributed in the given example. So we can say. that L-attributed definition is based on simple LR(1) grammar, but it can’t be implemented always but inherit attributes can be evaluated only if the definition has synthesized attributes.
View all questions of this test
Most Upvoted Answer
In a bottom-up evaluation of a syntax directed definition, inherited a...
Syntax Directed Definition (SDD)

Syntax Directed Definition (SDD) is a set of rules that are used to associate attributes with the grammar productions. The attributes can be of two types: inherited and synthesized.

Inherited Attributes

Inherited attributes are the attributes that are passed from the parent node to the child node in the parse tree. These attributes are used to store information that is required by the child node to evaluate its own attributes. Inherited attributes are evaluated during the parsing phase of the compiler.

Synthesized Attributes

Synthesized attributes are the attributes that are computed by the child node and passed up to the parent node in the parse tree. Synthesized attributes are used to store information that is required by the parent node to evaluate its own attributes. Synthesized attributes are evaluated during the code generation phase of the compiler.

Bottom-Up Evaluation

In a bottom-up evaluation of an SDD, the attributes are evaluated in the order in which the parse tree is constructed. This means that the attributes of the leaf nodes are evaluated first, followed by the attributes of the internal nodes in a bottom-up fashion.

Evaluation of Inherited Attributes

In a bottom-up evaluation of an SDD, inherited attributes can be evaluated only if the definition has synthesized attributes. This is because the inherited attributes are dependent on the synthesized attributes of the child node. If the child node does not have any synthesized attributes, then there is no information to pass up to the parent node, and hence the inherited attributes cannot be evaluated.

Evaluation of Synthesized Attributes

Synthesized attributes can always be evaluated in a bottom-up evaluation of an SDD. This is because the synthesized attributes are computed by the child node and passed up to the parent node, and hence there is always information available to evaluate the synthesized attributes.

Conclusion

In summary, in a bottom-up evaluation of an SDD, inherited attributes can be evaluated only if the definition has synthesized attributes. This is because the inherited attributes are dependent on the synthesized attributes of the child node, and if the child node does not have any synthesized attributes, then there is no information to pass up to the parent node, and hence the inherited attributes cannot be evaluated.
Explore Courses for Computer Science Engineering (CSE) exam
Question Description
In a bottom-up evaluation of a syntax directed definition, inherited attributes cana)Always be evaluatedb)Be evaluated only if the definition is L-attributedc)Be evaluated only if the definition has synthesized attributesd)Never be evaluatedCorrect answer is option 'C'. Can you explain this answer? for Computer Science Engineering (CSE) 2025 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about In a bottom-up evaluation of a syntax directed definition, inherited attributes cana)Always be evaluatedb)Be evaluated only if the definition is L-attributedc)Be evaluated only if the definition has synthesized attributesd)Never be evaluatedCorrect answer is option 'C'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for In a bottom-up evaluation of a syntax directed definition, inherited attributes cana)Always be evaluatedb)Be evaluated only if the definition is L-attributedc)Be evaluated only if the definition has synthesized attributesd)Never be evaluatedCorrect answer is option 'C'. Can you explain this answer?.
Solutions for In a bottom-up evaluation of a syntax directed definition, inherited attributes cana)Always be evaluatedb)Be evaluated only if the definition is L-attributedc)Be evaluated only if the definition has synthesized attributesd)Never be evaluatedCorrect answer is option 'C'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of In a bottom-up evaluation of a syntax directed definition, inherited attributes cana)Always be evaluatedb)Be evaluated only if the definition is L-attributedc)Be evaluated only if the definition has synthesized attributesd)Never be evaluatedCorrect answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of In a bottom-up evaluation of a syntax directed definition, inherited attributes cana)Always be evaluatedb)Be evaluated only if the definition is L-attributedc)Be evaluated only if the definition has synthesized attributesd)Never be evaluatedCorrect answer is option 'C'. Can you explain this answer?, a detailed solution for In a bottom-up evaluation of a syntax directed definition, inherited attributes cana)Always be evaluatedb)Be evaluated only if the definition is L-attributedc)Be evaluated only if the definition has synthesized attributesd)Never be evaluatedCorrect answer is option 'C'. Can you explain this answer? has been provided alongside types of In a bottom-up evaluation of a syntax directed definition, inherited attributes cana)Always be evaluatedb)Be evaluated only if the definition is L-attributedc)Be evaluated only if the definition has synthesized attributesd)Never be evaluatedCorrect answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice In a bottom-up evaluation of a syntax directed definition, inherited attributes cana)Always be evaluatedb)Be evaluated only if the definition is L-attributedc)Be evaluated only if the definition has synthesized attributesd)Never be evaluatedCorrect answer is option 'C'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam
Signup to solve all Doubts
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev