SlideShare a Scribd company logo
1 of 11
Compiler Construction
Symbol table
SYMBOL TABLE
• A symbol table is a data structure used by a
language translator such as a compiler or
interpreter
• where each identifier in a program's source code is
associated with information relating to its declaration
or appearance in the source, such as its type, scope
level and sometimes its location.
Symbol table
• Symbol table is a major data structure used in a
compiler which associates attributes with identifiers
in a program.
• A symbol table information is used by the analysis
and synthesis phases to verify that used identifiers
have been defined (declared), to verify that
expressions and assignments are semantically
correct (type checking), to generate intermediate or
target code.
Features Of Symbol Table
 This symbol table is used for the following purposes:
 It is used to keep all of the names of all entities in
one place in a structured format.
 It is used to check whether or not a variable has
been declared.
 It is used to identify the scope of a name.
 It is used to implement type checking in source code
by ensuring if assignments and expressions are
semantically accurate or not.
Basic Operations of a Symbol table
The basic operations defined on a symbol table
include:
 allocate – to allocate a new empty symbol table
 free – to remove all entries and free the storage of a
symbol table
 insert – to insert a name in a symbol table and return
a pointer to its entry
 lookup – to search for a name and return a pointer
to its entry
 set_attribute – to associate an attribute with a given
entry
 get_attribute – to get an attribute associated with a
given entry
Cont…
• Other operations can be added depending on
requirement. For example, a delete operation
removes a name previously inserted.
Possible Implementations Techniques:
 Unordered list: for a very small set of variables.
 Ordered linear list: insertion is expensive, but
implementation is relatively easy
 Binary search tree: O(log n) time per operation for n
variables.
 Hash table: most commonly used, and very efficient
provided the memory space is adequately larger
than the number of variables.
SYMBOL TABLE FORMAT:
 Symbol table is an environment that stores
information about identifiers, a data structure that
captures scope information.
 Each entry in symbol table contains: Name, Kind,
Type and additional properties.
 Symbol table contains the following format:
Cont….
Symbol table example:
Symbol table Example

More Related Content

Similar to Symbol Table.pptx

Symbol Table, Error Handler & Code Generation
Symbol Table, Error Handler & Code GenerationSymbol Table, Error Handler & Code Generation
Symbol Table, Error Handler & Code GenerationAkhil Kaushik
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptxmadhurij54
 
47468272 introduction-to-informatica
47468272 introduction-to-informatica47468272 introduction-to-informatica
47468272 introduction-to-informaticaVenkat485
 
Vizwik Coding Manual
Vizwik Coding ManualVizwik Coding Manual
Vizwik Coding ManualVizwik
 
unit2.pptx
unit2.pptxunit2.pptx
unit2.pptxsscprep9
 
what is compiler and five phases of compiler
what is compiler and five phases of compilerwhat is compiler and five phases of compiler
what is compiler and five phases of compileradilmehmood93
 
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERSIICT Chromepet
 
Introduction to R _IMPORTANT FOR DATA ANALYTICS
Introduction to R _IMPORTANT FOR DATA ANALYTICSIntroduction to R _IMPORTANT FOR DATA ANALYTICS
Introduction to R _IMPORTANT FOR DATA ANALYTICSHaritikaChhatwal1
 
Practical type mining in Scala
Practical type mining in ScalaPractical type mining in Scala
Practical type mining in ScalaRose Toomey
 
ProjectCompilers.pdfPage 1 of 6 Project Con.docx
ProjectCompilers.pdfPage 1 of 6 Project Con.docxProjectCompilers.pdfPage 1 of 6 Project Con.docx
ProjectCompilers.pdfPage 1 of 6 Project Con.docxwkyra78
 

Similar to Symbol Table.pptx (20)

Data structure
Data structureData structure
Data structure
 
Python Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
 
Symbol Table, Error Handler & Code Generation
Symbol Table, Error Handler & Code GenerationSymbol Table, Error Handler & Code Generation
Symbol Table, Error Handler & Code Generation
 
Lp 2
Lp 2Lp 2
Lp 2
 
Field symbols
Field symbolsField symbols
Field symbols
 
Plc part 2
Plc  part 2Plc  part 2
Plc part 2
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptx
 
47468272 introduction-to-informatica
47468272 introduction-to-informatica47468272 introduction-to-informatica
47468272 introduction-to-informatica
 
Advanced c#
Advanced c#Advanced c#
Advanced c#
 
098ca session7 c++
098ca session7 c++098ca session7 c++
098ca session7 c++
 
Vizwik Coding Manual
Vizwik Coding ManualVizwik Coding Manual
Vizwik Coding Manual
 
unit2.pptx
unit2.pptxunit2.pptx
unit2.pptx
 
what is compiler and five phases of compiler
what is compiler and five phases of compilerwhat is compiler and five phases of compiler
what is compiler and five phases of compiler
 
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS
500+ SAP ABAP INTERVIEW QUESTIONS WITH ANSWERS
 
Introduction to R _IMPORTANT FOR DATA ANALYTICS
Introduction to R _IMPORTANT FOR DATA ANALYTICSIntroduction to R _IMPORTANT FOR DATA ANALYTICS
Introduction to R _IMPORTANT FOR DATA ANALYTICS
 
Indexing
IndexingIndexing
Indexing
 
Practical type mining in Scala
Practical type mining in ScalaPractical type mining in Scala
Practical type mining in Scala
 
C#
C#C#
C#
 
Etl2
Etl2Etl2
Etl2
 
ProjectCompilers.pdfPage 1 of 6 Project Con.docx
ProjectCompilers.pdfPage 1 of 6 Project Con.docxProjectCompilers.pdfPage 1 of 6 Project Con.docx
ProjectCompilers.pdfPage 1 of 6 Project Con.docx
 

Recently uploaded

Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一ffjhghh
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改atducpo
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiSuhani Kapoor
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxMohammedJunaid861692
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 

Recently uploaded (20)

Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 

Symbol Table.pptx

  • 2. SYMBOL TABLE • A symbol table is a data structure used by a language translator such as a compiler or interpreter • where each identifier in a program's source code is associated with information relating to its declaration or appearance in the source, such as its type, scope level and sometimes its location.
  • 3. Symbol table • Symbol table is a major data structure used in a compiler which associates attributes with identifiers in a program. • A symbol table information is used by the analysis and synthesis phases to verify that used identifiers have been defined (declared), to verify that expressions and assignments are semantically correct (type checking), to generate intermediate or target code.
  • 4. Features Of Symbol Table  This symbol table is used for the following purposes:  It is used to keep all of the names of all entities in one place in a structured format.  It is used to check whether or not a variable has been declared.  It is used to identify the scope of a name.  It is used to implement type checking in source code by ensuring if assignments and expressions are semantically accurate or not.
  • 5. Basic Operations of a Symbol table The basic operations defined on a symbol table include:  allocate – to allocate a new empty symbol table  free – to remove all entries and free the storage of a symbol table  insert – to insert a name in a symbol table and return a pointer to its entry  lookup – to search for a name and return a pointer to its entry  set_attribute – to associate an attribute with a given entry  get_attribute – to get an attribute associated with a given entry
  • 6. Cont… • Other operations can be added depending on requirement. For example, a delete operation removes a name previously inserted.
  • 7. Possible Implementations Techniques:  Unordered list: for a very small set of variables.  Ordered linear list: insertion is expensive, but implementation is relatively easy  Binary search tree: O(log n) time per operation for n variables.  Hash table: most commonly used, and very efficient provided the memory space is adequately larger than the number of variables.
  • 8. SYMBOL TABLE FORMAT:  Symbol table is an environment that stores information about identifiers, a data structure that captures scope information.  Each entry in symbol table contains: Name, Kind, Type and additional properties.  Symbol table contains the following format: