<<

Subject: Design Symbol Table: Introduction

It is a of the compiler

2)-> compiler-> targetcode

3)source code-> enters into front end also called Analysis(Lex.Ana, symantic and syntax analysis)-> generation intermediate code-> backend(synthesis)

Compiler role: it consist all the data structure(variables(name, types, attributes,scopes,states) ->accumulated in the symbol table),that contain the source program and it also convey information of the source code

Symbol table creation is done at the beginning of the front end

How symbol table help us?

It gives name of all the identifiers of the SC Associated information related to the name and variable How we can access the related information

*What all attributes related to an identifier is provided by the symbol table-> procedure call,type,record etc.

Who creates this table?

1)this symbol is created at the analysis part by the help of the scanner. This scanner collects information and enters the data into the symbol table

Note: It enters data that is not present before in the symbol table

What is the use?

1) Used by both front end and back end 2) Just to check the identifiers present the source 3) To check the assignment and expression statements 4) To generate intermediate and target code

Implementation of the symbol table:

Operations used:

Insert()-> to insert value in the table , lookup()-> to search avalue in a symbol table

1)Hash table

2)Binary Search tree

3)Link list

Int a

LB1 UB1

Symbol table :

Whenever we declare an element in a program then that elements scope and their areas of implementation applies

A B

Block Global: Real, integer,A,B

Block A: Real , integer

Block B: Real, integer

Block A and B are nested to global