0

What is the difference between compiler and interpreter?

23rd Jan 2017, 3:44 PM
geetha
geetha - avatar
2 Réponses
+ 6
Compiler <- reads whole program before executing Interpreter <- executes line by line (Compiler is best for debugging, Interpreter is good for commands e.t.c....)
23rd Jan 2017, 3:50 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 2
A compiler translates the source code into a binary executable (there are actually 2 steps - compiling to object format and then linking to final binary format). The executable can then be distributed and the user only requires this executable to run the program, not the original source code. This is typically used by native languages such as C/C++/Pascal/etc. An interpreter requires the source code every time to execute the program, and it translates the source code every time it runs the program. This is typically used by scripting languages such as Python/Perl/Lua/etc. Note there are also languages that are compiled, but not to a final binary executable, but to an intermediate "byte-code" format which are then run inside a virtual machine (which can be considered as an optimized interpreter). For example C#/Java/etc.
23rd Jan 2017, 4:06 PM
Ettienne Gilbert
Ettienne Gilbert - avatar