All Topics  
Symbol table

 

   Email Print
   Bookmark   Link






 

Symbol table



 
 
In computer science
Computer science

Computer science is the study of the theoretical foundations of information and computation, and of practical techniques for their implementation and application in computer systems....
, a symbol table is a data structure
Data structure

A data structure in computer science is a way of storing data in a computer so that it can be used efficiently. It is an organization of mathematical and logical concepts of data....
 used by a language translator such as a compiler
Compiler

A compiler is a computer program that transforms source code written in a programming language into another computer language . The most common reason for wanting to transform source code is to create an executable program....
 or interpreter
Interpreter (computing)

In computer science, an interpreter normally means a computer program that execution , i.e. performs, instructions written in a programming language....
, where each identifier
Identifier

In computer science, Identifiers are Lexical Token s that name entity. The concept is analogy to that of a "name". Identifiers are used extensively in virtually all information processing systems....
 in a program's source code
Source code

In computer science, source code is any collection of statements or declarations written in some human-readable computer programming language....
 is associated with information relating to its declaration or appearance in the source, such as its type
Data type

A data type in programming languages is an attribute of a data which tells the computer something about the kind of data it is. This involves setting constraints on the datum, such as what values it can take and what operations may be performed upon it....
, scope
Scope (programming)

In computer programming, scope is an enclosing context where values and expressions are associated. Various programming languages have various types of scopes....
 level and sometimes its location.

mmon implementation technique is to use a hash table
Hash table

In computer science, a hash table, or a hash map, is a data structure that associates Unique key with value .The primary operation that hash functions support efficiently is a lookup: given a key , find the corresponding value ....
 implementation. A compiler may use one large symbol table for all symbols or use separated, hierarchical symbol tables for different scopes.

a class="link1" onMouseover='showByLink("m1802454",this)' onMouseout='hide("m1802454")'href="http://www.absoluteastronomy.com/topics/Object_file">object file
Object file

In computer science, object code, or an object file, is the representation of code that a compiler or assembler generates by processing a source code file....
 will contain a symbol table of the identifiers it contains that are externally visible.






Discussion
Ask a question about 'Symbol table'
Start a new discussion about 'Symbol table'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In computer science
Computer science

Computer science is the study of the theoretical foundations of information and computation, and of practical techniques for their implementation and application in computer systems....
, a symbol table is a data structure
Data structure

A data structure in computer science is a way of storing data in a computer so that it can be used efficiently. It is an organization of mathematical and logical concepts of data....
 used by a language translator such as a compiler
Compiler

A compiler is a computer program that transforms source code written in a programming language into another computer language . The most common reason for wanting to transform source code is to create an executable program....
 or interpreter
Interpreter (computing)

In computer science, an interpreter normally means a computer program that execution , i.e. performs, instructions written in a programming language....
, where each identifier
Identifier

In computer science, Identifiers are Lexical Token s that name entity. The concept is analogy to that of a "name". Identifiers are used extensively in virtually all information processing systems....
 in a program's source code
Source code

In computer science, source code is any collection of statements or declarations written in some human-readable computer programming language....
 is associated with information relating to its declaration or appearance in the source, such as its type
Data type

A data type in programming languages is an attribute of a data which tells the computer something about the kind of data it is. This involves setting constraints on the datum, such as what values it can take and what operations may be performed upon it....
, scope
Scope (programming)

In computer programming, scope is an enclosing context where values and expressions are associated. Various programming languages have various types of scopes....
 level and sometimes its location.

Implementation

A common implementation technique is to use a hash table
Hash table

In computer science, a hash table, or a hash map, is a data structure that associates Unique key with value .The primary operation that hash functions support efficiently is a lookup: given a key , find the corresponding value ....
 implementation. A compiler may use one large symbol table for all symbols or use separated, hierarchical symbol tables for different scopes.

Uses

An object file
Object file

In computer science, object code, or an object file, is the representation of code that a compiler or assembler generates by processing a source code file....
 will contain a symbol table of the identifiers it contains that are externally visible. During the linking of different object files, a linker
Linker

In computer science, a linker or link editor is a computer program that takes one ormore object file generated by a compiler and combines them into a single executable program....
 will use these symbol tables to resolve any unresolved references.

A symbol table may only exist during the translation process, or it may be embedded in the output of that process for later exploitation, for example, during an interactive debugging session
Debugger

A debugger is a computer program that is used to test and debug other programs. The code to be examined might alternatively be running on an Instruction Set Simulator, a technique that allows great power in its ability to halt when specific conditions are encountered but which will typically be much slower than executing the code directly on...
, or as a resource for formatting a diagnostic report during or after execution
Execution (computers)

Execution in computer engineering and software engineering is the Process by which a computer or a virtual machine carries out the instructions of a computer program....
 of a program.

Example


The symbol table of a small program is listed below. The table itself was generated using the GNU binutils'
GNU Binary Utilities

The GNU Binary Utilities, or binutils, is a collection of programming tools for the manipulation of object code in various object file formats....
 nm
Nm (Unix)

The nm command ships with a number of later versions of Unix and similar operating systems. nm is used to examine binary files and to display the contents of those files, or Metadata stored in them, specifically the symbol table....
 utility. There is one data symbol, holaamigosh (noted by the "D" type), and many functions (self defined as well as from the standard library). The first column is where the symbol is located in the memory, the second is "" and the third is the name of the symbol. By passing suitable parameters, the symbol table was made to sort on basis of address.
Example table
Address Type Name
00000020 a T_BIT
00000040 a F_BIT
00000080 a I_BIT
20000004 t irqvec
20000008 t fiqvec
2000000c t InitReset
20000018 T _main
20000024 t End
20000030 T AT91F_US3_CfgPIO_useB
2000005c t AT91F_PIO_CfgPeriph
200000b0 T main
20000120 T AT91F_DBGU_Printk
20000190 t AT91F_US_TxReady
200001c0 t AT91F_US_PutChar
200001f8 T AT91F_SpuriousHandler
20000214 T AT91F_DataAbort
20000230 T AT91F_FetchAbort
2000024c T AT91F_Undef
20000268 T AT91F_UndefHandler
20000284 T AT91F_LowLevelInit
200002e0 t AT91F_DBGU_CfgPIO
2000030c t AT91F_PIO_CfgPeriph
20000360 t AT91F_US_Configure
200003dc t AT91F_US_SetBaudrate
2000041c t AT91F_US_Baudrate
200004ec t AT91F_US_SetTimeguard
2000051c t AT91F_PDC_Open
2000059c t AT91F_PDC_DisableRx
200005c8 t AT91F_PDC_DisableTx
200005f4 t AT91F_PDC_SetNextTx
20000638 t AT91F_PDC_SetNextRx
2000067c t AT91F_PDC_SetTx
200006c0 t AT91F_PDC_SetRx
20000704 t AT91F_PDC_EnableRx
20000730 t AT91F_PDC_EnableTx
2000075c t AT91F_US_EnableTx
20000788 T __aeabi_uidiv
20000788 T __udivsi3
20000884 T __aeabi_uidivmod
2000089c T __aeabi_idiv0
2000089c T __aeabi_ldiv0
2000089c T __div0
200009a0 D _data
200009a0 A _etext
200009a0 D holaamigosh
200009a4 A __bss_end__
200009a4 A __bss_start
200009a4 A __bss_start__
200009a4 A _edata
200009a4 A _end


External links