SlideShare a Scribd company logo
Compiler Design
 Symbol Tables

         Nadar Mispa Paulraj
Symbol table
 The symbol table is used throughout the compiler
to hold information about the various entities in the
source program .

(classes, instances, methods, variables etc.) and their
properties (types, arguments, visibility, memory
requirement etc.).

 This information is collected incrementally and used
by various phases of the compiler.
Components of Symbol Table
The symbol table you will build will have two main
components

           The Name Table

           The Entity Table


                               each entity in the
The name table                    ,
                               program is represented
is used to
uniquely                       by a unique entry in
                               the entity table.
identify
different names
that occur in the
program.
Symbol Table Operations

   The two main operations are
     insert (name) makes an entry for this name
     lookup (name) finds the relevant occurrence of

      the name by searching the table
   Lookups occur a lot more often than insert
More Symbol Table Functions

   In addition to lookup and insert, the symbol table
    will also need
       initializeScope (level) , when a block is entered to
        create a new hash table entry in the symbol table list
       finializeScope (level), on block exit put the current
        hash table into a background list
Given sample program to
compile: lets see how symbol table is generated
Thus ,
The Symbol Table Shows

 How far the given program is
compiled and stored in the table.

   Entire program is transformed
    into a table
Thank You

More Related Content

What's hot

COMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time EnvironmentsCOMPILER DESIGN Run-Time Environments
Symbol table management and error handling in compiler design
Symbol table management and error handling in compiler designSymbol table management and error handling in compiler design
Symbol table management and error handling in compiler design
Swati Chauhan
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
Dr. C.V. Suresh Babu
 
Input-Buffering
Input-BufferingInput-Buffering
Input-Buffering
Dattatray Gandhmal
 
Symbol table
Symbol tableSymbol table
Symbol table
Sarvesh Singh
 
1.Role lexical Analyzer
1.Role lexical Analyzer1.Role lexical Analyzer
1.Role lexical Analyzer
Radhakrishnan Chinnusamy
 
Compiler Chapter 1
Compiler Chapter 1Compiler Chapter 1
Compiler Chapter 1
Huawei Technologies
 
Types of grammer - TOC
Types of grammer - TOCTypes of grammer - TOC
Types of grammer - TOC
AbhayDhupar
 
Sql subquery
Sql  subquerySql  subquery
Sql subquery
Raveena Thakur
 
Compiler design
Compiler designCompiler design
Compiler design
Thakur Ganeshsingh Thakur
 
Symbol table design (Compiler Construction)
Symbol table design (Compiler Construction)Symbol table design (Compiler Construction)
Symbol table design (Compiler Construction)Tech_MX
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
Muhammed Afsal Villan
 
Lex
LexLex
The role of the parser and Error recovery strategies ppt in compiler design
The role of the parser and Error recovery strategies ppt in compiler designThe role of the parser and Error recovery strategies ppt in compiler design
The role of the parser and Error recovery strategies ppt in compiler design
Sadia Akter
 
Single pass assembler
Single pass assemblerSingle pass assembler
Single pass assembler
Bansari Shah
 
Lexical Analysis - Compiler design
Lexical Analysis - Compiler design Lexical Analysis - Compiler design
Lexical Analysis - Compiler design
Aman Sharma
 
Intermediate code generator
Intermediate code generatorIntermediate code generator
Intermediate code generator
sanchi29
 
Ll(1) Parser in Compilers
Ll(1) Parser in CompilersLl(1) Parser in Compilers
Ll(1) Parser in Compilers
Mahbubur Rahman
 
Compiler Design
Compiler DesignCompiler Design
Compiler DesignMir Majid
 

What's hot (20)

COMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time EnvironmentsCOMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time Environments
 
Symbol table management and error handling in compiler design
Symbol table management and error handling in compiler designSymbol table management and error handling in compiler design
Symbol table management and error handling in compiler design
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
Input-Buffering
Input-BufferingInput-Buffering
Input-Buffering
 
Symbol table
Symbol tableSymbol table
Symbol table
 
1.Role lexical Analyzer
1.Role lexical Analyzer1.Role lexical Analyzer
1.Role lexical Analyzer
 
Compiler Chapter 1
Compiler Chapter 1Compiler Chapter 1
Compiler Chapter 1
 
Types of grammer - TOC
Types of grammer - TOCTypes of grammer - TOC
Types of grammer - TOC
 
Sql subquery
Sql  subquerySql  subquery
Sql subquery
 
Compiler design
Compiler designCompiler design
Compiler design
 
Symbol table design (Compiler Construction)
Symbol table design (Compiler Construction)Symbol table design (Compiler Construction)
Symbol table design (Compiler Construction)
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
Vectors in Java
Vectors in JavaVectors in Java
Vectors in Java
 
Lex
LexLex
Lex
 
The role of the parser and Error recovery strategies ppt in compiler design
The role of the parser and Error recovery strategies ppt in compiler designThe role of the parser and Error recovery strategies ppt in compiler design
The role of the parser and Error recovery strategies ppt in compiler design
 
Single pass assembler
Single pass assemblerSingle pass assembler
Single pass assembler
 
Lexical Analysis - Compiler design
Lexical Analysis - Compiler design Lexical Analysis - Compiler design
Lexical Analysis - Compiler design
 
Intermediate code generator
Intermediate code generatorIntermediate code generator
Intermediate code generator
 
Ll(1) Parser in Compilers
Ll(1) Parser in CompilersLl(1) Parser in Compilers
Ll(1) Parser in Compilers
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 

Similar to compiler ppt on symbol table

Symbol Table.pptx
Symbol Table.pptxSymbol Table.pptx
Symbol Table.pptx
LaibaFaisal3
 
Compiler and symbol table
Compiler and symbol tableCompiler and symbol table
Compiler and symbol table
Sunjid Hasan
 
First pass of assembler
First pass of assemblerFirst pass of assembler
First pass of assembler
Hemant Chetwani
 
Salesforce
SalesforceSalesforce
Salesforce
maheswara reddy
 
5-2 Introduction to Microsoft Excel Presentation.pdf
5-2 Introduction to Microsoft Excel Presentation.pdf5-2 Introduction to Microsoft Excel Presentation.pdf
5-2 Introduction to Microsoft Excel Presentation.pdf
BlueCharm1
 
Metaprogramming in Scala 2.10, Eugene Burmako,
Metaprogramming  in Scala 2.10, Eugene Burmako, Metaprogramming  in Scala 2.10, Eugene Burmako,
Metaprogramming in Scala 2.10, Eugene Burmako,
Vasil Remeniuk
 
Workshop presentation hands on r programming
Workshop presentation hands on r programmingWorkshop presentation hands on r programming
Workshop presentation hands on r programming
Nimrita Koul
 
Introduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in RIntroduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in R
Paul Richards
 
Introduction to visual basic 6 (1)
Introduction to visual basic 6 (1)Introduction to visual basic 6 (1)
Introduction to visual basic 6 (1)Mark Vincent Cantero
 
MorphX Development
MorphX DevelopmentMorphX Development
MorphX Development
logendran
 
Programming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) EnvironmentProgramming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) Environment
Mahmoud Samir Fayed
 
Microsoft excel
Microsoft excelMicrosoft excel
Microsoft excel
GC University Faisalabad
 
Financial reporting rpd using obiee
Financial reporting rpd using obieeFinancial reporting rpd using obiee
Financial reporting rpd using obieeAmit Sharma
 
Financial reporting rpd using obiee
Financial reporting rpd using obieeFinancial reporting rpd using obiee
Financial reporting rpd using obieeAmit Sharma
 
Financial reporting rpd using obiee
Financial reporting rpd using obieeFinancial reporting rpd using obiee
Financial reporting rpd using obieeAmit Sharma
 
Using Rational Publishing Engine to generate documents from Rational Rhapsody
Using Rational Publishing Engine to generate documents from Rational RhapsodyUsing Rational Publishing Engine to generate documents from Rational Rhapsody
Using Rational Publishing Engine to generate documents from Rational Rhapsody
GEBS Reporting
 
calc lecture
calc lecturecalc lecture
calc lectureJelz JZ
 
Vizwik Coding Manual
Vizwik Coding ManualVizwik Coding Manual
Vizwik Coding Manual
Vizwik
 
Userguide xmllistboxlite
Userguide xmllistboxliteUserguide xmllistboxlite
Userguide xmllistboxliteSamir Dash
 

Similar to compiler ppt on symbol table (20)

Symbol Table.pptx
Symbol Table.pptxSymbol Table.pptx
Symbol Table.pptx
 
Compiler and symbol table
Compiler and symbol tableCompiler and symbol table
Compiler and symbol table
 
First pass of assembler
First pass of assemblerFirst pass of assembler
First pass of assembler
 
Salesforce
SalesforceSalesforce
Salesforce
 
Form part1
Form part1Form part1
Form part1
 
5-2 Introduction to Microsoft Excel Presentation.pdf
5-2 Introduction to Microsoft Excel Presentation.pdf5-2 Introduction to Microsoft Excel Presentation.pdf
5-2 Introduction to Microsoft Excel Presentation.pdf
 
Metaprogramming in Scala 2.10, Eugene Burmako,
Metaprogramming  in Scala 2.10, Eugene Burmako, Metaprogramming  in Scala 2.10, Eugene Burmako,
Metaprogramming in Scala 2.10, Eugene Burmako,
 
Workshop presentation hands on r programming
Workshop presentation hands on r programmingWorkshop presentation hands on r programming
Workshop presentation hands on r programming
 
Introduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in RIntroduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in R
 
Introduction to visual basic 6 (1)
Introduction to visual basic 6 (1)Introduction to visual basic 6 (1)
Introduction to visual basic 6 (1)
 
MorphX Development
MorphX DevelopmentMorphX Development
MorphX Development
 
Programming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) EnvironmentProgramming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) Environment
 
Microsoft excel
Microsoft excelMicrosoft excel
Microsoft excel
 
Financial reporting rpd using obiee
Financial reporting rpd using obieeFinancial reporting rpd using obiee
Financial reporting rpd using obiee
 
Financial reporting rpd using obiee
Financial reporting rpd using obieeFinancial reporting rpd using obiee
Financial reporting rpd using obiee
 
Financial reporting rpd using obiee
Financial reporting rpd using obieeFinancial reporting rpd using obiee
Financial reporting rpd using obiee
 
Using Rational Publishing Engine to generate documents from Rational Rhapsody
Using Rational Publishing Engine to generate documents from Rational RhapsodyUsing Rational Publishing Engine to generate documents from Rational Rhapsody
Using Rational Publishing Engine to generate documents from Rational Rhapsody
 
calc lecture
calc lecturecalc lecture
calc lecture
 
Vizwik Coding Manual
Vizwik Coding ManualVizwik Coding Manual
Vizwik Coding Manual
 
Userguide xmllistboxlite
Userguide xmllistboxliteUserguide xmllistboxlite
Userguide xmllistboxlite
 

compiler ppt on symbol table

  • 1. Compiler Design Symbol Tables Nadar Mispa Paulraj
  • 2. Symbol table  The symbol table is used throughout the compiler to hold information about the various entities in the source program . (classes, instances, methods, variables etc.) and their properties (types, arguments, visibility, memory requirement etc.).  This information is collected incrementally and used by various phases of the compiler.
  • 3. Components of Symbol Table The symbol table you will build will have two main components  The Name Table  The Entity Table each entity in the The name table , program is represented is used to uniquely by a unique entry in the entity table. identify different names that occur in the program.
  • 4. Symbol Table Operations  The two main operations are  insert (name) makes an entry for this name  lookup (name) finds the relevant occurrence of the name by searching the table  Lookups occur a lot more often than insert
  • 5. More Symbol Table Functions  In addition to lookup and insert, the symbol table will also need  initializeScope (level) , when a block is entered to create a new hash table entry in the symbol table list  finializeScope (level), on block exit put the current hash table into a background list
  • 6. Given sample program to compile: lets see how symbol table is generated
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13. Thus , The Symbol Table Shows  How far the given program is compiled and stored in the table.  Entire program is transformed into a table