(require 'repl)
Here is a read-eval-print-loop which, given an eval, evaluates forms.
read
s,repl:eval
s andwrite
s expressions from(current-input-port)
to(current-output-port)
until an end-of-file is encountered.load
,slib:eval
,slib:error
, andrepl:quit
dynamically bound duringrepl:top-level
.
The repl:
procedures establish, as much as is possible to do
portably, a top level environment supporting macros.
repl:top-level
uses dynamic-wind
to catch error conditions
and interrupts. If your implementation supports this you are all set.
Otherwise, if there is some way your implementation can catch error
conditions and interrupts, then have them call slib:error
. It
will display its arguments and reenter repl:top-level
.
slib:error
dynamically bound by repl:top-level
.
To have your top level loop always use macros, add any interrupt catching lines and the following lines to your Scheme init file:
(require 'macro) (require 'repl) (repl:top-level macro:eval)