- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the Symbol Table?
Symbol Table is a data structure that supports an effective and efficient way of storing data about various names occurring in the source code. These names are used in the source code to identify the different program elements, like a variable, constants, procedures, and the labels of statements.
The symbol table is searched each time a name is encountered in the source text. When a new name or new data about an existing name is found, the content of the symbol table modifies.
Thus, the symbol table should have an effective structure for creating the data held in the table also for inserting new entries to the symbol table.
In any case, the symbol table is an effective abstraction to support the compiler to determine and check the semantics, or definitions, of a piece of program. It will maintain track of the names, types, locations, and properties of the symbols encountered in the program.
The type system and the code generation system rely on the symbol table to provide them with information about symbols located elsewhere in the code.
It can produce the compiler more effective because the file does not require to be re-parsed to find previously processed data.
For effectiveness, our option of implementing data structure for the symbol table and the organization of its contents must emphasize minimal value when inserting new entries or creating the data of current entries.
For example, if defining a variable like
int x
then the name of the variable, along with its type, is inserted in the symbol table.
The diagram is given below−
The form of the symbol table to analyze the C function is straightforward. Consider the following outline of a C function−
void scopes ( ) { int a, b, c; /* level 1 */ …………….. { int a, b; /* level 2 */ ………. } float c, d; /* level 3 */ { int m; /* level 4 */ ………. } } }
An upwards growing stack could represent the symbol table. We can have a look at the symbol table as given below−
- Initially the table is empty
- After the first three declarations, the symbol table will be
- After the second declaration of Level 2.
- As the control come out from Level 2.
- When control will enter into Level 3.
- After Entering Level 4.
- On leaving the control from Level 4.
- On leaving the control from Level 3.
- On leaving the function entirely, the symbol table will be again empty.
- Related Articles
- What Information is Stored in the Symbol Table?
- What is two array representations in the symbol table?
- What is Array Name Representation in Symbol Table?
- What is representation of fixed-length and variablelength array representation in the symbol table?
- What is the symbol of mercury?
- What is the symbol of battery?
- What is the symbol of alcohol?
- What is the symbol for baking soda?
- What is the symbol of the element helium?
- Different table symbol in SAP HANA database
- What is the use of the @ symbol in PHP?
- What is the significance of Hyderabad metro rail symbol?
- What is the usage of “@” symbol in MySQL stored procedure?
- What is the use of the '&' symbol in C++?
- What is "Processing Symbol Files" message in Xcode?
