TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

DS for symbols tables

DS for symbols tables with introduction, Phases, Passes, Bootstrapping, Optimization of DFA, Finite State machine, Formal Grammar, BNF Notation, YACC, Derivation, Parse Tree, Ambiguity, Syntax directed Translation, slr 1 parsing etc.

<< Back to DATA

Data structure for symbol table

  • A compiler contains two type of symbol table: global symbol table and scope symbol table.
  • Global symbol table can be accessed by all the procedures and scope symbol table.

The scope of a name and symbol table is arranged in the hierarchy structure as shown below:

int value=10;

void sum_num()
     {
       int num_1;
       int num_2;

            {
             int num_3;
             int num_4;
            }

       int num_5;

            {
             int_num 6;
             int_num 7;
            }
     }

Void sum_id
     {
       int id_1;
       int id_2;

            {
             int id_3;
             int id_4;
            }

       int num_5;
     }

The above grammar can be represented in a hierarchical data structure of symbol tables:

Data structure for symbol table

The global symbol table contains one global variable and two procedure names. The name mentioned in the sum_num table is not available for sum_id and its child tables.

Data structure hierarchy of symbol table is stored in the semantic analyzer. If you want to search the name in the symbol table then you can search it using the following algorithm:
  • First a symbol is searched in the current symbol table.
  • If the name is found then search is completed else the name will be searched in the symbol table of parent until,
  • The name is found or global symbol is searched.





Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf