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
Introduction to Compilers
Akhil Kaushik
 
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
Language processing system.pdf
RakibRahman19
 
PPTX
Lec 1 Compiler Construction (CC) CC.pptx
imranahmadrana28
 
PPT
Compiler Design Basics
Akhil Kaushik
 
PPTX
Life cycle of a computer program
Abhay Kumar
 
Introduction to Compilers
Akhil Kaushik
 
Compiler Construction from very basic start
voyoc79528
 
CD module 1.pptx Introduction to compiler Design
GAJJELASRAVANTHIGAJJ
 
Language processing system.pdf
RakibRahman19
 
Lec 1 Compiler Construction (CC) CC.pptx
imranahmadrana28
 
Compiler Design Basics
Akhil Kaushik
 
Life cycle of a computer program
Abhay Kumar
 

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

PPTX
Compiler Design Introduction
Thapar Institute
 
PPTX
Agro informatics centre up State of Lec 6.pptx
muddydevil2003
 
PPT
Compiler Design Basics
Akhil Kaushik
 
PPTX
Transpilers(Source-to-Source Compilers)
Shivang Bajaniya
 
PDF
Compilerandinterpreterghhhjjjjjjjjnnn.pdf
mksolanki527
 
PPTX
Cd ch1 - introduction
mengistu23
 
PPTX
CD - CH1 - Introduction to compiler design.pptx
ZiyadMohammed17
 
PPTX
4_5802928814682016556.pptx
AshenafiGirma5
 
PPT
Introduction to compiler design and phases of compiler
Ranjeet Reddy
 
PPTX
week 2 - INTRO TO PROGRAMMING.pptx
nuruddinnnaim
 
PPTX
basic programming introduction about java
SuperKmlo
 
PPTX
Programming Languages / Translators
Project Student
 
PPTX
aditya malkani compiler.pptx
WildVenomOP
 
PDF
Introduction to programming language (basic)
nharsh2308
 
PDF
Chapter1.pdf
tharwatabdulhmed
 
PDF
sege.pdf
SegezzBrian
 
PDF
Introduction to computer programming
VanessaBuensalida
 
PPTX
Compiler Construction-1 for bs computer scinece.pptx
DailyReminder1
 
PPTX
Compiler an overview
amudha arul
 
PPTX
programming.pptx
DarianElmyra
 
Compiler Design Introduction
Thapar Institute
 
Agro informatics centre up State of Lec 6.pptx
muddydevil2003
 
Compiler Design Basics
Akhil Kaushik
 
Transpilers(Source-to-Source Compilers)
Shivang Bajaniya
 
Compilerandinterpreterghhhjjjjjjjjnnn.pdf
mksolanki527
 
Cd ch1 - introduction
mengistu23
 
CD - CH1 - Introduction to compiler design.pptx
ZiyadMohammed17
 
4_5802928814682016556.pptx
AshenafiGirma5
 
Introduction to compiler design and phases of compiler
Ranjeet Reddy
 
week 2 - INTRO TO PROGRAMMING.pptx
nuruddinnnaim
 
basic programming introduction about java
SuperKmlo
 
Programming Languages / Translators
Project Student
 
aditya malkani compiler.pptx
WildVenomOP
 
Introduction to programming language (basic)
nharsh2308
 
Chapter1.pdf
tharwatabdulhmed
 
sege.pdf
SegezzBrian
 
Introduction to computer programming
VanessaBuensalida
 
Compiler Construction-1 for bs computer scinece.pptx
DailyReminder1
 
Compiler an overview
amudha arul
 
programming.pptx
DarianElmyra
 
Ad

Recently uploaded (20)

PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PDF
5.EXPLORING-FORCES-Detailed-Notes.pdf/8TH CLASS SCIENCE CURIOSITY
Sandeep Swamy
 
PDF
1.Natural-Resources-and-Their-Use.ppt pdf /8th class social science Exploring...
Sandeep Swamy
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
DOCX
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
PPTX
Strengthening open access through collaboration: building connections with OP...
Jisc
 
PPTX
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
RAKESH SAJJAN
 
PPTX
IMMUNIZATION PROGRAMME pptx
AneetaSharma15
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PDF
Sunset Boulevard Student Revision Booklet
jpinnuck
 
PPTX
ACUTE NASOPHARYNGITIS. pptx
AneetaSharma15
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PPTX
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
PDF
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
BANDITA PATRA
 
PPTX
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
PPTX
Skill Development Program For Physiotherapy Students by SRY.pptx
Prof.Dr.Y.SHANTHOSHRAJA MPT Orthopedic., MSc Microbiology
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
5.EXPLORING-FORCES-Detailed-Notes.pdf/8TH CLASS SCIENCE CURIOSITY
Sandeep Swamy
 
1.Natural-Resources-and-Their-Use.ppt pdf /8th class social science Exploring...
Sandeep Swamy
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
Strengthening open access through collaboration: building connections with OP...
Jisc
 
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
RAKESH SAJJAN
 
IMMUNIZATION PROGRAMME pptx
AneetaSharma15
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
Sunset Boulevard Student Revision Booklet
jpinnuck
 
ACUTE NASOPHARYNGITIS. pptx
AneetaSharma15
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
UPPER GASTRO INTESTINAL DISORDER.docx
BANDITA PATRA
 
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
Skill Development Program For Physiotherapy Students by SRY.pptx
Prof.Dr.Y.SHANTHOSHRAJA MPT Orthopedic., MSc Microbiology
 
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.