In computing, a translator is any tool that converts source code from one representation to another. While developers use these tools daily, the distinctions between them are often blurred. Here's a clear breakdown of the major types, how they work, and why they matter.
| Type | What It Does | Typical Examples |
|---|---|---|
| Compiler | Translates high-level source code into machine code or bytecode before execution (ahead-of-time). | GCC, javac, rustc |
| Interpreter | Executes high-level code line-by-line at runtime without producing a separate binary artifact. | CPython, Ruby MRI, Node.js (V8 uses JIT compilation) |
| Transpiler (Source-to-Source Compiler) | Converts code from one high-level language to another. | Babel (ES6→ES5), TypeScript Compiler, Dart2JS |
| Virtual Machine (VM) | Runs bytecode on an abstract machine, providing portability across hardware. | JVM, CLR (.NET), WebAssembly runtime |
| Code Generator | Produces source code from a specification, model, or schema. | Yeoman, Swagger Codegen, GraphQL Codegen |
| Decompiler | Attempts to reconstruct high-level source from binary or bytecode. | Ghidra, IDA Pro, CFR, Fernflower |
The lines have shifted. Many "interpreters" now JIT-compile hot paths (V8, PyPy, LuaJIT). Many "compilers" target an intermediate representation like LLVM IR rather than raw machine code. The spectrum is continuous—what matters is when and how translation happens, not the label.