While this is probably not what you are looking for, there is always
(system "csc -s path/to/file.scm"). This should help with issues of
using (eval ...). You can (write ...) your code to a temp file, run
csc on it, and (load ...) the .so.
If you are trying to compile a closure, I'm not sure of a good way to
make it happen, but I'd be interested to hear other input.
I am at this very moment working on a similar problem (though I'm only
compiling files not metaprogrammed code, so my situation may be easier).
Good luck and report back if you find anything,
-Mark
On Nov 11, 2008, at 4:09 PM, Felix Lange wrote:
hi, chicken-users,
i've been using chicken scheme for quite a while now, and would like
to request a feature (or at least a hint on doing something roughly
equivalent).
most, if not all common lisp implementations provide the 'compile-
file and 'compile functions.
these are very useful for implementing domain-specific languages
(among other tasks).
having 'compile available at runtime makes it possible to compile
these languages into lisp code, which,
when it is run, executes at the same speed as everything else in the
running image.
in scheme, since 'compile is not provided, i'd be building an
interpreter or, even worse,
use eval.
as chicken is a scheme-to-C compiler, 'compile, if it were available
would probably return a string of C code (and should therefore be
called 'compile-to-c).
the output of 'compile-to-c could be written to a temporary file,
which in turn could be
compiled/linked by an external c compiler (assuming it's presence,
libtcc?) and loaded back into the running user program as a shared
library.
example from dsl background (compilation might improve speed if some-
long-list is really really long):
(define dl (dsl-code->lambda-form (quote ..... )))
(map (compile dl) some-long-list)
a penny for your thoughts....
felix
_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users
_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users