Symbol table
From Wikipedia, the free encyclopedia
In computer science, a symbol table is a data structure used by a language translator such as a compiler or interpreter, where each symbol in a program's source code is associated with information such as location, type and scope level.
A hash table implementation of a symbol table is common and the table is usually maintained throughout all phases of translation. A compiler can use one large symbol table for all symbols or use separated, hierachical symbol tables for different scopes.
A symbol table can be a transient structure used only during a language translation process and then discarded, or it can be embedded in the output of that process for later exploitation, for example, during an interactive debugging session, or as a resource for formatting a diagnostic report during or after execution of a program.
"Symbol" in Symbol table can refer to a variable, a function, or a data type in the source code. For reference purposes, this symbol will be defined in terms of "sections and offset". Here, section will mean (1) data section, (2) bss section, (3) text/code section, (4) stack, or (5) heap.
This symbol table is part of every object file. During the linking of different object files, it is the linker's responsibility to handle any unresolved references.