Symbol table is an important data structure used in a compiler.
Symbol table is used to store the information about the occurrence of various entities such as objects, classes, variable name, interface, function name etc. it is used by both the analysis and synthesis phases.
The symbol table used for following purposes:
A symbol table can either be linear or a hash table. Using the following format, it maintains the entry for each name.
For example, suppose a variable store the information about the following variable declaration:
then, it stores an entry in the following format:
The clause attribute contains the entries related to the name.
The symbol table can be implemented in the unordered list if the compiler is used to handle the small amount of data.
A symbol table can be implemented in one of the following techniques:
Symbol table are mostly implemented as hash table.
The symbol table provides the following operations:
Should be processed by the compiler as:
In the symbol table, lookup() operation is used to search a name. It is used to determine:
The basic format of lookup() function is as follows:
This format is varies according to the programming language.