0% found this document useful (0 votes)
6 views2 pages

Compiler Desgin

The document outlines the phases of a compiler, which include lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, and final code generation. It also describes the role of the symbol table in tracking variables, functions, and identifiers, as well as the importance of input buffering for performance enhancement during lexical analysis. Each phase is crucial for transforming source code into executable machine code while ensuring correctness and efficiency.

Uploaded by

sdsharma96070
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Compiler Desgin

The document outlines the phases of a compiler, which include lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, and final code generation. It also describes the role of the symbol table in tracking variables, functions, and identifiers, as well as the importance of input buffering for performance enhancement during lexical analysis. Each phase is crucial for transforming source code into executable machine code while ensuring correctness and efficiency.

Uploaded by

sdsharma96070
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

PHASES OF A COMPILER (SOURCE CODE)

1.LEXICAL ANALYSIS
2. SYNTAX ANALYSIS
3. SEMANTIC ANALYSIS ( ERROR MODELING)
4. INSENDIATE CODE GENERATION
5. CODE OPTIMIZATION
6. FIND CODE GENERATION
1. LEXICAL ANALYSIS – The first phase where the source code is broken down into
token such as keywords ,operator and identifiers. It read the source code characters
by character rand groups them into taken based on predefined PATTERNS ,
SPECIFIED by the LANGUAGE GRAMMAR.
2. SYNTAX ANALYSIS – This phase checks if the source code follows the correct syntex
rules building a parge tree.
3. SEMANTIC ANALYSIS – It ensures the programs logic makes sense, checking for
errors like type missmatch or undeclare variables.
4. INSENDIATE ANALYSIS – In this phase the compiler converts the source code into one
intermediate , machine independent representation and translation.
5. CODE OPTIMIZATION – this phase improves the intermediate code to make it run
more efficientily redusing resource using or increasing speed.
6. FINAL CODE OPTIMIZATION - The final phase where the optimization code is
translated into target machine code or assembly language that can we executed on
the computer.

(SYMBOL TABLE)- Symbol table tracks all the variables functions and identifiers in a
programmings . It stores informations such as NAME , TYPE ,SCOPE AND MEMORY
LOCATION of each identifier . It act as a bridge between the analysis and synthes phase of
compiler.

ITEMS STORED IN SYMBOL TABLE


 VARIABLE NAMES AND CONSTANTS
 SPROCESSOR AND FUNCTION NAMES
 STRINGS AND LITERAL CONSTRANTS
 COMILER GENERATED TEMPORARY
 LABLES IN SOURCE LANGUAGE
INPUT BUFFERING: It involves the
input programs inchance or buffer to reduce
the overheads of input/output operation
instead of reading one character at a
time. The lexical analysis read a buffer
of character for improving
performance.

You might also like