Token
- Represented by an integer value or an enumeration literal
- Sometimes, it is necessary to preserve the string of characters that was scanned
- For example, name of an identifiers or value of a literal
Syntax Tree
- Constructed as a pointer-based structure
- Dynamically allocated as parsing proceeds
- Nodes have fields containing information collected by the parser and semantic analyzer
Symbol Table
- Keeps information associate with all kinds of identifiers:
Constants, variables, functions, parameters, types, fields, etc.
- Identifiers are entered by the scanner, parser or semantic analyzer
- Semantic analyzer adds type information and other attributes
- Code generation and optimization phases use the information in the symbol table
- Insertion, deletion and search operation needed to efficient because they are frequent
- Hash table with constant time operations is usually the preferred choice
- More than one symbol table may be used
Literal
Table
- Stores constant values and string literal in a program
- One literal table applies globally to the entire program
- Used by the code generator to:
Assign
addresses for literals
Enter
data definitions in the target code file
- Avoids the replication of constants and strings
- Quick insertion and lookup are essential. Deletion is not necessary
Temporary
Files
- Used historically by old compilers due to memory constraints
- Hold the data of various stages
|
Home
|
|