An incremental compiler is a kind of
incremental computation applied to the field of
compilation. Quite naturally, whereas ordinary compilers make a so-called clean build, that is, (re)build all program modules, an incremental compiler recompiles only modified portions of a program.
Definition
Imperative programming
In
imperative programming
In computer science, imperative programming is a programming paradigm of software that uses Statement (computer science), statements that change a program's state (computer science), state. In much the same way that the imperative mood in natural ...
and
software development
Software development is the process of designing and Implementation, implementing a software solution to Computer user satisfaction, satisfy a User (computing), user. The process is more encompassing than Computer programming, programming, wri ...
, incremental compilation takes only the ''changes'' of a known set of
source file
In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer.
Since a computer, at base, onl ...
s and ''updates'' any corresponding output files (in the compiler's target language, often
bytecode
Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normal ...
) that may already exist from previous compilations.
By effectively ''building upon'' previously compiled output files, an incremental compiler avoids the wasteful recompiling of entire source files, where most of the code remains unchanged. For most incremental compilers, compiling a program with small changes to its source code is usually near instantaneous.
It can be said that an incremental compiler reduces the
granularity
Granularity (also called graininess) is the degree to which a material or system is composed of distinguishable pieces, "granules" or "grains" (metaphorically).
It can either refer to the extent to which a larger entity is subdivided, or the ...
of a language's traditional compiling units while maintaining the language's
semantics
Semantics is the study of linguistic Meaning (philosophy), meaning. It examines what meaning is, how words get their meaning, and how the meaning of a complex expression depends on its parts. Part of this process involves the distinction betwee ...
, such that the compiler can append and replace smaller parts.
Many
programming tool
A programming tool or software development tool is a computer program that is used to develop another computer program, usually by helping the developer manage computer files. For example, a programmer may use a tool called a source code editor ...
s take advantage of incremental compilers to provide developers with a much more interactive programming environment. It is not unusual that an incremental compiler is invoked for ''every'' change of a source file, such that the developer is almost immediately informed about any
compilation error Compilation error or compile error refers to a state when a compiler fails to compile a piece of computer program source code, either due to errors in the code, or, more unusually, due to errors in the compiler itself. A compilation error message of ...
s that would arise as a result of their changes to the code. This scheme, in contrast with traditional compilation, shortens a programmer's development cycle significantly, because they would no longer have to wait for a long compile process before being informed of errors.
One downside to this type of incremental compiler is that it cannot easily
optimize the code that it compiles, due to locality and the limited scope of what is changed. This is usually not a problem, because for optimization is usually only carried out on
release
Release may refer to:
* Art release, the public distribution of an artistic production, such as a film, album, or song
* Legal release, a legal instrument
* News release, a communication directed at the news media
* Release (ISUP), a code to i ...
, an incremental compiler would be used throughout development, and a standard batch compiler would be used on release.
Interactive programming
In the
interactive programming
Interactive programming is the procedure of writing parts of a program while it is already active. This focuses on the program text as the main interface for a running process, rather than an interactive application, where the program is desig ...
paradigm, e.g. in
Poplog related literature,
[http://www.cs.bham.ac.uk/research/projects/poplog/primer/node14.html , teaching primer to Poplog] and an interactive compiler refers to a compiler that is actually a part of the
runtime system
In computer programming, a runtime system or runtime environment is a sub-system that exists in the computer where a program is created, as well as in the computers where the program is intended to be run. The name comes from the compile time ...
of the source language. The compiler can be invoked at runtime on some source code or data structure managed by the program, which then produces a new compiled program fragment containing
machine code
In computer programming, machine code is computer code consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). For conventional binary computers, machine code is the binaryOn nonb ...
that is then immediately available for use by the runtime system. If the newly compiled fragment replaces a previous compiled procedure the old one will be
garbage collected. This scheme allows for a degree of
self-modifying code
In computer science, self-modifying code (SMC or SMoC) is source code, code that alters its own instruction (computer science), instructions while it is execution (computing), executing – usually to reduce the instruction path length and imp ...
and requires
metaprogramming
Metaprogramming is a computer programming technique in which computer programs have the ability to treat other programs as their data. It means that a program can be designed to read, generate, analyse, or transform other programs, and even modi ...
language features. The ability to add, remove and delete code while running is known as
hot swapping
Hot swapping is the replacement or addition of components to a computer system without stopping, shutting down, or rebooting the system. Hot plugging describes only the addition of components to a running computer system. Components which ha ...
. Some interactive programming platforms mix the use of interpreted and compiled code to achieve the illusion that any changes to code are accessible by the program immediately.
List of incremental compilers
;Imperative and functional languages:
* The PECAN Programming Environment Generator was an incremental compiler, developed by Steven P. Reiss in the early 1980s.
*
GNU Compiler Collection
The GNU Compiler Collection (GCC) is a collection of compilers from the GNU Project that support various programming languages, Computer architecture, hardware architectures, and operating systems. The Free Software Foundation (FSF) distributes ...
has branched off its development with th
IncrementalCompilerproject, concentrating in providing
C/
C++ with a fast incremental compiler
* The
Eclipse
An eclipse is an astronomical event which occurs when an astronomical object or spacecraft is temporarily obscured, by passing into the shadow of another body or by having another body pass between it and the viewer. This alignment of three ...
platform has included an incremental compiler for
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
as a part of the ''Java Development Tools'' project
* The
Gradle
Gradle is a build automation tool for multi-language software development. It manages tasks like compilation, packaging, testing, deployment, and publishing. Supported languages include Java (as well as JDK-based languages Kotlin, Groovy, Sc ...
build tool has supported incremental Java compilation since version 2.1.
*
IBM VisualAge
VisualAge is a family of computer integrated development environments from IBM, which supports multiple programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in ...
C++ compiler 4.0
*
Embarcadero Delphi
Delphi is a general-purpose programming language and a software product that uses the Delphi dialect of the Object Pascal programming language and provides an integrated development environment (IDE) for rapid application development of desktop ...
* The
.NET Compiler Platform (
C# and
Visual Basic .NET
Visual Basic (VB), originally called Visual Basic .NET (VB.NET), is a multi-paradigm, object-oriented programming language developed by Microsoft and implemented on .NET, Mono, and the .NET Framework. Microsoft launched VB.NET in 2002 as the ...
)
*
Rust
Rust is an iron oxide, a usually reddish-brown oxide formed by the reaction of iron and oxygen in the catalytic presence of water or air moisture. Rust consists of hydrous iron(III) oxides (Fe2O3·nH2O) and iron(III) oxide-hydroxide (FeO(OH) ...
*
Go
*
Forth
*
Ceylon
Sri Lanka, officially the Democratic Socialist Republic of Sri Lanka, also known historically as Ceylon, is an island country in South Asia. It lies in the Indian Ocean, southwest of the Bay of Bengal, separated from the Indian subcontinent, ...
*
OCaml
OCaml ( , formerly Objective Caml) is a General-purpose programming language, general-purpose, High-level programming language, high-level, Comparison of multi-paradigm programming languages, multi-paradigm programming language which extends the ...
*
GNAT
GNAT is a free-software compiler for the Ada programming language which forms part of the GNU Compiler Collection (GCC). It supports all versions of the language, i.e. Ada 2012, Ada 2005, Ada 95 and Ada 83. Originally its ...
, the GNU Ada compiler
*
PTC ObjectAda
;Interactive environments and runtime systems:
*
Poplog (its core language
POP-11
POP-11 is a Reflective programming, reflective, Dynamic compilation, incrementally compiled programming language with many of the features of an interpreted language. It is the core language of the Poplog Computer programming, programming system ...
and its predecessor
POP-2)
* Versions of
Lisp
Lisp (historically LISP, an abbreviation of "list processing") is a family of programming languages with a long history and a distinctive, fully parenthesized Polish notation#Explanation, prefix notation.
Originally specified in the late 1950s, ...
:
**
Steel Bank Common Lisp
Steel Bank Common Lisp (SBCL) is a free and open-source Common Lisp implementation that features a high-performance native compiler, Unicode support and threading. It is open source software, with a permissive license. In addition to the compile ...
**
Carnegie Mellon University Common Lisp
**
Scieneer Common Lisp
** GNU
CLISP
CLISP is an implementation of the programming language Common Lisp originally developed by Bruno Haible and Michael Stoll for the Atari ST. Today it supports the Unix and Microsoft Windows operating systems.
CLISP includes an interpreter, a bytec ...
**
Franz Allegro Common Lisp
* Versions of
Scheme:
**
Ikarus
**
Chez Scheme
* Versions of
Prolog
Prolog is a logic programming language that has its origins in artificial intelligence, automated theorem proving, and computational linguistics.
Prolog has its roots in first-order logic, a formal logic. Unlike many other programming language ...
:
**
SWI-Prolog
SWI-Prolog is a free implementation of the programming language Prolog, commonly used for teaching and semantic web applications. It has a rich set of features, libraries for constraint logic programming, multithreading, unit testing, GUI, int ...
**
Yap Prolog
**
XSB
* Versions of
ML:
**
Standard ML of New Jersey
Standard ML of New Jersey (SML/NJ; Standard Meta-Language of New Jersey) is a compiler and integrated development environment for the programming language Standard ML. It is written in Standard ML, except for the runtime system in C language. It ...
(
Bell Labs
Nokia Bell Labs, commonly referred to as ''Bell Labs'', is an American industrial research and development company owned by Finnish technology company Nokia. With headquarters located in Murray Hill, New Jersey, Murray Hill, New Jersey, the compa ...
' headquarters resides in
New Jersey
New Jersey is a U.S. state, state located in both the Mid-Atlantic States, Mid-Atlantic and Northeastern United States, Northeastern regions of the United States. Located at the geographic hub of the urban area, heavily urbanized Northeas ...
)
**
Poplog ML
See also
*
Dynamic compilation
Dynamic compilation is a process used by some programming language implementations to gain performance during program execution. Although the technique originated in Smalltalk,Peter L. Deutsch and Alan Schiffman. "Efficient Implementation of the S ...
* {{section link, Hot swapping, Software
*
Incremental build (build system) An incremental build is a process within a build system where build tools use an incremental compiler to recompile only the parts of a software project that have changed since the last build, rather than rebuilding everything from scratch. This o ...
References
External links
Dr. Dobb's Journal about making an incremental C++ compiler Eds.
D. Sleeman and N. Bernsen, Lawrence Erlbaum, 1992, pp 203–231
Compilers
Incremental computing