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
PPTX
4_5802928814682016556.pptx
PPTX
CD - CH1 - Introduction to compiler design.pptx
PPTX
Cd ch1 - introduction
DOCX
COMPILER DESIGN.docx
PPTX
Introduction to Compilers
PPT
Lect-01.ppt
PPTX
Chapter 2 Program language translation.pptx
Chapter 1.pptx compiler design lecture note
4_5802928814682016556.pptx
CD - CH1 - Introduction to compiler design.pptx
Cd ch1 - introduction
COMPILER DESIGN.docx
Introduction to Compilers
Lect-01.ppt
Chapter 2 Program language translation.pptx

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

PPTX
Compilers.pptx
DOC
PPTX
Compiler Construction from very basic start
PPTX
CD module 1.pptx Introduction to compiler Design
PDF
Compiler Design Introduction
PDF
Chapter1.pdf
PPTX
Lecture1 compilers
PPT
C++ Program session new edition 2025.ppt
PDF
Compiler type
PDF
Introduction to compiler
PDF
unit1pdf__2021_12_14_12_37_34.pdf
PPTX
Unit2_CD.pptx more about compilation of the day
PPTX
Compiler design slide share
PPTX
Unit 1 part1 Introduction of Compiler Design.pptx
PPT
Compiler Design Basics
PPT
Compiler Design Basics
PPT
phases of compiler PPT includes phases of compiler
PPT
Compiler design lessons notes from Semester
PPTX
Pros and cons of c as a compiler language
PDF
Lecture1 introduction compilers
Compilers.pptx
Compiler Construction from very basic start
CD module 1.pptx Introduction to compiler Design
Compiler Design Introduction
Chapter1.pdf
Lecture1 compilers
C++ Program session new edition 2025.ppt
Compiler type
Introduction to compiler
unit1pdf__2021_12_14_12_37_34.pdf
Unit2_CD.pptx more about compilation of the day
Compiler design slide share
Unit 1 part1 Introduction of Compiler Design.pptx
Compiler Design Basics
Compiler Design Basics
phases of compiler PPT includes phases of compiler
Compiler design lessons notes from Semester
Pros and cons of c as a compiler language
Lecture1 introduction compilers
Ad

Recently uploaded (20)

PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Classroom Observation Tools for Teachers
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Presentation on HIE in infants and its manifestations
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Institutional Correction lecture only . . .
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Cell Types and Its function , kingdom of life
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
01-Introduction-to-Information-Management.pdf
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
Microbial disease of the cardiovascular and lymphatic systems
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Classroom Observation Tools for Teachers
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Presentation on HIE in infants and its manifestations
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Institutional Correction lecture only . . .
GDM (1) (1).pptx small presentation for students
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Complications of Minimal Access Surgery at WLH
Cell Types and Its function , kingdom of life
2.FourierTransform-ShortQuestionswithAnswers.pdf
O7-L3 Supply Chain Operations - ICLT Program
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
01-Introduction-to-Information-Management.pdf
Chinmaya Tiranga quiz Grand Finale.pdf
Cell Structure & Organelles in detailed.
Microbial disease of the cardiovascular and lymphatic systems
Ad

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

  • 1. Compiler Construction By: Ayesha Tariq 📧:ayshatariq742@gmail.com
  • 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.