SlideShare a Scribd company logo
Compiler Construction
By: Ayesha Tariq
📧:ayshatariq742@gmail.com
Scope
• Introduction to Compiler
• Why we construct compilers?
• Features of Compiler
• Types of Compilers
• Decompiler
• Cousins of Compiler
Do you know?
 What are the high or low level languages?
 Difference b/w them.
 Difference b/w Assembly and Machine language.
 What is the language of computer ?
 Why we feel easy in high level language ?
 What is language translator?
Compiler
A compiler is a program that reads a program written in one
language (i.e. source program) and translates it into equivalent
program in another Language (i.e. the target language).
Compiler
Source program Target program
Compiler
• The compiler reports to its user the presence of errors in the
source program.
Error Messages
Why we construct compilers?
• Without compilers our machines (computers) are not able
to understand the source code, written in high level
language and thus required task will not get executed.
Features of Compiler
• Correctness (preserve the meaning of the code)
• Recognize legal and illegal program
• Speed of target code
• Good error reporting
• Cooperation with the debugger
• Manage storage of all variables and codes
Types of Compilers
• Single Pass
• Multi Pass
Single Pass Compiler
• Single pass compiler is a compiler that passes the source
code through each compilation unit only once.
• It is faster and smaller than the multi pass compiler.
• As a disadvantage of single pass compiler is that it is less
efficient in comparison with multi pass compiler.
• Single pass compiler is one that processes the input exactly
once, so going directly from lexical analysis to code
generator, and then going back for the next read.
Single Pass Compiler
•
Source program
Compiler
Target program
Multi Pass Compiler
• A multi pass compiler separates compilation into multiple passes,
where each pass would continue with the result of the previous
pass.
• Slower as each pass reads and write an intermediate file.
• Memory consumption is high.
• Take some times to compile.
• Used to implement programing languages such as Java.
Multi Pass Compiler
Decompiler
• A program that translates from low level to higher level one is a
decompiler.
• It can be used for the recovery of lost source code, and is also
useful in some cases for error correction. In case if the vendor of a
software lose its source code ,they can use a decompiler to
recover the source code from the executable.
• It is an opposite of a compiler.
The Ethics of Decompilation
• Is decompilation legal, and is it allowed?
• There are many situations when decompilation can be used...
• To recover lost source code. You may have written a program for
which you only have the executable now (or you got the exe of a
program you wrote long back, from someone else!). If you want to
have the source for such a program, you can use decompilation to
recover it. In all rights, you are the owner of the program, so
nobody is going to question you.
The Ethics of Decompilation
• Just as stated above, applications written long back for a
computer may not have the source code now, and you may need to
port it to a new platform. Either you have to rewrite the
application from the scratch, or use decompilation to understand
the working of the application and write it again.
Cousins of Compiler
Cousins of Compiler
1. Preprocessor
It converts the HLL (high level language)into pure high level language.
It includes all the header files and also evaluates if any macro is
included. It is the optional because if any language which does not
support #include and macro preprocessor is not required.
2. Compiler
It takes pure high level language as a input and convert into assembly
code.
3. Assembler
It takes assembly code as an input and converts it into assembly code.
Cousins of Compiler
4. Linking and loading
It has four functions:
• Allocation: It means get the memory portions from operating
system and storing the object data.
• Relocation: It maps the relative address to the physical
address and relocating the object code.
• Linker: It combines all the executable object module to pre
single executable file.
• Loader: It loads the executable file into permanent storage.

More Related Content

PPTX
Chapter 1.pptx compiler design lecture note
adugnanegero
 
PPTX
4_5802928814682016556.pptx
AshenafiGirma5
 
PPTX
CD - CH1 - Introduction to compiler design.pptx
ZiyadMohammed17
 
PPTX
Cd ch1 - introduction
mengistu23
 
DOCX
COMPILER DESIGN.docx
Revathiparamanathan
 
PPTX
Introduction to Compilers
Akhil Kaushik
 
PPT
Lect-01.ppt
KamranAli649587
 
PPTX
Chapter 2 Program language translation.pptx
dawod yimer
 
Chapter 1.pptx compiler design lecture note
adugnanegero
 
4_5802928814682016556.pptx
AshenafiGirma5
 
CD - CH1 - Introduction to compiler design.pptx
ZiyadMohammed17
 
Cd ch1 - introduction
mengistu23
 
COMPILER DESIGN.docx
Revathiparamanathan
 
Introduction to Compilers
Akhil Kaushik
 
Lect-01.ppt
KamranAli649587
 
Chapter 2 Program language translation.pptx
dawod yimer
 

Similar to Compiler constuction lec 1 ( features of compiler and types of compiler).pptx (20)

PPTX
Compilers.pptx
MohammedMohammed578197
 
DOC
compiler vs interpreter
Faculty of Science , portsaid Univeristy
 
PPTX
Compiler Construction from very basic start
voyoc79528
 
PPTX
CD module 1.pptx Introduction to compiler Design
GAJJELASRAVANTHIGAJJ
 
PDF
Compiler Design Introduction
Kuppusamy P
 
PDF
Chapter1.pdf
tharwatabdulhmed
 
PPTX
Lecture1 compilers
Aftab Ahmad
 
PPT
C++ Program session new edition 2025.ppt
jafargubwi
 
PDF
Compiler type
Amrish rajput
 
PDF
Introduction to compiler
A. S. M. Shafi
 
PDF
unit1pdf__2021_12_14_12_37_34.pdf
DrIsikoIsaac
 
PPTX
Unit2_CD.pptx more about compilation of the day
k12196987
 
PPTX
Compiler design slide share
Sudhaa Ravi
 
PPTX
Unit 1 part1 Introduction of Compiler Design.pptx
Neelkaranbind
 
PPT
Compiler Design Basics
Akhil Kaushik
 
PPT
Compiler Design Basics
Akhil Kaushik
 
PPT
phases of compiler PPT includes phases of compiler
premajain3
 
PPTX
Pros and cons of c as a compiler language
Ashok Raj
 
PDF
Lecture1 introduction compilers
Mahesh Kumar Chelimilla
 
PPTX
Programming Languages / Translators
Project Student
 
Compilers.pptx
MohammedMohammed578197
 
Compiler Construction from very basic start
voyoc79528
 
CD module 1.pptx Introduction to compiler Design
GAJJELASRAVANTHIGAJJ
 
Compiler Design Introduction
Kuppusamy P
 
Chapter1.pdf
tharwatabdulhmed
 
Lecture1 compilers
Aftab Ahmad
 
C++ Program session new edition 2025.ppt
jafargubwi
 
Compiler type
Amrish rajput
 
Introduction to compiler
A. S. M. Shafi
 
unit1pdf__2021_12_14_12_37_34.pdf
DrIsikoIsaac
 
Unit2_CD.pptx more about compilation of the day
k12196987
 
Compiler design slide share
Sudhaa Ravi
 
Unit 1 part1 Introduction of Compiler Design.pptx
Neelkaranbind
 
Compiler Design Basics
Akhil Kaushik
 
Compiler Design Basics
Akhil Kaushik
 
phases of compiler PPT includes phases of compiler
premajain3
 
Pros and cons of c as a compiler language
Ashok Raj
 
Lecture1 introduction compilers
Mahesh Kumar Chelimilla
 
Programming Languages / Translators
Project Student
 
Ad

Recently uploaded (20)

PPTX
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PDF
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
PDF
1.Natural-Resources-and-Their-Use.ppt pdf /8th class social science Exploring...
Sandeep Swamy
 
PPTX
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
PDF
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
PPTX
FSSAI (Food Safety and Standards Authority of India) & FDA (Food and Drug Adm...
Dr. Paindla Jyothirmai
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PPTX
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
PDF
Study Material and notes for Women Empowerment
ComputerScienceSACWC
 
PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
1.Natural-Resources-and-Their-Use.ppt pdf /8th class social science Exploring...
Sandeep Swamy
 
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
FSSAI (Food Safety and Standards Authority of India) & FDA (Food and Drug Adm...
Dr. Paindla Jyothirmai
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
Study Material and notes for Women Empowerment
ComputerScienceSACWC
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
Ad

Compiler constuction lec 1 ( features of compiler and types of compiler).pptx

  • 2. Scope • Introduction to Compiler • Why we construct compilers? • Features of Compiler • Types of Compilers • Decompiler • Cousins of Compiler
  • 3. Do you know?  What are the high or low level languages?  Difference b/w them.  Difference b/w Assembly and Machine language.  What is the language of computer ?  Why we feel easy in high level language ?  What is language translator?
  • 4. Compiler A compiler is a program that reads a program written in one language (i.e. source program) and translates it into equivalent program in another Language (i.e. the target language). Compiler Source program Target program
  • 5. Compiler • The compiler reports to its user the presence of errors in the source program. Error Messages
  • 6. Why we construct compilers? • Without compilers our machines (computers) are not able to understand the source code, written in high level language and thus required task will not get executed.
  • 7. Features of Compiler • Correctness (preserve the meaning of the code) • Recognize legal and illegal program • Speed of target code • Good error reporting • Cooperation with the debugger • Manage storage of all variables and codes
  • 8. Types of Compilers • Single Pass • Multi Pass
  • 9. Single Pass Compiler • Single pass compiler is a compiler that passes the source code through each compilation unit only once. • It is faster and smaller than the multi pass compiler. • As a disadvantage of single pass compiler is that it is less efficient in comparison with multi pass compiler. • Single pass compiler is one that processes the input exactly once, so going directly from lexical analysis to code generator, and then going back for the next read.
  • 10. Single Pass Compiler • Source program Compiler Target program
  • 11. Multi Pass Compiler • A multi pass compiler separates compilation into multiple passes, where each pass would continue with the result of the previous pass. • Slower as each pass reads and write an intermediate file. • Memory consumption is high. • Take some times to compile. • Used to implement programing languages such as Java.
  • 13. Decompiler • A program that translates from low level to higher level one is a decompiler. • It can be used for the recovery of lost source code, and is also useful in some cases for error correction. In case if the vendor of a software lose its source code ,they can use a decompiler to recover the source code from the executable. • It is an opposite of a compiler.
  • 14. The Ethics of Decompilation • Is decompilation legal, and is it allowed? • There are many situations when decompilation can be used... • To recover lost source code. You may have written a program for which you only have the executable now (or you got the exe of a program you wrote long back, from someone else!). If you want to have the source for such a program, you can use decompilation to recover it. In all rights, you are the owner of the program, so nobody is going to question you.
  • 15. The Ethics of Decompilation • Just as stated above, applications written long back for a computer may not have the source code now, and you may need to port it to a new platform. Either you have to rewrite the application from the scratch, or use decompilation to understand the working of the application and write it again.
  • 17. Cousins of Compiler 1. Preprocessor It converts the HLL (high level language)into pure high level language. It includes all the header files and also evaluates if any macro is included. It is the optional because if any language which does not support #include and macro preprocessor is not required. 2. Compiler It takes pure high level language as a input and convert into assembly code. 3. Assembler It takes assembly code as an input and converts it into assembly code.
  • 18. Cousins of Compiler 4. Linking and loading It has four functions: • Allocation: It means get the memory portions from operating system and storing the object data. • Relocation: It maps the relative address to the physical address and relocating the object code. • Linker: It combines all the executable object module to pre single executable file. • Loader: It loads the executable file into permanent storage.