Chapter 5:Semantic Analysis

Example

. Consider following definition

D T L L.in := T.type
T real T.type := real
T int T.type := int
L L1 ,I L 1 .in :=L.in; I.in=L.in
L I I.in = L.in
I I 1 [num] I1 .in=array(numeral, I.in)
I id addtype(id.entry,I.in)

As an example, consider the attributed grammar given in the slide. We will consider the string int x[3], y[5]. The parse tree and dependency graph for this expression can be seen in the next Slide.