From: Chris Hanson Date: Thu, 29 Mar 2018 07:00:51 +0000 (-0700) Subject: Rewrite local-declare using syntax-rules. X-Git-Tag: mit-scheme-pucked-x11-0.3.1~7^2~157 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=2270f10af3e16ab0f575e10585f984be36afc48d;p=mit-scheme.git Rewrite local-declare using syntax-rules. --- diff --git a/src/runtime/mit-macros.scm b/src/runtime/mit-macros.scm index 0ab768d3b..f7012ebc5 100644 --- a/src/runtime/mit-macros.scm +++ b/src/runtime/mit-macros.scm @@ -741,15 +741,11 @@ USA. system-global-environment)) (define-syntax :local-declare - (er-macro-transformer - (lambda (form rename compare) - compare - (syntax-check '(_ (* (identifier * datum)) + form) form) - (let ((r-let (rename 'LET)) - (r-declare (rename 'DECLARE))) - `(,r-let () - (,r-declare ,@(cadr form)) - ,@(cddr form)))))) + (syntax-rules () + ((_ ((directive datum ...) ...) form0 form1+ ...) + (let () + (declare (directive datum ...) ...) + form0 form1+ ...)))) (define (unspecific-expression) `(,keyword:unspecific)) @@ -759,26 +755,26 @@ USA. (define-syntax :begin0 (syntax-rules () - ((BEGIN0 form0 form1+ ...) - (LET ((RESULT form0)) + ((_ form0 form1+ ...) + (let ((result form0)) form1+ ... - RESULT)))) + result)))) (define-syntax :assert (syntax-rules () - ((ASSERT condition . extra) - (IF (NOT condition) - (ERROR "Assertion failed:" 'condition . extra))))) + ((_ condition . extra) + (if (not condition) + (error "Assertion failed:" 'condition . extra))))) (define-syntax :when (syntax-rules () - ((when condition form ...) + ((_ condition form ...) (if condition (begin form ...))))) (define-syntax :unless (syntax-rules () - ((unless condition form ...) + ((_ condition form ...) (if (not condition) (begin form ...)))))