Also known as: compiler, AOT compiler
A compiler is a program that translates source code written for humans into a form a machine can run — typically native machine code — doing the work ahead of time, before the program is ever executed.1
How it works
A compiler reads the entire source program, checks it (including its types), and emits an equivalent program in a lower-level language. Classic ahead-of-time (AOT) compilers such as those for C, C++, Rust, and Go produce native machine code packaged as an executable. Other compilers target bytecode for a virtual machine instead. Along the way the compiler optimizes — inlining calls, vectorizing loops, eliminating dead code — so the output often runs far faster than a naive translation would.1
Trade-offs
Because the translation happens once, the CPU runs native instructions with no per-operation overhead, and performance is predictable from run to run. The price is a build step between editing and running, and output that is usually tied to one platform — a binary built for x86-64 Linux will not run on an ARM Mac without recompiling (see cross-compilation).1 This contrasts with an interpreter, which skips the build step but pays overhead on every run, and with JIT compilation, which moves the translation to run time.
In practice
Compiled languages dominate systems software, where speed and a self-contained static binary matter. GopherTrunk is compiled by the Go toolchain into a single native executable, which is why it ships without requiring any runtime on the target machine.