data structure of symbol table.pptx

PooraniBalamurugan3 112 views 9 slides Nov 02, 2022
Slide 1
Slide 1 of 9
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9

About This Presentation

Useful for study


Slide Content

NADAR SARAWATHI COLLEGE OF ARTS AND SCIENCE,THENI. DEPARTMENT OF COMPUTER SCIENCE DATA STRUCTURE OF SYMBOL TABLE BY: B.POORANI I-MSC(CS)

Symbol tables A data structure used by a compiler to keep track of semantic of names. Determine whether the variable is defined already or not. Determine the scope Search : access the information associated with given name. Insert: add a name into the table. Delete : remove a name when its scope is closed.

Block structured languages Two basic operation : set and reset The set operation is invoked when the beginning of a block is recognized during compilation. The reset operation ,is applied when the end of a block is encountered.

Four structure Unordered symbol table Ordered symbol table Tree structured symbol table Hash symbol table

Unordered list: For a very small set of variable. Coding is easy , but performance is bad for large number of variables. Ordered linear list: Use binary search on arrays, Insertion and deletion are expensive. Coding is relatively easy.

Binary search tree: O(log n) time per operation (search ,insert or delete)for n variables. Coding is relatively different. Hash table: Most commonly used. Very efficient provided the memory space is adequately larger than the number of variable. Coding is not too difficult.

Content in a symbol table Possible entries in a symbol table: Name : a string Attribute: Reserved word Variable name Type name Procedure name Constant name

Thank you
Tags