Study Atlas › Computer Science › Programming languages

Compilers

Programs that translate source code into machine code through lexing, parsing, analysis, optimisation and code generation.

Edited by Alex C, EduAlx · Sources cited below

Explanation

Hopper's A-0 (1952) and Backus's FORTRAN compiler (1957) began the field. Chomsky's grammar hierarchy and Backus–Naur form describe syntax. LLVM (Lattner, 2003 onward) is a widely used modern compiler infrastructure. Interpreters and JIT compilers (V8, JVM HotSpot) are related approaches.

Example

x = a + b * 2 becomes tokens, then a syntax tree, then instructions such as MUL, ADD, STORE.

How it works, step by step

  1. Lexical analysis: characters → tokens
  2. Parsing: tokens → syntax tree
  3. Semantic analysis: types and scopes
  4. Intermediate representation and optimisation
  5. Code generation for the target machine

Open the interactive page with diagrams →

People behind it

References

  1. J. W. Backus et al., Proc. Western Joint Computer Conf. 1957, 188–198.
  2. N. Chomsky, IRE Trans. Inf. Theory 1956, 2, 113–124.

Textbooks

Related topics

Programming paradigmsMachine learningNeural networks and backpropagationPublic-key cryptography (Diffie–Hellman, RSA)Transformers and large language modelsInformation theory and entropyArtificial intelligence: search and the Turing testWorld Wide Web, HTTP and HTMLSoftware engineering and version controlComputer networks and the TCP/IP model