What are the differences between Compiler and Interpreter?


In the field of computers, the instructions given by the user are normally of high level language, whereas the computer will understand the instructions only in the binary format, the language of a computer is known as machine language. The sole purpose of the compiler and interpreter is to convert the user given high level language into machine level language so as to make the computer understand and executed the users driven instruction set. “If both the interpreter and compiler are used for sole purpose then what is the significance of each, for this reason the current report if aimed at exploring the difference between a compiler and interpreter”. A compiler will translate the high level language input given by the user into the machine language, i.e. in the binary codes, whereas an interpreter also converts the high-level language into machine level language but the interpreter will initially generate an intermediate code and then convert the high level language to machine level language.

 

The following context doles out brief description on the differences among the compiler and interpreter

 

Difference between compiler and interpreter:

Even though the compiler and interpreter are used for converting the high level language to machine language, there exist few variations between the compiler in the style and functionalities in converting the languages.

 

Compiler is a unique program that runs the instructions that are written in a certain programming language and convert them into the machine code that a computer can understand. The interpreter just does the same work as of the compiler, but the major variation is that, it converts the high level language into an intermediate code which is executed by the processor.  Normally a developer compose the instructions set by using any kind of programming language such as C, Java, Pascal, Python etc. The instruction written by the programmer is referred as the source code. The programmer must initiate the compiler or interpreter that is pertained to the language used for writing source code. Interpreter investigates and runs each line of source code in sequence, without considering the whole program at once. Nevertheless, programs shaped by compilers run greatly faster than the same instructions executed by an interpreter.


 

Basic differences between Compiler and Interpreter:
  • Compiler translates the high level instruction into machine language, but the interpreter translates the high level instruction into an intermediate code.
  • The compiler executes the entire program at a time, but the interpreter executes each and every line individually.
  • Compiler reports the list of errors that are caused during the process of execution, but the interpreter quits translating soon after finding an error, the progression of the other lines of the program will be done after refining the error.
  • Autonomous executable file is generated by the compiler while interpreter is compulsory for an interpreter program.

 

Differences on the basis of Various characteristics:
  • In a compiler the analyzing and processing time of the program is more, while an interpreter spends less time for the program analyzing and processing.
  • The resulting code of the compiler is in the form of machine code or binary format, in case of interpreter the resulting code is in the form of the intermediate code.
  • In case of compiler, the resulting code is executed by the computer hardware, in an interpreter; another program interprets the resulting code.
  • The execution of the program is fast in the compiler; in an interpreter the program execution speed is comparatively slow.

 

Differences on the basis of programming:
  • The compiler will verify syntax of program, whereas the interpreter verifies the keywords of a program.
  • The compiler will verify the entire program at a time, but the interpreter verifies the program concurrently in the editor.
  • The execution of the program in the interpreter is done line by line but the compiler executes the program on the whole.
+115
-14
  

  • Nitin

    the one who dislikes this, is the animal…

  • ADiiii

    good one but not the excellent u can improve it more!!!!!!

  • ZaidK

    “Compiler executes the program on the whole” , you mean to say that it executes without more conversion from high-level to binary.

  • subbu

    what are the major reasons for using java instead of c++ eventhough both are OOPS,expecting clarity for each point of your answer

  • emran

    Very good answer & it is necessary for me

  • UVRamana

    nicely explained

  • MK

    That’s nice, but you have not explained clearly that when to prefer interpreter over compiler.

  • Md.Ibrahim

    “The resulting code of the compiler is in the form of machine code or binary format, in case of interpreter the resulting code is in the form of the intermediate code”
    C#/Java are compiled languages. If they are compiled directly to machine code then where does MSIL and Java Byte Code fit respectively?

  • Jofila

    simple and precise description is given…
    easily understandable…

  • http://www.youtube.com/Steamlite Best E Cigarette Store

    I think this is very useful information that will any person who really wants to gain knowledge about what is compiler and interpreter. Both convert high level instruction but compiler will convert into machine code and interpreter will convert into intermediate code. Also compiler will give list of errors after doing compilation of source code and at other hand interpreter will stop execution as it find any error.

  • http://www.youtube.com/Steamlite Best E Cigarette Store

    I think this is very useful information that will any person who really wants to gain knowledge about what is compiler and interpreter. Both convert high level instruction but compiler will convert into machine code and interpreter will convert into intermediate code. Also compiler will give list of errors after doing compilation of source code and at other hand interpreter will stop execution as it find any error.

  • SSDN TECH

    very good explanation