SlideShare une entreprise Scribd logo
1  sur  69
COMPILER CONSTRUCTION Principles and Practice Kenneth C. Louden San Jose State University
Content ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Main References ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
1. INTRODUCTION
What is a compiler? ,[object Object],[object Object],[object Object],[object Object],[object Object],Compiler Source Program Target Program
What is the purpose of this text ,[object Object],[object Object],[object Object],[object Object],[object Object]
Main Topics  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
1.1 Why? A Brief History
Why Compiler ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Brief History of Compiler ,[object Object],[object Object],[object Object]
Brief History of Compiler ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Brief History of Compiler ,[object Object],[object Object],[object Object],[object Object],[object Object]
Brief History of Compiler ,[object Object],[object Object],[object Object]
Brief History of Compiler ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],BACK
1.2 Programs related to Compiler
Interpreters ,[object Object],[object Object],[object Object],[object Object]
Assemblers ,[object Object],[object Object],[object Object]
Linkers ,[object Object],[object Object],[object Object]
Loaders ,[object Object],[object Object],[object Object]
Preprocessors ,[object Object],[object Object]
Editors ,[object Object],[object Object],[object Object]
Debuggers ,[object Object],[object Object],[object Object],[object Object]
Profiles ,[object Object],[object Object],[object Object],[object Object]
Project Managers ,[object Object],[object Object],[object Object],[object Object],[object Object],BACK
1.3 The Translation Process
The phases of a compiler ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Phases of a Compiler Scanner Parser Semantics Analyzer Source Code Optimizer Code Generator Target Code Optimizer Literal Table Symbol Table Error Handler Source code Syntax Tree Annotated Tree Intermediate code Target code Target code Tokens
The Scanner ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],RETURN
The Parser ,[object Object],[object Object],[object Object],[object Object],[object Object]
The Parse Tree a  index  4  2 identifier  identifier  number  number Expression  [  expression  ]  expression  +  expression subscript-expression  additive-expression expression  =  expression Assign-expression expression
The Syntax Tree RETURN a  index  4  2 identifier  identifier  number  number subscript-expression  additive-expression Assign-expression
The Semantic Analyzer ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Annotated Syntax Tree RETURN a  index  4  2 identifier  identifier  number  number subscript-expression  additive-expression integer  integer Assign-expression array of integer  integer  integer  integer
The Source Code Optimizer ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Optimizations on Annotated Tree a  index  4  2 identifier  identifier  number  number subscript-expression  additive-expression integer  integer Assign-expression array of integer  integer  integer  integer
Optimizations on Annotated Tree a  index  6 identifier  identifier  number subscript-expression  integer  Assign-expression array of integer  integer  integer
Optimization on Intermediate Code t  =  4  +  2 a[index]=t t =  6 a[index]=t a[index]=6 RETURN
The Code Generate ,[object Object],[object Object],[object Object],[object Object],[object Object]
A possible code sequence a[index]=6 MOV R0, index MUL R0,2 MOV R1,&a ADD R1,R0 MOV *R1,6 RETURN
The Target Code Optimizer ,[object Object],[object Object],[object Object],[object Object],MOV R0, index MUL R0,2 MOV R1,&a ADD R1,R0 MOV *R1,6 MOV R0, index SHL R0 MOV &a[R1],6 BACK
1.4 Major Data Structure in a Compiler
Principle Data Structure for Communication among Phases ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Principle Data Structure for Communication among Phases ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Principle Data Structure for Communication among Phases ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],BACK
1.5 Other Issues in Compiler Structure
The Structure of Compiler ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analysis and Synthesis ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Front End and Back End ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Passes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Language Definition and compilers  ,[object Object],[object Object],[object Object],[object Object],[object Object]
Language Definition and compilers  ,[object Object],[object Object],[object Object],[object Object],[object Object]
Language Definition and compilers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Compiler options and interfaces ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Error Handling ,[object Object],[object Object],[object Object],[object Object],[object Object],BACK
1.6 Bootstrapping and Porting
Third Language  for Compiler Construction ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
T-Diagram Describing Complex Situation ,[object Object],[object Object],[object Object],[object Object]
The First T-diagram Combination ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Second T-diagram Combination ,[object Object],[object Object],[object Object],[object Object],[object Object]
The First Scenario  ,[object Object],[object Object],[object Object],[object Object],[object Object]
The Second Scenario  ,[object Object],[object Object],[object Object],[object Object],[object Object]
Process of Bootstrapping ,[object Object],[object Object],[object Object],[object Object],[object Object]
The First step in bootstrap  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Second step in bootstrap  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The step 1 in porting  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The step 2 in porting  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],BACK
1.7 The TINY Sample Language and Compiler Reading this part of text as homework
1.8 C-Minus: A Language for A Compiler Project Reading this part of text as homework)
End of Chapter One Thanks Feb. 28th , 2005

Contenu connexe

Tendances

Tendances (20)

Context free grammar
Context free grammar Context free grammar
Context free grammar
 
Language Translator ( Compiler)
Language Translator ( Compiler)Language Translator ( Compiler)
Language Translator ( Compiler)
 
Compiler Construction introduction
Compiler Construction introductionCompiler Construction introduction
Compiler Construction introduction
 
Lex & yacc
Lex & yaccLex & yacc
Lex & yacc
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
Compilers
CompilersCompilers
Compilers
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Pumping lemma Theory Of Automata
Pumping lemma Theory Of AutomataPumping lemma Theory Of Automata
Pumping lemma Theory Of Automata
 
Turing machine-TOC
Turing machine-TOCTuring machine-TOC
Turing machine-TOC
 
Software tools
Software toolsSoftware tools
Software tools
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
System Programing Unit 1
System Programing Unit 1System Programing Unit 1
System Programing Unit 1
 
Passes of compilers
Passes of compilersPasses of compilers
Passes of compilers
 
Interfacing With High Level Programming Language
Interfacing With High Level Programming Language Interfacing With High Level Programming Language
Interfacing With High Level Programming Language
 
Assemblers: Ch03
Assemblers: Ch03Assemblers: Ch03
Assemblers: Ch03
 
Compiler Design Lecture Notes
Compiler Design Lecture NotesCompiler Design Lecture Notes
Compiler Design Lecture Notes
 
Unix ppt
Unix pptUnix ppt
Unix ppt
 
Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generation
 
Compiler Design Introduction
Compiler Design IntroductionCompiler Design Introduction
Compiler Design Introduction
 

Similaire à Chapter One

Chapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfChapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfDrIsikoIsaac
 
01. Introduction.ppt
01. Introduction.ppt01. Introduction.ppt
01. Introduction.pptReshmaR57
 
unit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfunit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfDrIsikoIsaac
 
Chapter-1.pptx compiler Design Course Material
Chapter-1.pptx compiler Design Course MaterialChapter-1.pptx compiler Design Course Material
Chapter-1.pptx compiler Design Course MaterialgadisaAdamu
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdfAkarTaher
 
PSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATOR
PSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATORPSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATOR
PSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATORijistjournal
 
Compiler gate question key
Compiler gate question keyCompiler gate question key
Compiler gate question keyArthyR3
 
1 - Introduction to Compilers.ppt
1 - Introduction to Compilers.ppt1 - Introduction to Compilers.ppt
1 - Introduction to Compilers.pptRakesh Kumar
 
Chapter 1 1
Chapter 1 1Chapter 1 1
Chapter 1 1bolovv
 
Ch 1.pptx
Ch 1.pptxCh 1.pptx
Ch 1.pptxwoldu2
 
lec00-Introduction.pdf
lec00-Introduction.pdflec00-Introduction.pdf
lec00-Introduction.pdfwigewej294
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in detailskazi_aihtesham
 

Similaire à Chapter One (20)

Chapter#01 cc
Chapter#01 ccChapter#01 cc
Chapter#01 cc
 
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
 
Cpcs302 1
Cpcs302  1Cpcs302  1
Cpcs302 1
 
Chapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfChapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdf
 
01. Introduction.ppt
01. Introduction.ppt01. Introduction.ppt
01. Introduction.ppt
 
unit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfunit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdf
 
Compiler Design Material
Compiler Design MaterialCompiler Design Material
Compiler Design Material
 
Chapter-1.pptx compiler Design Course Material
Chapter-1.pptx compiler Design Course MaterialChapter-1.pptx compiler Design Course Material
Chapter-1.pptx compiler Design Course Material
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdf
 
Compiler
Compiler Compiler
Compiler
 
PSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATOR
PSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATORPSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATOR
PSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATOR
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
Compiler gate question key
Compiler gate question keyCompiler gate question key
Compiler gate question key
 
1 - Introduction to Compilers.ppt
1 - Introduction to Compilers.ppt1 - Introduction to Compilers.ppt
1 - Introduction to Compilers.ppt
 
Chapter 1 1
Chapter 1 1Chapter 1 1
Chapter 1 1
 
Ch 1.pptx
Ch 1.pptxCh 1.pptx
Ch 1.pptx
 
LANGUAGE TRANSLATOR
LANGUAGE TRANSLATORLANGUAGE TRANSLATOR
LANGUAGE TRANSLATOR
 
lec00-Introduction.pdf
lec00-Introduction.pdflec00-Introduction.pdf
lec00-Introduction.pdf
 
Assignment1
Assignment1Assignment1
Assignment1
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in details
 

Plus de bolovv

Chapter 2 2 1 1
Chapter 2 2 1 1Chapter 2 2 1 1
Chapter 2 2 1 1bolovv
 
Chapter 2 2 1 2
Chapter 2 2 1 2Chapter 2 2 1 2
Chapter 2 2 1 2bolovv
 
Chapter Three(2)
Chapter Three(2)Chapter Three(2)
Chapter Three(2)bolovv
 
Chapter Three(1)
Chapter Three(1)Chapter Three(1)
Chapter Three(1)bolovv
 
Chapter Seven(2)
Chapter Seven(2)Chapter Seven(2)
Chapter Seven(2)bolovv
 
Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)bolovv
 
Chapter Five(2)
Chapter Five(2)Chapter Five(2)
Chapter Five(2)bolovv
 
Chapter Seven(1)
Chapter Seven(1)Chapter Seven(1)
Chapter Seven(1)bolovv
 
Chapter Two(1)
Chapter Two(1)Chapter Two(1)
Chapter Two(1)bolovv
 
Chapter Eight(1)
Chapter Eight(1)Chapter Eight(1)
Chapter Eight(1)bolovv
 
Chapter Eight(2)
Chapter Eight(2)Chapter Eight(2)
Chapter Eight(2)bolovv
 

Plus de bolovv (11)

Chapter 2 2 1 1
Chapter 2 2 1 1Chapter 2 2 1 1
Chapter 2 2 1 1
 
Chapter 2 2 1 2
Chapter 2 2 1 2Chapter 2 2 1 2
Chapter 2 2 1 2
 
Chapter Three(2)
Chapter Three(2)Chapter Three(2)
Chapter Three(2)
 
Chapter Three(1)
Chapter Three(1)Chapter Three(1)
Chapter Three(1)
 
Chapter Seven(2)
Chapter Seven(2)Chapter Seven(2)
Chapter Seven(2)
 
Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)
 
Chapter Five(2)
Chapter Five(2)Chapter Five(2)
Chapter Five(2)
 
Chapter Seven(1)
Chapter Seven(1)Chapter Seven(1)
Chapter Seven(1)
 
Chapter Two(1)
Chapter Two(1)Chapter Two(1)
Chapter Two(1)
 
Chapter Eight(1)
Chapter Eight(1)Chapter Eight(1)
Chapter Eight(1)
 
Chapter Eight(2)
Chapter Eight(2)Chapter Eight(2)
Chapter Eight(2)
 

Dernier

CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 

Dernier (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

Chapter One

  • 1. COMPILER CONSTRUCTION Principles and Practice Kenneth C. Louden San Jose State University
  • 2.
  • 3.
  • 5.
  • 6.
  • 7.
  • 8. 1.1 Why? A Brief History
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15. 1.2 Programs related to Compiler
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 26.
  • 27. The Phases of a Compiler Scanner Parser Semantics Analyzer Source Code Optimizer Code Generator Target Code Optimizer Literal Table Symbol Table Error Handler Source code Syntax Tree Annotated Tree Intermediate code Target code Target code Tokens
  • 28.
  • 29.
  • 30. The Parse Tree a index 4 2 identifier identifier number number Expression [ expression ] expression + expression subscript-expression additive-expression expression = expression Assign-expression expression
  • 31. The Syntax Tree RETURN a index 4 2 identifier identifier number number subscript-expression additive-expression Assign-expression
  • 32.
  • 33. The Annotated Syntax Tree RETURN a index 4 2 identifier identifier number number subscript-expression additive-expression integer integer Assign-expression array of integer integer integer integer
  • 34.
  • 35. Optimizations on Annotated Tree a index 4 2 identifier identifier number number subscript-expression additive-expression integer integer Assign-expression array of integer integer integer integer
  • 36. Optimizations on Annotated Tree a index 6 identifier identifier number subscript-expression integer Assign-expression array of integer integer integer
  • 37. Optimization on Intermediate Code t = 4 + 2 a[index]=t t = 6 a[index]=t a[index]=6 RETURN
  • 38.
  • 39. A possible code sequence a[index]=6 MOV R0, index MUL R0,2 MOV R1,&a ADD R1,R0 MOV *R1,6 RETURN
  • 40.
  • 41. 1.4 Major Data Structure in a Compiler
  • 42.
  • 43.
  • 44.
  • 45. 1.5 Other Issues in Compiler Structure
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67. 1.7 The TINY Sample Language and Compiler Reading this part of text as homework
  • 68. 1.8 C-Minus: A Language for A Compiler Project Reading this part of text as homework)
  • 69. End of Chapter One Thanks Feb. 28th , 2005