Sunday, 1 July 2012

Diffrence between. compiler and IInterpreter & High & Low Level Languages

The difference between compiler and interpreter :










alt text


Definition of compiler:

Compiler is a program that translates a computer program written on one computer language to another computer language. A "compiler" is primarily used for programs that translate source code from a high level language to a lower level language (e.g., assembly language or machine language). A program that translates from a low level language to a higher level one is a decompiler. A compiler for a relatively simple language written by one person might be a single, monolithic, piece of software. When the source language is large and complex, and high quality output is required the design may be split into a number of relatively independent phases, or passes. Having separate phases means development can be parceled up into small parts and given to different people. It also becomes much easier to replace a single phase by an improved one, or to insert new phases later.

Definition of Interpreter:


Interpreter is a program that translates an instruction into a machine language and executes it before proceeding to the next instruction..... A high-level programming language translator that translates and runs the program at the same time. It translates one program statement into machine language, executes it, and then proceeds to the next statement. This differs from regular executable programs that are presented to the computer as binary-coded instructions. Interpreted programs remain in the source language the programmer wrote in, which is human readable text. Interpreted programs run slower than their compiler counterparts. Whereas the compiler translates the entire program before it is run, interpreters translate a line at a time while the program is being run. However, it is very convenient to write an interpreted program, since a single line of code can be tested interactively.



Main difference:

Compiler and interpreter are both translates used for converting the source program to computer readable form.
Major difference between compiler and interpreter is that compiler converts the high level language program (source code) to machine readable form as a whole (like C, C++ and Java program -there we write the entire program and then compile and the errors will be shown like 25 errors, 16 errors etc...) while an interpreter converts the H.L.L. to M.L. line by line (like VB - there we write a statement like if (condition) and if we omit the 'then' statement and press enter - we cant move to second line since the interpreter will show an error and after typing 'then' only we can move to the next line.


Differences Between High & Low Level Languages :


A high level language is a language for programming computers which does not require detailed knowledge of a specific computer, as a low-level language does.High-level languages do not have to be written for a particular computer, but must be compiled for the computer they will work with.High-level languages are closer to human language than low-level languages, and include statements like GOTO or FOR which are regular words

On the other hand, a low level language is a computer programming language that is close to machine language.Machine language is at the lowest level, because it is the actual binary code of 1s and 0s that the computer understands.Assembly languages are low- level languages which are translated into machine code by an assembler.Each assembly language instruction corresponds to one machine language instruction, but assembly language is easier notation for the programmer to use than machine code.

No comments:

Post a Comment