chapter 3: symbol table 1 compiler designs and constructions chapter 3: symbol table objectives:...
TRANSCRIPT
![Page 1: Chapter 3: Symbol Table 1 Compiler Designs and Constructions Chapter 3: Symbol Table Objectives: (7.6) Introduction to Symbol Table Implementation of Symbol](https://reader036.vdocuments.net/reader036/viewer/2022082417/56649ef65503460f94c09873/html5/thumbnails/1.jpg)
Chapter 3: Symbol Table 1
Compiler Designs and Constructions
Chapter 3: Symbol Table
Objectives: (7.6) Introduction to Symbol Table Implementation of Symbol Table Hash Functions & Types of Hash Functions
Dr. Mohsen Chitsaz
![Page 2: Chapter 3: Symbol Table 1 Compiler Designs and Constructions Chapter 3: Symbol Table Objectives: (7.6) Introduction to Symbol Table Implementation of Symbol](https://reader036.vdocuments.net/reader036/viewer/2022082417/56649ef65503460f94c09873/html5/thumbnails/2.jpg)
Chapter 3: Symbol Table 2
Implementation Techniquesinsert & search
Unordered List Index+1 index bucket O(n)
Ordered List Find location O(log2n)
Binary Tree
Hash Table
![Page 3: Chapter 3: Symbol Table 1 Compiler Designs and Constructions Chapter 3: Symbol Table Objectives: (7.6) Introduction to Symbol Table Implementation of Symbol](https://reader036.vdocuments.net/reader036/viewer/2022082417/56649ef65503460f94c09873/html5/thumbnails/3.jpg)
Chapter 3: Symbol Table 3
Hash Functions
1-How to use Hash Functions:
2-Hash Functions:
Index = f(token)
3-Characteristics of hash functions
![Page 4: Chapter 3: Symbol Table 1 Compiler Designs and Constructions Chapter 3: Symbol Table Objectives: (7.6) Introduction to Symbol Table Implementation of Symbol](https://reader036.vdocuments.net/reader036/viewer/2022082417/56649ef65503460f94c09873/html5/thumbnails/4.jpg)
Chapter 3: Symbol Table 4
Hash function Methods
a. Digital Selectionabcdefgh efh
b. Divisiondigits MOD prime_Number
c. Multiplicationabcd * defg
d. Folding
ab+cd+de+ef
![Page 5: Chapter 3: Symbol Table 1 Compiler Designs and Constructions Chapter 3: Symbol Table Objectives: (7.6) Introduction to Symbol Table Implementation of Symbol](https://reader036.vdocuments.net/reader036/viewer/2022082417/56649ef65503460f94c09873/html5/thumbnails/5.jpg)
Chapter 3: Symbol Table 5
Resolving Collisions
a. Closed Hashing Leaner Resolution
Quadratic Probing
Double Hashing
![Page 6: Chapter 3: Symbol Table 1 Compiler Designs and Constructions Chapter 3: Symbol Table Objectives: (7.6) Introduction to Symbol Table Implementation of Symbol](https://reader036.vdocuments.net/reader036/viewer/2022082417/56649ef65503460f94c09873/html5/thumbnails/6.jpg)
Chapter 3: Symbol Table 6
Resolving Collisions
b. Open Hashing Chaining
![Page 7: Chapter 3: Symbol Table 1 Compiler Designs and Constructions Chapter 3: Symbol Table Objectives: (7.6) Introduction to Symbol Table Implementation of Symbol](https://reader036.vdocuments.net/reader036/viewer/2022082417/56649ef65503460f94c09873/html5/thumbnails/7.jpg)
Chapter 3: Symbol Table 7
Symbol Table Operators:
CreateASymbolTable(size)
Insert(Token)
Lookup(Token)
Delete(Token)
GetAttributes( Token, … )
AddAttributes( Token, …. )
![Page 8: Chapter 3: Symbol Table 1 Compiler Designs and Constructions Chapter 3: Symbol Table Objectives: (7.6) Introduction to Symbol Table Implementation of Symbol](https://reader036.vdocuments.net/reader036/viewer/2022082417/56649ef65503460f94c09873/html5/thumbnails/8.jpg)
Chapter 3: Symbol Table 8
Symbol Table
Symbol Table Entry:
Scope Rules:
Block:
Symbol Table Types: Static Dynamic
![Page 9: Chapter 3: Symbol Table 1 Compiler Designs and Constructions Chapter 3: Symbol Table Objectives: (7.6) Introduction to Symbol Table Implementation of Symbol](https://reader036.vdocuments.net/reader036/viewer/2022082417/56649ef65503460f94c09873/html5/thumbnails/9.jpg)
Chapter 3: Symbol Table 9
Symbol Table
Summary:
Token Name
TokenValue
TokenType
TokenScope
MaxSizeArray