Compiler vs Interpreter
A compiler translates the whole program before running it; an interpreter translates and runs it line by line.
Compiler
Translates all the source code into machine code first.
Interpreter
Reads and runs the source code one statement at a time.
| Compiler | Interpreter | |
|---|---|---|
| Speed of the finished program | Usually faster | Usually slower |
| Errors reported | All together, before running | One at a time, while running |
| Examples | C, C++ | Python (mostly), JavaScript (traditionally) |
Example
Python stops at the first line with an error and shows it; a C compiler lists every error before anything runs.