
The SDD in Fig. 5.8 is used for declarations of the form:
T id1, id2, id3;
Where:Tis a type (intorfloat)- Followed by a comma-separated list of identifiers
Explanation:
- T.type is a synthesized attribute that carries the type (
intorfloat) - L.inh is an inherited attribute passed from the type
Tto all identifiers in the listL - The
addType()function is used to store the type info of each identifier in the symbol table.
Example: int id1, id2, id3;
Parsing this using the productions:
D → T L
T → int → T.type = integer
L → L1 , id3
L1 → L2 , id2
L2 → id1
Here, L.inh = integer, and each addType(id.entry, L.inh) assigns the type integer to id1, id2, and id3.
Dependency Graph for int id1, id2, id3

Graph Nodes Explained:
| Node No. | Represents |
|---|---|
| 1 | id1.entry |
| 2 | id2.entry |
| 3 | id3.entry |
| 4 | T.type = integer |
| 5,7,9 | L.inh at each level (copied from T.type) |
| 6,8,10 | addType(id1.entry, integer) and so on |
The type is propagated downward through L.inh attributes
Each addType() operation depends on both the identifier and the type value.
