COMPILER CONSTRUCTION Principles and practice Kenneth C. louden
COMPILER CONSTRUCTION Principles and Practice Kenneth C. Louden
6. Semantic Analysis PART TWO
6. Semantic Analysis PART TWO
Contents Part One 6. 1 Attributes and Attribute grammars 6.2 Algorithms for Attribute Computation Part two 6.3 The Symbol Table 6.4 Data Types and Type Checking 6.5 A Semantic analyzer for the tiny language
Contents Part One 6.1 Attributes and Attribute Grammars 6.2 Algorithms for Attribute Computation Part Two 6.3 The Symbol Table 6.4 Data Types and Type Checking 6.5 A Semantic Analyzer for the TINY Language
6.3 The Symbol Table
6.3 The Symbol Table
Symbol table: major inherited attribute and major data structure in a compiler Principal operations: Insert: store the information provided by name declarations when processing these declarations Lookup: retrieve the information associated to a name when that name is used in the associated code Delete: remove the information provided by a declaration when that declaration no longer applies · Information stored: Include data type information, information on region of applicability(scope), and information on eventual location in memory
• Symbol table: major inherited attribute and major data structure in a compiler • Principal operations: – Insert: store the information provided by name declarations when processing these declarations – Lookup: retrieve the information associated to a name when that name is used in the associated code. – Delete: remove the information provided by a declaration when that declaration no longer applies. • Information stored: – Include data type information, information on region of applicability (scope), and information on eventual location in memory