SlideShare uma empresa Scribd logo
1 de 18
Baixar para ler offline
Compiler
Translators

     A program which converts a user’s program
     written in some language to another
     language.
     The language in which the user’s program is
     written is called the source language
     The language to which the source language
     is converted is called the target language


5/1/2006    Computer System Software CS 012 BE 7th Semester   2
Translators
There is an important difference between
translation and interpretation. In the former,
the original program is first converted to an
equivalent program called an object program.
Then this object program is executed i.e. only
after the translation has been completed.
Hence, the original program in the source
language is not directly executed.


5/1/2006   Computer System Software CS 012 BE 7th Semester   3
Translators
 translation comprises of two steps i.e
    Generation of an equivalent program in
    target language
    Execution of the generated program
 Interpretation consists of only one step i.e.
    executing the original source program



5/1/2006   Computer System Software CS 012 BE 7th Semester   4
Translators




5/1/2006   Computer System Software CS 012 BE 7th Semester   5
Translators




5/1/2006   Computer System Software CS 012 BE 7th Semester   6
Translators




5/1/2006   Computer System Software CS 012 BE 7th Semester   7
Phases in a compiler
     Lexical analysis
     Syntactic analysis
     Semantic analysis
     Intermediate code generation
     Code optimization
     Code generation


5/1/2006   Computer System Software CS 012 BE 7th Semester   8
Compiler
  Compiler (Front - End )
  Largely dependent on the source language
  Independent of the target machine
 Comprises the first three phases viz.,
  – Lexical Analysis
  – Syntactic Analysis
  – Semantic Analysis
  Sometimes the intermediate code
  generation phase is also included

5/1/2006   Computer System Software CS 012 BE 7th Semester   9
Compiler
     Back-End
     Dependent on the target machine
     Independent of the source language
     Includes the last two phases viz.,
     – Code Optimization
     – Code Generation


5/1/2006   Computer System Software CS 012 BE 7th Semester   10
Lexical Analysis
     Scans the source program into basic
     elements called tokens
     Prepares the symbol table which
     maintains information about tokens
     Eliminates white space characters such
     as comments, blanks and tabs



5/1/2006   Computer System Software CS 012 BE 7th Semester   11
Lexical Analysis
EXAMPLE:
IF ( x < 5.0 ) THEN x=x+2 ELSE x=x-3;
TOKENS:
Keywords : IF, THEN, ELSE
Identifier(s) : x
Constants : 2, 3, 5.0
The blanks separating these tokens would
normally be eliminated during lexical analysis.
Nowadays, there are tools to do this phase
efficiently. For e.g. in Unix systems, a standard
tool called lex is available for this purpose.
 5/1/2006   Computer System Software CS 012 BE 7th Semester   12
Syntax Analysis
 Syntax analysis is also known as parsing or
   hierarchical analysis.
   It basically involves grouping of the
   statements into grammatical phrases that are
   used by the compiler to generate the output
   finally. The grammatical phrases of the
   source program are usually represented by a
   parse tree( A parse tree is a structural
   representation of the input being parsed) as
   shown

5/1/2006   Computer System Software CS 012 BE 7th Semester   13
5/1/2006   Computer System Software CS 012 BE 7th Semester   14
Syntax Analysis
     there are tools to generate parsers. For
     e.g. in Unix systems, a tool called as
     YACC (Yet Another Compiler Compiler)
     is available for this purpose.




5/1/2006    Computer System Software CS 012 BE 7th Semester   15
Semantic Analysis

   Looks into the static meaning of the program
   Gathers type information for the subsequent
   code generation phase
 Checks whether the type of variables used in
   the program is consistent with the type
   defined in the declaration.
 Example: If a variable is defined as type char,
   then it is not permitted to do arithmetic
   operations on that variable.
5/1/2006   Computer System Software CS 012 BE 7th Semester   16
Intermediate Code Generation
     Some compilers generate an explicit
     intermediate representation of the source
     program after syntax and semantic analysis.
     This intermediate representation of the
     source program can be thought of as a
     program for an abstract machine and should
     have two main properties viz.,
     It should be easy to produce
     It should be easy to translate into the target
     program

5/1/2006     Computer System Software CS 012 BE 7th Semester   17
Next Session

 Compilers -:

 Code optimization

 Code Generation


5/1/2006   Computer System Software CS 012 BE 7th Semester   18

Mais conteúdo relacionado

Mais procurados

Language processors
Language processorsLanguage processors
Language processorsYash Bansal
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language ProcessingHemant Sharma
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programmingMukesh Tekwani
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler ConstructionAhmed Raza
 
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
 
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 compileradilmehmood93
 
Spr ch-05-compilers
Spr ch-05-compilersSpr ch-05-compilers
Spr ch-05-compilersVasim Pathan
 
Principles of compiler design
Principles of compiler designPrinciples of compiler design
Principles of compiler designDHARANI BABU
 

Mais procurados (20)

Compiler presentaion
Compiler presentaionCompiler presentaion
Compiler presentaion
 
Analysis of the source program
Analysis of the source programAnalysis of the source program
Analysis of the source program
 
Language processors
Language processorsLanguage processors
Language processors
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
 
phases of a compiler
 phases of a compiler phases of a compiler
phases of a compiler
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
 
Compiler design
Compiler designCompiler design
Compiler design
 
System programming
System programmingSystem programming
System programming
 
Ch1
Ch1Ch1
Ch1
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
Phases of-compiler
Phases of-compilerPhases of-compiler
Phases of-compiler
 
Compilers
CompilersCompilers
Compilers
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
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...
 
Cpcs302 1
Cpcs302  1Cpcs302  1
Cpcs302 1
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
 
Cd unit i
Cd unit iCd unit i
Cd unit i
 
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
 
Spr ch-05-compilers
Spr ch-05-compilersSpr ch-05-compilers
Spr ch-05-compilers
 
Principles of compiler design
Principles of compiler designPrinciples of compiler design
Principles of compiler design
 

Destaque

Lesson 5 - Managing Devices
Lesson 5 - Managing DevicesLesson 5 - Managing Devices
Lesson 5 - Managing DevicesGene Carboni
 
Lesson 2 - Understanding Operating System Configurations
Lesson 2 - Understanding Operating System ConfigurationsLesson 2 - Understanding Operating System Configurations
Lesson 2 - Understanding Operating System ConfigurationsGene Carboni
 
Lesson 8 - Understanding Backup and Recovery Methods
Lesson 8 - Understanding Backup and Recovery MethodsLesson 8 - Understanding Backup and Recovery Methods
Lesson 8 - Understanding Backup and Recovery MethodsGene Carboni
 
Lesson 7 - Maintaining, Updating, and Protecting
Lesson 7 - Maintaining, Updating, and ProtectingLesson 7 - Maintaining, Updating, and Protecting
Lesson 7 - Maintaining, Updating, and ProtectingGene Carboni
 
Lesson 1 - Introducing, Installing, and Upgrading Windows 7
Lesson 1 - Introducing, Installing, and Upgrading Windows 7Lesson 1 - Introducing, Installing, and Upgrading Windows 7
Lesson 1 - Introducing, Installing, and Upgrading Windows 7Gene Carboni
 
Lesson 4 - Managing Applications, Services, Folders, and Libraries
Lesson 4 - Managing Applications, Services, Folders, and LibrariesLesson 4 - Managing Applications, Services, Folders, and Libraries
Lesson 4 - Managing Applications, Services, Folders, and LibrariesGene Carboni
 

Destaque (6)

Lesson 5 - Managing Devices
Lesson 5 - Managing DevicesLesson 5 - Managing Devices
Lesson 5 - Managing Devices
 
Lesson 2 - Understanding Operating System Configurations
Lesson 2 - Understanding Operating System ConfigurationsLesson 2 - Understanding Operating System Configurations
Lesson 2 - Understanding Operating System Configurations
 
Lesson 8 - Understanding Backup and Recovery Methods
Lesson 8 - Understanding Backup and Recovery MethodsLesson 8 - Understanding Backup and Recovery Methods
Lesson 8 - Understanding Backup and Recovery Methods
 
Lesson 7 - Maintaining, Updating, and Protecting
Lesson 7 - Maintaining, Updating, and ProtectingLesson 7 - Maintaining, Updating, and Protecting
Lesson 7 - Maintaining, Updating, and Protecting
 
Lesson 1 - Introducing, Installing, and Upgrading Windows 7
Lesson 1 - Introducing, Installing, and Upgrading Windows 7Lesson 1 - Introducing, Installing, and Upgrading Windows 7
Lesson 1 - Introducing, Installing, and Upgrading Windows 7
 
Lesson 4 - Managing Applications, Services, Folders, and Libraries
Lesson 4 - Managing Applications, Services, Folders, and LibrariesLesson 4 - Managing Applications, Services, Folders, and Libraries
Lesson 4 - Managing Applications, Services, Folders, and Libraries
 

Semelhante a 3ss

Compiler Construction introduction
Compiler Construction introductionCompiler Construction introduction
Compiler Construction introductionRana Ehtisham Ul Haq
 
design intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdfdesign intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdfadvRajatSharma
 
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
 
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
 
Chapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptxChapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptxdawod yimer
 
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
 
Ch 1.pptx
Ch 1.pptxCh 1.pptx
Ch 1.pptxwoldu2
 
SSD Mod 2 -18CS61_Notes.pdf
SSD Mod 2 -18CS61_Notes.pdfSSD Mod 2 -18CS61_Notes.pdf
SSD Mod 2 -18CS61_Notes.pdfJacobDragonette
 
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docxvenkatapranaykumarGa
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdfAkarTaher
 
Compiler Design(Nanthu)
Compiler Design(Nanthu)Compiler Design(Nanthu)
Compiler Design(Nanthu)guest91cc85
 
Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)guest251d9a
 
Compilerdesignnew 091219090526-phpapp02
Compilerdesignnew 091219090526-phpapp02Compilerdesignnew 091219090526-phpapp02
Compilerdesignnew 091219090526-phpapp02Anil Thakral
 

Semelhante a 3ss (20)

Compiler Construction introduction
Compiler Construction introductionCompiler Construction introduction
Compiler Construction introduction
 
design intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdfdesign intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdf
 
Chapter#01 cc
Chapter#01 ccChapter#01 cc
Chapter#01 cc
 
Assignment1
Assignment1Assignment1
Assignment1
 
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
 
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
 
Chapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptxChapter 2 Program language translation.pptx
Chapter 2 Program language translation.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
 
Ch 1.pptx
Ch 1.pptxCh 1.pptx
Ch 1.pptx
 
SSD Mod 2 -18CS61_Notes.pdf
SSD Mod 2 -18CS61_Notes.pdfSSD Mod 2 -18CS61_Notes.pdf
SSD Mod 2 -18CS61_Notes.pdf
 
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptx
 
Chapter 1.pptx
Chapter 1.pptxChapter 1.pptx
Chapter 1.pptx
 
3.2
3.23.2
3.2
 
Phases of Compiler.pdf
Phases of Compiler.pdfPhases of Compiler.pdf
Phases of Compiler.pdf
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdf
 
Compiler Design(Nanthu)
Compiler Design(Nanthu)Compiler Design(Nanthu)
Compiler Design(Nanthu)
 
Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)
 
Compilerdesignnew 091219090526-phpapp02
Compilerdesignnew 091219090526-phpapp02Compilerdesignnew 091219090526-phpapp02
Compilerdesignnew 091219090526-phpapp02
 
Compiler Design Material
Compiler Design MaterialCompiler Design Material
Compiler Design Material
 

Último

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Último (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

3ss

  • 2. Translators A program which converts a user’s program written in some language to another language. The language in which the user’s program is written is called the source language The language to which the source language is converted is called the target language 5/1/2006 Computer System Software CS 012 BE 7th Semester 2
  • 3. Translators There is an important difference between translation and interpretation. In the former, the original program is first converted to an equivalent program called an object program. Then this object program is executed i.e. only after the translation has been completed. Hence, the original program in the source language is not directly executed. 5/1/2006 Computer System Software CS 012 BE 7th Semester 3
  • 4. Translators translation comprises of two steps i.e Generation of an equivalent program in target language Execution of the generated program Interpretation consists of only one step i.e. executing the original source program 5/1/2006 Computer System Software CS 012 BE 7th Semester 4
  • 5. Translators 5/1/2006 Computer System Software CS 012 BE 7th Semester 5
  • 6. Translators 5/1/2006 Computer System Software CS 012 BE 7th Semester 6
  • 7. Translators 5/1/2006 Computer System Software CS 012 BE 7th Semester 7
  • 8. Phases in a compiler Lexical analysis Syntactic analysis Semantic analysis Intermediate code generation Code optimization Code generation 5/1/2006 Computer System Software CS 012 BE 7th Semester 8
  • 9. Compiler Compiler (Front - End ) Largely dependent on the source language Independent of the target machine Comprises the first three phases viz., – Lexical Analysis – Syntactic Analysis – Semantic Analysis Sometimes the intermediate code generation phase is also included 5/1/2006 Computer System Software CS 012 BE 7th Semester 9
  • 10. Compiler Back-End Dependent on the target machine Independent of the source language Includes the last two phases viz., – Code Optimization – Code Generation 5/1/2006 Computer System Software CS 012 BE 7th Semester 10
  • 11. Lexical Analysis Scans the source program into basic elements called tokens Prepares the symbol table which maintains information about tokens Eliminates white space characters such as comments, blanks and tabs 5/1/2006 Computer System Software CS 012 BE 7th Semester 11
  • 12. Lexical Analysis EXAMPLE: IF ( x < 5.0 ) THEN x=x+2 ELSE x=x-3; TOKENS: Keywords : IF, THEN, ELSE Identifier(s) : x Constants : 2, 3, 5.0 The blanks separating these tokens would normally be eliminated during lexical analysis. Nowadays, there are tools to do this phase efficiently. For e.g. in Unix systems, a standard tool called lex is available for this purpose. 5/1/2006 Computer System Software CS 012 BE 7th Semester 12
  • 13. Syntax Analysis Syntax analysis is also known as parsing or hierarchical analysis. It basically involves grouping of the statements into grammatical phrases that are used by the compiler to generate the output finally. The grammatical phrases of the source program are usually represented by a parse tree( A parse tree is a structural representation of the input being parsed) as shown 5/1/2006 Computer System Software CS 012 BE 7th Semester 13
  • 14. 5/1/2006 Computer System Software CS 012 BE 7th Semester 14
  • 15. Syntax Analysis there are tools to generate parsers. For e.g. in Unix systems, a tool called as YACC (Yet Another Compiler Compiler) is available for this purpose. 5/1/2006 Computer System Software CS 012 BE 7th Semester 15
  • 16. Semantic Analysis Looks into the static meaning of the program Gathers type information for the subsequent code generation phase Checks whether the type of variables used in the program is consistent with the type defined in the declaration. Example: If a variable is defined as type char, then it is not permitted to do arithmetic operations on that variable. 5/1/2006 Computer System Software CS 012 BE 7th Semester 16
  • 17. Intermediate Code Generation Some compilers generate an explicit intermediate representation of the source program after syntax and semantic analysis. This intermediate representation of the source program can be thought of as a program for an abstract machine and should have two main properties viz., It should be easy to produce It should be easy to translate into the target program 5/1/2006 Computer System Software CS 012 BE 7th Semester 17
  • 18. Next Session Compilers -: Code optimization Code Generation 5/1/2006 Computer System Software CS 012 BE 7th Semester 18