mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-18 21:29:18 +02:00
41 lines
835 B
Scheme
41 lines
835 B
Scheme
;; Cyclone Scheme
|
|
;; Copyright (c) 2014, Justin Ethier
|
|
;; All rights reserved.
|
|
;;
|
|
;; This module contains a simple Read-Eval-Print Loop
|
|
;;
|
|
(cond-expand
|
|
(cyclone
|
|
(display *Cyc-version-banner*))
|
|
(else #f))
|
|
|
|
(define (repl:next-line)
|
|
(call/cc
|
|
(lambda (k)
|
|
(with-exception-handler
|
|
(lambda (obj)
|
|
(display "Error: ")
|
|
(write obj)
|
|
; TODO:
|
|
;(for-each
|
|
; (lambda (o)
|
|
; (display o)
|
|
; (display " "))
|
|
; obj)
|
|
(k #t))
|
|
(lambda ()
|
|
(repl)))))
|
|
(repl:next-line))
|
|
|
|
(define (repl)
|
|
(display "cyclone> ")
|
|
(let ((c (eval (read))))
|
|
(cond
|
|
((not (eof-object? c))
|
|
(write c)
|
|
(repl:next-line))
|
|
(else
|
|
(exit 0) ;; TODO: crashes on this branch... WTF?
|
|
))))
|
|
|
|
(repl:next-line)
|