Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

compiler ppt on symbol table

  • Be the first to comment

compiler ppt on symbol table

  1. 1. Compiler Design Symbol Tables Nadar Mispa Paulraj
  2. 2. Symbol table The symbol table is used throughout the compilerto hold information about the various entities in thesource program .(classes, instances, methods, variables etc.) and theirproperties (types, arguments, visibility, memoryrequirement etc.). This information is collected incrementally and usedby various phases of the compiler.
  3. 3. Components of Symbol TableThe symbol table you will build will have two maincomponents  The Name Table  The Entity Table each entity in theThe name table , program is representedis used touniquely by a unique entry in the entity table.identifydifferent namesthat occur in theprogram.
  4. 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. 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. 6. Given sample program tocompile: lets see how symbol table is generated
  7. 7. Thus ,The Symbol Table Shows How far the given program iscompiled and stored in the table. Entire program is transformed into a table
  8. 8. Thank You

×