SlideShare una empresa de Scribd logo
1 de 4
Computer assignment for grade 9
                                Bereket Solomun

Compiler and interpreter, both basically serve the same purpose. They convert one level of
language to another level. A compiler converts the high level instructions into machine
language while an interpreter converts the high level instruction into some intermediate
form and after that, the instruction is executed.

Compiler

A compiler is defined as a computer program that is used to convert high level instructions
or language into a form that can be understood by the computer. Since computer can
understand only in binary numbers so a compiler is used to fill the gap otherwise it would
have been difficult for a human to find info in the 0 and 1 form.

Earlier the compilers were simple programs which were used to convert symbols into bits.
The programs were also very simple and they contained a series of steps translated by hand
into the data. However, this was a very time consuming process. So, some parts were
programmed or automated. This formed the first compiler.

More sophisticated compliers are created using the simpler ones. With every new version,
more rules added to it and a more natural language environment is created for the human
programmer. The complier programs are evolving in this way which improves their ease of
use.

There are specific compliers for certain specific languages or tasks. Compliers can be
multiple or multistage pass. The first pass can convert the high level language into a
language that is closer to computer language. Then the further passes can convert it into
final stage for the purpose of execution.

Interpreter

The programs created in high level languages can be executed by using two different ways.
The first one is the use of compiler and the other method is to use an interpreter. High level
instruction or language is converted into intermediate from by an interpreter. The
advantage of using an interpreter is that the high level instruction does not goes through
compilation stage which can be a time consuming method. So, by using an interpreter, the
high level program is executed directly. That is the reason why some programmers use
interpreters while making small sections as this saves time.
Almost all high level programming languages have compilers and interpreters. But some
languages like LISP and BASIC are designed in such a way that the programs made using
them are executed by an interpreter.

                 Difference between compiler and interpreter

                 • A complier converts the high level instruction into machine
                 language while an interpreter converts the high level
                 instruction into an intermediate form.

                 • Before execution, entire program is executed by the compiler
                 whereas after translating the first line, an interpreter then
                 executes it and so on.

                 • List of errors is created by the compiler after the compilation
                 process while an interpreter stops translating after the first
                 error.

                 • An independent executable file is created by the compiler
                 whereas interpreter is required by an interpreted program
                 each time.




What is the main difference between an
interpreter and a compiler?
Computer Programming Questions
Answer
The execution of a program can happen either natively -- the intructions are actual CPU
instructions, or it can happen through an interpreter. The interprer thus takes instructions (which
are typically not native CPU instructions), and performs the actions associated with the
instruction (open a file, write a character to the screen, etc). The interpreter is thus in charge of
the execution of the program instructions.

Now consider a program written in spoken English. It is obvious that the CPU does not
understand spoken English. We can either use an interpreter to execute this program, or we can
translate to "another form" (typically machine code specific to a particular CPU) -- using a
compiler. This "other form" may require additional things to happen, so the compiler may insert
extra instructions to cater for these things. The end result is our spoken English program, in
another form -- either native, which can be executed by the CPU, or an a form which requires
that an interpreter be used to execute it.

The interested reader is encouraged to read Allan Turing's groundbreaking paper on computing
machines entitled "On computable numbers: With an application to the Entscheidungsproblem".
You can find this easily by simply searching for this title with your favourite search engine.

Another Answer
We usually prefer to write computer programs in languages we understand rather than in
machine language, but the processor can only understand machine language. So we need a way
of converting our instructions (source code) into machine language. This is done by an
interpreter or a compiler.

An interpreter reads the source code one instruction or line at a time, converts this line into
machine code and executes it. The machine code is then discarded and the next line is read. The
advantage of this is it's simple and you can interrupt it while it is running, change the program
and either continue or start again. The disadvantage is that every line has to be translated every
time it is executed, even if it is executed many times as the program runs. Because of this
interpreters tend to be slow. Examples of interpreters are Basic on older home computers, and
script interpreters such as JavaScript, and languages such as Lisp and Forth.

A compiler reads the whole source code and translates it into a complete machine code program
to perform the required tasks which is output as a new file. This completely separates the source
code from the executable file. The biggest advantage of this is that the translation is done once
only and as a separate process. The program that is run is already translated into machine code so
is much faster in execution. The disadvantage is that you cannot change the program without
going back to the original source code, editing that and recompiling (though for a professional
software developer this is more of an advantage because it stops source code being copied).
Current examples of compilers are Visual Basic, C, C++, C#, Fortran, Cobol, Ada, Pascal and so
on.

You will sometimes see reference to a third type of translation program: an assembler. This is
like a compiler, but works at a much lower level, where one source code line usually translates
directly into one machine code instruction. Assemblers are normally used only by people who
want to squeeze the last bit of performance out of a processor by working at machine code level.

Compiler

A Compiler is a program that translates code of a programming language in machine code

*****Translated source code into machine code***** .

A compiler is a special program that processes statements written in a particular programming
language and converts them into machine language, a "binary program" or "code," that a
computer processor uses.
A compiler works with what are sometimes called 3GL and higher-level languages (3rd-
generation languages, such as Java and C

Interpreter

Interpreters translate code one line at time, executing each line as it is "translated," much the way
a foreign language interpreter would translate a book, by translating one line at a time.
Interpreters do generate binary code, but that code is never compiled into one program entity.

Interpreters offer programmers some advantages that compilers do not. Interpreted languages are
easier to learn than compiled languages, which is great for beginning programmers. An
interpreter lets the programmer know immediately when and where problems exist in the code;
compiled programs make the programmer wait until the program is complete.

Interpreters therefore can be easier to use and produce more immediate results; however the
source code of an interpreted language cannot run without the interpreter.

Compilers produce better optimized code that generally run faster and compiled code is self
sufficient and can be run on their intended platforms without the compiler present

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

BIOS basic input output system
BIOS basic input output systemBIOS basic input output system
BIOS basic input output system
 
Presentation on input devices
Presentation on input devicesPresentation on input devices
Presentation on input devices
 
Random access memory
Random access memoryRandom access memory
Random access memory
 
Operating system notes pdf
Operating system notes pdfOperating system notes pdf
Operating system notes pdf
 
Computer software
Computer softwareComputer software
Computer software
 
Fundamental of Computers
Fundamental of ComputersFundamental of Computers
Fundamental of Computers
 
Operating system
Operating system Operating system
Operating system
 
Processor types
Processor typesProcessor types
Processor types
 
Booting of Computer System
Booting of Computer SystemBooting of Computer System
Booting of Computer System
 
Secondary memory
Secondary memorySecondary memory
Secondary memory
 
operating system
operating systemoperating system
operating system
 
Block diagram of a computer
Block diagram of a computerBlock diagram of a computer
Block diagram of a computer
 
Hardware & software
Hardware & softwareHardware & software
Hardware & software
 
Characteristics ofcomputer
Characteristics ofcomputerCharacteristics ofcomputer
Characteristics ofcomputer
 
Batch operating system
Batch operating system Batch operating system
Batch operating system
 
Powerpoint on Software Concept (ClassXI)
Powerpoint on Software Concept (ClassXI)Powerpoint on Software Concept (ClassXI)
Powerpoint on Software Concept (ClassXI)
 
Presentation on operating system
 Presentation on operating system Presentation on operating system
Presentation on operating system
 
Main memory of computer .ppt
Main memory of computer .pptMain memory of computer .ppt
Main memory of computer .ppt
 
Device Drivers
Device DriversDevice Drivers
Device Drivers
 
Operating system presentation
Operating system presentationOperating system presentation
Operating system presentation
 

Destacado

Day in-the-life-of-a-cell
Day in-the-life-of-a-cellDay in-the-life-of-a-cell
Day in-the-life-of-a-cellnahomyitbarek
 
Five themes of geography
Five themes of geographyFive themes of geography
Five themes of geographynahomyitbarek
 
Cvd definitions and statistics jan 2012
Cvd definitions and statistics jan 2012Cvd definitions and statistics jan 2012
Cvd definitions and statistics jan 2012nahomyitbarek
 
Concept presentation on chemical bonding (iris lo)
Concept presentation on chemical bonding (iris lo)Concept presentation on chemical bonding (iris lo)
Concept presentation on chemical bonding (iris lo)nahomyitbarek
 

Destacado (7)

Day in-the-life-of-a-cell
Day in-the-life-of-a-cellDay in-the-life-of-a-cell
Day in-the-life-of-a-cell
 
Five themes of geography
Five themes of geographyFive themes of geography
Five themes of geography
 
Biol3400 labmanual
Biol3400 labmanualBiol3400 labmanual
Biol3400 labmanual
 
Digestive
DigestiveDigestive
Digestive
 
Cvd definitions and statistics jan 2012
Cvd definitions and statistics jan 2012Cvd definitions and statistics jan 2012
Cvd definitions and statistics jan 2012
 
Concept presentation on chemical bonding (iris lo)
Concept presentation on chemical bonding (iris lo)Concept presentation on chemical bonding (iris lo)
Concept presentation on chemical bonding (iris lo)
 
Questionnaire
QuestionnaireQuestionnaire
Questionnaire
 

Similar a Computer assignment for grade 9

Language processing system.pdf
Language processing system.pdfLanguage processing system.pdf
Language processing system.pdfRakibRahman19
 
COMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSCOMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSsonalikharade3
 
compilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdfcompilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdfHarshaVardhan196987
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreterParas Patel
 
Programming Languages
Programming LanguagesProgramming Languages
Programming LanguagesMohamed Omar
 
La 5 Pl Translator
La 5   Pl TranslatorLa 5   Pl Translator
La 5 Pl TranslatorCma Mohd
 
Programming Fundamental Slide No.1
Programming Fundamental Slide No.1Programming Fundamental Slide No.1
Programming Fundamental Slide No.1Arslan Hussain
 
Compiler design slide share
Compiler design slide shareCompiler design slide share
Compiler design slide shareSudhaa Ravi
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compilerA. S. M. Shafi
 
[ITP - Lecture 01] Introduction to Programming & Different Programming Languages
[ITP - Lecture 01] Introduction to Programming & Different Programming Languages[ITP - Lecture 01] Introduction to Programming & Different Programming Languages
[ITP - Lecture 01] Introduction to Programming & Different Programming LanguagesMuhammad Hammad Waseem
 
Compliers and interpreters
Compliers and interpretersCompliers and interpreters
Compliers and interpretersshivasdhtsvmic
 
Introduction to Compilers
Introduction to CompilersIntroduction to Compilers
Introduction to CompilersAkhil Kaushik
 
Computer basics
Computer basicsComputer basics
Computer basicssans87
 
programming languages
programming languagesprogramming languages
programming languagesRajendran
 

Similar a Computer assignment for grade 9 (20)

Language processing system.pdf
Language processing system.pdfLanguage processing system.pdf
Language processing system.pdf
 
compiler vs interpreter
compiler vs interpretercompiler vs interpreter
compiler vs interpreter
 
COMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSCOMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONS
 
COMPILER DESIGN.docx
COMPILER DESIGN.docxCOMPILER DESIGN.docx
COMPILER DESIGN.docx
 
Compiler vs interpreter
Compiler vs interpreter Compiler vs interpreter
Compiler vs interpreter
 
compilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdfcompilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdf
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
 
Programming Languages
Programming LanguagesProgramming Languages
Programming Languages
 
La 5 Pl Translator
La 5   Pl TranslatorLa 5   Pl Translator
La 5 Pl Translator
 
Assembler
AssemblerAssembler
Assembler
 
Programming Fundamental Slide No.1
Programming Fundamental Slide No.1Programming Fundamental Slide No.1
Programming Fundamental Slide No.1
 
Ppt 1
Ppt 1Ppt 1
Ppt 1
 
Compiler design slide share
Compiler design slide shareCompiler design slide share
Compiler design slide share
 
Introduction to compiler
Introduction to compilerIntroduction to compiler
Introduction to compiler
 
[ITP - Lecture 01] Introduction to Programming & Different Programming Languages
[ITP - Lecture 01] Introduction to Programming & Different Programming Languages[ITP - Lecture 01] Introduction to Programming & Different Programming Languages
[ITP - Lecture 01] Introduction to Programming & Different Programming Languages
 
Presentation
PresentationPresentation
Presentation
 
Compliers and interpreters
Compliers and interpretersCompliers and interpreters
Compliers and interpreters
 
Introduction to Compilers
Introduction to CompilersIntroduction to Compilers
Introduction to Compilers
 
Computer basics
Computer basicsComputer basics
Computer basics
 
programming languages
programming languagesprogramming languages
programming languages
 

Más de nahomyitbarek (20)

Chembond
ChembondChembond
Chembond
 
Chapter13
Chapter13Chapter13
Chapter13
 
Cellular respiration teacher
Cellular respiration teacherCellular respiration teacher
Cellular respiration teacher
 
Cellular respiration
Cellular respirationCellular respiration
Cellular respiration
 
Cell respirationc
Cell respirationcCell respirationc
Cell respirationc
 
Cell respiration-apbio-1204285933555932-5
Cell respiration-apbio-1204285933555932-5Cell respiration-apbio-1204285933555932-5
Cell respiration-apbio-1204285933555932-5
 
Cell respirationa
Cell respirationaCell respirationa
Cell respirationa
 
Cell respiration
Cell respirationCell respiration
Cell respiration
 
Bioint9 10
Bioint9 10Bioint9 10
Bioint9 10
 
Bioe506
Bioe506Bioe506
Bioe506
 
11ch16
11ch1611ch16
11ch16
 
04 gr3 gd
04 gr3 gd04 gr3 gd
04 gr3 gd
 
Condspe
CondspeCondspe
Condspe
 
Topic1
Topic1Topic1
Topic1
 
Em10 fl
Em10 flEm10 fl
Em10 fl
 
Em09 cn
Em09 cnEm09 cn
Em09 cn
 
Em08 ect
Em08 ectEm08 ect
Em08 ect
 
Em07 p
Em07 pEm07 p
Em07 p
 
Em06 iav
Em06 iavEm06 iav
Em06 iav
 
Em05 pe
Em05 peEm05 pe
Em05 pe
 

Computer assignment for grade 9

  • 1. Computer assignment for grade 9 Bereket Solomun Compiler and interpreter, both basically serve the same purpose. They convert one level of language to another level. A compiler converts the high level instructions into machine language while an interpreter converts the high level instruction into some intermediate form and after that, the instruction is executed. Compiler A compiler is defined as a computer program that is used to convert high level instructions or language into a form that can be understood by the computer. Since computer can understand only in binary numbers so a compiler is used to fill the gap otherwise it would have been difficult for a human to find info in the 0 and 1 form. Earlier the compilers were simple programs which were used to convert symbols into bits. The programs were also very simple and they contained a series of steps translated by hand into the data. However, this was a very time consuming process. So, some parts were programmed or automated. This formed the first compiler. More sophisticated compliers are created using the simpler ones. With every new version, more rules added to it and a more natural language environment is created for the human programmer. The complier programs are evolving in this way which improves their ease of use. There are specific compliers for certain specific languages or tasks. Compliers can be multiple or multistage pass. The first pass can convert the high level language into a language that is closer to computer language. Then the further passes can convert it into final stage for the purpose of execution. Interpreter The programs created in high level languages can be executed by using two different ways. The first one is the use of compiler and the other method is to use an interpreter. High level instruction or language is converted into intermediate from by an interpreter. The advantage of using an interpreter is that the high level instruction does not goes through compilation stage which can be a time consuming method. So, by using an interpreter, the high level program is executed directly. That is the reason why some programmers use interpreters while making small sections as this saves time.
  • 2. Almost all high level programming languages have compilers and interpreters. But some languages like LISP and BASIC are designed in such a way that the programs made using them are executed by an interpreter. Difference between compiler and interpreter • A complier converts the high level instruction into machine language while an interpreter converts the high level instruction into an intermediate form. • Before execution, entire program is executed by the compiler whereas after translating the first line, an interpreter then executes it and so on. • List of errors is created by the compiler after the compilation process while an interpreter stops translating after the first error. • An independent executable file is created by the compiler whereas interpreter is required by an interpreted program each time. What is the main difference between an interpreter and a compiler? Computer Programming Questions Answer The execution of a program can happen either natively -- the intructions are actual CPU instructions, or it can happen through an interpreter. The interprer thus takes instructions (which are typically not native CPU instructions), and performs the actions associated with the instruction (open a file, write a character to the screen, etc). The interpreter is thus in charge of the execution of the program instructions. Now consider a program written in spoken English. It is obvious that the CPU does not understand spoken English. We can either use an interpreter to execute this program, or we can translate to "another form" (typically machine code specific to a particular CPU) -- using a compiler. This "other form" may require additional things to happen, so the compiler may insert extra instructions to cater for these things. The end result is our spoken English program, in
  • 3. another form -- either native, which can be executed by the CPU, or an a form which requires that an interpreter be used to execute it. The interested reader is encouraged to read Allan Turing's groundbreaking paper on computing machines entitled "On computable numbers: With an application to the Entscheidungsproblem". You can find this easily by simply searching for this title with your favourite search engine. Another Answer We usually prefer to write computer programs in languages we understand rather than in machine language, but the processor can only understand machine language. So we need a way of converting our instructions (source code) into machine language. This is done by an interpreter or a compiler. An interpreter reads the source code one instruction or line at a time, converts this line into machine code and executes it. The machine code is then discarded and the next line is read. The advantage of this is it's simple and you can interrupt it while it is running, change the program and either continue or start again. The disadvantage is that every line has to be translated every time it is executed, even if it is executed many times as the program runs. Because of this interpreters tend to be slow. Examples of interpreters are Basic on older home computers, and script interpreters such as JavaScript, and languages such as Lisp and Forth. A compiler reads the whole source code and translates it into a complete machine code program to perform the required tasks which is output as a new file. This completely separates the source code from the executable file. The biggest advantage of this is that the translation is done once only and as a separate process. The program that is run is already translated into machine code so is much faster in execution. The disadvantage is that you cannot change the program without going back to the original source code, editing that and recompiling (though for a professional software developer this is more of an advantage because it stops source code being copied). Current examples of compilers are Visual Basic, C, C++, C#, Fortran, Cobol, Ada, Pascal and so on. You will sometimes see reference to a third type of translation program: an assembler. This is like a compiler, but works at a much lower level, where one source code line usually translates directly into one machine code instruction. Assemblers are normally used only by people who want to squeeze the last bit of performance out of a processor by working at machine code level. Compiler A Compiler is a program that translates code of a programming language in machine code *****Translated source code into machine code***** . A compiler is a special program that processes statements written in a particular programming language and converts them into machine language, a "binary program" or "code," that a computer processor uses.
  • 4. A compiler works with what are sometimes called 3GL and higher-level languages (3rd- generation languages, such as Java and C Interpreter Interpreters translate code one line at time, executing each line as it is "translated," much the way a foreign language interpreter would translate a book, by translating one line at a time. Interpreters do generate binary code, but that code is never compiled into one program entity. Interpreters offer programmers some advantages that compilers do not. Interpreted languages are easier to learn than compiled languages, which is great for beginning programmers. An interpreter lets the programmer know immediately when and where problems exist in the code; compiled programs make the programmer wait until the program is complete. Interpreters therefore can be easier to use and produce more immediate results; however the source code of an interpreted language cannot run without the interpreter. Compilers produce better optimized code that generally run faster and compiled code is self sufficient and can be run on their intended platforms without the compiler present