SlideShare a Scribd company logo
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
   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

More Related Content

What's hot

Compiler construction tools
Compiler construction toolsCompiler construction tools
Compiler construction tools
Akhil Kaushik
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languagesVarun Garg
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
Muhammed Afsal Villan
 
Introduction to Compiler
Introduction to CompilerIntroduction to Compiler
Introduction to Compiler
Radhakrishnan Chinnusamy
 
Language processor
Language processorLanguage processor
Language processorAbha Damani
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
Akhil Kaushik
 
Loaders
LoadersLoaders
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
Paras Patel
 
Computer Language Translator
Computer Language TranslatorComputer Language Translator
Computer Language Translator
Ranjeet Kumar
 
Computer languages
Computer languagesComputer languages
Computer languages
Buxoo Abdullah
 
Von Neumann Architecture
Von Neumann ArchitectureVon Neumann Architecture
Von Neumann Architecture
Chamodi Adikaram
 
Algorithms and Flowcharts
Algorithms and FlowchartsAlgorithms and Flowcharts
Algorithms and Flowcharts
Deva Singh
 
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming ConceptsJussi Pohjolainen
 
Programming
ProgrammingProgramming
Programming
Leo Simon Anfone
 
Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming conceptssalmankhan570
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
MAHASREEM
 
Lexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignLexical Analysis - Compiler Design
Lexical Analysis - Compiler Design
Akhil Kaushik
 
Introduction to Compiler Construction
Introduction to Compiler Construction Introduction to Compiler Construction
Introduction to Compiler Construction
Sarmad Ali
 
Chapter One
Chapter OneChapter One
Chapter Onebolovv
 

What's hot (20)

Compiler construction tools
Compiler construction toolsCompiler construction tools
Compiler construction tools
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
Introduction to Compiler
Introduction to CompilerIntroduction to Compiler
Introduction to Compiler
 
Language processor
Language processorLanguage processor
Language processor
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
 
Loaders
LoadersLoaders
Loaders
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
 
Computer Language Translator
Computer Language TranslatorComputer Language Translator
Computer Language Translator
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
Computer languages
Computer languagesComputer languages
Computer languages
 
Von Neumann Architecture
Von Neumann ArchitectureVon Neumann Architecture
Von Neumann Architecture
 
Algorithms and Flowcharts
Algorithms and FlowchartsAlgorithms and Flowcharts
Algorithms and Flowcharts
 
Intro To Programming Concepts
Intro To Programming ConceptsIntro To Programming Concepts
Intro To Programming Concepts
 
Programming
ProgrammingProgramming
Programming
 
Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming concepts
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
 
Lexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignLexical Analysis - Compiler Design
Lexical Analysis - Compiler Design
 
Introduction to Compiler Construction
Introduction to Compiler Construction Introduction to Compiler Construction
Introduction to Compiler Construction
 
Chapter One
Chapter OneChapter One
Chapter One
 

Viewers also liked

Difference Between Emulation & Simulation
Difference Between Emulation & SimulationDifference Between Emulation & Simulation
Difference Between Emulation & Simulation
catchanil1989
 
Simulation PowerPoint
Simulation PowerPointSimulation PowerPoint
Simulation PowerPoint
Melissa Wilson
 
compiler and their types
compiler and their typescompiler and their types
compiler and their types
patchamounika7
 
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
 
Debugging
DebuggingDebugging
SIMULATION
SIMULATIONSIMULATION
SIMULATION
Eminent Planners
 
Assemblers
AssemblersAssemblers
Assemblers
Dattatray Gandhmal
 
Two pass Assembler
Two pass AssemblerTwo pass Assembler
Two pass Assembler
Satyamevjayte Haxor
 

Viewers also liked (14)

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)
 
Assembler
AssemblerAssembler
Assembler
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
 
Introduction to Simulation
Introduction to SimulationIntroduction to Simulation
Introduction to Simulation
 
Debugging
DebuggingDebugging
Debugging
 
SIMULATION
SIMULATIONSIMULATION
SIMULATION
 
Assemblers
AssemblersAssemblers
Assemblers
 
Assembler
AssemblerAssembler
Assembler
 
Two pass Assembler
Two pass AssemblerTwo pass Assembler
Two pass Assembler
 

Similar to Compilers

Compiler design and lexical analyser
Compiler design and lexical analyserCompiler design and lexical analyser
Compiler design and lexical analyser
abhishek 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.pdf
DrIsikoIsaac
 
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_Lecture1.pdf
Compiler_Lecture1.pdfCompiler_Lecture1.pdf
Compiler_Lecture1.pdf
AkarTaher
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
A. S. M. Shafi
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processors
Rebaz Najeeb
 
aditya malkani compiler.pptx
aditya malkani compiler.pptxaditya malkani compiler.pptx
aditya malkani compiler.pptx
WildVenomOP
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptx
ssuser3b4934
 
Chapter#01 cc
Chapter#01 ccChapter#01 cc
Chapter#01 cc
abdulbaki3
 
Compiler Construction introduction
Compiler Construction introductionCompiler Construction introduction
Compiler Construction introduction
Rana Ehtisham Ul Haq
 
Language translators
Language translatorsLanguage translators
Language translatorsAditya Sharat
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
Ahmed Raza
 
COMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptxCOMPILER CONSTRUCTION KU 1.pptx
COMPILER CONSTRUCTION KU 1.pptx
Rossy719186
 
Chapter 1.pptx
Chapter 1.pptxChapter 1.pptx
Chapter 1.pptx
NesredinTeshome1
 
1._Introduction_.pptx
1._Introduction_.pptx1._Introduction_.pptx
1._Introduction_.pptx
Anbarasan Radhakrishnan R
 
Compiler design
Compiler designCompiler design
Compiler design
nazmul hoque
 
Cpcs302 1
Cpcs302  1Cpcs302  1
Cpcs302 1
guest5de1a5
 
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 language
Ashok Raj
 

Similar to 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
 
Compiler Construction introduction
Compiler Construction introductionCompiler Construction introduction
Compiler Construction introduction
 
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
 
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
 

Recently uploaded

Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 

Recently uploaded (20)

Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 

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
  • 3.
  • 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.