SlideShare a Scribd company logo
1 of 11
Download to read offline
Compilation Vs.
Interpretation
Source Code Translators
An Interpreter is a
Translator
Examples of translators:
● Compilers - translates high level code to low level code, e.g. Java -> JVM
● Assemblers - translates assembly language code to machine code, e.g. x86as -> x86
● High-level translators - translates code from one PL to another, e.g. Java -> C
● Decompilers - translates low-level code to high-level code, e.g. Java JVM bytecode -> Java
High Level / Low Level
Low High
Machine Readable Human Readable
Binary: 011011 Grammar: if let, while, for
executable Not executable
Knows about hardware Does not know about hardware
A compiler can be compared to taking a foreign
movie and first sub-titling it and then being able to
watch it again and again.
While an interpreter is like having a translator at the
UN translate each line of a delegate’s speech in real-
time.
AKA...
The compiler translates the entire program before it is run.
The interpreters translate a line at a time while the program is being run.
Compiled Languages
Python
Javascript
Lisp
Java ( compiled to byte code first )
C# (compiled to MSIL)
PHP
Perl
Interpreted Languages
C
C++
Objective-C
Swift
Fortran
Advantages of Compiled Languages
- Pre-Compiled binaries are inherently more difficult to reverse-engineer and
are therefore helpful to closed-source software providers wishing to keep the
I.P. contained in their source code private.
- Once a program is translated into native instructions (machine code), it can
then be executed over and over again withouth the overhead of this
translation.
- Ability to support architectures the interpreter hasn't been compiled for (such
as embedded systems)
- Can be optimized more heavily due to larger window of code to be translated.
Advantages of Interpreted Languages
- Programs can immediately be executed without the requirement of compiling
first.
- Potentially has lower memory footprint because no Object Code is created.
- Supports portability if interpreter is installed on different platforms.
- Starts executing immediately (no compilation phase)
- Source Code can be more easily changed between program executions
because there is no compilation step in between.
Hybrid Approach
An interpretive compiler combines fast translation with moderately fast execution, provided that:
● VM code is lower than the source language, but higher than native machine code
● VM instructions have simple formats (can be quickly analysed by an interpreter)
Example: JDK provides an interpretive compiler for Java.
Hybrid Approach Continued..
- any language can be either compiled or interpreted but the implementation of the language is what is either one or both. Sometimes even a
spectrum of compiled/interpreted
- Etymology - compiler (pile things together, throw in pile), interpreter (inter, between source and assembly)
- Interpreted languages require the interpreted to be installed on host machine
- Interpreter continues interpreting until it hits an error
- Compiler will check errors for you at compilation time
- Compiled program requires more memory as all the code is compiled as opposed to line by line discarding the previous line. However with
modern computers equipped with gigabytes of ram this isn’t a practical concern.
Extra Points

More Related Content

What's hot

Language processor
Language processorLanguage processor
Language processor
Abha Damani
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
Abha Damani
 

What's hot (20)

Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
 
Language processor
Language processorLanguage processor
Language processor
 
compiler vs interpreter
compiler vs interpretercompiler vs interpreter
compiler vs interpreter
 
Loaders ( system programming )
Loaders ( system programming ) Loaders ( system programming )
Loaders ( system programming )
 
Classification of Compilers
Classification of CompilersClassification of Compilers
Classification of Compilers
 
Linking in MS-Dos System
Linking in MS-Dos SystemLinking in MS-Dos System
Linking in MS-Dos System
 
loaders and linkers
 loaders and linkers loaders and linkers
loaders and linkers
 
Loaders
LoadersLoaders
Loaders
 
Compiler type
Compiler typeCompiler type
Compiler type
 
LANGUAGE TRANSLATOR
LANGUAGE TRANSLATORLANGUAGE TRANSLATOR
LANGUAGE TRANSLATOR
 
Interpreter
InterpreterInterpreter
Interpreter
 
COMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSCOMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONS
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
 
Assembly Language
Assembly LanguageAssembly Language
Assembly Language
 
Computer Language Translator
Computer Language TranslatorComputer Language Translator
Computer Language Translator
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
 
Linkers And Loaders
Linkers And LoadersLinkers And Loaders
Linkers And Loaders
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
 
Assemblers: Ch03
Assemblers: Ch03Assemblers: Ch03
Assemblers: Ch03
 

Similar to Compilation v. interpretation

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

Similar to Compilation v. interpretation (20)

Cf&oa
Cf&oaCf&oa
Cf&oa
 
La 5 Pl Translator
La 5   Pl TranslatorLa 5   Pl Translator
La 5 Pl Translator
 
Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution ppt
 
Introduction to Compilers
Introduction to CompilersIntroduction to Compilers
Introduction to Compilers
 
Language processing system.pdf
Language processing system.pdfLanguage processing system.pdf
Language processing system.pdf
 
COMPILER DESIGN.docx
COMPILER DESIGN.docxCOMPILER DESIGN.docx
COMPILER DESIGN.docx
 
Compiler vs interpreter
Compiler vs interpreter Compiler vs interpreter
Compiler vs interpreter
 
Life cycle of a computer program
Life cycle of a computer programLife cycle of a computer program
Life cycle of a computer program
 
Computer assignment for grade 9
Computer assignment for grade  9Computer assignment for grade  9
Computer assignment for grade 9
 
Assembler
AssemblerAssembler
Assembler
 
compilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdfcompilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdf
 
Cd ch1 - introduction
Cd   ch1 - introductionCd   ch1 - introduction
Cd ch1 - introduction
 
CD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptxCD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptx
 
4_5802928814682016556.pptx
4_5802928814682016556.pptx4_5802928814682016556.pptx
4_5802928814682016556.pptx
 
Compiler - Computer Programming - UOZ
Compiler - Computer Programming - UOZ Compiler - Computer Programming - UOZ
Compiler - Computer Programming - UOZ
 
Programming Languages / Translators
Programming Languages / TranslatorsProgramming Languages / Translators
Programming Languages / Translators
 
aditya malkani compiler.pptx
aditya malkani compiler.pptxaditya malkani compiler.pptx
aditya malkani compiler.pptx
 
Interpreter
InterpreterInterpreter
Interpreter
 
Compiler design slide share
Compiler design slide shareCompiler design slide share
Compiler design slide share
 
Chapter1.pdf
Chapter1.pdfChapter1.pdf
Chapter1.pdf
 

Recently uploaded

Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 

Recently uploaded (20)

Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 

Compilation v. interpretation

  • 2. An Interpreter is a Translator Examples of translators: ● Compilers - translates high level code to low level code, e.g. Java -> JVM ● Assemblers - translates assembly language code to machine code, e.g. x86as -> x86 ● High-level translators - translates code from one PL to another, e.g. Java -> C ● Decompilers - translates low-level code to high-level code, e.g. Java JVM bytecode -> Java
  • 3. High Level / Low Level Low High Machine Readable Human Readable Binary: 011011 Grammar: if let, while, for executable Not executable Knows about hardware Does not know about hardware
  • 4. A compiler can be compared to taking a foreign movie and first sub-titling it and then being able to watch it again and again. While an interpreter is like having a translator at the UN translate each line of a delegate’s speech in real- time. AKA... The compiler translates the entire program before it is run. The interpreters translate a line at a time while the program is being run.
  • 5.
  • 6. Compiled Languages Python Javascript Lisp Java ( compiled to byte code first ) C# (compiled to MSIL) PHP Perl Interpreted Languages C C++ Objective-C Swift Fortran
  • 7. Advantages of Compiled Languages - Pre-Compiled binaries are inherently more difficult to reverse-engineer and are therefore helpful to closed-source software providers wishing to keep the I.P. contained in their source code private. - Once a program is translated into native instructions (machine code), it can then be executed over and over again withouth the overhead of this translation. - Ability to support architectures the interpreter hasn't been compiled for (such as embedded systems) - Can be optimized more heavily due to larger window of code to be translated.
  • 8. Advantages of Interpreted Languages - Programs can immediately be executed without the requirement of compiling first. - Potentially has lower memory footprint because no Object Code is created. - Supports portability if interpreter is installed on different platforms. - Starts executing immediately (no compilation phase) - Source Code can be more easily changed between program executions because there is no compilation step in between.
  • 9. Hybrid Approach An interpretive compiler combines fast translation with moderately fast execution, provided that: ● VM code is lower than the source language, but higher than native machine code ● VM instructions have simple formats (can be quickly analysed by an interpreter) Example: JDK provides an interpretive compiler for Java.
  • 11. - any language can be either compiled or interpreted but the implementation of the language is what is either one or both. Sometimes even a spectrum of compiled/interpreted - Etymology - compiler (pile things together, throw in pile), interpreter (inter, between source and assembly) - Interpreted languages require the interpreted to be installed on host machine - Interpreter continues interpreting until it hits an error - Compiler will check errors for you at compilation time - Compiled program requires more memory as all the code is compiled as opposed to line by line discarding the previous line. However with modern computers equipped with gigabytes of ram this isn’t a practical concern. Extra Points