Declarations
When we encounter declarations, we need to lay out storage for the declared variables.
For every local name in a procedure, we create a ST(Symbol Table) entry containing:
The production:
1. D → integer, id
2. D → real, id
3. D → D1, id
Production rule | Semantic action |
D → integer, id | ENTER (id.PLACE, integer) |
D → real, id | ENTER (id.PLACE, real) |
D → D1, id | ENTER (id.PLACE, D1.ATTR) |
ENTER is used to make the entry into symbol table and ATTR is used to trace the data type.