Hello All, I want to know which one is better for Input program point of view between compiler and interpreter? According to this post, The interpreter takes in lines of code for analysis. but not an idea about interpreter? Can anyone explain me what’s the exact difference between them?
Compiler will overview the code without checking in every line and their definitions.
While interpreter is that strict teacher, who checks and tests line by line. Slower than compiler.
I hope this clears the doubt of difference.
@ankitdixit7890 I THINK THIS IS YOUR ANSWER
Compiler scans the entire program and translates the whole of it into machine code at once . It basically transform the code from high level language to a machine code .
It debugging is slow but executes comparatively faster
eg.- C, C++, JAVA
Source code ----------> Compiler ---------> Machine Code ----------> Output
Interpreter translates just one statement of the program at a time into machine code. Translate program one statement at a time. Considering it scans code one line at a time, errors are shown line by line. It debugging time is fast but executes less faster than compiler
eg.- Python, MATLAB
Source code ----------> Interpreter ----------> Output
Hope this helps you (Gourav Sarkar)