-
Notifications
You must be signed in to change notification settings - Fork 0
/
repl.scm
21 lines (20 loc) · 961 Bytes
/
repl.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(import (silly-k) (rnrs))
(let ([args (cdr (command-line))])
(let-values ([(verbose) (if (and (not (null? args)) (equal? (car args) "-v"))
(values #t)
(values #f))])
(letrec ([go (lambda ()
(display " ]")
(let ([e (get-line (console-input-port))])
(cond
[(equal? e #!eof) (newline)]
[else
(let* ([e^ (string-append "]" e)]
[scm (with-exception-handler
(lambda (ex) (display-condition ex) (newline) (go))
(lambda () (with-input-from-string e^ compile-to-scheme)))])
(when verbose (pretty-print scm))
(eval scm)
(newline)
(go))])))])
(go))))