Chapter 5:Semantic Analysis

Attributes .

. Each grammar production A a has associated with it a set of semantic rules of the form

b = f (c1 , c2 , ..., ck )

where f is a function, and either

- b is a synthesized attribute of A OR

- b is an inherited attribute of one of the grammar symbols on the right

. attribute b depends on attributes c1 , c2 , ..., ck

Dependence relation tells us what attributes we need to know before hand to calculate a particular attribute.

Here the value of the attribute b depends on the values of the attributes c1 to ck . If c1 to ck belong to the children nodes and b to A then b will be called a synthesized attribute. And if b belongs to one among a (child nodes) then it is an inherited attribute of one of the grammar symbols on the right.