Variable Scope in Compiler Design Tutorial with Examples

Variable Scope in Compiler Design Tutorial with Examples

Variable Scope

The scope rules of the language determine, which declaration of a name applies when the name appears in the program. An occurrence of a variable is local, if that occurrence is in the same procedure in which that name is declared and the variable is non-local, if is declared outside of that procedure.

Storage Organisation


 Activation Record

Information needed by a single execution of a procedure is managed using a contiguous block of storage called activation record. When a procedure is entered, an activation record is allocated and it is deallocated when that procedure exits. Size of each field can be determined at compile time, although actual location of the activation record is determined at run-time.

 Key Points

.if a procedure has a local variable and its size depends on a parameter, its size is determined at run-time.

* Some part of the activation record of a procedure is created by that procedure, immediately after that procedure is entered and score part k created by the caller of that procedure before that procedure is entered.

Sorting in Design and Analysis of Algorithm Study Notes with Example

Learn Sorting in Handbook Series:  Click here 

Follow Us on Social Platforms to get Updated : twiter,  facebookGoogle Plus

Leave a Reply

Your email address will not be published. Required fields are marked *