Skip to main content

Interpretation

Interpretation executes a program directly from source or bytecode without an ahead-of-time native build, favoring immediacy and portability over raw speed.

Interpretation is a way of running a program in which an interpreter reads the source code (or a parsed/bytecode form of it) and executes it directly, rather than translating the whole program into native machine code beforehand. The interpreter is itself a program that processes instructions on the fly.

How It Works

A pure interpreter reads each construct and immediately performs the corresponding action. In practice, most modern "interpreted" languages first compile source to a compact bytecode, which a virtual machine then interprets — Python and Ruby work this way. Many such runtimes also include a just-in-time (JIT) compiler that detects frequently executed code and compiles it to native machine code while the program runs, blurring the line between interpretation and compilation. Because execution happens directly from source, there is no separate, platform-specific binary to build.

Why It Matters

Interpretation offers immediacy and flexibility. There is no build step, so the edit-run cycle is fast, which suits scripting, exploratory programming, and interactive shells (REPLs). The same source can run on any platform that has the interpreter, aiding portability. Interpretation also enables dynamic features like evaluating code generated at run time.

The trade-off is performance: interpreting instructions adds overhead, so naively interpreted code is slower than compiled code, and errors that a compiler would catch up front may only appear at run time. JIT compilation and bytecode caches substantially close the performance gap for mature runtimes.

Related Terms

Compilation translates code ahead of execution. Dynamic typing is common in interpreted languages. The type system is often enforced at run time, and the runtime manages concurrency.