SYNTAX ANALYSIS
ROLE OF THE PARSER
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
always be evaluated
|
|
be evaluated only if the definition is L-attributed
|
|
be evaluated only if the definition has synthesized attributes
|
|
never be evaluated
|
Detailed explanation-1: -The correct option is C be evaluated only if the definition has synthesized attributes.
Detailed explanation-2: -BOTTOM UP EVALUATION OF S ATTRIBUTED DEFINITION Bottom Up Evaluation of S Attributed An attribute grammar is a formal way to define attributes for the productions of a formal grammar, associating these attributes to values.
Detailed explanation-3: -Bottom-up parsing starts from the leaf nodes of a tree and works in upward direction till it reaches the root node. Here, we start from a sentence and then apply production rules in reverse manner in order to reach the start symbol.
Detailed explanation-4: -Summary. In an L-attributed SDD attributes may be inherited or synthesized, this is referred to as an L-attribute definition. In an S-attributed SDD, attributes all attributes are synthesized-S-attribute definition.
Detailed explanation-5: -Bottom up evaluation of S-attributed definition ➢ Syntax-directed definitions with only synthesized attributes(S-attribute) can be evaluated. by a bottom up parser (BUP) as input is parsed. ➢ In this approach, the parser will keep the values of synthesized attributes associated with. the grammar symbol on its stack.