2-Compile Phases Design

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Compiler Design
KCS502
by
DR PARUL YADAV

Institute of Engineering and Technology, Lucknow


Lecture 2:
COMPILER: PHASES AND PASSES
Contents
• Phases of Compiler
• Example
• One Pass Compiler
• Multi Pass Compiler
Compiler
•Translates source code written in HLL into
target code written in assembly language or
low level language
•Reports user about error(s) in source
program, if any
•Example: C/ C++, BASIC, COBOL, FORTRAN,
Ada compiler
Phases of Compiler
Phases
of
Compiler
Phases of Compiler:
Example
Phases of Compiler: Example
1. Lexical Analysis
2. Syntax Analysis
3. Semantics Analysis
4. Intermediate Code Generation
5. Code Optimization
6. Code Generation

Lexeme: Group of characters into meaningful sequences

letter ( letter + digit )*

Token: < taken_name, attr_val >


Phases of Compiler: Example
1. Lexical Analysis
2. Syntax Analysis
3. Semantics Analysis
4. Intermediate Code Generation
5. Code Optimization
6. Code Generation
Phases of Compiler: Example
1. Lexical Analysis
2. Syntax Analysis
3. Semantics Analysis
4. Intermediate Code Generation
5. Code Optimization
6. Code Generation
Phases of Compiler: Example
1. Lexical Analysis
2. Syntax Analysis
3. Semantics Analysis
4. Intermediate Code Generation
5. Code Optimization
6. Code Generation
Phases of Compiler: Example
1. Lexical Analysis
2. Syntax Analysis
3. Semantics Analysis
4. Intermediate Code Generation
5. Code Optimization
6. Code Generation
Phases of Compiler: Example
1. Lexical Analysis
2. Syntax Analysis
3. Semantics Analysis
4. Intermediate Code Generation
5. Code Optimization
6. Code Generation
Phases of Compiler:
Example
Phases of Compiler:
Example
Single Pass Compiler
Two Pass Compiler
Multi Pass Compiler
Thank you
Single Pass Compiler
Two Pass Compiler
Multi Pass Compiler
Difference between One Pass and Multi
Pass Compiler
Thank you

You might also like