Home

compiler

A compiler is a program that translates source code written in a programming language into a target representation, usually executable machine code, assembly, or an intermediate form such as bytecode. The translation aims to preserve program semantics while producing efficient code. Compilers enable software to run on different hardware platforms and to exploit performance optimizations.

A typical compiler has a front end, a middle end, and a back end. The front end

Some languages are compiled to native machine code, others to portable bytecode run by a virtual machine.

Historically, the development of compilers began in the 1950s, with early work credited to Grace Hopper and

performs
lexical
analysis
and
parsing,
followed
by
semantic
analysis
and
type
checking;
it
builds
internal
structures
such
as
a
symbol
table
and
an
abstract
syntax
tree.
The
middle
end
applies
optimizations
on
an
intermediate
representation.
The
back
end
translates
the
IR
into
target
code
and
handles
tasks
like
register
allocation
and
instruction
selection.
There
are
ahead-of-time
compilers
and
just-in-time
compilers,
and
many
systems
combine
both
approaches.
Languages
such
as
C
and
C++
are
usually
compiled
to
native
code,
while
Java
and
C#
are
typically
compiled
to
bytecode
and
then
JIT-compiled.
others
on
the
first
compiler
for
COBOL-like
languages.
Since
then,
compiler
theory
has
shaped
language
design
and
computer
architecture,
enabling
portability,
higher-level
abstractions,
and
aggressive
optimizations.
Limitations
include
the
difficulty
of
ensuring
correctness
across
optimizations,
long
compile
times
for
large
programs,
and
the
challenge
of
generating
efficient
code
for
many
architectures.
See
also:
cross-compiler,
just-in-time
compilation.