When you do programming, your computer does not directly understand your program. For the computer to understand it, your program needs to be translated into machine language first. This translation is handled by either a compiler or and interpreter.

This difference determines how fast programs run, how easy they are to debug, and which languages are better for certain tasks than others. After this article you will know:

What does compilation and interpretation actually mean?

Pro Contra
Easy to debug because errors are noticed immediately. Slower execution.
One step less: Program can be executed instantly after writing it. Users might need to install additional dependencies.
One step less: Program can be executed instantly after writing it. Requires an interpreter on the target system.
Platform-independent: Every system with an interpreter can run the program. Because the source code is distributed, it is easier to reverse-engineer or copy.

How do compilers and interpreters operate?

Compiler:

A compiler reads your source code, checks it for correctness (both syntactically and semantically), optimizes it, and foutputs a standalone executable.

Interpreter:

An interpreter reads your source code and executes it line by line. It performs many of the same checks as a compiler but instead of giving the user a binary file, it runs the source directly.

JIT: Just-in-Time compilation:

Just-In-Time (JIT) compilation is a hybrid approach that combines features of interpreters and compilers. Instead of compiling the whole program before or interpreting it line by line during execution, a JIT compiler begins by interpreting the code or executing it in an intermediate form, such as bytecode. While the program runs, the system identifies frequently used sections—called "hot spots". Then it compiles only those hot spots into optimized machine code while the program is still running. A popular example for this is Java's JVM (Java Virtual Machine).

Which popular programming languages use which method?

Programming Language Type
CCompiled
C++Compiled
PythonInterpreted
JavaJIT
JavaScriptInterpreted
GoCompiled
AssemblyCompiled
PHPInterpreted
SwiftCompiled
RubyInterpreted
RustCompiled
MATLABInterpreted
ScratchInterpreted
RInterpreted
PerlInterpreted
Objective-CCompiled
BashInterpreted
LuaInterpreted
C#JIT