LCC ("Local C Compiler" or "Little C Compiler") is a small,
retargetable compiler
In software engineering, retargeting is an attribute of software development tools that have been specifically designed to generate code for more than one computing platform.
Compilers
A retargetable compiler is a compiler that has been designed ...
for the
ANSI C
ANSI C, ISO C, and Standard C are successive standards for the C programming language published by the American National Standards Institute (ANSI) and ISO/IEC JTC 1/SC 22/WG 14 of the International Organization for Standardization (ISO) and the ...
programming language. Although its source code is available at no charge for personal use, it is not
open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
or
free software
Free software, libre software, libreware sometimes known as freedom-respecting software is computer software distributed open-source license, under terms that allow users to run the software for any purpose as well as to study, change, distribut ...
according to the usual definitions because products derived from LCC may not be sold, although components not derived from LCC may be sold.
It was developed by
Chris Fraser
Christopher Neil Fraser (born 15 July 1974) is a British-born Australian businessman. Born in the UK and brought up in Australia, Fraser was an investment banker, before becoming chief executive (CEO) of Sirius Minerals.
Fraser was born in Yeo ...
and
David Hanson.
LCC
LCC is intended to be very simple to understand and is well-documented; its design is described in Fraser and Hanson's book ''A Retargetable C Compiler: Design and Implementation''. The book includes most of the source code for version 3.6 of the compiler, which was written as a
literate program using
noweb
Noweb, stylised in lowercase as noweb, is a literate programming tool, created in 1989–1999 by Norman Ramsey, and designed to be simple, easily extensible and language independent.
As in WEB and CWEB, the main components of Noweb are two prog ...
. As of July 2011 the current version of LCC is 4.2, but much of the book still applies to this version. The major change since the book was published is in the code-generator interface, which is described in a separate document.
The source code for LCC is around 20,000 lines, which is much smaller than many major compilers.
LCC can generate code for several processor architectures, including
Alpha
Alpha (uppercase , lowercase ) is the first letter of the Greek alphabet. In the system of Greek numerals, it has a value of one. Alpha is derived from the Phoenician letter ''aleph'' , whose name comes from the West Semitic word for ' ...
,
SPARC,
MIPS, and
x86
x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel, based on the 8086 microprocessor and its 8-bit-external-bus variant, the 8088. Th ...
; there is also an LCC backend that generates Microsoft's
Common Intermediate Language
Common Intermediate Language (CIL), formerly called Microsoft Intermediate Language (MSIL) or Intermediate Language (IL), is the intermediate language binary instruction set defined within the Common Language Infrastructure (CLI) specification. ...
.
Projects incorporating LCC
Quake 3
id Software
id Software LLC () is an American video game developer based in Richardson, Texas. It was founded on February 1, 1991, by four members of the computer company Softdisk: game programmer, programmers John Carmack and John Romero, game designer T ...
's
id Tech 3
id Tech 3, popularly known as the ''Quake III Arena'' engine, is a game engine developed by id Software for its 1999 game ''Quake III Arena''. It has subsequently been used in numerous games. Commercially, id Tech 3 competed with early version ...
engine
An engine or motor is a machine designed to convert one or more forms of energy into mechanical energy.
Available energy sources include potential energy (e.g. energy of the Earth's gravitational field as exploited in hydroelectric power ge ...
relies on a modified version of LCC to compile the source code of each game module or third-party
mod
Mod, MOD or mods may refer to:
Places
* Modesto City–County Airport, Stanislaus County, California, US
Arts, entertainment, and media Music
* Mods (band), a Norwegian rock band
* M.O.D. (Method of Destruction), a band from New York City, US
* ...
into
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 ...
targeting its
virtual machine
In computing, a virtual machine (VM) is the virtualization or emulator, emulation of a computer system. Virtual machines are based on computer architectures and provide the functionality of a physical computer. Their implementations may involve ...
. This means that modules are oblivious to the system beyond the
system call
In computing, a system call (syscall) is the programmatic way in which a computer program requests a service from the operating system on which it is executed. This may include hardware-related services (for example, accessing a hard disk drive ...
s and limited
file system scope offered by the engine, which is intended to reduce the threat posed by malicious mod authors. Another consideration is that games and mods written for the engine are
portable
Portable may refer to:
General
* Portable building, a manufactured structure that is built off site and moved in upon completion of site and utility work
* Portable classroom, a temporary building installed on the grounds of a school to provide a ...
without recompilation; only the virtual machine needs to be
ported
In software engineering, porting is the process of adapting software for the purpose of achieving some form of execution in a computing environment that is different from the one that a given program (meant for such execution) was originally desig ...
to new platforms in order to execute the modules.
lcc-win
lcc-win32 is an
integrated development environment
An integrated development environment (IDE) is a Application software, software application that provides comprehensive facilities for software development. An IDE normally consists of at least a source-code editor, build automation tools, an ...
package for
Microsoft Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
which includes a
fork
In cutlery or kitchenware, a fork (from 'pitchfork') is a utensil, now usually made of metal, whose long handle terminates in a head that branches into several narrow and often slightly curved tines with which one can spear foods either to h ...
of LCC. An
amd64
x86-64 (also known as x64, x86_64, AMD64, and Intel 64) is a 64-bit extension of the x86 instruction set. It was announced in 1999 and first available in the AMD Opteron family in 2003. It introduces two new operating modes: 64-bit mode an ...
counterpart named lcc-win64 exists, which has been available since April 15, 2012.
Pelles C
Pelles C
The Fisher King (; ; ; ) is a figure in Arthurian legend, the last in a long line of British kings tasked with guarding the Holy Grail. The Fisher King is both the protector and physical embodiment of his lands, but a wound renders him impotent ...
's compiler is a heavily modified version of LCC providing
C11 as well as
C17 support, amd64 support, additional optimisation techniques such as
inline expansion
In computing, inline expansion, or inlining, is a manual or compiler optimization that replaces a function call site with the body of the called function. Inline expansion is similar to macro expansion, but occurs during compiling, without cha ...
Pelles C Overview
/ref> and an IDE.
MathWorks
For 32-bit Windows machines, Lcc is used as a default if no other compiler is installed for MathWorks
The MathWorks, Inc. is an American privately held corporation that specializes in mathematical computing software. Its major products include MATLAB and Simulink, which support data analysis and simulation.
History
MATLAB was created in the 1 ...
MATLAB
MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementat ...
and related products.
License
LCC is free for personal use and may be redistributed provided all distribution media and product documentation acknowledges it. The LCC license relies on examples in multiple cases. LCC may not be sold for profit, but it may be included with other software that is sold for profit, provided LCC itself is distributed for free. Per user and unlimited use licenses are available by contacting Addison-Wesley, in particular for compilers of languages such as C++ for which a C compiler may constitute much of its work.
See also
* Tiny C Compiler
The Tiny C Compiler, TCC, tCc, or TinyCC is a x86 (32-bits), X86-64 and ARM processor C compiler initially written by Fabrice Bellard. It is designed to work for slower computers with little disk space (e.g. on rescue disks). Windows operati ...
* Portable C compiler
The Portable C Compiler (also known as pcc or sometimes pccm - portable C compiler machine) is an early compiler for the C programming language written by Stephen C. Johnson of Bell Labs in the mid-1970s, based in part on ideas proposed by Alan ...
* Small-C
Small-C is both a subset of the C programming language, suitable for resource-limited microcomputers and embedded systems, and an implementation of that subset. Originally valuable as an early compiler for microcomputer systems available during t ...
*Comparison of integrated development environments
The following tables list notable software packages that are nominal IDEs; standalone tools such as source-code editors and GUI builders are not included. These IDEs are listed in alphabetic order of the supported language.
ActionScript
A ...
References
External links
Official Pelles C IDE homepage
Bibliography
*
{{CProLang
C (programming language) compilers