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

What is the difference between a compiler and interpreter?

2nd Dec 2018, 2:25 AM
Kovan Hussein
Kovan Hussein - avatar
2 Answers
+ 2
compiler converts the whole program(i.e.source code) at a time into some intermediate language before the program gets executed. So if there are any errors, the compiler displays all the errors. Interpreter directly converts one line at a time to machine code and execute it. Thus displays only one error if exist for example, java has both compiler(for security) and interpreter(for platform independency). java compiler takes the entire source code at a time as an input and generates .class file. This .class file is nothing but the bytecode. Then the java interpreter takes only one line at a time as an input from .class file and generates machine code which then gets executed
2nd Dec 2018, 2:36 AM
Rishi Anand
Rishi Anand - avatar
2nd Dec 2018, 2:44 AM
‎ ‏‏‎Anonymous Guy