COMPILER DESIGN

SEMANTIC ANALYSIS

ATTRIBUTE GRAMMARS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
A parse tree for ____ can be always annotated by evaluating semantic rules for attributes at each node bottom up
A
S-attributed
B
Inherited attributes
C
Both a and b
D
Syntax directed definition
Explanation: 

Detailed explanation-1: -A parse tree showing the values of attributes at each node is called an Annotated parse tree. The process of computing the attributes values at the nodes is called annotating (or decorating) of the parse tree. Of course, the order of these computations depends on the dependency graph induced by the semantic rules.

Detailed explanation-2: -Attribute grammar is a medium to provide semantics to the context-free grammar and it can help specify the syntax and semantics of a programming language. Attribute grammar (when viewed as a parse-tree) can pass values or information among the nodes of a tree.

Detailed explanation-3: -Dependency graphs are used to determine an evaluation order for instances of attributes in a parse tree.

There is 1 question to complete.