1 Semantic Analysis (Symbol Table and Type Checking) Chapter 5.
Chapter 3: Symbol Table 1 Compiler Designs and Constructions Chapter 3: Symbol Table Objectives:...
-
Upload
rudolf-ball -
Category
Documents
-
view
219 -
download
0
Transcript of Chapter 3: Symbol Table 1 Compiler Designs and Constructions Chapter 3: Symbol Table Objectives:...
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
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
Chapter 3: Symbol Table 3
Hash Functions
1-How to use Hash Functions:
2-Hash Functions:
Index = f(token)
3-Characteristics of hash functions
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
Chapter 3: Symbol Table 5
Resolving Collisions
a. Closed Hashing Leaner Resolution
Quadratic Probing
Double Hashing
Chapter 3: Symbol Table 6
Resolving Collisions
b. Open Hashing Chaining
Chapter 3: Symbol Table 7
Symbol Table Operators:
CreateASymbolTable(size)
Insert(Token)
Lookup(Token)
Delete(Token)
GetAttributes( Token, … )
AddAttributes( Token, …. )
Chapter 3: Symbol Table 8
Symbol Table
Symbol Table Entry:
Scope Rules:
Block:
Symbol Table Types: Static Dynamic
Chapter 3: Symbol Table 9
Symbol Table
Summary:
Token Name
TokenValue
TokenType
TokenScope
MaxSizeArray