+1 vote
in Programming Languages & Algorithms by
compiler vs interpreter

1 Answer

+2 votes
by (37.4k points)
Best answer

Source code

A compiler in it's simplest form is a translator program that takes in source code (high level language) as input and converts that to machine code (binary objects). The compiler converts the entire program source code at compile-time.

An interpreter on the other hand is a translator program which emulates the behavior of a program in execution. It converts the program source code by evaluating one line at a time.

The table below highlights the key differences between a compiler and an interpreter.

Comparison Chart - Compiler vs Interpreter
Generates intermediate object codeNo intermediate object code produced
The compiler takes an entire program for evaluationThe interpreter takes one line of the program at a time for evaluation
Compilation is done before program executionCompilation and program execution happen at the same time
Compilation process is fasterSlower compilation process
More memory is needed to create intermediate object codeIt requires less memory as no intermediate object code is needed
Detecting errors is difficultEasier to detect errors
C++, C and C# are compiled languagesPHP, Perl, Python, Ruby are interpreted languages
All errors after compilation are displayed at the same timeErrors are displayed one after the other; line by line.

Related questions

Welcome to CPEN Talk
Solution-oriented students of computer engineering on one platform to get you that


Chuck Norris can solve the Towers of Hanoi in one move.