diff --git a/src/ikarus.boot b/src/ikarus.boot index 802b07b..cd1b15d 100644 Binary files a/src/ikarus.boot and b/src/ikarus.boot differ diff --git a/src/ikarus.syntax.ss b/src/ikarus.syntax.ss index ae2e661..51e1a88 100644 --- a/src/ikarus.syntax.ss +++ b/src/ikarus.syntax.ss @@ -7,7 +7,7 @@ (library (ikarus syntax) (export identifier? syntax-dispatch environment environment? - eval generate-temporaries free-identifier=? + eval expand generate-temporaries free-identifier=? bound-identifier=? syntax-error datum->syntax syntax->datum make-variable-transformer eval-r6rs-top-level boot-library-expand eval-top-level @@ -2363,6 +2363,21 @@ (seal-rib! rib) (for-each invoke-library (rtc)) (eval-core x))))))) + (define expand + (lambda (x env) + (unless (eval-environment? env) + (error 'expand "~s is not an environment" env)) + (let ([subst (eval-environment-subst env)]) + (let ([rib (make-top-rib subst)]) + (let ([x (stx x top-mark* (list rib))] + [rtc (make-collector)] + [vtc (make-collector)]) + (let ([x + (parameterize ([inv-collector rtc] + [vis-collector vtc]) + (chi-expr x '() '()))]) + (seal-rib! rib) + (values x (rtc)))))))) (define (visit! macro*) (for-each (lambda (x) (let ([loc (car x)] [proc (cadr x)]) diff --git a/src/makefile.ss b/src/makefile.ss index bdb2b0f..70e37af 100755 --- a/src/makefile.ss +++ b/src/makefile.ss @@ -652,6 +652,7 @@ [assembler-output i] [new-cafe i] [eval i ev] + [expand i] [environment i ev] [null-environment i] [environment? i]