From 387ff63a4870e0b7abf5731b2639ad121734fffc Mon Sep 17 00:00:00 2001 From: Jesse McDonald Date: Sun, 2 May 2010 04:21:01 -0500 Subject: [PATCH] Fix some reader-bugs introduced in the conversion to scheme/match. --- libcompiler/reader.scm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libcompiler/reader.scm b/libcompiler/reader.scm index afb8af1..bb4aeb4 100644 --- a/libcompiler/reader.scm +++ b/libcompiler/reader.scm @@ -1,6 +1,7 @@ #lang scheme/base (require scheme/list) +(require scheme/match) (require scheme/path) (provide read-module) @@ -14,17 +15,17 @@ (if (null? bindings) '() `((letrec ,(reverse bindings))))] - [`((define ,var ,expr) . ,rst) - (iter rst (cons (list var expr) bindings))] - [`((define (,var . ,arglist) . ,body) . ,rst) + [`((define (,(? symbol? var) . ,arglist) . ,body) . ,rst) (iter rst (cons (list var `(lambda ,arglist ,@body)) bindings))] + [`((define ,(? symbol? var) ,expr) . ,rst) + (iter rst (cons (list var expr) bindings))] [`((define . ,_) . ,_) (error "Unrecognized define-form:" (first forms))] [`((begin . ,body) . ,rst) (iter (append body rst) bindings)] [`((load ,(? string? pathname)) . ,rst) - (let ([complete-path (path->complete-path pathname)] - [directory (path-only complete-path)]) + (let* ([complete-path (path->complete-path pathname)] + [directory (path-only complete-path)]) (iter (append (with-input-from-file complete-path (lambda () (parameterize ([current-directory directory]) @@ -33,7 +34,7 @@ bindings))] [`((load . ,_) . ,rst) (error "Unrecognized load-form:" (first forms))] - [(,form . ,rst) + [`(,form . ,rst) (if (null? bindings) (cons form (iter rst '())) `((letrec ,(reverse bindings)