Contents    Page-10    Prev    Next    Page+10    Index   

Use of Symbol Table

Usually, there are some symbols that are predefined by the language, e.g. integer. These will be put into the symbol table by the initialization of the compiler.

User symbols are added in response to declaration statements; these statements usually appear at the top of a procedure. Declaration statements often do not generate any code, but cause symbol table entries to be made and affect code generation for executable statements.

Symbols encountered in code, e.g. in assignment statements, are looked up in the symbol table. If a symbol is not found in the table, an undefined symbol error is generated. Looking up a symbol provides its type and its memory address (offset), which are needed for type checking and code generation.