SlideShare a Scribd company logo
1 of 9
Compiler Construction
By Noor Wali Khan
Uoch
Source Language
• Any programming language or high level languages
are called source language.
• These languages contains English like words and
mathematical symbols, that are easy to understand by
the Human. E.g. C, C++, java, Python, PHP etc.
• There are thousand of languages(source) ranges from
traditional programming languages to specialized
language.
Target Language
•low level programming languages.
•It has two forms
•Relocatable Machine Code
•Target Assembly Code
Relocatable Machine Code
• It is a machine code with relocatable address.
• Machine code that is loaded in storage so that its relative address is
different from its absolute address.
• Absolute Address: A direct address that identifies a location, such as
a storage location, without a reference to any other address, such as a
base address.
• Relative address: A direct address that identifies its location by
means of its displacement from a base address.
Target Assembly Code
•If the output of the compiler is in assembly
language then a translator called assembler is
used to translate the output(assembly codes)
into machine code.
Context of compiler
Compiler
Preprocessor
Assembler
Linker
Loader
Skeletal Source
Program
Source
program
Relocatable Machine
code
Execute
.obj
extension
Desirable Properties of compiler
• It must generate a correct executable code.
• The input program and the output program must be
equivalent, the compiler should preserve the meaning
of the input program.
• Compiler should be fast.
• Compiler should provide good diagnostic for
programming errors.
Compiler lecture 02

More Related Content

What's hot

Language processor
Language processorLanguage processor
Language processor
Abha Damani
 
Chapter One
Chapter OneChapter One
Chapter One
bolovv
 
Language translators
Language translatorsLanguage translators
Language translators
Aditya Sharat
 
Learning programming by: Ysa & Faye
Learning programming by: Ysa & FayeLearning programming by: Ysa & Faye
Learning programming by: Ysa & Faye
TuanDanaIm
 
Learning programming
Learning programmingLearning programming
Learning programming
TuanDanaIm
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
Mir Majid
 

What's hot (20)

Techniques & applications of Compiler
Techniques & applications of CompilerTechniques & applications of Compiler
Techniques & applications of Compiler
 
compiler and their types
compiler and their typescompiler and their types
compiler and their types
 
Types of Compilers
Types of CompilersTypes of Compilers
Types of Compilers
 
Introduction to compilers
Introduction to compilersIntroduction to compilers
Introduction to compilers
 
Language processor
Language processorLanguage processor
Language processor
 
Languages in computer
Languages in computerLanguages in computer
Languages in computer
 
Chapter One
Chapter OneChapter One
Chapter One
 
Presentation compiler design
Presentation compiler designPresentation compiler design
Presentation compiler design
 
Compiler Design Lecture Notes
Compiler Design Lecture NotesCompiler Design Lecture Notes
Compiler Design Lecture Notes
 
LANGUAGE TRANSLATOR
LANGUAGE TRANSLATORLANGUAGE TRANSLATOR
LANGUAGE TRANSLATOR
 
Language translators
Language translatorsLanguage translators
Language translators
 
Learning programming by: Ysa & Faye
Learning programming by: Ysa & FayeLearning programming by: Ysa & Faye
Learning programming by: Ysa & Faye
 
Learning programming
Learning programmingLearning programming
Learning programming
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
Compilers
CompilersCompilers
Compilers
 
Programing paradigm & implementation
Programing paradigm & implementationPrograming paradigm & implementation
Programing paradigm & implementation
 
Session01 basics programming
Session01 basics programmingSession01 basics programming
Session01 basics programming
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
 
Syntax directed-translation
Syntax directed-translationSyntax directed-translation
Syntax directed-translation
 
Life cycle of a computer program
Life cycle of a computer programLife cycle of a computer program
Life cycle of a computer program
 

Similar to Compiler lecture 02

Similar to Compiler lecture 02 (20)

Language translator
Language translatorLanguage translator
Language translator
 
Embedded firmware
Embedded firmwareEmbedded firmware
Embedded firmware
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
 
Computer languages
Computer languagesComputer languages
Computer languages
 
Compiler Design Introduction
Compiler Design Introduction Compiler Design Introduction
Compiler Design Introduction
 
Chapter1.pdf
Chapter1.pdfChapter1.pdf
Chapter1.pdf
 
Programing fundamentals with C++
Programing fundamentals with C++Programing fundamentals with C++
Programing fundamentals with C++
 
X-CS-8.0 Programming in C Language 2022-2023.pdf
X-CS-8.0 Programming in C Language 2022-2023.pdfX-CS-8.0 Programming in C Language 2022-2023.pdf
X-CS-8.0 Programming in C Language 2022-2023.pdf
 
aditya malkani compiler.pptx
aditya malkani compiler.pptxaditya malkani compiler.pptx
aditya malkani compiler.pptx
 
Unit-1 Part2.pptawegawegawergawewrrgawewgd
Unit-1 Part2.pptawegawegawergawewrrgawewgdUnit-1 Part2.pptawegawegawergawewrrgawewgd
Unit-1 Part2.pptawegawegawergawewrrgawewgd
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
 
Unit1 Part2 1.ppt
Unit1 Part2 1.pptUnit1 Part2 1.ppt
Unit1 Part2 1.ppt
 
Unit1 Part2 1.ppt
Unit1 Part2 1.pptUnit1 Part2 1.ppt
Unit1 Part2 1.ppt
 
Compilers.pptx
Compilers.pptxCompilers.pptx
Compilers.pptx
 
Compiler an overview
Compiler  an overviewCompiler  an overview
Compiler an overview
 
CD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptxCD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptx
 
Cd ch1 - introduction
Cd   ch1 - introductionCd   ch1 - introduction
Cd ch1 - introduction
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
4_5802928814682016556.pptx
4_5802928814682016556.pptx4_5802928814682016556.pptx
4_5802928814682016556.pptx
 
introduction computer programming languages
introduction computer programming languages introduction computer programming languages
introduction computer programming languages
 

More from University of Chitral (15)

Compiler lecture 07
Compiler lecture 07Compiler lecture 07
Compiler lecture 07
 
Compiler lecture 06
Compiler lecture 06Compiler lecture 06
Compiler lecture 06
 
Compiler lecture 04
Compiler lecture 04Compiler lecture 04
Compiler lecture 04
 
Compiler lecture 05
Compiler lecture 05Compiler lecture 05
Compiler lecture 05
 
Oop lecture 06
Oop lecture 06Oop lecture 06
Oop lecture 06
 
Oop lecture 05
Oop lecture 05Oop lecture 05
Oop lecture 05
 
OOP lecture 04
OOP  lecture 04OOP  lecture 04
OOP lecture 04
 
Compiler lecture 05
Compiler lecture 05Compiler lecture 05
Compiler lecture 05
 
Compiler lecture 04
Compiler lecture 04Compiler lecture 04
Compiler lecture 04
 
Compiler lecture 03
Compiler lecture 03Compiler lecture 03
Compiler lecture 03
 
Compiler lecture 01
Compiler lecture 01Compiler lecture 01
Compiler lecture 01
 
O op lecture 04
O op lecture 04O op lecture 04
O op lecture 04
 
Oop lecture 03
Oop lecture 03Oop lecture 03
Oop lecture 03
 
Oop lecture 02
Oop lecture 02Oop lecture 02
Oop lecture 02
 
Oop lecture 01
Oop lecture 01Oop lecture 01
Oop lecture 01
 

Recently uploaded

會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 

Recently uploaded (20)

Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 

Compiler lecture 02

  • 2.
  • 3. Source Language • Any programming language or high level languages are called source language. • These languages contains English like words and mathematical symbols, that are easy to understand by the Human. E.g. C, C++, java, Python, PHP etc. • There are thousand of languages(source) ranges from traditional programming languages to specialized language.
  • 4. Target Language •low level programming languages. •It has two forms •Relocatable Machine Code •Target Assembly Code
  • 5. Relocatable Machine Code • It is a machine code with relocatable address. • Machine code that is loaded in storage so that its relative address is different from its absolute address. • Absolute Address: A direct address that identifies a location, such as a storage location, without a reference to any other address, such as a base address. • Relative address: A direct address that identifies its location by means of its displacement from a base address.
  • 6. Target Assembly Code •If the output of the compiler is in assembly language then a translator called assembler is used to translate the output(assembly codes) into machine code.
  • 7. Context of compiler Compiler Preprocessor Assembler Linker Loader Skeletal Source Program Source program Relocatable Machine code Execute .obj extension
  • 8. Desirable Properties of compiler • It must generate a correct executable code. • The input program and the output program must be equivalent, the compiler should preserve the meaning of the input program. • Compiler should be fast. • Compiler should provide good diagnostic for programming errors.