Show in graph
λ

Software → Programming Languages

Compiler

A program that translates source code into another form such as machine code, bytecode, or an intermediate representation.

Compiler diagram

Motivation

A compiler solves the problem of turning human-readable source code into a form a machine or runtime can execute efficiently.

Where it fits

Compilers belong to programming languages and connect source code, syntax, semantics, intermediate representations, bytecode, and machine code.

Mental model

A compiler is a translator with several stages: parse the program, understand its structure, check rules, optimize, and emit lower-level code.

Common mistakes

  • Thinking compilation is just text replacement.
  • Confusing compilers with interpreters.
  • Ignoring type checking, optimization, and code generation.

Interpreter, parser, AST, bytecode, runtime, machine code.