CS450 Compiler Design
32
Semantics
Example: The semantics of declarations.
A declaration is elaborated to produce bindings. It may also have the side effect of allocating (memory for) variables.
The constant declaration  const I~E is elaborated by binding the identifier value I to the value yielded by E.
The variable declaration  var I:T is elaborated by binding I to a newly allocated variable, whose initial value is undefined. The variable will be de-allocated upon exit from the let-command that contains the declaration.
The sequential declaration D1;D2 is elaborated by elaborating D1 followed by D2 and combining the bindings produced by both.  D2 is elaborated in the environment of the sequential declaration overlaid by the bindings produced by D1.