SlideShare a Scribd company logo
1 of 14
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
Compiler DesignCompiler Design
Compiler DesignMir Majid
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compilerIffat Anjum
 
Lecture 14 run time environment
Lecture 14 run time environmentLecture 14 run time environment
Lecture 14 run time environmentIffat Anjum
 
Three address code In Compiler Design
Three address code In Compiler DesignThree address code In Compiler Design
Three address code In Compiler DesignShine Raj
 
Intermediate code generation in Compiler Design
Intermediate code generation in Compiler DesignIntermediate code generation in Compiler Design
Intermediate code generation in Compiler DesignKuppusamy P
 
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 designSwati Chauhan
 
Error Detection & Recovery
Error Detection & RecoveryError Detection & Recovery
Error Detection & RecoveryAkhil Kaushik
 

What's hot (20)

Software tools
Software toolsSoftware tools
Software tools
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
Symbol Table
Symbol TableSymbol Table
Symbol Table
 
Role-of-lexical-analysis
Role-of-lexical-analysisRole-of-lexical-analysis
Role-of-lexical-analysis
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
 
Input-Buffering
Input-BufferingInput-Buffering
Input-Buffering
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Parsing
ParsingParsing
Parsing
 
Lecture 14 run time environment
Lecture 14 run time environmentLecture 14 run time environment
Lecture 14 run time environment
 
Code optimization
Code optimizationCode optimization
Code optimization
 
Three address code In Compiler Design
Three address code In Compiler DesignThree address code In Compiler Design
Three address code In Compiler Design
 
operating system structure
operating system structureoperating system structure
operating system structure
 
Parsing
ParsingParsing
Parsing
 
Intermediate code generation in Compiler Design
Intermediate code generation in Compiler DesignIntermediate code generation in Compiler Design
Intermediate code generation in Compiler Design
 
Types of Parser
Types of ParserTypes of Parser
Types of Parser
 
Compiler Design Unit 2
Compiler Design Unit 2Compiler Design Unit 2
Compiler Design Unit 2
 
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
 
Error Detection & Recovery
Error Detection & RecoveryError Detection & Recovery
Error Detection & Recovery
 

Similar to compiler ppt on symbol table

Compiler and symbol table
Compiler and symbol tableCompiler and symbol table
Compiler and symbol tableSunjid Hasan
 
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.pdfBlueCharm1
 
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 programmingNimrita 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 RPaul 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 Developmentlogendran
 
Programming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) EnvironmentProgramming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) EnvironmentMahmoud Samir Fayed
 
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 RhapsodyGEBS Reporting
 
calc lecture
calc lecturecalc lecture
calc lectureJelz JZ
 
Vizwik Coding Manual
Vizwik Coding ManualVizwik Coding Manual
Vizwik Coding ManualVizwik
 

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
 
Symbol table
Symbol tableSymbol table
Symbol table
 
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
 

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