SlideShare ist ein Scribd-Unternehmen logo
1 von 9
TOPIC
COMPILER DESIGN OPTIONS
BY:SONALI KAHARADE
INTRODUCTION
 A compiler is a translator that converts the high-level language into the machine language.
 High-level language is written by a developer and machine language can be understood by the processor.
 Compiler is used to show errors to the programmer.
 The main purpose of compiler is to change the code written in one language without changing the meaning of the
program.
 When you execute a program which is written in HLL programming language then it executes into two parts.
 In the first part, the source program compiled and translated into the object program (low level language).
 In the second part, object program translated into the target program through the assembler.
 A compiler is a language processor that converts a users program written in a programming language into a machine
language program which can execute on the computer, while an Interpreter is a language processor that itself performs
the action indicated in a user program without generating a machine language program.
 We have learnt that any computer system is made of hardware and
software. The hardware understands a language, which humans cannot
understand. So we write programs in high-level language, which is easier
for us to understand and remember. These programs are then fed into a
series of tools and OS components to get the desired code that can be used
by the machine. This is known as Language Processing System.
 Let us first understand how a program, using C compiler, is executed on a
host machine.
 User writes a program in C language (high-level language).
 The C compiler, compiles the program and translates it to assembly
program (low-level language).
 An assembler then translates the assembly program into machine code
(object).
 A linker tool is used to link all the parts of the program together for
execution (executable machine code).
 A loader loads all of them into memory and then the program is executed.
LANGUAGE PROCESSING SYSTEM
Pre
Processor
Compiler
Assembler
Linker
Loader
Memory
A compiler can broadly be divided into two phases based on the way they compile.
1. Analysis Phase
Known as the front-end of the compiler, the analysis phase of the compiler reads the source program, divides it into core parts
and then checks for lexical, grammar and syntax errors. The analysis phase generates an intermediate representation of the
source program and symbol table, which should be fed to the Synthesis phase as input.
2. Synthesis Phase
Known as the back-end of the compiler, the synthesis phase generates the target program with the help of intermediate source
code representation and symbol table.
COMPILER DESIGN- ARCHITECTURE
Analysis
Phase
Synthesis
Phase
Intermediate code
Source code Machine code
INTERPRETER
 An interpreter is a computer program that is used to directly execute program instructions written using one of the many
high-level programming languages.
 The interpreter transforms the high-level program into an intermediate language that it then executes, or it could parse the
high-level source code and then performs the commands directly, which is done line by line or statement by statement.
 The interpreter reads each statement of code and then converts or executes it directly. In contrast, an assembler or a
compiler converts a high-level source code into native (compiled) code that can be executed directly by the operating
system (e.g. by creating a .exe program).
 This feature makes easy for programmers to check any particular line at the time of debugging, but slows down the overall
time of execution of the entire program.
Data
Interpreter
Source
code
Machine
code
Advantage Disadvantage
The program code is already translat
ed into machine code. Thus, it code
execution time is less.
Interpreters are easier to use, especially
for beginners.
You can't change the program withou
t going back to the source code.
Interpreted programs can run on compu
ters that have the
corresponding interpreter.
Role of Compiler
•Compliers reads the source code, outputs executable code
•Translates software written in a higher-level language into instructions that computer can understand. It
converts the text that a programmer writes into a format the CPU can understand.
•The process of compilation is relatively complicated. It spends a lot of time analyzing and processing the
program.
•The executable result is some form of machine-specific binary code.
Role of Interpreter
•The interpreter converts the source code line-by-line during RUN Time.
•Interpret completely translates a program written in a high-level language into machine level language.
•Interpreter allows evaluation and modification of the program while it is executing.
•Relatively less time spent for analyzing and processing the program
•Program execution is relatively slow compared to compiler
ROLE OF COMPILER & INTERPRETER
Interpreter Compiler
Translates program one statement at a time.
Scans the entire program and translates it as a whole into
machine code.
Interpreters usually take less amount of time to analyze the
source code. However, the overall execution time is
comparatively slower than compilers.
Compilers usually take a large amount of time to analyze the
source code. However, the overall execution time is
comparatively faster than interpreters.
No intermediate object code is generated, hence are memory
efficient.
Generates intermediate object code which further requires
linking, hence requires more memory.
Errors are displayed for every instruction interpreted. Errors are displayed after entire program is checked.
Programming languages like JavaScript, Python, Ruby use
interpreters.
Programming languages like C, C++, Java use compilers.
COMPARISION OF INTERPRETER & COMPILER
1. Pure Interpreters:
 In a pure interpreter, the source program is maintained in the source form throughout its interpretation. Each
statement of source program is analyzed while interpreting. This arrangement acquires substantial analysis
overheads when interpreting a statement.
2. Impure Interpreters:
 An impure interpreter carries out some preliminary processing of the source program to decrease the
analysis overheads during interpretation. To reduce the analysis overhead, some initial processing of the
source program is done by the impure interpreter during interpretation.
 The source program is given to the preprocessor and the preprocessor transforms the program to an
intermediate representation (IR) that is used during interpretation.
 This speeds up interpretation since the code component of the IR that is the IC, can be analyzed more
resourcefully than the source form of the program.
PURE AND IMPUTER INTERPRETER
 Like interpreter, p-code compilers are also analyzed and convert
source program into an intermediate code(IC).
 P-code compilers are also called bytecode compilers & are very
similar in concept to interpreter. The source program is analyzed and
converted into an intermediate form, which is then executed
interpretively.
 With a P-Code compiler, this intermediate forms is the machine
language for a hypothetical machine, often call pseudo-machine. P-
code object programs can be executed on any machine that has a P-
Code interpreter.
P-CODE COMPILERS
Compiler
Object Program
p-code
P-code
interpreter
Source Program
Advantage Disadvantage
1. Portability 1. Slower execution of program
2. Saves memory

Weitere ähnliche Inhalte

Was ist angesagt?

Dma transfer
Dma transferDma transfer
Dma transfer
gmnithya
 
Assembler design options
Assembler design optionsAssembler design options
Assembler design options
Mohd Arif
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
Piyush Rochwani
 
Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9
myrajendra
 

Was ist angesagt? (20)

Dma transfer
Dma transferDma transfer
Dma transfer
 
Assembler design options
Assembler design optionsAssembler design options
Assembler design options
 
File Handling Python
File Handling PythonFile Handling Python
File Handling Python
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating Systems
 
Two pass Assembler
Two pass AssemblerTwo pass Assembler
Two pass Assembler
 
Principal source of optimization in compiler design
Principal source of optimization in compiler designPrincipal source of optimization in compiler design
Principal source of optimization in compiler design
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
 
Bootstrapping in Compiler
Bootstrapping in CompilerBootstrapping in Compiler
Bootstrapping in Compiler
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler Design
 
Interactive debugging system
Interactive debugging systemInteractive debugging system
Interactive debugging system
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
 
Loaders
LoadersLoaders
Loaders
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 
Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9
 
Lexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignLexical Analysis - Compiler Design
Lexical Analysis - Compiler Design
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
 
Code generation
Code generationCode generation
Code generation
 
Compilers
CompilersCompilers
Compilers
 

Ähnlich wie COMPILER DESIGN OPTIONS

Language processing system.pdf
Language processing system.pdfLanguage processing system.pdf
Language processing system.pdf
RakibRahman19
 
La 5 Pl Translator
La 5   Pl TranslatorLa 5   Pl Translator
La 5 Pl Translator
Cma Mohd
 
Computer assignment for grade 9
Computer assignment for grade  9Computer assignment for grade  9
Computer assignment for grade 9
nahomyitbarek
 
Programming Languages
Programming LanguagesProgramming Languages
Programming Languages
Mohamed Omar
 

Ähnlich wie COMPILER DESIGN OPTIONS (20)

Compiler design slide share
Compiler design slide shareCompiler design slide share
Compiler design slide share
 
COMPILER DESIGN.docx
COMPILER DESIGN.docxCOMPILER DESIGN.docx
COMPILER DESIGN.docx
 
Assembler
AssemblerAssembler
Assembler
 
Language processing system.pdf
Language processing system.pdfLanguage processing system.pdf
Language processing system.pdf
 
Compliers and interpreters
Compliers and interpretersCompliers and interpreters
Compliers and interpreters
 
La 5 Pl Translator
La 5   Pl TranslatorLa 5   Pl Translator
La 5 Pl Translator
 
Computer assignment for grade 9
Computer assignment for grade  9Computer assignment for grade  9
Computer assignment for grade 9
 
Presentation
PresentationPresentation
Presentation
 
Translators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreterTranslators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreter
 
compilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdfcompilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdf
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
 
Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution ppt
 
basics of compiler design
basics of compiler designbasics of compiler design
basics of compiler design
 
Programming Languages
Programming LanguagesProgramming Languages
Programming Languages
 
Chapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptxChapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptx
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
 
Compiler vs interpreter
Compiler vs interpreter Compiler vs interpreter
Compiler vs interpreter
 
Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.
 
design intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdfdesign intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdf
 
lce1 مترجمات.pptx
lce1 مترجمات.pptxlce1 مترجمات.pptx
lce1 مترجمات.pptx
 

Mehr von sonalikharade3 (6)

EDITORS
EDITORSEDITORS
EDITORS
 
SIMULATING A SIMPLE MACHINE (smaco)
SIMULATING A SIMPLE MACHINE (smaco)SIMULATING A SIMPLE MACHINE (smaco)
SIMULATING A SIMPLE MACHINE (smaco)
 
Introduction to system programming
Introduction to system programmingIntroduction to system programming
Introduction to system programming
 
Phishing Attack Awareness and Prevention
Phishing Attack Awareness and PreventionPhishing Attack Awareness and Prevention
Phishing Attack Awareness and Prevention
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
 
Linker and Loader
Linker and Loader Linker and Loader
Linker and Loader
 

Kürzlich hochgeladen

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 

Kürzlich hochgeladen (20)

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 

COMPILER DESIGN OPTIONS

  • 2. INTRODUCTION  A compiler is a translator that converts the high-level language into the machine language.  High-level language is written by a developer and machine language can be understood by the processor.  Compiler is used to show errors to the programmer.  The main purpose of compiler is to change the code written in one language without changing the meaning of the program.  When you execute a program which is written in HLL programming language then it executes into two parts.  In the first part, the source program compiled and translated into the object program (low level language).  In the second part, object program translated into the target program through the assembler.  A compiler is a language processor that converts a users program written in a programming language into a machine language program which can execute on the computer, while an Interpreter is a language processor that itself performs the action indicated in a user program without generating a machine language program.
  • 3.  We have learnt that any computer system is made of hardware and software. The hardware understands a language, which humans cannot understand. So we write programs in high-level language, which is easier for us to understand and remember. These programs are then fed into a series of tools and OS components to get the desired code that can be used by the machine. This is known as Language Processing System.  Let us first understand how a program, using C compiler, is executed on a host machine.  User writes a program in C language (high-level language).  The C compiler, compiles the program and translates it to assembly program (low-level language).  An assembler then translates the assembly program into machine code (object).  A linker tool is used to link all the parts of the program together for execution (executable machine code).  A loader loads all of them into memory and then the program is executed. LANGUAGE PROCESSING SYSTEM Pre Processor Compiler Assembler Linker Loader Memory
  • 4. A compiler can broadly be divided into two phases based on the way they compile. 1. Analysis Phase Known as the front-end of the compiler, the analysis phase of the compiler reads the source program, divides it into core parts and then checks for lexical, grammar and syntax errors. The analysis phase generates an intermediate representation of the source program and symbol table, which should be fed to the Synthesis phase as input. 2. Synthesis Phase Known as the back-end of the compiler, the synthesis phase generates the target program with the help of intermediate source code representation and symbol table. COMPILER DESIGN- ARCHITECTURE Analysis Phase Synthesis Phase Intermediate code Source code Machine code
  • 5. INTERPRETER  An interpreter is a computer program that is used to directly execute program instructions written using one of the many high-level programming languages.  The interpreter transforms the high-level program into an intermediate language that it then executes, or it could parse the high-level source code and then performs the commands directly, which is done line by line or statement by statement.  The interpreter reads each statement of code and then converts or executes it directly. In contrast, an assembler or a compiler converts a high-level source code into native (compiled) code that can be executed directly by the operating system (e.g. by creating a .exe program).  This feature makes easy for programmers to check any particular line at the time of debugging, but slows down the overall time of execution of the entire program. Data Interpreter Source code Machine code Advantage Disadvantage The program code is already translat ed into machine code. Thus, it code execution time is less. Interpreters are easier to use, especially for beginners. You can't change the program withou t going back to the source code. Interpreted programs can run on compu ters that have the corresponding interpreter.
  • 6. Role of Compiler •Compliers reads the source code, outputs executable code •Translates software written in a higher-level language into instructions that computer can understand. It converts the text that a programmer writes into a format the CPU can understand. •The process of compilation is relatively complicated. It spends a lot of time analyzing and processing the program. •The executable result is some form of machine-specific binary code. Role of Interpreter •The interpreter converts the source code line-by-line during RUN Time. •Interpret completely translates a program written in a high-level language into machine level language. •Interpreter allows evaluation and modification of the program while it is executing. •Relatively less time spent for analyzing and processing the program •Program execution is relatively slow compared to compiler ROLE OF COMPILER & INTERPRETER
  • 7. Interpreter Compiler Translates program one statement at a time. Scans the entire program and translates it as a whole into machine code. Interpreters usually take less amount of time to analyze the source code. However, the overall execution time is comparatively slower than compilers. Compilers usually take a large amount of time to analyze the source code. However, the overall execution time is comparatively faster than interpreters. No intermediate object code is generated, hence are memory efficient. Generates intermediate object code which further requires linking, hence requires more memory. Errors are displayed for every instruction interpreted. Errors are displayed after entire program is checked. Programming languages like JavaScript, Python, Ruby use interpreters. Programming languages like C, C++, Java use compilers. COMPARISION OF INTERPRETER & COMPILER
  • 8. 1. Pure Interpreters:  In a pure interpreter, the source program is maintained in the source form throughout its interpretation. Each statement of source program is analyzed while interpreting. This arrangement acquires substantial analysis overheads when interpreting a statement. 2. Impure Interpreters:  An impure interpreter carries out some preliminary processing of the source program to decrease the analysis overheads during interpretation. To reduce the analysis overhead, some initial processing of the source program is done by the impure interpreter during interpretation.  The source program is given to the preprocessor and the preprocessor transforms the program to an intermediate representation (IR) that is used during interpretation.  This speeds up interpretation since the code component of the IR that is the IC, can be analyzed more resourcefully than the source form of the program. PURE AND IMPUTER INTERPRETER
  • 9.  Like interpreter, p-code compilers are also analyzed and convert source program into an intermediate code(IC).  P-code compilers are also called bytecode compilers & are very similar in concept to interpreter. The source program is analyzed and converted into an intermediate form, which is then executed interpretively.  With a P-Code compiler, this intermediate forms is the machine language for a hypothetical machine, often call pseudo-machine. P- code object programs can be executed on any machine that has a P- Code interpreter. P-CODE COMPILERS Compiler Object Program p-code P-code interpreter Source Program Advantage Disadvantage 1. Portability 1. Slower execution of program 2. Saves memory