Symbol Table Management An essential function of a compiler is to collect and use the information about the names (identifiers) appearing in the source program. The information may include various attributes of an identifier like its type, scope, and the allocated storage, etc. This information about an identifier is stored in a data structure called the symbol table and the process of creating, manipulating, and retrieving data from the symbol is called symbol table management.
The symbol table management routine interacts with all the phases of compiler design. When an identifier in the source program is defected by the lexical analyzer, the identifier is entered into the symbol table. Each entry in a symbol table has two fields.
(i) Name field
(ii) Information field which includes the attributes of an identifier.
All the attributes of an identifier cannot normally be determined during lexical analysis therefore some of the remaining attributes are entered by the remaining phases of the compiler. The information collected in the symbol table is used during several stages of the compilation process. In general, a symbol table provides the capabilities to
(a) Determine whether a given identifier is in the symbol table
(b) Add a new identifier.
(c) Access information about a stored identifier
(d) Update the information about a stored identifier
(e) Delete an identifier from a symbol table.