The ECL compiler is essentially a translator from Common-Lisp to C. Given a Lisp source file, the compiler first generates three intermediate files:
a C-file which consists of the C version of the Lisp program
an H-file which consists of declarations referenced in the C-file
a Data-file which consists of Lisp data to be used at load time
The ECL compiler then invokes the C compiler to compile the
C-file into an object file. Finally, the contents of the Data-file is
appended to the object file to make a Fasl-file. The generated
Fasl-file can be loaded into the ECL system by the Common-Lisp
load. By default, the three intermediate files are
deleted after the compilation, but, if asked, the compiler leaves
The merits of the use of C as the intermediate language are:
The ECL compiler is highly portable.
Cross compilation is possible, because the contents of the intermediate files are common to all versions of ECL. For example, one can compile his or her Lisp program by the ECL compiler on a Sun, bring the intermediate files to DOS, compile the C-file with the gcc compiler under DOS, and then append the Data-file to the object file. This procedure generates the Fasl-file for the ECL system on DOS. This kind of cross compilation makes it easier to port ECL.
Hardware-dependent optimizations such as register allocations are done by the C compiler.
The demerits are:
At those sites where no C compiler is available, the users cannot compile their Lisp programs.
The compilation time is long. 70% to 80% of the compilation time is used by the C compiler. The ECL compiler is therefore slower than compiler generating machine code directly.