Skip to main content

Interpreter

In Turkish
Yorumlayıcı
Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/interpreter

In short

An interpreter is a program that runs source code directly, step by step, instead of first translating the whole program into a separate executable file.

What is an interpreter?

An interpreter executes a program by reading its code and carrying out each instruction as it goes, rather than producing a standalone executable file first. You hand it a script, and it starts running right away. Python, Ruby, PHP, JavaScript and shell languages like Bash are usually run by interpreters, which is why they are often called interpreted languages.

Very few modern interpreters run raw source text line by line. Most first parse the code into a tree, and many then compile it into bytecode, a compact set of instructions for a virtual machine, which the interpreter's main loop executes. CPython works this way, and JavaScript engines like V8 go further with just-in-time (JIT) compilation, turning frequently run code into native machine code while the program runs. Many interpreters also offer a REPL (read-eval-print loop), an interactive prompt where you type one line and see the result immediately.

An interpreter is like a live interpreter at a conference who translates a speech sentence by sentence as it is given, while a compiler is like a translator who converts a whole book before it is published. Interpretation makes the edit-and-run cycle fast and lets the same script run on any machine that has the interpreter installed, at the cost of slower execution and errors that only appear when the faulty line actually runs.

Interpreter vs compiler describes an implementation, not a language. The same language can be handled both ways: Java is compiled to bytecode that the JVM then interprets and JIT-compiles, and Python has both the CPython interpreter and ahead-of-time compilers. So "interpreted language" is shorthand for how a language is usually run, not a strict rule.

Key takeaways

  • An interpreter runs code directly, without producing a separate executable first.
  • Most interpreters parse code and run bytecode on a virtual machine rather than raw text.
  • JIT compilation inside an interpreter turns hot code into fast machine code at runtime.
  • Interpreted code is quick to change and test but usually runs slower than compiled code.
  • Being compiled or interpreted describes an implementation, not the language itself.

Example

A tiny stack-based interpreter in Pythonpython
# Read each instruction and carry it out immediately
program = ["push 2", "push 3", "add", "print"]
stack = []

for line in program:
    op, *args = line.split()
    if op == "push":
        stack.append(int(args[0]))
    elif op == "add":
        stack.append(stack.pop() + stack.pop())
    elif op == "print":
        print(stack[-1])  # 5

Readers ask

What is the difference between an interpreter and a compiler?

A compiler translates the whole program ahead of time into another form, such as machine code, and you run the result later. An interpreter executes the program directly, translating as it goes, so there is no separate build step.

Is Python interpreted?

The standard implementation, CPython, compiles source code to bytecode and then interprets that bytecode in a virtual machine. From a developer's point of view it behaves like an interpreted language, because you run the .py file directly.

What is a REPL?

A REPL, short for read-eval-print loop, is an interactive prompt provided by many interpreters. It reads one expression, evaluates it, prints the result and waits for the next, which makes it handy for experimenting.

Often compared

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings