7.0 Introduction

7.1 Symbol Attributes

7.2 Symbol Table Operations

7.3 External Data Structures

7.4 Internal Data Structures

7.5 Other Symbol Table Techniques

7.6 Summary

Web References

Exercises

Scope Attribute

Block Structured languages allow declarations to be nested; that is, a name can be redefined to be of a different class. A similar problem occurs when nested procedures or packages (Ada) redefine a name. The name's scope is limited to the block or procedure or function in which is is defined. In Ada, For Loop variables cause a new scope to be opened (containing only this variable).

Example 1 shows a program Main with global variables a and b, a procedure P with parameter x and a local variable a. Information about each of these names is kept in the symbol table. References to a, b, and x are made in procedure P and to its variable a.

The scope, often represented by a number, is then an attribute for the name. An alternative technique is to have a separate symbol table for each scope.

Send questions and comments to: Karen Lemone