0
What is the difference between a compiler and interpreter?
2 Answers
+ 2
A compiler translates from High Level Language (C++, Java, C etc) to Low Level Language (Machine language - 0 1).
An Interpreter is almost the same as a compiler, except it translates the code while running.
:
A compiler translates your whole code and then runs it.
An Interpreter runs your code, translates the first line and runs it, then it goes to the second line, translates it and then runs it, and so on.
Interpreter takes less amount of time analyzing the code, but execution is slower.
Compiler takes more time analyzing the code, but the overall execution time is faster.
+ 1
Interpreter translates program one statement at a time while compiler Scans the entire program and translates it as a whole into machine code. Interpreter continues translating the program until the first error is met, in which case it stops. Hence debugging is easy while compiler generates the error message only after scanning the whole program. Hence debugging is comparatively hard. Programming language like Python, Ruby use interpreters and language like C, C++ use compilers.