PooraniBalamurugan3
112 views
9 slides
Nov 02, 2022
Slide 1 of 9
1
2
3
4
5
6
7
8
9
About This Presentation
Useful for study
Size: 66.57 KB
Language: en
Added: Nov 02, 2022
Slides: 9 pages
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