SlideShare a Scribd company logo
NADAR SARASWATHI COLLEGE OF ARTS AND SCIENCE
 Similar terms: Intermediate representation,
intermediate language
 Ties the front and back ends together
 Language and Machine neutral
 Many forms
 Level depends on how being processed
 More than one intermediate language may be
used by a compiler
Intermediate language levels
High
t1  a[i,j+2]
Medium
t1  j + 2
t2  i * 20
t3  t1 + t2
t4  4 * t3
t5  addr a
t6  t5 + t 4
t7  *t6
Low
r1 [fp-4]
r2  r1 + 2
r3  [fp-8]
r4  r3*20
r5  r4 + r2
r6  4 * r5
r7  fp – 216
f1  [r7+r6]
Intermediate Languages Types
 Graphical IRs: Abstract Syntax trees,
DAGs, Control Flow Graphs
 Linear IRs:
 Stack based (postfix)
 Three address code (quadruples)
ASTs and DAGs:
a := b *-c + b*-c
a +
* *
b - (uni)
c
a +
- (uni)
b b
*
- (uni)
c c
:=
:=
• If a compiler translates the source language to its target machine language without
having the option for generating intermediate code, then for each new machine, a full native
compiler is required.
 Intermediate code eliminates the need of a new full compiler for every unique machine by
keeping the analysis portion same for all the compilers.
 The second part of compiler, synthesis, is changed according to the target machine.
 It becomes easier to apply the source code modifications to improve code performance by
applying code optimization techniques on the intermediate code.
Intermediate Representation
Intermediate codes can be represented in a variety of ways and they have their own
benefits.
•High Level IR - High-level intermediate code representation is very close to the source
language itself. They can be easily generated from the source code and we can easily
apply code modifications to enhance performance. But for target machine optimization, it
is less preferred.
•Low Level IR - This one is close to the target machine, which makes it suitable for
register and memory allocation, instruction set selection, etc. It is good for machine-
dependent optimizations.
Semantic Rule Program fragment
E.code = E1.code || E2.code ||
op
print op
E.code = E1.code
E.code = id print id
Example
Production
1.E → E1 op E2
2.E → (E1)
3.E → id
Parsetree
A sentence id + id * id would have the following syntax tree:
Thank you

More Related Content

Similar to gayathri.p.pptx

microprocesser-140306112352-phpapp01.pdf
microprocesser-140306112352-phpapp01.pdfmicroprocesser-140306112352-phpapp01.pdf
microprocesser-140306112352-phpapp01.pdf
PriyankaRana171346
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in details
kazi_aihtesham
 
01. Introduction.ppt
01. Introduction.ppt01. Introduction.ppt
01. Introduction.ppt
ReshmaR57
 
Intermediate Representation in Compiler Construction
Intermediate Representation in Compiler ConstructionIntermediate Representation in Compiler Construction
Intermediate Representation in Compiler Construction
theizm1
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
PANKAJKUMAR2519
 
C programming part2
C programming part2C programming part2
C programming part2
Keroles karam khalil
 
C programming part2
C programming part2C programming part2
C programming part2
Keroles karam khalil
 
C programming part2
C programming part2C programming part2
C programming part2
Keroles karam khalil
 
Compiler gate question key
Compiler gate question keyCompiler gate question key
Compiler gate question key
ArthyR3
 
C Lang notes.ppt
C Lang notes.pptC Lang notes.ppt
C Lang notes.ppt
ShivanadhuniBhanuPra
 
Compilers Design
Compilers DesignCompilers Design
Compilers Design
Akshaya Arunan
 
Lect05 Prog Model
Lect05 Prog ModelLect05 Prog Model
Lect05 Prog Model
anoosdomain
 
Compiler chapter six .ppt course material
Compiler chapter six .ppt course materialCompiler chapter six .ppt course material
Compiler chapter six .ppt course material
gadisaAdamu
 
Introduction to computer architecture .pptx
Introduction to computer architecture .pptxIntroduction to computer architecture .pptx
Introduction to computer architecture .pptx
Fatma Sayed Ibrahim
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
amol_chavan
 
Chapter 11 - Intermediate Code Generation.pdf
Chapter 11 - Intermediate Code Generation.pdfChapter 11 - Intermediate Code Generation.pdf
Chapter 11 - Intermediate Code Generation.pdf
RAnwarpasha
 
Msc prev completed
Msc prev completedMsc prev completed
Msc prev completed
mshoaib15
 
Msc prev updated
Msc prev updatedMsc prev updated
Msc prev updated
mshoaib15
 

Similar to gayathri.p.pptx (20)

microprocesser-140306112352-phpapp01.pdf
microprocesser-140306112352-phpapp01.pdfmicroprocesser-140306112352-phpapp01.pdf
microprocesser-140306112352-phpapp01.pdf
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in details
 
01. Introduction.ppt
01. Introduction.ppt01. Introduction.ppt
01. Introduction.ppt
 
Intermediate Representation in Compiler Construction
Intermediate Representation in Compiler ConstructionIntermediate Representation in Compiler Construction
Intermediate Representation in Compiler Construction
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
 
C programming part2
C programming part2C programming part2
C programming part2
 
C programming part2
C programming part2C programming part2
C programming part2
 
C programming part2
C programming part2C programming part2
C programming part2
 
Compiler gate question key
Compiler gate question keyCompiler gate question key
Compiler gate question key
 
C Lang notes.ppt
C Lang notes.pptC Lang notes.ppt
C Lang notes.ppt
 
Compilers Design
Compilers DesignCompilers Design
Compilers Design
 
Lect05 Prog Model
Lect05 Prog ModelLect05 Prog Model
Lect05 Prog Model
 
Compiler chapter six .ppt course material
Compiler chapter six .ppt course materialCompiler chapter six .ppt course material
Compiler chapter six .ppt course material
 
Assembly Language
Assembly LanguageAssembly Language
Assembly Language
 
Compiler Design Material
Compiler Design MaterialCompiler Design Material
Compiler Design Material
 
Introduction to computer architecture .pptx
Introduction to computer architecture .pptxIntroduction to computer architecture .pptx
Introduction to computer architecture .pptx
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
 
Chapter 11 - Intermediate Code Generation.pdf
Chapter 11 - Intermediate Code Generation.pdfChapter 11 - Intermediate Code Generation.pdf
Chapter 11 - Intermediate Code Generation.pdf
 
Msc prev completed
Msc prev completedMsc prev completed
Msc prev completed
 
Msc prev updated
Msc prev updatedMsc prev updated
Msc prev updated
 

More from GayathriP95

cloud computing.pptx
cloud computing.pptxcloud computing.pptx
cloud computing.pptx
GayathriP95
 
ML.pptx
ML.pptxML.pptx
ML.pptx
GayathriP95
 
women.pptx
women.pptxwomen.pptx
women.pptx
GayathriP95
 
IOT.pptx
IOT.pptxIOT.pptx
IOT.pptx
GayathriP95
 
dip.pptx
dip.pptxdip.pptx
dip.pptx
GayathriP95
 
cloud computing.pptx
cloud computing.pptxcloud computing.pptx
cloud computing.pptx
GayathriP95
 
gayathrinosql.pptx
gayathrinosql.pptxgayathrinosql.pptx
gayathrinosql.pptx
GayathriP95
 
crypto.pptx
crypto.pptxcrypto.pptx
crypto.pptx
GayathriP95
 
dos.pptx
dos.pptxdos.pptx
dos.pptx
GayathriP95
 
python.pptx
python.pptxpython.pptx
python.pptx
GayathriP95
 
gayathri23.pptx
gayathri23.pptxgayathri23.pptx
gayathri23.pptx
GayathriP95
 
gayathri.pptx
gayathri.pptxgayathri.pptx
gayathri.pptx
GayathriP95
 

More from GayathriP95 (12)

cloud computing.pptx
cloud computing.pptxcloud computing.pptx
cloud computing.pptx
 
ML.pptx
ML.pptxML.pptx
ML.pptx
 
women.pptx
women.pptxwomen.pptx
women.pptx
 
IOT.pptx
IOT.pptxIOT.pptx
IOT.pptx
 
dip.pptx
dip.pptxdip.pptx
dip.pptx
 
cloud computing.pptx
cloud computing.pptxcloud computing.pptx
cloud computing.pptx
 
gayathrinosql.pptx
gayathrinosql.pptxgayathrinosql.pptx
gayathrinosql.pptx
 
crypto.pptx
crypto.pptxcrypto.pptx
crypto.pptx
 
dos.pptx
dos.pptxdos.pptx
dos.pptx
 
python.pptx
python.pptxpython.pptx
python.pptx
 
gayathri23.pptx
gayathri23.pptxgayathri23.pptx
gayathri23.pptx
 
gayathri.pptx
gayathri.pptxgayathri.pptx
gayathri.pptx
 

Recently uploaded

Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 

Recently uploaded (20)

Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 

gayathri.p.pptx

  • 1. NADAR SARASWATHI COLLEGE OF ARTS AND SCIENCE
  • 2.  Similar terms: Intermediate representation, intermediate language  Ties the front and back ends together  Language and Machine neutral  Many forms  Level depends on how being processed  More than one intermediate language may be used by a compiler
  • 3. Intermediate language levels High t1  a[i,j+2] Medium t1  j + 2 t2  i * 20 t3  t1 + t2 t4  4 * t3 t5  addr a t6  t5 + t 4 t7  *t6 Low r1 [fp-4] r2  r1 + 2 r3  [fp-8] r4  r3*20 r5  r4 + r2 r6  4 * r5 r7  fp – 216 f1  [r7+r6]
  • 4. Intermediate Languages Types  Graphical IRs: Abstract Syntax trees, DAGs, Control Flow Graphs  Linear IRs:  Stack based (postfix)  Three address code (quadruples)
  • 5. ASTs and DAGs: a := b *-c + b*-c a + * * b - (uni) c a + - (uni) b b * - (uni) c c := :=
  • 6. • If a compiler translates the source language to its target machine language without having the option for generating intermediate code, then for each new machine, a full native compiler is required.  Intermediate code eliminates the need of a new full compiler for every unique machine by keeping the analysis portion same for all the compilers.  The second part of compiler, synthesis, is changed according to the target machine.  It becomes easier to apply the source code modifications to improve code performance by applying code optimization techniques on the intermediate code.
  • 7. Intermediate Representation Intermediate codes can be represented in a variety of ways and they have their own benefits. •High Level IR - High-level intermediate code representation is very close to the source language itself. They can be easily generated from the source code and we can easily apply code modifications to enhance performance. But for target machine optimization, it is less preferred. •Low Level IR - This one is close to the target machine, which makes it suitable for register and memory allocation, instruction set selection, etc. It is good for machine- dependent optimizations.
  • 8. Semantic Rule Program fragment E.code = E1.code || E2.code || op print op E.code = E1.code E.code = id print id Example Production 1.E → E1 op E2 2.E → (E1) 3.E → id
  • 10. A sentence id + id * id would have the following syntax tree: