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

Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compilerIffat Anjum
 
Introduction to Compiler Construction
Introduction to Compiler Construction Introduction to Compiler Construction
Introduction to Compiler Construction Sarmad Ali
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops conceptsNilesh Dalvi
 
Visual Programming
Visual ProgrammingVisual Programming
Visual ProgrammingBagzzz
 
Language processing activity
Language processing activityLanguage processing activity
Language processing activityDhruv Sabalpara
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.Ravi Kumar Patel
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design MAHASREEM
 
Loaders ( system programming )
Loaders ( system programming ) Loaders ( system programming )
Loaders ( system programming ) Adarsh Patel
 
Types of grammer - TOC
Types of grammer - TOCTypes of grammer - TOC
Types of grammer - TOCAbhayDhupar
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-SystemsVenkata Sreeram
 
Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentationfazli khaliq
 
Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Akshay Nagpurkar
 

What's hot (20)

Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
 
Introduction to Compiler Construction
Introduction to Compiler Construction Introduction to Compiler Construction
Introduction to Compiler Construction
 
Assembly language
Assembly languageAssembly language
Assembly language
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
 
Programming in c
Programming in cProgramming in c
Programming in c
 
Visual Programming
Visual ProgrammingVisual Programming
Visual Programming
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Language processing activity
Language processing activityLanguage processing activity
Language processing activity
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
 
Loaders ( system programming )
Loaders ( system programming ) Loaders ( system programming )
Loaders ( system programming )
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Types of grammer - TOC
Types of grammer - TOCTypes of grammer - TOC
Types of grammer - TOC
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-Systems
 
Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentation
 
Assembler
AssemblerAssembler
Assembler
 
Registers
RegistersRegisters
Registers
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
 

Similar to Compiler Design Options Explained

Compiler design slide share
Compiler design slide shareCompiler design slide share
Compiler design slide shareSudhaa Ravi
 
Language processing system.pdf
Language processing system.pdfLanguage processing system.pdf
Language processing system.pdfRakibRahman19
 
Compliers and interpreters
Compliers and interpretersCompliers and interpreters
Compliers and interpretersshivasdhtsvmic
 
La 5 Pl Translator
La 5   Pl TranslatorLa 5   Pl Translator
La 5 Pl TranslatorCma Mohd
 
Computer assignment for grade 9
Computer assignment for grade  9Computer assignment for grade  9
Computer assignment for grade 9nahomyitbarek
 
compilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdfcompilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdfHarshaVardhan196987
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreterParas Patel
 
Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution pptKeerty Smile
 
basics of compiler design
basics of compiler designbasics of compiler design
basics of compiler designPreeti Katiyar
 
Programming Languages
Programming LanguagesProgramming Languages
Programming LanguagesMohamed Omar
 
Chapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptxChapter 2 Program language translation.pptx
Chapter 2 Program language translation.pptxdawod yimer
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compilerA. S. M. Shafi
 
Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.Md Hossen
 
design intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdfdesign intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdfadvRajatSharma
 
lce1 مترجمات.pptx
lce1 مترجمات.pptxlce1 مترجمات.pptx
lce1 مترجمات.pptxSamiAAli44
 

Similar to Compiler Design Options Explained (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

SIMULATING A SIMPLE MACHINE (smaco)
SIMULATING A SIMPLE MACHINE (smaco)SIMULATING A SIMPLE MACHINE (smaco)
SIMULATING A SIMPLE MACHINE (smaco)sonalikharade3
 
Introduction to system programming
Introduction to system programmingIntroduction to system programming
Introduction to system programmingsonalikharade3
 
Phishing Attack Awareness and Prevention
Phishing Attack Awareness and PreventionPhishing Attack Awareness and Prevention
Phishing Attack Awareness and Preventionsonalikharade3
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligencesonalikharade3
 

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

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 

Recently uploaded (20)

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 

Compiler Design Options Explained

  • 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