[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] using the compiler at runtime
From: |
Felix Lange |
Subject: |
[Chicken-users] using the compiler at runtime |
Date: |
Tue, 11 Nov 2008 23:09:14 +0100 |
User-agent: |
Thunderbird 2.0.0.17 (X11/20081005) |
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] using the compiler at runtime,
Felix Lange <=