Fetching contributors…
Cannot retrieve contributors at this time
44 lines (30 sloc) 792 Bytes
;; now build up the clos environment and jump into the more
;; object aware repl
(require 'clos)
(define (write-port obj . port)
(let ((stream (if port
(make <native-output-stream>
'port (car port))
(print-object stream obj)))
;; define a VM exception handler that uses our higher level condition
;; system
(lambda (ex)
(raise (list 'vm-error ex))))
(define (clos-repl)
(letrec ((repl-loop
(lambda ()
(display "bs> ")
(let* ((exp (read-port stdin))
(res (eval exp)))
(when (eof-object? res)
(exit 0))
(print-object stdout-stream res)
(ex (#t (printf "clos-repl: %a\n" ex)))