Compiler:
Interpreter:
An interpreter reads the source code of your program one line at a time, executing the specific instructions contained in that line.
In general, an interpreted program runs slower than a compiled program. Remember, a compiler converts a program's source code into object code that a computer can execute directly. Therefore,
compilation is a one-time cost, while interpretation incurs an overhead each time a program is run.
- Compiler reads the entire program and converts it into object code, which is a translation of the program's source code into a form that the computer can execute directly.
- Object code is also referred to as binary code or machine code.
- Once the program is compiled, a line of source code is no longer meaningful in the execution of your program.
Interpreter:
An interpreter reads the source code of your program one line at a time, executing the specific instructions contained in that line.
In general, an interpreted program runs slower than a compiled program. Remember, a compiler converts a program's source code into object code that a computer can execute directly. Therefore,
compilation is a one-time cost, while interpretation incurs an overhead each time a program is run.