SlideShare una empresa de Scribd logo
1 de 30
Descargar para leer sin conexión
J. Bense Tony
Anna University
        Chennai
Acompiler is a program that reads a
program written in one language and
translates into equivalent target
language
                COMPILER
     Source-                   - Target
                      |
                      |
                      |
                Error Message
Compilers
   The Front end checks whether the
    program is correctly written in terms of the
    programming language syntax and
    semantics

   The back end is responsible for translating
    the source into assembly code.
Front End :

LexicalAnalysis
Preprocessing
Syntax Analysis
Semantic Analysis
Back End

 Analysis
 Optimization
 Code   generation
   Lexical Analyzer
   Syntax Analyzer
   Semantic Analyzer
   Intermediate code generator
   Code optimizer
   Code generator
Lexical



                  Syntax




                 Semantic
Symbol                                  Error
Table                                   Handler
manager
          Intermediate Code Generator




               Code Generator




                Code Optimizer
 Also called Linear Analysis
 Characters read from left to right and
  grouped into tokens that are a sequence of
  characters with a collective meaning
Scans Input
Removes White spaces and comments
Manufacture Tokens
Generate Error if Any
◦ Example

◦ A=B+C

◦ Variable tokens - A ,B, C
◦ Symbolic token -- = +
   Also called as Hierarchial Analysis
   A syntax tree[also called as parse tree] is generated
    where
    ◦ Operators  Interior nodes
    ◦ Operands  Children of node for operators.

                          =

                  A               +           Interior

                              B       C       Children
   Characters grouped as tokens in Lexical Analysis are
    recorded as Tables. Checks for semantic errors



   Collect TYPE information for the subsequent code
    generation phase
   Sophisticated compilers typically perform multiple
    passes over various intermediate forms.
   Many algorithms for code optimization are easier to
    apply one at a time
   The input to one optimization relies on the
    processing performed by another optimization
 Input : Concrete Syntax Tree[Parse Tree] or
           Abstract Syntax Tree
 The tree is converted into a linear sequence
  of instructions, usually in an intermediate
  language such as three address code.
 This is an Early stage of Code generation
Concrete Parse tree
             Abstract syntax tree



Converted into a linear sequence of instructions




       Results in 3AC [ 3 Address Code]
   This phase attempts to improve the intermediate
    code inorder to increase the running time

   Reduce the complexity of the code generated

   Leading to a faster execution of the program

   Increased Performance
   Platform Dependant/ Platform Independent
   Optimization can be automated by compilers or
    performed by programmers
   Usually, the most powerful optimization is to find
    a superior algorithm.
   Include activities like
    ◦ Optimization of LOOPS
    ◦ Optimization of Bottlenecks
 Succeeding step of Intermediate code
  optimizer
 Consists of re-locatable machine
  code/assembly code
 Intermediate instructions are converted
  into a a sequence of machine instructions
 One   pass compilers

 Multi   pass compilers

 Load    and go compilers

 Optimizing   compilers
One pass                            Multi pass

Passes through the source code of   Processes the source code of a
each compilation unit only once     program several times


Compilation time is faster          Compilation time is slower


Has limited scope of passes         Has wide scope of passes.


wide compilers                      Narrow compilers


Pascal                              Java
 Generates machine code and immediately
  executes it.

 Compilers usually produce either absolute
 code that is executed immediately upon
 conclusion of the compilation or object code that
 is transformed by a linking loader into absolute
 code.
   Loop optimization
   Data flow
   Code generation
   Functional language
   Interprocedural optimizations
   SSA [Static Single Assignment] based
    optimizations
Threaded code compiler
 database lookup program.
 replaces given strings in the source with
  given binary code.

   Incremental compiler:
    ◦ Individual functions can be compiled in a run-time
      environment that also includes interpreted
      functions.
   Stage compiler
    That compiles to assembly language of a
    theoretical machine, like some Prolog
    implementations

   Just-in-time compiler
    ◦ Applications are delivered in byte code, which is
      compiled to native machine code just prior to
      execution
   A Retargetable compiler
    ◦ object code is frequently of lesser quality than that
      produced by a compiler developed specifically for a
      processor.
    ◦ Retargetable compilers are often also cross
      compilers
   A parallelizing compiler
    ◦ converts a serial input program into a form suitable
      for efficient execution on a parallel computer
      architecture.
 The compiler highlights all the possible
  errors which are obstacle in the
  program to provide a good meaning.
 Logical errors could be found only at
  Run time of the program.
   Array bound missing
   Array size too large
   Bad file name
   Call of on function
   Declaration missing
   Compound statement missing
   Illegal Accessions
   Not abstract
   Not accessible
   Not initialized
   Not found in “import”
   Scope related errors
   Cannot be inherited
   Overloading
   Overriding errors
   Program is free from lexical errors
   Program is free from syntax errors
   Program is free from semantic errors
   Even a complex program could be compiled in a
    small interval of time
   In programs related to database accessing,
    many risks are reduced.
THANK


YOU

Más contenido relacionado

La actualidad más candente (20)

Language processor
Language processorLanguage processor
Language processor
 
Pass Structure of Assembler
Pass Structure of AssemblerPass Structure of Assembler
Pass Structure of Assembler
 
Assembly Language
Assembly LanguageAssembly Language
Assembly Language
 
Assembler
AssemblerAssembler
Assembler
 
The Phases of a Compiler
The Phases of a CompilerThe Phases of a Compiler
The Phases of a Compiler
 
Assemblers
AssemblersAssemblers
Assemblers
 
Loaders
LoadersLoaders
Loaders
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
Features of java
Features of javaFeatures of java
Features of java
 
structured programming
structured programmingstructured programming
structured programming
 
Ch 4 linker loader
Ch 4 linker loaderCh 4 linker loader
Ch 4 linker loader
 
Software tools
Software toolsSoftware tools
Software tools
 
Loaders
LoadersLoaders
Loaders
 
Debugging
DebuggingDebugging
Debugging
 
Unit 4 sp macro
Unit 4 sp macroUnit 4 sp macro
Unit 4 sp macro
 
1.Role lexical Analyzer
1.Role lexical Analyzer1.Role lexical Analyzer
1.Role lexical Analyzer
 
Introduction to Compiler Construction
Introduction to Compiler Construction Introduction to Compiler Construction
Introduction to Compiler Construction
 
Compiler Construction introduction
Compiler Construction introductionCompiler Construction introduction
Compiler Construction introduction
 
System software - macro expansion,nested macro calls
System software - macro expansion,nested macro callsSystem software - macro expansion,nested macro calls
System software - macro expansion,nested macro calls
 
Lexical Analysis - Compiler design
Lexical Analysis - Compiler design Lexical Analysis - Compiler design
Lexical Analysis - Compiler design
 

Destacado

Difference Between Emulation & Simulation
Difference Between Emulation & SimulationDifference Between Emulation & Simulation
Difference Between Emulation & Simulationcatchanil1989
 
compiler and their types
compiler and their typescompiler and their types
compiler and their typespatchamounika7
 
Emulation and simulation
Emulation and simulationEmulation and simulation
Emulation and simulationNebalAlJamal
 
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)Ahmed El-Arabawy
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compilerAbha Damani
 
Introduction to Simulation
Introduction to SimulationIntroduction to Simulation
Introduction to Simulationchimco.net
 

Destacado (11)

GCC, GNU compiler collection
GCC, GNU compiler collectionGCC, GNU compiler collection
GCC, GNU compiler collection
 
Difference Between Emulation & Simulation
Difference Between Emulation & SimulationDifference Between Emulation & Simulation
Difference Between Emulation & Simulation
 
Simulation PowerPoint
Simulation PowerPointSimulation PowerPoint
Simulation PowerPoint
 
compiler and their types
compiler and their typescompiler and their types
compiler and their types
 
Emulation and simulation
Emulation and simulationEmulation and simulation
Emulation and simulation
 
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
 
Introduction to Simulation
Introduction to SimulationIntroduction to Simulation
Introduction to Simulation
 
SIMULATION
SIMULATIONSIMULATION
SIMULATION
 
Assembler
AssemblerAssembler
Assembler
 
Two pass Assembler
Two pass AssemblerTwo pass Assembler
Two pass Assembler
 

Similar a Compilers

Compiler design and lexical analyser
Compiler design and lexical analyserCompiler design and lexical analyser
Compiler design and lexical analyserabhishek gupta
 
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
 
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
 
Compiler_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdfAkarTaher
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processorsRebaz Najeeb
 
aditya malkani compiler.pptx
aditya malkani compiler.pptxaditya malkani compiler.pptx
aditya malkani compiler.pptxWildVenomOP
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptxssuser3b4934
 
Language translators
Language translatorsLanguage translators
Language translatorsAditya Sharat
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler ConstructionAhmed Raza
 
COMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptxCOMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptxRossy719186
 
Chapter One
Chapter OneChapter One
Chapter Onebolovv
 
Compiler Design Introduction
Compiler Design Introduction Compiler Design Introduction
Compiler Design Introduction Thapar Institute
 
Pros and cons of c as a compiler language
  Pros and cons of c as a compiler language  Pros and cons of c as a compiler language
Pros and cons of c as a compiler languageAshok Raj
 

Similar a Compilers (20)

Compiler design and lexical analyser
Compiler design and lexical analyserCompiler design and lexical analyser
Compiler design and lexical analyser
 
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
 
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_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdf
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processors
 
aditya malkani compiler.pptx
aditya malkani compiler.pptxaditya malkani compiler.pptx
aditya malkani compiler.pptx
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptx
 
Chapter#01 cc
Chapter#01 ccChapter#01 cc
Chapter#01 cc
 
Language translators
Language translatorsLanguage translators
Language translators
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
COMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptxCOMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptx
 
LANGUAGE TRANSLATOR
LANGUAGE TRANSLATORLANGUAGE TRANSLATOR
LANGUAGE TRANSLATOR
 
Chapter 1.pptx
Chapter 1.pptxChapter 1.pptx
Chapter 1.pptx
 
1._Introduction_.pptx
1._Introduction_.pptx1._Introduction_.pptx
1._Introduction_.pptx
 
Compiler design
Compiler designCompiler design
Compiler design
 
Chapter One
Chapter OneChapter One
Chapter One
 
Cpcs302 1
Cpcs302  1Cpcs302  1
Cpcs302 1
 
Compiler Design Introduction
Compiler Design Introduction Compiler Design Introduction
Compiler Design Introduction
 
Pros and cons of c as a compiler language
  Pros and cons of c as a compiler language  Pros and cons of c as a compiler language
Pros and cons of c as a compiler language
 

Último

Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?IES VE
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 

Último (20)

Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 

Compilers

  • 1. J. Bense Tony Anna University Chennai
  • 2. Acompiler is a program that reads a program written in one language and translates into equivalent target language COMPILER Source- - Target | | | Error Message
  • 4. The Front end checks whether the program is correctly written in terms of the programming language syntax and semantics  The back end is responsible for translating the source into assembly code.
  • 6. Back End  Analysis  Optimization  Code generation
  • 7. Lexical Analyzer  Syntax Analyzer  Semantic Analyzer  Intermediate code generator  Code optimizer  Code generator
  • 8. Lexical Syntax Semantic Symbol Error Table Handler manager Intermediate Code Generator Code Generator Code Optimizer
  • 9.  Also called Linear Analysis  Characters read from left to right and grouped into tokens that are a sequence of characters with a collective meaning Scans Input Removes White spaces and comments Manufacture Tokens Generate Error if Any
  • 10. ◦ Example ◦ A=B+C ◦ Variable tokens - A ,B, C ◦ Symbolic token -- = +
  • 11. Also called as Hierarchial Analysis  A syntax tree[also called as parse tree] is generated where ◦ Operators  Interior nodes ◦ Operands  Children of node for operators. = A + Interior B C Children
  • 12. Characters grouped as tokens in Lexical Analysis are recorded as Tables. Checks for semantic errors  Collect TYPE information for the subsequent code generation phase
  • 13. Sophisticated compilers typically perform multiple passes over various intermediate forms.  Many algorithms for code optimization are easier to apply one at a time  The input to one optimization relies on the processing performed by another optimization
  • 14.  Input : Concrete Syntax Tree[Parse Tree] or Abstract Syntax Tree  The tree is converted into a linear sequence of instructions, usually in an intermediate language such as three address code.  This is an Early stage of Code generation
  • 15. Concrete Parse tree Abstract syntax tree Converted into a linear sequence of instructions Results in 3AC [ 3 Address Code]
  • 16. This phase attempts to improve the intermediate code inorder to increase the running time  Reduce the complexity of the code generated  Leading to a faster execution of the program  Increased Performance
  • 17. Platform Dependant/ Platform Independent  Optimization can be automated by compilers or performed by programmers  Usually, the most powerful optimization is to find a superior algorithm.  Include activities like ◦ Optimization of LOOPS ◦ Optimization of Bottlenecks
  • 18.  Succeeding step of Intermediate code optimizer  Consists of re-locatable machine code/assembly code  Intermediate instructions are converted into a a sequence of machine instructions
  • 19.  One pass compilers  Multi pass compilers  Load and go compilers  Optimizing compilers
  • 20. One pass Multi pass Passes through the source code of Processes the source code of a each compilation unit only once program several times Compilation time is faster Compilation time is slower Has limited scope of passes Has wide scope of passes. wide compilers Narrow compilers Pascal Java
  • 21.  Generates machine code and immediately executes it.  Compilers usually produce either absolute code that is executed immediately upon conclusion of the compilation or object code that is transformed by a linking loader into absolute code.
  • 22. Loop optimization  Data flow  Code generation  Functional language  Interprocedural optimizations  SSA [Static Single Assignment] based optimizations
  • 23. Threaded code compiler  database lookup program.  replaces given strings in the source with given binary code.  Incremental compiler: ◦ Individual functions can be compiled in a run-time environment that also includes interpreted functions.
  • 24. Stage compiler That compiles to assembly language of a theoretical machine, like some Prolog implementations  Just-in-time compiler ◦ Applications are delivered in byte code, which is compiled to native machine code just prior to execution
  • 25. A Retargetable compiler ◦ object code is frequently of lesser quality than that produced by a compiler developed specifically for a processor. ◦ Retargetable compilers are often also cross compilers  A parallelizing compiler ◦ converts a serial input program into a form suitable for efficient execution on a parallel computer architecture.
  • 26.  The compiler highlights all the possible errors which are obstacle in the program to provide a good meaning.  Logical errors could be found only at Run time of the program.
  • 27. Array bound missing  Array size too large  Bad file name  Call of on function  Declaration missing  Compound statement missing  Illegal Accessions
  • 28. Not abstract  Not accessible  Not initialized  Not found in “import”  Scope related errors  Cannot be inherited  Overloading  Overriding errors
  • 29. Program is free from lexical errors  Program is free from syntax errors  Program is free from semantic errors  Even a complex program could be compiled in a small interval of time  In programs related to database accessing, many risks are reduced.