Hi all,
I'd like to check whether ECL and GCL are non-conforming according to the
ANSI specification in not being able to call COMPILE-FILE recursively.
I suspect recursive compilation could be very difficult to implement when
generating C so even if this is non-conforming it still may not be practical
to fix and rely upon.
ABCL, CLISP, CMUCL and SBCL will happily compile broken.lisp via
(load "precompile.lisp"):
;;---------------
;;precompile.lisp
;;---------------
(eval-when (:compile-toplevel :load-toplevel :execute)
(compile-file "compile.lisp"))
;;------------
;;compile.lisp
;;------------
(eval-when (:compile-toplevel :load-toplevel :execute)
(compile-file "broken.lisp"))
;;-----------
;;broken.lisp
;;-----------
(eval-when (:compile-toplevel :load-toplevel :execute)
(print "***** Bootstrapping *****"))
For example:
* (load "precompile")
; compiling file "/home/adam/t/compile.lisp" (written 23 APR 2005 08:51:03 PM):
; compiling (COMPILE-FILE "broken.lisp")
; compiling file "/home/adam/t/broken.lisp" (written 23 APR 2005 07:47:40 PM):
"***** Bootstrapping *****"
; /home/adam/t/broken.fasl written
; compilation finished in 0:00:00
; /home/adam/t/compile.fasl written
; compilation finished in 0:00:00
This is what happens in ECL:
> (load "precompile")
;;; Loading #P"precompile.lisp"
;;; Loading #P"/usr/local/lib/ecl/cmp.fas"
;;; Loading #P"/usr/local/lib/ecl/sysfun.lsp"
;;; Compiling compile.lisp.
;;; The compiler was called recursively.
Cannot compile broken.lisp.
;;; End of Pass 1.
;;; Note: Emiting FDEFINITION for COMPILE-FILE
;;; Calling the C compiler...
;;; Invoking external command: gcc -I../include -g -O2 -fPIC -fstrict-aliasing -Dlinux -O "-I/usr/local/lib/ecl//h" -w -c "compile.c" -o "compile.o"
;;; Invoking external command: gcc -o "compile.fas" -L"/usr/local/lib/ecl/" "compile.o" -Wl,--rpath,/usr/local/lib/ecl/ -shared -lecl -ldl -lm
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3
;;; Finished compiling compile.lisp.
#P"precompile.lisp"
>
While the debugger is not entered one can see the messages "The compiler
was called recursively./Cannot compile broken.lisp." plus the
"***** Bootstrapping *****" message is not output at compile time.
Thanks for the analysis!
Regards,
Adam
In article <······························@consulting.net.nz>,
Adam Warner <······@consulting.net.nz> wrote:
> I'd like to check whether ECL and GCL are non-conforming according to the
> ANSI specification in not being able to call COMPILE-FILE recursively.
> I suspect recursive compilation could be very difficult to implement when
> generating C so even if this is non-conforming it still may not be practical
> to fix and rely upon.
There's nothing in the language spec that mentions any restrictions on
the expressions used within an EVAL-WHEN :COMPILE-TOPLEVEL. So COMPILE
and COMPILE-FILE should be usable.
--
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
On Mon, 25 Apr 2005 19:49:59 -0400, Barry Margolin wrote:
> In article <······························@consulting.net.nz>,
> Adam Warner <······@consulting.net.nz> wrote:
>
>> I'd like to check whether ECL and GCL are non-conforming according to the
>> ANSI specification in not being able to call COMPILE-FILE recursively.
>> I suspect recursive compilation could be very difficult to implement when
>> generating C so even if this is non-conforming it still may not be practical
>> to fix and rely upon.
>
> There's nothing in the language spec that mentions any restrictions on
> the expressions used within an EVAL-WHEN :COMPILE-TOPLEVEL. So COMPILE
> and COMPILE-FILE should be usable.
Thanks for the confirmation Barry!
Regards,
Adam
Hello!
Adam Warner <······@consulting.net.nz> wrote:
>Hi all,
>I'd like to check whether ECL and GCL are non-conforming according to the
>ANSI specification in not being able to call COMPILE-FILE recursively.
>I suspect recursive compilation could be very difficult to implement when
>generating C so even if this is non-conforming it still may not be practical
>to fix and rely upon.
Why should this be difficult? Just use different (temporary) file names.
>[...]
Kind regards,
Hannah.
The difficulty does not have to do with using C or whatever. It is just
a problem of two old compilers with similar roots, that use a lot of
global variables to keep compiler information and are not reentrant.
Juanjo