Interpreter
In one line
An interpreter is a program that reads and executes source code directly, line by line, at runtime.
In simple words
An interpreter reads your source code and executes it directly, one statement at a time, without producing a separate machine code file. The interpretation happens while the program is running.
The advantage is flexibility: you can run code immediately without a compilation step, test snippets interactively, and modify code without rebuilding. This makes development faster and more interactive. The disadvantage is speed — interpreting code at runtime is slower than running pre-compiled machine code.
Interpreted languages include Python, JavaScript, Ruby, and PHP. Many modern languages use a hybrid approach: JavaScript is interpreted (or JIT-compiled), Python compiles to bytecode which is then interpreted, and Java compiles to bytecode which is JIT-compiled.
Example
# Run a Python script directly (interpreted)
$ python program.py
Hello, World!
# No compilation step needed —
# the interpreter reads and executes immediatelyPython reads program.py and executes each line directly. No separate compilation step is needed.
Common confusions
Confused with: compiler
The difference: An interpreter executes code line-by-line at runtime (no separate build step); a compiler translates all code to machine code before execution (faster but requires compilation).
Related terms
Related Resources
Related Lessons
- How Programs Work
Learn about compilers and interpreters.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.