The compilation process is a sequence of various phases that transforms the source program from one representation to another. Each phase takes input from its previous stage, and feeds its output to the next phase of the compiler.
Phases of compiler are
i) Lexical analysis.
ii) Syntax analysis.
iii) Intermediate code generation.
iv) Code optimization.
v) Code generation.
Symbol Table Management
- This record variable name used in the source p
- This stores attributes of each name
- Eg: name, its type, its scope
- Method of passing each argument(by value or by reference)
- Return type
Implementation of symbol table can be done is either linear list or hash table.
Error Handling Routine:In the compiler design process error may occur in all the below-given phases:
- Lexical analyzer: Wrongly spelled tokens
- Syntax analyzer: Missing parenthesis
- Intermediate code generator: Mismatched operands for an operator
- Code Optimizer: When the statement is not reachable
- Code Generator: Unreachable statements
- Symbol tables: Error of multiple declared identifiers