SlideShare a Scribd company logo
Compilation From code to executable By David Halliday
Stages from Source to Executable Compilation:  source code ==> relocatable object code (binaries) Linking: many relocatable binaries (modules plus libraries) ==> one relocatable binary (with all external references satisfied) Loading: relocatable ==> absolute binary (with all code and data references bound to the addresses occupied in memory) Execution: control is transferred to the first instruction of the program
Phases of the Compilation Process 1 Lexical analysis (scanning):  the source text is broken into tokens. Syntactic analysis (parsing):  tokens are combined to form syntactic structures, typically represented by a parse tree. The parser may be replaced by a syntax-directed editor, which directly generates a parse tree as a product of editing. Semantic analysis:  intermediate code is generated for each syntactic structure. Type checking is performed in this phase.
Phases of the Compilation Process 2 Machine-independent optimization: intermediate code is optimized to improve efficiency. Code generation: intermediate code is translated to relocatable object code for the target machine. Machine-dependent optimization: the machine code is optimized. On some systems (e.g., C under Unix), the compiler produces assembly code, which is then translated by an assembler.
Ad

More Related Content

What's hot (20)

Postnatal Care and Counselling
Postnatal Care and Counselling Postnatal Care and Counselling
Postnatal Care and Counselling
Dr Christa Maria Joel MBBS MPH MRSPH (GMC registered)
 
Management of 3rd stage of labor
Management of 3rd stage of laborManagement of 3rd stage of labor
Management of 3rd stage of labor
RituChahal3
 
3rd gnm -fertility vs infertility
3rd gnm -fertility vs infertility3rd gnm -fertility vs infertility
3rd gnm -fertility vs infertility
suchitrarati
 
India MCP Card English_Print file (28-05-2018).pdf
India MCP Card English_Print file (28-05-2018).pdfIndia MCP Card English_Print file (28-05-2018).pdf
India MCP Card English_Print file (28-05-2018).pdf
drpoonam valvi
 
Management of normal labour
Management of normal labourManagement of normal labour
Management of normal labour
Safa Kokab
 
Uterine Displacement
Uterine DisplacementUterine Displacement
Uterine Displacement
AgnesDavid4
 
visit report on subcentre.pdf
visit report on subcentre.pdfvisit report on subcentre.pdf
visit report on subcentre.pdf
Gouri Das
 
Essental new born care
Essental new born careEssental new born care
Essental new born care
sumanbisht13
 
Abortion
AbortionAbortion
Abortion
Rajani17
 
Delivery of community health services
Delivery of community health servicesDelivery of community health services
Delivery of community health services
KalpanaInstituteofNu
 
Puerperal Infection
Puerperal InfectionPuerperal Infection
Puerperal Infection
SasikalaNallathambi1
 
Women empowerment
Women empowerment Women empowerment
Women empowerment
Hari OM Mehta
 
Reproductive tract infection
Reproductive tract infectionReproductive tract infection
Reproductive tract infection
RakhiYadav53
 
National population policy
National population policyNational population policy
National population policy
pramod kumar
 
Vital statistics
Vital statisticsVital statistics
Vital statistics
Kunal Soni
 
Bag technique
Bag techniqueBag technique
Bag technique
pramod kumar
 
Minor discomforts
Minor discomfortsMinor discomforts
Minor discomforts
Srishti Massey
 
FP counselling
FP counsellingFP counselling
FP counselling
MamataSharma3
 
Normal Neonates
 Normal Neonates Normal Neonates
Normal Neonates
Akshaykumari Jhala S.
 
Fetal skull
Fetal skull Fetal skull
Fetal skull
Syaidatul Zariyah Zahari
 

Similar to Compilation (20)

Compiler presentaion
Compiler presentaionCompiler presentaion
Compiler presentaion
Shady A. Alefrangy
 
Compiler construction lecture 01 .pptx.pdf
Compiler construction  lecture 01 .pptx.pdfCompiler construction  lecture 01 .pptx.pdf
Compiler construction lecture 01 .pptx.pdf
zamanjktiktok
 
Compiler Design Material
Compiler Design MaterialCompiler Design Material
Compiler Design Material
Dr. C.V. Suresh Babu
 
Dineshmaterial1 091225091539-phpapp02
Dineshmaterial1 091225091539-phpapp02Dineshmaterial1 091225091539-phpapp02
Dineshmaterial1 091225091539-phpapp02
Tirumala Rao
 
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
DrIsikoIsaac
 
A basic introduction to compiler design.ppt
A basic introduction to compiler design.pptA basic introduction to compiler design.ppt
A basic introduction to compiler design.ppt
pandaashirbad9
 
A basic introduction to compiler design.ppt
A basic introduction to compiler design.pptA basic introduction to compiler design.ppt
A basic introduction to compiler design.ppt
pandaashirbad9
 
Chapter 1.pptx
Chapter 1.pptxChapter 1.pptx
Chapter 1.pptx
NesredinTeshome1
 
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
DrIsikoIsaac
 
Compilation in c
Compilation in cCompilation in c
Compilation in c
JosephBonillaArcinie
 
Chapter One
Chapter OneChapter One
Chapter One
bolovv
 
Compiler
Compiler Compiler
Compiler
IGZ Software house
 
Compiler Construction introduction
Compiler Construction introductionCompiler Construction introduction
Compiler Construction introduction
Rana Ehtisham Ul Haq
 
Lecture 2.1 - Phase of a Commmmpiler.pdf
Lecture 2.1 - Phase of a Commmmpiler.pdfLecture 2.1 - Phase of a Commmmpiler.pdf
Lecture 2.1 - Phase of a Commmmpiler.pdf
AbuZahed5
 
Compiler
Compiler Compiler
Compiler
Md. Sumon Fakir
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdf
AkarTaher
 
Assignment1
Assignment1Assignment1
Assignment1
Sunita Milind Dol
 
Embedded systems designUNIT 4 PART 2.pdf
Embedded systems designUNIT 4 PART 2.pdfEmbedded systems designUNIT 4 PART 2.pdf
Embedded systems designUNIT 4 PART 2.pdf
vmspraneeth
 
Compiler design and lexical analyser
Compiler design and lexical analyserCompiler design and lexical analyser
Compiler design and lexical analyser
abhishek gupta
 
Unit 1 part1 Introduction of Compiler Design.pptx
Unit 1 part1 Introduction of Compiler Design.pptxUnit 1 part1 Introduction of Compiler Design.pptx
Unit 1 part1 Introduction of Compiler Design.pptx
Neelkaranbind
 
Compiler construction lecture 01 .pptx.pdf
Compiler construction  lecture 01 .pptx.pdfCompiler construction  lecture 01 .pptx.pdf
Compiler construction lecture 01 .pptx.pdf
zamanjktiktok
 
Dineshmaterial1 091225091539-phpapp02
Dineshmaterial1 091225091539-phpapp02Dineshmaterial1 091225091539-phpapp02
Dineshmaterial1 091225091539-phpapp02
Tirumala Rao
 
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
DrIsikoIsaac
 
A basic introduction to compiler design.ppt
A basic introduction to compiler design.pptA basic introduction to compiler design.ppt
A basic introduction to compiler design.ppt
pandaashirbad9
 
A basic introduction to compiler design.ppt
A basic introduction to compiler design.pptA basic introduction to compiler design.ppt
A basic introduction to compiler design.ppt
pandaashirbad9
 
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
DrIsikoIsaac
 
Chapter One
Chapter OneChapter One
Chapter One
bolovv
 
Compiler Construction introduction
Compiler Construction introductionCompiler Construction introduction
Compiler Construction introduction
Rana Ehtisham Ul Haq
 
Lecture 2.1 - Phase of a Commmmpiler.pdf
Lecture 2.1 - Phase of a Commmmpiler.pdfLecture 2.1 - Phase of a Commmmpiler.pdf
Lecture 2.1 - Phase of a Commmmpiler.pdf
AbuZahed5
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdf
AkarTaher
 
Embedded systems designUNIT 4 PART 2.pdf
Embedded systems designUNIT 4 PART 2.pdfEmbedded systems designUNIT 4 PART 2.pdf
Embedded systems designUNIT 4 PART 2.pdf
vmspraneeth
 
Compiler design and lexical analyser
Compiler design and lexical analyserCompiler design and lexical analyser
Compiler design and lexical analyser
abhishek gupta
 
Unit 1 part1 Introduction of Compiler Design.pptx
Unit 1 part1 Introduction of Compiler Design.pptxUnit 1 part1 Introduction of Compiler Design.pptx
Unit 1 part1 Introduction of Compiler Design.pptx
Neelkaranbind
 
Ad

Recently uploaded (20)

HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
BookNet Canada
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
TrsLabs - AI Agents for All - Chatbots to Multi-Agents Systems
TrsLabs - AI Agents for All - Chatbots to Multi-Agents SystemsTrsLabs - AI Agents for All - Chatbots to Multi-Agents Systems
TrsLabs - AI Agents for All - Chatbots to Multi-Agents Systems
Trs Labs
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and MLGyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
Gyrus AI
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
AI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdfAI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdf
Precisely
 
Foundations of Cybersecurity - Google Certificate
Foundations of Cybersecurity - Google CertificateFoundations of Cybersecurity - Google Certificate
Foundations of Cybersecurity - Google Certificate
VICTOR MAESTRE RAMIREZ
 
TrsLabs - Leverage the Power of UPI Payments
TrsLabs - Leverage the Power of UPI PaymentsTrsLabs - Leverage the Power of UPI Payments
TrsLabs - Leverage the Power of UPI Payments
Trs Labs
 
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptxWebinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
MSP360
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Raffi Khatchadourian
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...Canadian book publishing: Insights from the latest salary survey - Tech Forum...
Canadian book publishing: Insights from the latest salary survey - Tech Forum...
BookNet Canada
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
TrsLabs - AI Agents for All - Chatbots to Multi-Agents Systems
TrsLabs - AI Agents for All - Chatbots to Multi-Agents SystemsTrsLabs - AI Agents for All - Chatbots to Multi-Agents Systems
TrsLabs - AI Agents for All - Chatbots to Multi-Agents Systems
Trs Labs
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and MLGyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
Gyrus AI
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
AI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdfAI You Can Trust: The Critical Role of Governance and Quality.pdf
AI You Can Trust: The Critical Role of Governance and Quality.pdf
Precisely
 
Foundations of Cybersecurity - Google Certificate
Foundations of Cybersecurity - Google CertificateFoundations of Cybersecurity - Google Certificate
Foundations of Cybersecurity - Google Certificate
VICTOR MAESTRE RAMIREZ
 
TrsLabs - Leverage the Power of UPI Payments
TrsLabs - Leverage the Power of UPI PaymentsTrsLabs - Leverage the Power of UPI Payments
TrsLabs - Leverage the Power of UPI Payments
Trs Labs
 
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptxWebinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
MSP360
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Raffi Khatchadourian
 
Ad

Compilation

  • 1. Compilation From code to executable By David Halliday
  • 2. Stages from Source to Executable Compilation: source code ==> relocatable object code (binaries) Linking: many relocatable binaries (modules plus libraries) ==> one relocatable binary (with all external references satisfied) Loading: relocatable ==> absolute binary (with all code and data references bound to the addresses occupied in memory) Execution: control is transferred to the first instruction of the program
  • 3. Phases of the Compilation Process 1 Lexical analysis (scanning): the source text is broken into tokens. Syntactic analysis (parsing): tokens are combined to form syntactic structures, typically represented by a parse tree. The parser may be replaced by a syntax-directed editor, which directly generates a parse tree as a product of editing. Semantic analysis: intermediate code is generated for each syntactic structure. Type checking is performed in this phase.
  • 4. Phases of the Compilation Process 2 Machine-independent optimization: intermediate code is optimized to improve efficiency. Code generation: intermediate code is translated to relocatable object code for the target machine. Machine-dependent optimization: the machine code is optimized. On some systems (e.g., C under Unix), the compiler produces assembly code, which is then translated by an assembler.