A diagram of the operation of a typical multi-
language, multi-target compiler.
A compiler is a computer program (or set
of programs) that transforms source code
written in a computer language (the source
language) into another computer language
(the target language, often having a binary
form known as object code). The most com-
mon reason for wanting to transform source
code is to create an executable program.
The name "compiler" is primarily used for
programs that translate source code from a
high-level programming language to a lower
level language (e.g., assembly language or
machine code). A program that translates
from a low level language to a higher level
one is a decompiler. A program that trans-
lates between high-level languages is usually
called a language translator, source to source
translator, or language converter. A language
rewriter is usually a program that translates
the form of expressions without a change of
A compiler is likely to perform many or all
of the following operations: lexical analysis,
preprocessing, parsing, semantic analysis,
code generation, and code optimization.
Program faults caused by incorrect com-
piler behavior can be very difficult to track
down and work around and compiler imple-
mentors invest a lot of time ensuring the cor-
rectness of their software.
The term compiler-compiler is sometimes
used to refer to a parser generator, a tool of-
ten used to help create a compiler.
Software for early computers was primarily
written in assembly language for many years.
Higher level programming languages were
not invented until the benefits of being able
to reuse software on different kinds of CPUs
started to become significantly greater than
the cost of writing a compiler. The very lim-
ited memory capacity of early computers also
created many technical problems when im-
plementing a compiler.
Towards the end of the 1950s, machine-in-
first proposed. Subsequently, several experi-
mental compilers were developed.