(Arne Babenhauserheide)
2013-09-13: module path for the wisp-reader has to be (language wisp spec) module path for the wisp-reader has to be (language wisp spec)
diff --git a/wisp-reader.w b/wisp-reader.w
--- a/wisp-reader.w
+++ b/wisp-reader.w
@@ -9,8 +9,8 @@
; adapted from spec.scm: https://gitorious.org/nacre/guile-sweet/source/ae306867e371cb4b56e00bb60a50d9a0b8353109:sweet/spec.scm
-(define-module (wisp-reader)
- #:use-module (wisp)
+(define-module (language wisp spec)
+ #:use-module (wisp) ; I’d like to specify
#:use-module (system base compile)
#:use-module (system base language)
#:use-module (language scheme compile-tree-il)
@@ -21,12 +21,16 @@
;;; Language definition
;;;
+(define (compile-scheme x e opts) (values x e e))
+
+(define (decompile-scheme x e opts) (values x e))
+
(define-language wisp
#:title "Wisp Scheme Syntax"
#:reader (lambda (port env)
- (wisp-read port))
- #:compilers `((tree-il . ,compile-tree-il))
- #:decompilers `((tree-il . ,decompile-tree-il))
+ (wisp2lisp (wisp-chunkreader port)))
+ #:compilers `((scheme . ,compile-scheme))
+ #:decompilers `((scheme . ,decompile-scheme))
#:evaluator (lambda (x module) (primitive-eval x))
#:printer write
#:make-default-environment
@@ -45,32 +49,3 @@
(module-set! m 'format simple-format)
m)))
-; adapted from sugar.scm: https://gitorious.org/nacre/guile-sweet/source/ae306867e371cb4b56e00bb60a50d9a0b8353109:sweet/sugar.scm
-
-(define* (wisp-read #:optional (port (current-input-port)))
- ; Read single complete I-expression.
- (let* ((indentation (list->string (accumulate-hspace port)))
- (c (peek-char port)))
- (cond
- ((eof-object? c) c) ; EOF - return it, we're done.
- ((eqv? c #\; ) ; comment - consume and see what's after it.
- (let ((d (consume-to-eol port)))
- (cond
- ((eof-object? d) d) ; If EOF after comment, return it.
- (#t
- (read-char port) ; Newline after comment. Consume NL
- (sugar-read port))))) ; and try again
- ((eqv? c #\newline)
- (read-char port) ; Newline (with no preceding comment).
- (sugar-read port)) ; Consume and again
- (#t
- ; TODO: Handle (> (string-length indentation) 0)
- (let* ((read (readblock-clean "" port))
- (level (car read))
- (block (cdr read)))
- (cond
- ((eq? block '.)
- '())
- (#t
- block)))))))
-