This document outlines the eight phases of a compiler: lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, code generation, symbol table management, and error handling. The first six phases comprise the formal phases and transform the source code through various representations. Symbol table management and error handling are informal phases that support the formal phases. The document also describes the roles and functions of the symbol table manager, including storing attributes of identifiers and variables accessed by different compiler phases.
This document outlines the eight phases of a compiler: lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, code generation, symbol table management, and error handling. The first six phases comprise the formal phases and transform the source code through various representations. Symbol table management and error handling are informal phases that support the formal phases. The document also describes the roles and functions of the symbol table manager, including storing attributes of identifiers and variables accessed by different compiler phases.
This document outlines the eight phases of a compiler: lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, code generation, symbol table management, and error handling. The first six phases comprise the formal phases and transform the source code through various representations. Symbol table management and error handling are informal phases that support the formal phases. The document also describes the roles and functions of the symbol table manager, including storing attributes of identifiers and variables accessed by different compiler phases.
Uoch Phases of compiler • Phase: • A logical activity which transforms the source code from one representation to another representation. • There are eight phases of compiler: • Lexical Analyzer Formal Analysis Portion Phases • Syntax Analyzer • Semantic Analyzer • Intermediate Code Generator Synthesis Portion • Code Optimizer • Code Generator • Symbol Table Manager Informal Phases • Error handler Target Code Explanation • The first six phases are called formal phases of compiler. While the last two are informal phases of compiler. • The last two symbol table manager and Error Handler are not the formal phases of compiler but these help in the activities of the formal phases. • The first three phases form the bulk of the analysis portion and 4, 5, 6 are the synthesis portion of compiler. Symbol Table Manager • It is a data structure which contains a record for each keyword, reserved word, and identifier in the source program, with fields for various attributes of the identifier. • It serves as a dictionary for the compiler. • Here the identifier can be: • Variable name • Function name Symbol Table Manager • In case of a variable name the attributes are: • Type of variable • Scope of variable • Storage classes • Size • Life time • In case of function name the attributes are: • Name • Method of passing arguments • Order of arguments • Return type Symbol Table Manager • Different phases of compiler enters information into symbol table e.g. • lexical analyzer enters identifier names into the symbol table. • Semantic analyzer enters type information into the symbol table • e.t.c • Different phases use information from symbol table e.g. • Semantic analyzer frequently uses symbol table information Continue to Next lecture