Site icon i2tutorials

Compiler Design-Environment and State

Environment and State

 

It is important to ensure that the language that is being designed has the ability to map the data names with the respective data values before we start designing the language. 

 

For example, the execution of an assignment such as a = b + 2, changes the value present in the variable x. In other words, the assignment changes the value in whatever location x is present in.

 

There are two stages of mapping 

 

Environment

It is a mapping wherein the data names are mapped to their respective location in the memory. 

 

State

It is a mapping where the locations are mapped to their respective data values. This two-stage mapping is Dynamic in nature

 

Note: Environments change according to the scope rules of a language.

 

Reference Link

Environment and State

Exit mobile version