Ablaufschema der Compiler-Stufen: Quelltext wird zerlegt in Bausteine, dann auf Struktur geprüft, dann inhaltlich geprüft, danach in eine optimierte Zwischenform überführt und schließlich in Maschinencode für den Zielprozessor übersetzt.

Compiler

A compiler is a program that translates human-written program code into a computer's command language. Without this translation, a processor could make nothing of instructions like "if" or "print".

Humans write programs in languages that are reasonably readable. There you’ll find words like “if”, “while”, or “print”. A processor, that is, the compute chip in the device, doesn’t understand a single word of that. It only knows very simple commands as numeric patterns: add these two values, load something from memory, jump to another location. A compiler is the program that translates between these two worlds. It reads the written text and produces from it a file that the chip can execute directly.

Why software doesn’t run without translation

Without a compiler, one would have to write programs directly in numeric commands. That is indeed what was done in the 1950s, and it was extremely tedious. A single typo in a column of numbers could bring everything to a halt. Only translator programs made it possible to build software on the scale we know today. A modern operating system consists of dozens of millions of lines of code.

A second point is speed. The compiler doesn’t just translate, it also optimizes. It recognizes calculations whose result is already known in advance and carries them out right during translation. It removes code that is never reached. It reorders instructions so that the processor has to wait less. As a result, the same source code can run two or three times faster depending on the optimization level.

Third, a compiler makes the same program runnable on different devices. A chip in a Windows laptop understands different commands than the chip in an iPhone. The written code, however, remains largely the same. One simply has it translated by a suitable compiler for the respective target platform.

From source code to executable file

The translation proceeds in several stages. First, the compiler breaks the text down into individual building blocks: names, numbers, brackets, operators. Then it checks whether these building blocks form a meaningful structure, similar to a grammar check in a language class. If a closing bracket is missing, it stops here and reports the error with a line number.

If the structure is correct, the content check follows. The compiler checks, for example, whether one is trying to multiply a number by a piece of text. It finds such errors before the program has even run once. It then builds a simplified intermediate form of the program, on which the optimizations are applied. Right at the end, the actual machine code for the target processor is produced from this.

It’s important to distinguish this from an interpreter. An interpreter does not translate in advance but reads the program line by line during execution. This starts up faster and is convenient for experimenting, but usually runs more slowly. Languages like C or Rust are classically compiled, while Python works predominantly with an interpreter. The line is blurry today, because many systems compile after the fact during runtime.

Compilers in AI chips and developer tools

Compilers are rarely directly visible. But anyone who installs an app is using the result of a translation run. In development environments, a compiler often runs in the background and underlines errors as you type. The red messages that programming beginners stumble over also come from it.

The term regularly comes up in AI news. A neural network is, at its core, a huge chain of computational operations. Special compilers translate this chain into instructions for graphics cards or AI accelerators. Well-known examples are XLA from Google and the compiler component of PyTorch. They combine individual computation steps and thereby save on memory accesses.

This is exactly where an economically relevant point lies. Nvidia is, among other reasons, hard to attack precisely because its software and compiler ecosystem has been maintained for years. Competitors do deliver powerful chips, but their translation layer is often less mature. When financial news talks about a “software stack”, compilers are a central part of it.

Subscribe free. Unsubscribe the second it sucks.

High-signal news across AI, business, UX, and tech. Every morning.