Home

Transpilation

Transpilation, short for source-to-source compilation, is the process of converting code written in one high-level programming language into another high-level language at a similar level of abstraction. The goal is to preserve behavior and structure as much as possible while changing the language and often the target runtime environment. This contrasts with traditional compilation, which typically targets lower-level code such as machine language or bytecode, and with interpretation, which executes code directly without generating an alternative source form.

A transpiler typically performs parsing, an abstract syntax tree transformation, and code generation. It may adapt

Common uses include enabling developers to write code in a preferred or newer language and run it

Examples include TypeScript to JavaScript, CoffeeScript to JavaScript, and Babel-based workflows that convert modern JavaScript syntax

Limitations arise when a source language’s features do not map cleanly to the target language, which may

or
erase
types,
insert
runtime
libraries,
or
rely
on
polyfills
to
emulate
features
not
present
in
the
target
language.
The
resulting
code
is
intended
to
run
in
environments
that
support
the
target
language
or
its
ecosystem,
often
within
the
same
runtime
family
(for
example,
JavaScript
running
in
a
web
browser).
in
environments
that
only
support
an
older
or
different
language,
facilitating
backward
compatibility
or
cross-language
workflows.
Transpilers
are
also
used
during
language
migrations
and
to
leverage
ecosystem
tooling
across
languages.
(ECMAScript
2015
and
later)
into
backward-compatible
JavaScript.
Other
languages,
such
as
Elm,
Kotlin,
or
Scala,
may
compile
to
JavaScript,
while
some
transpilation
pipelines
target
intermediate
representations
for
platforms
like
WebAssembly.
require
compromises,
runtime
libraries,
or
polyfills.
Transpilation
remains
a
foundational
technique
for
modern
cross-language
development
and
web
tooling.