SlideShare a Scribd company logo
Compilers
Content
• Translators
• Working
• Phases of compiler
• Lexical Analysis
• Syntax Analysis
• Semantic Analysis
• Code Optimization
• Code Generation
Translators
Translators are used to convert source code to machine code.
Types :-
• Compiler ,
• Interpreters and,
• Assembler.
Working
• Compiler
CompilerProgram EXE
Data
Output
• Interpreters
Program
Interpreter
Data
Output
Phases of Compiler
• Lexical Analysis
• Syntax Analysis
• Semantic Analysis
• Code Optimization
• Code Generation
Lexical analysis
Lexical analysis code is broken into series of tokens by removing
comments and extra whitespaces from the source code.
If any illegal token encounters it generates an error(Token error).
Ex :
x = a + b; //Addition.
Tokens = keywords, identifiers, operators etc.
Syntax analysis
Also know as parsing determines weather the series of token give by
lexical analysis is valid or not.
It checks for the syntax of code.
If the syntax of a code is invalid then it generates an error(syntax
error).
Semantic analysis
Semantics tells what does a token or a syntax of a language actually
mean actually mean.
It interprets the relationship between symbols, identifiers, and other
tokens used in a code.
If any error occurs it generates semantic error.
Code Optimization
Code is transformed so that it consumes less computer resources like
Memory, RAM etc.
In this
• Output of program is not changed.
• Should always reduce resource consumption.
• Should not delay overall compiling process.
Code generation
This is the final phase of compilation.
Compiler generates an object code which will be in a low level
language.
Code generated should
• Have exact meaning of source code and,
• Should be resource efficient.
Thank you

More Related Content

What's hot

Cd ch2 - lexical analysis
Cd   ch2 - lexical analysisCd   ch2 - lexical analysis
Cd ch2 - lexical analysis
mengistu23
 
Type checking in compiler design
Type checking in compiler designType checking in compiler design
Type checking in compiler design
Sudip Singh
 
Lexical1
Lexical1Lexical1
Error detection recovery
Error detection recoveryError detection recovery
Error detection recovery
Tech_MX
 
Principles of compiler design
Principles of compiler designPrinciples of compiler design
Principles of compiler design
Janani Parthiban
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
Ahmed Raza
 
Parser
ParserParser
role of lexical anaysis
role of lexical anaysisrole of lexical anaysis
role of lexical anaysis
Sudhaa Ravi
 
Phases of a Compiler
Phases of a CompilerPhases of a Compiler
Phases of a Compiler
University of Saskatchewan
 
phases of compiler-analysis phase
phases of compiler-analysis phasephases of compiler-analysis phase
phases of compiler-analysis phase
Suyash Srivastava
 
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Bhavin Darji
 
Phases of-compiler
Phases of-compilerPhases of-compiler
Phases of-compiler
Zahidul Islam Razu
 
Compiler Design(Nanthu)
Compiler Design(Nanthu)Compiler Design(Nanthu)
Compiler Design(Nanthu)
guest91cc85
 
Cpcs302 1
Cpcs302  1Cpcs302  1
Cpcs302 1
guest5de1a5
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
Hemant Sharma
 
Presentation compiler design
Presentation compiler designPresentation compiler design
Presentation compiler design
Md. Touhidur Rahman
 
Compilers
CompilersCompilers
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
Farzana Aktar
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
Chetan Mahawar
 
Compiler presentaion
Compiler presentaionCompiler presentaion
Compiler presentaion
Shady A. Alefrangy
 

What's hot (20)

Cd ch2 - lexical analysis
Cd   ch2 - lexical analysisCd   ch2 - lexical analysis
Cd ch2 - lexical analysis
 
Type checking in compiler design
Type checking in compiler designType checking in compiler design
Type checking in compiler design
 
Lexical1
Lexical1Lexical1
Lexical1
 
Error detection recovery
Error detection recoveryError detection recovery
Error detection recovery
 
Principles of compiler design
Principles of compiler designPrinciples of compiler design
Principles of compiler design
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
Parser
ParserParser
Parser
 
role of lexical anaysis
role of lexical anaysisrole of lexical anaysis
role of lexical anaysis
 
Phases of a Compiler
Phases of a CompilerPhases of a Compiler
Phases of a Compiler
 
phases of compiler-analysis phase
phases of compiler-analysis phasephases of compiler-analysis phase
phases of compiler-analysis phase
 
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
Overview of Language Processor : Fundamentals of LP , Symbol Table , Data Str...
 
Phases of-compiler
Phases of-compilerPhases of-compiler
Phases of-compiler
 
Compiler Design(Nanthu)
Compiler Design(Nanthu)Compiler Design(Nanthu)
Compiler Design(Nanthu)
 
Cpcs302 1
Cpcs302  1Cpcs302  1
Cpcs302 1
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
 
Presentation compiler design
Presentation compiler designPresentation compiler design
Presentation compiler design
 
Compilers
CompilersCompilers
Compilers
 
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Compiler presentaion
Compiler presentaionCompiler presentaion
Compiler presentaion
 

Similar to Compilers in computer programming

1._Introduction_.pptx
1._Introduction_.pptx1._Introduction_.pptx
1._Introduction_.pptx
Anbarasan Radhakrishnan R
 
COMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptxCOMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptx
Rossy719186
 
11700220036.pdf
11700220036.pdf11700220036.pdf
11700220036.pdf
SouvikRoy149
 
Plc part 2
Plc  part 2Plc  part 2
Plc part 2
Taymoor Nazmy
 
LANGUAGE TRANSLATOR
LANGUAGE TRANSLATORLANGUAGE TRANSLATOR
Lexical Analysis.pdf
Lexical Analysis.pdfLexical Analysis.pdf
Lexical Analysis.pdf
BiswanathSethi2
 
Chapter 1.pptx
Chapter 1.pptxChapter 1.pptx
Chapter 1.pptx
NesredinTeshome1
 
Role-of-lexical-analysis
Role-of-lexical-analysisRole-of-lexical-analysis
Role-of-lexical-analysis
Dattatray Gandhmal
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
Sarmad Ali
 
Lexical Analysis
Lexical AnalysisLexical Analysis
Lexical Analysis
Nayemid4676
 
The Phases of a Compiler
The Phases of a CompilerThe Phases of a Compiler
The Phases of a Compiler
Radhika Talaviya
 
Compier Design_Unit I.ppt
Compier Design_Unit I.pptCompier Design_Unit I.ppt
Compier Design_Unit I.ppt
sivaganesh293
 
Compier Design_Unit I.ppt
Compier Design_Unit I.pptCompier Design_Unit I.ppt
Compier Design_Unit I.ppt
sivaganesh293
 
Introduction to Compilers
Introduction to CompilersIntroduction to Compilers
Introduction to Compilers
vijaya603274
 
Principles of Compiler Design
Principles of Compiler DesignPrinciples of Compiler Design
Principles of Compiler Design
Marimuthu M
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptx
ssuser3b4934
 
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
 
Compiler lecture 04
Compiler lecture 04Compiler lecture 04
Compiler lecture 04
University of Chitral
 
Compiler lecture 04
Compiler lecture 04Compiler lecture 04
Compiler lecture 04
University of Chitral
 
Compiler Design.pptx
Compiler Design.pptxCompiler Design.pptx
Compiler Design.pptx
SouvikRoy149
 

Similar to Compilers in computer programming (20)

1._Introduction_.pptx
1._Introduction_.pptx1._Introduction_.pptx
1._Introduction_.pptx
 
COMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptxCOMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptx
 
11700220036.pdf
11700220036.pdf11700220036.pdf
11700220036.pdf
 
Plc part 2
Plc  part 2Plc  part 2
Plc part 2
 
LANGUAGE TRANSLATOR
LANGUAGE TRANSLATORLANGUAGE TRANSLATOR
LANGUAGE TRANSLATOR
 
Lexical Analysis.pdf
Lexical Analysis.pdfLexical Analysis.pdf
Lexical Analysis.pdf
 
Chapter 1.pptx
Chapter 1.pptxChapter 1.pptx
Chapter 1.pptx
 
Role-of-lexical-analysis
Role-of-lexical-analysisRole-of-lexical-analysis
Role-of-lexical-analysis
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
Lexical Analysis
Lexical AnalysisLexical Analysis
Lexical Analysis
 
The Phases of a Compiler
The Phases of a CompilerThe Phases of a Compiler
The Phases of a Compiler
 
Compier Design_Unit I.ppt
Compier Design_Unit I.pptCompier Design_Unit I.ppt
Compier Design_Unit I.ppt
 
Compier Design_Unit I.ppt
Compier Design_Unit I.pptCompier Design_Unit I.ppt
Compier Design_Unit I.ppt
 
Introduction to Compilers
Introduction to CompilersIntroduction to Compilers
Introduction to Compilers
 
Principles of Compiler Design
Principles of Compiler DesignPrinciples of Compiler Design
Principles of Compiler Design
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptx
 
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 lecture 04
Compiler lecture 04Compiler lecture 04
Compiler lecture 04
 
Compiler lecture 04
Compiler lecture 04Compiler lecture 04
Compiler lecture 04
 
Compiler Design.pptx
Compiler Design.pptxCompiler Design.pptx
Compiler Design.pptx
 

More from Chetan Pandey

RFID (Radio Frequency Identification)
RFID (Radio Frequency Identification) RFID (Radio Frequency Identification)
RFID (Radio Frequency Identification)
Chetan Pandey
 
Land resources , soil erosion and land degradation
Land resources , soil erosion and land degradationLand resources , soil erosion and land degradation
Land resources , soil erosion and land degradation
Chetan Pandey
 
Analog to Digital conversion
Analog to Digital conversionAnalog to Digital conversion
Analog to Digital conversion
Chetan Pandey
 
Internet Addiction , causes , symptoms and consequences
Internet Addiction , causes , symptoms and consequences Internet Addiction , causes , symptoms and consequences
Internet Addiction , causes , symptoms and consequences
Chetan Pandey
 
Business Letters and Essential Qualities.
Business Letters and Essential Qualities.Business Letters and Essential Qualities.
Business Letters and Essential Qualities.
Chetan Pandey
 
Communication , And its types in officially and non-officially
Communication ,  And its types in officially and non-officially  Communication ,  And its types in officially and non-officially
Communication , And its types in officially and non-officially
Chetan Pandey
 

More from Chetan Pandey (6)

RFID (Radio Frequency Identification)
RFID (Radio Frequency Identification) RFID (Radio Frequency Identification)
RFID (Radio Frequency Identification)
 
Land resources , soil erosion and land degradation
Land resources , soil erosion and land degradationLand resources , soil erosion and land degradation
Land resources , soil erosion and land degradation
 
Analog to Digital conversion
Analog to Digital conversionAnalog to Digital conversion
Analog to Digital conversion
 
Internet Addiction , causes , symptoms and consequences
Internet Addiction , causes , symptoms and consequences Internet Addiction , causes , symptoms and consequences
Internet Addiction , causes , symptoms and consequences
 
Business Letters and Essential Qualities.
Business Letters and Essential Qualities.Business Letters and Essential Qualities.
Business Letters and Essential Qualities.
 
Communication , And its types in officially and non-officially
Communication ,  And its types in officially and non-officially  Communication ,  And its types in officially and non-officially
Communication , And its types in officially and non-officially
 

Recently uploaded

Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 

Recently uploaded (20)

Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 

Compilers in computer programming

  • 2. Content • Translators • Working • Phases of compiler • Lexical Analysis • Syntax Analysis • Semantic Analysis • Code Optimization • Code Generation
  • 3. Translators Translators are used to convert source code to machine code. Types :- • Compiler , • Interpreters and, • Assembler.
  • 4. Working • Compiler CompilerProgram EXE Data Output • Interpreters Program Interpreter Data Output
  • 5. Phases of Compiler • Lexical Analysis • Syntax Analysis • Semantic Analysis • Code Optimization • Code Generation
  • 6. Lexical analysis Lexical analysis code is broken into series of tokens by removing comments and extra whitespaces from the source code. If any illegal token encounters it generates an error(Token error). Ex : x = a + b; //Addition. Tokens = keywords, identifiers, operators etc.
  • 7. Syntax analysis Also know as parsing determines weather the series of token give by lexical analysis is valid or not. It checks for the syntax of code. If the syntax of a code is invalid then it generates an error(syntax error).
  • 8. Semantic analysis Semantics tells what does a token or a syntax of a language actually mean actually mean. It interprets the relationship between symbols, identifiers, and other tokens used in a code. If any error occurs it generates semantic error.
  • 9. Code Optimization Code is transformed so that it consumes less computer resources like Memory, RAM etc. In this • Output of program is not changed. • Should always reduce resource consumption. • Should not delay overall compiling process.
  • 10. Code generation This is the final phase of compilation. Compiler generates an object code which will be in a low level language. Code generated should • Have exact meaning of source code and, • Should be resource efficient.