Embeddable Common Lisp (often abbreviated ECL) is an implementation of the ANSI Common Lisp language standard that is designed for easy integration into applications written in C, C++, and other compiled languages. ECL provides a complete Common Lisp system, a byte‑code interpreter, a native code compiler that generates C source, and a dynamic library interface that allows a Lisp environment to be loaded and controlled from a host program.
Key characteristics
- Standard compliance – ECL implements the full ANSI Common Lisp language, including the standard macro system, the condition system, and the Common Lisp Object System (CLOS).
- Embeddability – The system can be built as a shared or static library (
libecl). Host programs link against this library and invoke functions such ascl_bootto start a Lisp runtime, evaluate forms, and call back into the host. - Native compilation – Lisp source is compiled to portable C code, which is then compiled with the host’s C compiler. This approach permits the generated code to be linked directly into the host binary, producing a single executable without a separate Lisp runtime.
- Garbage collection – By default ECL uses the Boehm–Conservative Garbage Collector, but alternative collectors (e.g., the integrated generational GC) can be selected at build time.
- Foreign Function Interface (FFI) – ECL includes a built‑in FFI that enables direct calls to C functions and the manipulation of C data structures from Lisp code, and vice‑versa.
- Portability – ECL runs on major operating systems, including Linux, macOS, Windows, and the BSD family, and supports a wide range of CPU architectures (x86, x86‑64, ARM, PowerPC, etc.).
- Small footprint – The runtime is intentionally lightweight; typical builds require only a few megabytes of memory, making ECL suitable for resource‑constrained environments.
Implementation overview
ECL’s compilation pipeline consists of:
- Front‑end parser – Reads Common Lisp source and produces an abstract syntax tree.
- Byte‑code compiler – Translates the tree into ECL’s own byte‑code, which can be interpreted by the runtime for rapid development cycles.
- C back‑end – Optionally translates the byte‑code into C source files; these files are compiled by the system’s C compiler to produce native object code.
- Linkage – The generated objects are linked either into a shared library (
libecl.so/ecl.dll) or directly into the host application.
The runtime includes a compact representation of Lisp objects, a small interpreter loop for byte‑code execution, and support for dynamic loading of compiled modules at runtime.
History and development
The ECL project began in the mid‑1990s as an effort to create a Common Lisp system that could be readily embedded in other software. Development has been carried out by a community of contributors; the primary maintainer has historically been José Antonio Gómez‑Llorente, although the project now accepts patches and enhancements from a broader open‑source community. Regular releases are made available on the official project website and via common package managers (e.g., apt, brew, conda).
Typical usage scenarios
- Scripting extensions – Applications embed ECL to provide a Lisp‑based scripting language for user‑customizable behavior.
- Rapid prototyping – Developers use the byte‑code interpreter for interactive development and then compile performance‑critical sections to native code.
- Research and education – The small size and easy build process make ECL a convenient platform for teaching Lisp concepts and experimenting with language extensions.
- Cross‑language integration – Projects that need to interface Lisp with existing C or C++ codebases benefit from the built‑in FFI and the ability to compile Lisp directly into the host binary.
Licensing
ECL is distributed under the GNU Lesser General Public License (LGPL) version 2.1, with an additional exception that permits static linking of the library without imposing the copyleft requirements of the full GPL on the host program.
References and external links
- Official project page: https://common-lisp.net/project/ecl/
- ECL user manual (PDF): https://common-lisp.net/project/ecl/manual/
- Source code repository (Git): https://github.com/ciel-lang/ecl
The information presented reflects the current state of Embeddable Common Lisp as documented by its maintainers and publicly available resources.