Interpreter vs Complier

All the programs written in programming language (except machine level language) is first translated into machine understandable form for its successful execution. Assemblers, Compilers and Interpreter are the examples of Language translators.

 Assembler: An assembler translates assembly language into machine code.

 Compiler: A Compiler translates code written in a high level language to a lower level language, object/machine code. 

Eg: Computer languages that use compiler : C, C++

Interpreter: An interpreter executes the programs directly, running through program code and executing it line-by-line. 

Eg : Computer Languages that used interpreter : BASIC

Difference between Interpreter and Compiler

Compiler

1.     It translates a whole program at a time

2.     It generates intermediate codes after translation

3.     Errors are detected only after compilation

4.     More memory space required (since intermediate code is generated)

5.     Compiled programs are faster

6.     Can be used for both small and huge size program

7. Compiler translate from a high-level programming language to a lower level language (Source code) to a lower level language (Machine language or object code) to create an executable program.

8.    Scans the entire program and translates it as a whole into machine code.

9. Overall execution time is slower but it takes less amount of time to analyze the source code.

10. Requires more memory (Generates intermediate object code which further linking)

11. Debugging is comparatively hard (Generates the error message only after scanning the whole program)

12. Programming languages like C, C++ use compliers.

Interpreter

1.     It translates a line of code at a time

2.     No intermediate codes generated

3.     Errors are known at each line

4.     Less memory space required

5.     Interpreted programs are rather slow

6.     Only used in small blocks of code

7.     An interpreter is also a program that translates high level source code into machine code (Object code)

8.     Translate program one statement at a time (Translate line by line)

9.     Overall execution time is slower but it takes less amount of time to analyze the source code.

10. Memory efficient (No intermediate object code is generated)

11. Debugging is easy

12. Programming language like Python, BASIC, Ruby use interpreters.

Post a Comment

We Love to hear from U :) Leave us a Comment to improve this site
Thanks for Visiting.....

Previous Post Next Post