[This paper was presented at the 40th Anniversary of Lisp Conference, November 17, 1998, Berkeley, CA.]
The Eclipse Common Lisp system serves as a Lisp-to-C translator, an extendible Lisp library for C programmers, and a complete traditional top-level Lisp system implemented in portable C. Using Eclipse, hand-written or system-generated C calls to Lisp look like ordinary C function calls, and Lisp data can be manipulated as ordinary C data by programs. Conversely, C function calls look like ordinary function calls within Lisp programs. We describe how this is used, the technology that implements it, and list related work.
Eclipse Common Lisp is a commercial implementation that makes the full
ANSI language definition [Ansi]
available to programmers in two ways: as a traditional top-level
program featuring a read-eval-print loop, and as a C-callable
library.[Stearns] The library
uses normal C naming and function-calling conventions, is suitable for
use directly by C programmers, and was used to implement the top-level
program. In addition, the library and top-level contain a definition
of COMPILE-FILE
that generates human-readable, lintable C
code that can be compiled and linked with the library. The generated
code shares the same naming and calling conventions as the library,
and, in fact, was used to generate the library C source code from Lisp
source code.
This language implementation strategy provides the following benefits:
main()
program can be written in any language.
COMPILE-FILE
as though they were part of any sophisticated
C library.
What follows is a description of how this is accomplished. Section 2 describes the core technologies Eclipse uses to integrate Lisp and C. Section 3 describes how Eclipse allows Lisp utilities to be used from C code, and gives an example of generated code. Section 4 describes how C utilities are used from Lisp code. Section 5 lists related work and suggests where this technology might be headed.