90 likes | 184 Views
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. Implementation Techniques insert & search. Unordered List Index+1 index bucket
E N D
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
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
Hash Functions 1-How to use Hash Functions: 2-Hash Functions: Index = f(token) 3-Characteristics of hash functions Chapter 3: Symbol Table
Hash function Methods • Digital Selection abcdefgh efh • Division digits MOD prime_Number • Multiplication abcd * defg • Folding ab+cd+de+ef Chapter 3: Symbol Table
Resolving Collisions • Closed Hashing • Leaner Resolution • Quadratic Probing • Double Hashing Chapter 3: Symbol Table
Resolving Collisions • Open Hashing • Chaining Chapter 3: Symbol Table
Symbol Table Operators: CreateASymbolTable(size) Insert(Token) Lookup(Token) Delete(Token) GetAttributes( Token, … ) AddAttributes( Token, …. ) Chapter 3: Symbol Table
Symbol Table • Symbol Table Entry: • Scope Rules: • Block: • Symbol Table Types: • Static • Dynamic Chapter 3: Symbol Table
Symbol Table • Summary: Chapter 3: Symbol Table