What is the difference between compiler and interpreter? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the difference between compiler and interpreter?

Recently joined the challenge. Not a big fan of programming, but I wondered what actually is the compiler and interpreter? Are they same?

7th Apr 2018, 6:19 AM
Graham Damien
3 Answers
+ 5
Interpreter➡️ Translates program one statement at a time. compiler➡️ Scans the entire program and translates it as a whole into machine code. interpreter➡️ It takes less amount of time to analyze the source code but the overall execution time is slower. compiler➡️ It takes large amount of time to analyze the source code but the overall execution time is comparatively faster. interpreter➡️ No intermediate object code is generated, hence are memory efficient. compiler➡️ Generates intermediate object code which further requires linking, hence requires more memory. interpreter➡️ Continues translating the program until the first error is met, in which case it stops. Hence debugging is easy. compiler➡️ It generates the error message only after scanning the whole program. Hence debugging is comparatively hard.
7th Apr 2018, 6:34 AM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 1
A Compiler usually translates your code in CPU instructions, a interpreter just reads the code and executes it directly (which is slower than a compiled program, but maybe more flexible)
7th Apr 2018, 6:26 AM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 1
@Brains !! Thanks dude ! This is helpful for us too !!
7th Apr 2018, 6:37 AM
Aaron Stone
Aaron Stone - avatar