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

More Related Content

What's hot

Assembler design options
Assembler design optionsAssembler design options
Assembler design options
Mohd Arif
 

What's hot (20)

Ch 4 linker loader
Ch 4 linker loaderCh 4 linker loader
Ch 4 linker loader
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
P code
P codeP code
P code
 
Recognition-of-tokens
Recognition-of-tokensRecognition-of-tokens
Recognition-of-tokens
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
Input-Buffering
Input-BufferingInput-Buffering
Input-Buffering
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Language Translator ( Compiler)
Language Translator ( Compiler)Language Translator ( Compiler)
Language Translator ( Compiler)
 
Interrupts
InterruptsInterrupts
Interrupts
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
 
Type Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLikeType Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLike
 
Assembler design options
Assembler design optionsAssembler design options
Assembler design options
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
 
Macro Processor
Macro ProcessorMacro Processor
Macro Processor
 
Memory management
Memory managementMemory management
Memory management
 
Ll(1) Parser in Compilers
Ll(1) Parser in CompilersLl(1) Parser in Compilers
Ll(1) Parser in Compilers
 
Computer system architecture
Computer system architectureComputer system architecture
Computer system architecture
 
loaders and linkers
 loaders and linkers loaders and linkers
loaders and linkers
 
Decomposition technique In Software Engineering
Decomposition technique In Software Engineering Decomposition technique In Software Engineering
Decomposition technique In Software Engineering
 

Similar to 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
 

Similar to 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
 

More from 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
 

Recently uploaded

Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
httgc7rh9c
 

Recently uploaded (20)

PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Our Environment Class 10 Science Notes pdf
Our Environment Class 10 Science Notes pdfOur Environment Class 10 Science Notes pdf
Our Environment Class 10 Science Notes pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 

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