A transpiler:
- takes code in one high-level language
- rewrites it into another high-level language
- while preserving semantics
Classic examples:
- TypeScript → JavaScript
- Modern JS → older JS
- Wasm → C
- DSL → Rust
What an interpreter is
An interpreter is a program that executes another program directly, instruction by instruction, without first translating it into a different executable form.
In one line:
Interpreter = “read instruction → perform its meaning → repeat.”
The core execution loop (the essence)
Almost every interpreter boils down to something like:
while not halted:
instr = fetch(pc)
state = execute(instr, state)
pc = next(pc)What “state” means here
The interpreter updates some abstract machine state, depending on the language:
- Program counter
- Stack (Wasm)
- Registers (RISC-V)
- Memory
- Call stack
- Locals / globals
For example:
- WebAssembly interpreter → stack + locals
- RISC-V interpreter → registers + PC
| Thing | Input | Output | What happens |
|---|---|---|---|
| Interpreter | Program | Result | Executes directly |
| Compiler | Program | Program | Produces executable |
| Transpiler | Program | Program | Rewrites language |
| JIT | Program | Program | Compiles during execution |
Interpreter in VM and zkVM contexts
This is where it gets interesting.
In zk systems:
- You cannot just run the program
- You must prove that you ran it correctly
So many zkVMs do this:
“Interpreter, but constrained.”
That means:
- Each interpreter step becomes a trace row
- “Execute” becomes algebraic constraints
This is exactly how systems like OpenVM think about execution.
Interpreter vs runtime (how they relate)
Interpreter
- Executes instructions
- Defines how each instruction updates state
- Has the main execution loop
Think:
“Given this instruction, what happens now?”
Runtime
- The whole environment a program runs in
- Usually includes:
- interpreter (or JIT)
- memory management
- stack / call frames
- syscalls / host functions
- standard library support
Concrete examples
WebAssembly
- Runtime: Wasmtime, Wasmer
- Interpreter: the component that executes Wasm bytecode
- Also includes:
- host functions
- linear memory
- module instantiation
RISC-V
- Interpreter/emulator: Spike, QEMU
- Runtime: OS + loader + syscall layer
The interpreter alone can’t run real programs without runtime support.