-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrepl.lisp
More file actions
29 lines (26 loc) · 714 Bytes
/
Copy pathrepl.lisp
File metadata and controls
29 lines (26 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
; Read-Eval-Print Loop for Kakapo
; First print some information about us.
(let ()
(import "fmt")
(fmt.Printf "Welcome to %s %s\n"
-interpreter
-interpreter-version)
; Now start the actual REPL
(let ((readSexpr
(lambda () (begin
(fmt.Print "kakapo> ")
(read)))))
(define REPL
(lambda ()
(recover '(eof)
(lambda ()
(for 1
(recover '(_)
(lambda () (print (eval (readSexpr))))
(lambda (e)
(if (equal? e 'eof)
(panic e)
(fmt.Println e))))))
(lambda (_)
(fmt.Println "Bye!")))))))
(REPL)