Chapter 5:Semantic Analysis

Space for attributes at compile time

. Lifetime of an attribute begins when it is first computed

. Lifetime of an attribute ends when all the attributes depending on it, have been computed

. Space can be conserved by assigning space for an attribute only during its lifetime

Since a large number of attributes may need to be evaluated at the compile time, therefore it is important to study the computation of attributes during runtime so as to optimize the usage of memory during the semantic analysis phase of compilation. The attributes in a grammar may not be necessarily evaluated in depth first order. In general,

. The lifetime of an attribute begins when it is first computed

. The lifetime of an attribute ends when all the attributes depending on it have been computed.

Therefore, we can conserve space by allocating space to an attribute only during its lifetime