SlideShare a Scribd company logo
Toy Compiler
Toy compiler
Front end :
It performs lexical , syntax and semantic Involved functions…
1.Determining validity of a source statement from the view point
of analysis.
2.Determine the “content” of source statement.
3.Construct a suitable representation of the source statement for
being used by subsequent analysis function (or)the synthesis
phase of the language processor.
FrontEnd…
•Lexical analysis=Content in lexical class.
•Syntax analysis=syntactic structure of source
statement.
•Semantic analysis=In meaning of statement
_ For a declaration statement
_ It is set of attributes of a declared variable
Example: Type, length and dimensionality
FrontEnd…
Output of Front end:
1.Tables of information.
2.An intermediate code which is the
description of the source program.
Analysis phase for the program..
I : integer;
a ,b :=real;
a :=b+I;
Symbol table:
Intermediate code:
1.Convert(Id,#1)to real , giving(Id,#4)
2.Add(Id,#4)to(Id,#3),giving(Id,#5)
3.Store(Id,#5)in(Id,#2)
Symbol type length address
i int
a real
b real
i* real
Temp real
Lexical analysis(scanning):
Identifies lexical units in source statement.Its
Classifies units into different lexical classes.
Eg: id’s,constants,reserved id’s etc.
Eg:the statement a := b+i represented as string
of tokens.
Id#2 Op#5 Id#3 OP#3 Id#1 Op#10
Syntax Analysis:
Syntax analysis processes the string of tokens
built by lexical analysis to determine the
statement classes.
Eg: assignment statement,if statement ,etc..
real :=
a b a +
b i
•Semantic Analysis:
:= := :=
a,real + a,real + a,real temp,real
b,real i,int b,real i*,real
Back End:
• Involves Two phases
• Memory Allocation
• Code Generation
Memory Allocation
• It is a simple task given the presence of the
symbol table.
• The memory requirement of an identifier is
computed from its type,length,dimensionality
and memory is allocated
• For example
Symbol Type Length Address
1 i int 2000
2 a real 2001
3 a real 2002
Code Generation
• It uses knowledge of the target architectue i.e.. Knowledge of
instructions and addressing modes
• Issues
• 1.Detremine the places where the intermediate results to be
kept (either on memory locations or in machine registers)
• 2.Determine which instruction should be used for type
conversion
• 3.determine which addressing mode to be used while
accessing variables.
Code Generation
• a:=b+i
• 1.convert I to real, giving i*
• 2.add i* to b giving temp
• 3.store temp in a
• Synthesis phase may decide to hold values of i* and temp in
machine register and may generate assembly code
• CONV_R AREG,I
• ADD_R AREG,B
• MOVEM AREG,A

More Related Content

What's hot

System Programming Overview
System Programming OverviewSystem Programming Overview
System Programming Overview
Dattatray Gandhmal
 
Text Editor in System software
Text Editor in System softwareText Editor in System software
Text Editor in System software
sundareswaran kannan
 
Macro-processor
Macro-processorMacro-processor
Macro-processor
Temesgen Molla
 
Assemblers
AssemblersAssemblers
Assemblers
Dattatray Gandhmal
 
MACRO PROCESSOR
MACRO PROCESSORMACRO PROCESSOR
MACRO PROCESSOR
Bhavik Vashi
 
System Programming Unit III
System Programming Unit IIISystem Programming Unit III
System Programming Unit IIIManoj Patil
 
Language processors
Language processorsLanguage processors
Language processors
Ganesh Wedpathak
 
Macro Processor
Macro ProcessorMacro Processor
Macro Processor
Saranya1702
 
Introduction to loaders
Introduction to loadersIntroduction to loaders
Introduction to loadersTech_MX
 
Pass Structure of Assembler
Pass Structure of AssemblerPass Structure of Assembler
Single Pass Assembler
Single Pass AssemblerSingle Pass Assembler
Single Pass Assembler
Satyamevjayte Haxor
 
Macro assembler
 Macro assembler Macro assembler
Macro assembler
Meghaj Mallick
 
1.Role lexical Analyzer
1.Role lexical Analyzer1.Role lexical Analyzer
1.Role lexical Analyzer
Radhakrishnan Chinnusamy
 
System Programming- Unit I
System Programming- Unit ISystem Programming- Unit I
System Programming- Unit I
Saranya1702
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
Karan Deopura
 
COMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSCOMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONS
sonalikharade3
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
Hemant Sharma
 
Direct linking loaders
Direct linking loadersDirect linking loaders
Direct linking loaders
Satyamevjayte Haxor
 
Token, Pattern and Lexeme
Token, Pattern and LexemeToken, Pattern and Lexeme
Token, Pattern and Lexeme
A. S. M. Shafi
 
Single pass assembler
Single pass assemblerSingle pass assembler
Single pass assembler
Bansari Shah
 

What's hot (20)

System Programming Overview
System Programming OverviewSystem Programming Overview
System Programming Overview
 
Text Editor in System software
Text Editor in System softwareText Editor in System software
Text Editor in System software
 
Macro-processor
Macro-processorMacro-processor
Macro-processor
 
Assemblers
AssemblersAssemblers
Assemblers
 
MACRO PROCESSOR
MACRO PROCESSORMACRO PROCESSOR
MACRO PROCESSOR
 
System Programming Unit III
System Programming Unit IIISystem Programming Unit III
System Programming Unit III
 
Language processors
Language processorsLanguage processors
Language processors
 
Macro Processor
Macro ProcessorMacro Processor
Macro Processor
 
Introduction to loaders
Introduction to loadersIntroduction to loaders
Introduction to loaders
 
Pass Structure of Assembler
Pass Structure of AssemblerPass Structure of Assembler
Pass Structure of Assembler
 
Single Pass Assembler
Single Pass AssemblerSingle Pass Assembler
Single Pass Assembler
 
Macro assembler
 Macro assembler Macro assembler
Macro assembler
 
1.Role lexical Analyzer
1.Role lexical Analyzer1.Role lexical Analyzer
1.Role lexical Analyzer
 
System Programming- Unit I
System Programming- Unit ISystem Programming- Unit I
System Programming- Unit I
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
 
COMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSCOMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONS
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
 
Direct linking loaders
Direct linking loadersDirect linking loaders
Direct linking loaders
 
Token, Pattern and Lexeme
Token, Pattern and LexemeToken, Pattern and Lexeme
Token, Pattern and Lexeme
 
Single pass assembler
Single pass assemblerSingle pass assembler
Single pass assembler
 

Similar to Toy compiler

Assignment11
Assignment11Assignment11
Assignment11
Sunita Milind Dol
 
Module 2
Module 2 Module 2
Module 2
ShwetaNirmanik
 
SS & CD Module 3
SS & CD Module 3 SS & CD Module 3
SS & CD Module 3
ShwetaNirmanik
 
Handout#08
Handout#08Handout#08
Handout#08
Sunita Milind Dol
 
Programming in C [Module One]
Programming in C [Module One]Programming in C [Module One]
Programming in C [Module One]
Abhishek Sinha
 
what is compiler and five phases of compiler
what is compiler and five phases of compilerwhat is compiler and five phases of compiler
what is compiler and five phases of compiler
adilmehmood93
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
Sarmad Ali
 
Dineshmaterial1 091225091539-phpapp02
Dineshmaterial1 091225091539-phpapp02Dineshmaterial1 091225091539-phpapp02
Dineshmaterial1 091225091539-phpapp02
Tirumala Rao
 
Chapter 1.pdf
Chapter 1.pdfChapter 1.pdf
Chapter 1.pdf
JoemerCastillo3
 
Unit 1.pptx
Unit 1.pptxUnit 1.pptx
Unit 1.pptx
NISHASOMSCS113
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
Dr. Jaydeep Patil
 
Code Analysis-run time error prediction
Code Analysis-run time error predictionCode Analysis-run time error prediction
Code Analysis-run time error predictionNIKHIL NAWATHE
 
Chapter 1 1
Chapter 1 1Chapter 1 1
Chapter 1 1bolovv
 
1-Phases of compiler-26-04-2023.pptx
1-Phases of compiler-26-04-2023.pptx1-Phases of compiler-26-04-2023.pptx
1-Phases of compiler-26-04-2023.pptx
venkatapranaykumarGa
 
Programming Fundamental Slide lecture no.2 (Section E)
Programming Fundamental Slide lecture no.2 (Section E)Programming Fundamental Slide lecture no.2 (Section E)
Programming Fundamental Slide lecture no.2 (Section E)
Arslan Hussain
 
System software module 4 presentation file
System software module 4 presentation fileSystem software module 4 presentation file
System software module 4 presentation file
jithujithin657
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in details
kazi_aihtesham
 
The Phases of a Compiler
The Phases of a CompilerThe Phases of a Compiler
The Phases of a Compiler
Radhika Talaviya
 
Presentation1 (1).pptx
Presentation1 (1).pptxPresentation1 (1).pptx
Presentation1 (1).pptx
BodapatiNagaeswari1
 

Similar to Toy compiler (20)

Assignment11
Assignment11Assignment11
Assignment11
 
Module 2
Module 2 Module 2
Module 2
 
SS & CD Module 3
SS & CD Module 3 SS & CD Module 3
SS & CD Module 3
 
Handout#08
Handout#08Handout#08
Handout#08
 
Programming in C [Module One]
Programming in C [Module One]Programming in C [Module One]
Programming in C [Module One]
 
what is compiler and five phases of compiler
what is compiler and five phases of compilerwhat is compiler and five phases of compiler
what is compiler and five phases of compiler
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
Dineshmaterial1 091225091539-phpapp02
Dineshmaterial1 091225091539-phpapp02Dineshmaterial1 091225091539-phpapp02
Dineshmaterial1 091225091539-phpapp02
 
Chapter 1.pdf
Chapter 1.pdfChapter 1.pdf
Chapter 1.pdf
 
Unit 1.pptx
Unit 1.pptxUnit 1.pptx
Unit 1.pptx
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
Code Analysis-run time error prediction
Code Analysis-run time error predictionCode Analysis-run time error prediction
Code Analysis-run time error prediction
 
Chapter 1 1
Chapter 1 1Chapter 1 1
Chapter 1 1
 
Compiler Design Material
Compiler Design MaterialCompiler Design Material
Compiler Design Material
 
1-Phases of compiler-26-04-2023.pptx
1-Phases of compiler-26-04-2023.pptx1-Phases of compiler-26-04-2023.pptx
1-Phases of compiler-26-04-2023.pptx
 
Programming Fundamental Slide lecture no.2 (Section E)
Programming Fundamental Slide lecture no.2 (Section E)Programming Fundamental Slide lecture no.2 (Section E)
Programming Fundamental Slide lecture no.2 (Section E)
 
System software module 4 presentation file
System software module 4 presentation fileSystem software module 4 presentation file
System software module 4 presentation file
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in details
 
The Phases of a Compiler
The Phases of a CompilerThe Phases of a Compiler
The Phases of a Compiler
 
Presentation1 (1).pptx
Presentation1 (1).pptxPresentation1 (1).pptx
Presentation1 (1).pptx
 

More from home

WEBPACK
WEBPACKWEBPACK
WEBPACK
home
 
User interface & structure
User interface & structureUser interface & structure
User interface & structure
home
 
Multi media Data mining
Multi media Data miningMulti media Data mining
Multi media Data mining
home
 
Data mining on Social Media
Data mining on Social MediaData mining on Social Media
Data mining on Social Media
home
 
Cantata++
Cantata++Cantata++
Cantata++
home
 
Ubuntu
UbuntuUbuntu
Ubuntu
home
 

More from home (6)

WEBPACK
WEBPACKWEBPACK
WEBPACK
 
User interface & structure
User interface & structureUser interface & structure
User interface & structure
 
Multi media Data mining
Multi media Data miningMulti media Data mining
Multi media Data mining
 
Data mining on Social Media
Data mining on Social MediaData mining on Social Media
Data mining on Social Media
 
Cantata++
Cantata++Cantata++
Cantata++
 
Ubuntu
UbuntuUbuntu
Ubuntu
 

Recently uploaded

Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
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)
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
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
 
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
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
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
 
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
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 

Recently uploaded (20)

Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
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
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
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
 
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
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 

Toy compiler

  • 2. Toy compiler Front end : It performs lexical , syntax and semantic Involved functions… 1.Determining validity of a source statement from the view point of analysis. 2.Determine the “content” of source statement. 3.Construct a suitable representation of the source statement for being used by subsequent analysis function (or)the synthesis phase of the language processor.
  • 3. FrontEnd… •Lexical analysis=Content in lexical class. •Syntax analysis=syntactic structure of source statement. •Semantic analysis=In meaning of statement _ For a declaration statement _ It is set of attributes of a declared variable Example: Type, length and dimensionality
  • 4. FrontEnd… Output of Front end: 1.Tables of information. 2.An intermediate code which is the description of the source program.
  • 5. Analysis phase for the program.. I : integer; a ,b :=real; a :=b+I; Symbol table: Intermediate code: 1.Convert(Id,#1)to real , giving(Id,#4) 2.Add(Id,#4)to(Id,#3),giving(Id,#5) 3.Store(Id,#5)in(Id,#2) Symbol type length address i int a real b real i* real Temp real
  • 6. Lexical analysis(scanning): Identifies lexical units in source statement.Its Classifies units into different lexical classes. Eg: id’s,constants,reserved id’s etc. Eg:the statement a := b+i represented as string of tokens. Id#2 Op#5 Id#3 OP#3 Id#1 Op#10
  • 7. Syntax Analysis: Syntax analysis processes the string of tokens built by lexical analysis to determine the statement classes. Eg: assignment statement,if statement ,etc.. real := a b a + b i
  • 8. •Semantic Analysis: := := := a,real + a,real + a,real temp,real b,real i,int b,real i*,real
  • 9. Back End: • Involves Two phases • Memory Allocation • Code Generation
  • 10. Memory Allocation • It is a simple task given the presence of the symbol table. • The memory requirement of an identifier is computed from its type,length,dimensionality and memory is allocated • For example Symbol Type Length Address 1 i int 2000 2 a real 2001 3 a real 2002
  • 11. Code Generation • It uses knowledge of the target architectue i.e.. Knowledge of instructions and addressing modes • Issues • 1.Detremine the places where the intermediate results to be kept (either on memory locations or in machine registers) • 2.Determine which instruction should be used for type conversion • 3.determine which addressing mode to be used while accessing variables.
  • 12. Code Generation • a:=b+i • 1.convert I to real, giving i* • 2.add i* to b giving temp • 3.store temp in a • Synthesis phase may decide to hold values of i* and temp in machine register and may generate assembly code • CONV_R AREG,I • ADD_R AREG,B • MOVEM AREG,A