SlideShare a Scribd company logo
1 of 13
NADAR SARASWATHI COLLEGE OF ARTS&SCIENCE,THENI
DEPARTMENT OF COMPUTER SCIENCE&INFORMATION TECHNOLOGY
V.S.PRIYADHARSHINI
I-MSC(CS)
COMPILER DESIGN
TOPIC: DATA STRUCTURES FOR SYMBOL TABLES
DATA STRUCTURES FOR SYMBOL
TABLES
Symbol Table in Compiler
 A symbol table is a data structure employed by a
language translator, like a compiler or interpreter,
within which each identifier in a program's source
code is connected with information about its
declaration or presence in the source code, like
its type, scope level, and infrequently its position.
 A symbol table is a significant data structure
used in a compiler that correlates characteristics
with program identifiers. The analysis and
synthesis stages employ symbol table
information to verify that used identifiers have
been specified, to validate that expressions and
assignments are semantically accurate, and to
build intermediate or target code.
There are three data structures used to
implement symbol table:
Linear List
Binary Search Tree
Hash Table
LINEAR LISTS
Linear Lists
 It is the simplest and most
straightforward method of
implementing data structures. To store
names and their accompanying
information, we use a single array.
New names are added to the list in the
order that they appear. To add a new
name, we must first check the list to
ensure that it does not already exist.
TREES
Trees
It is a more efficient method of
organizing symbol tables. Each record
now has two link fields, LEFT and
RIGHT. The procedure below is used
to find NAME in a binary search tree
where x is originally a reference to the
root.
 1. while x ≠ null do
 2. if NAME = NAME(x) then /* NAME
found take action on success*/
 3. else if NAME < NAME(x) then
x:=LEFT(x) /* visit left child*/ 5. else /*
NAME (p)<NAME*/ X:= RIGHT(x)
/*visit right child*/
HASH TABLE
Hash Table
Hashing table technique is suitable for
searching and hence it is implemented
in compiler.
HASH FUNCTION
Hash Function
The hash function is the mapping
between an item and the place in the
hash table where that item resides.
The hash function takes a collection
item and returns an integer in the
range of slot names from 0 to m-1.
Example:
Assume that we have the set of integer items 59,
28, 93, 18, 77 and 31.
Consider m=11 (number of slots of hash table)
Suppose we want to insert the above elements
within the slots by using formula:
h(item) % m
59 % 11 = 4
28 % 11 = 6
93 % 11 = 5
18 % 11 = 7
77 % 11 = 0
31 % 11 = 9
Data Structures for Compiler Symbol Tables

More Related Content

What's hot

Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler DesignKuppusamy P
 
Presentation on Data Structure
Presentation on Data StructurePresentation on Data Structure
Presentation on Data StructureA. N. M. Jubaer
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueGhaffar Khan
 
Hashing and Hashtable, application of hashing, advantages of hashing, disadva...
Hashing and Hashtable, application of hashing, advantages of hashing, disadva...Hashing and Hashtable, application of hashing, advantages of hashing, disadva...
Hashing and Hashtable, application of hashing, advantages of hashing, disadva...NaveenPeter8
 
Data structure & its types
Data structure & its typesData structure & its types
Data structure & its typesRameesha Sadaqat
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its typesNavtar Sidhu Brar
 
linked list (c#)
 linked list (c#) linked list (c#)
linked list (c#)swajahatr
 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceTransweb Global Inc
 
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...Hassan Ahmed
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsAakash deep Singhal
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure pptNalinNishant3
 
Skipl List implementation - Part 1
Skipl List implementation - Part 1Skipl List implementation - Part 1
Skipl List implementation - Part 1Amrith Krishna
 

What's hot (20)

Join operation
Join operationJoin operation
Join operation
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler Design
 
Presentation on Data Structure
Presentation on Data StructurePresentation on Data Structure
Presentation on Data Structure
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, Queue
 
Hashing and Hashtable, application of hashing, advantages of hashing, disadva...
Hashing and Hashtable, application of hashing, advantages of hashing, disadva...Hashing and Hashtable, application of hashing, advantages of hashing, disadva...
Hashing and Hashtable, application of hashing, advantages of hashing, disadva...
 
Datastructureitstypes
DatastructureitstypesDatastructureitstypes
Datastructureitstypes
 
Data Structures
Data StructuresData Structures
Data Structures
 
Data structure & its types
Data structure & its typesData structure & its types
Data structure & its types
 
Data structure
Data structureData structure
Data structure
 
R data types
R data typesR data types
R data types
 
Hashing 1
Hashing 1Hashing 1
Hashing 1
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
 
linked list (c#)
 linked list (c#) linked list (c#)
linked list (c#)
 
08 Hash Tables
08 Hash Tables08 Hash Tables
08 Hash Tables
 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer Science
 
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithms
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
Skipl List implementation - Part 1
Skipl List implementation - Part 1Skipl List implementation - Part 1
Skipl List implementation - Part 1
 
Hashing
HashingHashing
Hashing
 

Similar to Data Structures for Compiler Symbol Tables

Data Structures Design Notes.pdf
Data Structures Design Notes.pdfData Structures Design Notes.pdf
Data Structures Design Notes.pdfAmuthachenthiruK
 
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...Bhavin Darji
 
Algorithms notes tutorials duniya
Algorithms notes   tutorials duniyaAlgorithms notes   tutorials duniya
Algorithms notes tutorials duniyaTutorialsDuniya.com
 
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data StructuresSHAKOOR AB
 
Hashing and File Structures in Data Structure.pdf
Hashing and File Structures in Data Structure.pdfHashing and File Structures in Data Structure.pdf
Hashing and File Structures in Data Structure.pdfJaithoonBibi
 
Learning ObjectivesGain some experience using dynamic data structu.docx
Learning ObjectivesGain some experience using dynamic data structu.docxLearning ObjectivesGain some experience using dynamic data structu.docx
Learning ObjectivesGain some experience using dynamic data structu.docxjesseniasaddler
 
Chapter 10: hashing data structure
Chapter 10:  hashing data structureChapter 10:  hashing data structure
Chapter 10: hashing data structureMahmoud Alfarra
 
Chapter 2.2 data structures
Chapter 2.2 data structuresChapter 2.2 data structures
Chapter 2.2 data structuressshhzap
 
2 data structure in R
2 data structure in R2 data structure in R
2 data structure in Rnaroranisha
 
unit-1-dsa-hashing-2022_compressed-1-converted.pptx
unit-1-dsa-hashing-2022_compressed-1-converted.pptxunit-1-dsa-hashing-2022_compressed-1-converted.pptx
unit-1-dsa-hashing-2022_compressed-1-converted.pptxBabaShaikh3
 
Presentation.pptx
Presentation.pptxPresentation.pptx
Presentation.pptxAgonySingh
 
Data Structure In C#
Data Structure In C#Data Structure In C#
Data Structure In C#Shahzad
 
C interview-questions-techpreparation
C interview-questions-techpreparationC interview-questions-techpreparation
C interview-questions-techpreparationKushaal Singla
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management Systemsweetysweety8
 
20130215 Reading data into R
20130215 Reading data into R20130215 Reading data into R
20130215 Reading data into RKazuki Yoshida
 

Similar to Data Structures for Compiler Symbol Tables (20)

Data Structures Design Notes.pdf
Data Structures Design Notes.pdfData Structures Design Notes.pdf
Data Structures Design Notes.pdf
 
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
 
Algorithms notes tutorials duniya
Algorithms notes   tutorials duniyaAlgorithms notes   tutorials duniya
Algorithms notes tutorials duniya
 
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data Structures
 
Hashing and File Structures in Data Structure.pdf
Hashing and File Structures in Data Structure.pdfHashing and File Structures in Data Structure.pdf
Hashing and File Structures in Data Structure.pdf
 
Learning ObjectivesGain some experience using dynamic data structu.docx
Learning ObjectivesGain some experience using dynamic data structu.docxLearning ObjectivesGain some experience using dynamic data structu.docx
Learning ObjectivesGain some experience using dynamic data structu.docx
 
Chapter 10: hashing data structure
Chapter 10:  hashing data structureChapter 10:  hashing data structure
Chapter 10: hashing data structure
 
Chapter 2.2 data structures
Chapter 2.2 data structuresChapter 2.2 data structures
Chapter 2.2 data structures
 
2 data structure in R
2 data structure in R2 data structure in R
2 data structure in R
 
unit-1-dsa-hashing-2022_compressed-1-converted.pptx
unit-1-dsa-hashing-2022_compressed-1-converted.pptxunit-1-dsa-hashing-2022_compressed-1-converted.pptx
unit-1-dsa-hashing-2022_compressed-1-converted.pptx
 
DS_PPT.pptx
DS_PPT.pptxDS_PPT.pptx
DS_PPT.pptx
 
Presentation.pptx
Presentation.pptxPresentation.pptx
Presentation.pptx
 
Data structures in c#
Data structures in c#Data structures in c#
Data structures in c#
 
Data Structure In C#
Data Structure In C#Data Structure In C#
Data Structure In C#
 
R교육1
R교육1R교육1
R교육1
 
C interview-questions-techpreparation
C interview-questions-techpreparationC interview-questions-techpreparation
C interview-questions-techpreparation
 
Unit 3
Unit 3Unit 3
Unit 3
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 
20130215 Reading data into R
20130215 Reading data into R20130215 Reading data into R
20130215 Reading data into R
 
DS_PPT.ppt
DS_PPT.pptDS_PPT.ppt
DS_PPT.ppt
 

More from PriyadharshiniVS

R Ramya devi digital image processing
R  Ramya devi digital image processingR  Ramya devi digital image processing
R Ramya devi digital image processingPriyadharshiniVS
 
R ramya devi cloud computing
R ramya devi cloud computingR ramya devi cloud computing
R ramya devi cloud computingPriyadharshiniVS
 
Ramya devi R women empowerment
Ramya devi R women empowermentRamya devi R women empowerment
Ramya devi R women empowermentPriyadharshiniVS
 
R Ramya devi artificial intelligence and machine learning
R Ramya devi  artificial intelligence and machine learningR Ramya devi  artificial intelligence and machine learning
R Ramya devi artificial intelligence and machine learningPriyadharshiniVS
 
Ramya devi R internet of things
Ramya devi R internet of thingsRamya devi R internet of things
Ramya devi R internet of thingsPriyadharshiniVS
 
MOBILE APP DEVELOPMENT USING PYTHON
MOBILE APP DEVELOPMENT USING PYTHONMOBILE APP DEVELOPMENT USING PYTHON
MOBILE APP DEVELOPMENT USING PYTHONPriyadharshiniVS
 
PriyaDharshini distributed operating system
PriyaDharshini distributed operating systemPriyaDharshini distributed operating system
PriyaDharshini distributed operating systemPriyadharshiniVS
 
Vanmathy distributed operating system
Vanmathy distributed operating system Vanmathy distributed operating system
Vanmathy distributed operating system PriyadharshiniVS
 
vanmathy cryptography network security
vanmathy cryptography network securityvanmathy cryptography network security
vanmathy cryptography network securityPriyadharshiniVS
 
vanmathy cryptography network security
vanmathy cryptography network security vanmathy cryptography network security
vanmathy cryptography network security PriyadharshiniVS
 
Vanmathy distributed operating system
Vanmathy distributed operating system Vanmathy distributed operating system
Vanmathy distributed operating system PriyadharshiniVS
 
Cryptography and network security
Cryptography and network securityCryptography and network security
Cryptography and network securityPriyadharshiniVS
 
Graph, graph and network modeling, advantage of graph database
Graph, graph and network modeling, advantage of graph databaseGraph, graph and network modeling, advantage of graph database
Graph, graph and network modeling, advantage of graph databasePriyadharshiniVS
 

More from PriyadharshiniVS (20)

R Ramya devi digital image processing
R  Ramya devi digital image processingR  Ramya devi digital image processing
R Ramya devi digital image processing
 
R ramya devi cloud computing
R ramya devi cloud computingR ramya devi cloud computing
R ramya devi cloud computing
 
Ramya devi R women empowerment
Ramya devi R women empowermentRamya devi R women empowerment
Ramya devi R women empowerment
 
R Ramya devi artificial intelligence and machine learning
R Ramya devi  artificial intelligence and machine learningR Ramya devi  artificial intelligence and machine learning
R Ramya devi artificial intelligence and machine learning
 
Ramya devi R internet of things
Ramya devi R internet of thingsRamya devi R internet of things
Ramya devi R internet of things
 
vs.pptx
vs.pptxvs.pptx
vs.pptx
 
WE.pptx
WE.pptxWE.pptx
WE.pptx
 
IOT.pptx
IOT.pptxIOT.pptx
IOT.pptx
 
cc.pptx
cc.pptxcc.pptx
cc.pptx
 
MOBILE APP DEVELOPMENT USING PYTHON
MOBILE APP DEVELOPMENT USING PYTHONMOBILE APP DEVELOPMENT USING PYTHON
MOBILE APP DEVELOPMENT USING PYTHON
 
Vanmathy python
Vanmathy python Vanmathy python
Vanmathy python
 
PriyaDharshini distributed operating system
PriyaDharshini distributed operating systemPriyaDharshini distributed operating system
PriyaDharshini distributed operating system
 
Vanmathy distributed operating system
Vanmathy distributed operating system Vanmathy distributed operating system
Vanmathy distributed operating system
 
vanmathy cryptography network security
vanmathy cryptography network securityvanmathy cryptography network security
vanmathy cryptography network security
 
vanmathy cryptography network security
vanmathy cryptography network security vanmathy cryptography network security
vanmathy cryptography network security
 
Vanmathy distributed operating system
Vanmathy distributed operating system Vanmathy distributed operating system
Vanmathy distributed operating system
 
Vanmathy no sql
Vanmathy no sql Vanmathy no sql
Vanmathy no sql
 
Cryptography and network security
Cryptography and network securityCryptography and network security
Cryptography and network security
 
No sql
No sql No sql
No sql
 
Graph, graph and network modeling, advantage of graph database
Graph, graph and network modeling, advantage of graph databaseGraph, graph and network modeling, advantage of graph database
Graph, graph and network modeling, advantage of graph database
 

Recently uploaded

APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 

Recently uploaded (20)

APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 

Data Structures for Compiler Symbol Tables

  • 1. NADAR SARASWATHI COLLEGE OF ARTS&SCIENCE,THENI DEPARTMENT OF COMPUTER SCIENCE&INFORMATION TECHNOLOGY V.S.PRIYADHARSHINI I-MSC(CS)
  • 2. COMPILER DESIGN TOPIC: DATA STRUCTURES FOR SYMBOL TABLES
  • 3. DATA STRUCTURES FOR SYMBOL TABLES Symbol Table in Compiler  A symbol table is a data structure employed by a language translator, like a compiler or interpreter, within which each identifier in a program's source code is connected with information about its declaration or presence in the source code, like its type, scope level, and infrequently its position.  A symbol table is a significant data structure used in a compiler that correlates characteristics with program identifiers. The analysis and synthesis stages employ symbol table information to verify that used identifiers have been specified, to validate that expressions and assignments are semantically accurate, and to build intermediate or target code.
  • 4. There are three data structures used to implement symbol table: Linear List Binary Search Tree Hash Table
  • 5. LINEAR LISTS Linear Lists  It is the simplest and most straightforward method of implementing data structures. To store names and their accompanying information, we use a single array. New names are added to the list in the order that they appear. To add a new name, we must first check the list to ensure that it does not already exist.
  • 6.
  • 7. TREES Trees It is a more efficient method of organizing symbol tables. Each record now has two link fields, LEFT and RIGHT. The procedure below is used to find NAME in a binary search tree where x is originally a reference to the root.
  • 8.  1. while x ≠ null do  2. if NAME = NAME(x) then /* NAME found take action on success*/  3. else if NAME < NAME(x) then x:=LEFT(x) /* visit left child*/ 5. else /* NAME (p)<NAME*/ X:= RIGHT(x) /*visit right child*/
  • 9. HASH TABLE Hash Table Hashing table technique is suitable for searching and hence it is implemented in compiler.
  • 10.
  • 11. HASH FUNCTION Hash Function The hash function is the mapping between an item and the place in the hash table where that item resides. The hash function takes a collection item and returns an integer in the range of slot names from 0 to m-1.
  • 12. Example: Assume that we have the set of integer items 59, 28, 93, 18, 77 and 31. Consider m=11 (number of slots of hash table) Suppose we want to insert the above elements within the slots by using formula: h(item) % m 59 % 11 = 4 28 % 11 = 6 93 % 11 = 5 18 % 11 = 7 77 % 11 = 0 31 % 11 = 9