We can't include Kent Dybvig's syntax-case macro expander in the
authorJim Blandy <jimb@red-bean.com>
Mon, 19 Oct 1998 13:43:50 +0000 (13:43 +0000)
committerJim Blandy <jimb@red-bean.com>
Mon, 19 Oct 1998 13:43:50 +0000 (13:43 +0000)
core Guile distribution, because we don't have copyright
assignments for this code.  We can certainly distribute them as a
separate package, but Guile should be FSF code.
* syncase.scm, psyntax.pp, psyntax.ss: Removed.
* Makefile.am (ice9_sources): Removed syncase.scm, psyntax.pp, and
psyntax.ss.
* Makefile.in: Regenerated.
* Makefile.am (ice9_sources): Add getopt-gnu-style.scm.
* Makefile.in: Regenerated.

ice-9/Makefile.am
ice-9/Makefile.in
ice-9/psyntax.pp [deleted file]
ice-9/psyntax.ss [deleted file]
ice-9/syncase.scm [deleted file]

index 5400f97..2298404 100644 (file)
@@ -4,9 +4,9 @@ AUTOMAKE_OPTIONS = foreign
 
 # These should be installed and distributed.
 ice9_sources = boot-9.scm calling.scm common-list.scm debug.scm \
-emacs.scm expect.scm hcons.scm lineio.scm ls.scm mapping.scm poe.scm \
-q.scm readline.scm regex.scm runq.scm slib.scm string-fun.scm tags.scm \
-threads.scm r4rs.scm session.scm syncase.scm psyntax.pp psyntax.ss
+emacs.scm expect.scm getopt-gnu-style.scm hcons.scm lineio.scm ls.scm \
+mapping.scm poe.scm q.scm readline.scm regex.scm runq.scm slib.scm \
+string-fun.scm tags.scm threads.scm r4rs.scm session.scm
 
 # These should be installed, but not distributed.
 ice9_generated = version.scm
index cf5cc06..f1d887f 100644 (file)
@@ -92,9 +92,9 @@ AUTOMAKE_OPTIONS = foreign
 
 # These should be installed and distributed.
 ice9_sources = boot-9.scm calling.scm common-list.scm debug.scm \
-emacs.scm expect.scm hcons.scm lineio.scm ls.scm mapping.scm poe.scm \
-q.scm readline.scm regex.scm runq.scm slib.scm string-fun.scm tags.scm \
-threads.scm r4rs.scm session.scm syncase.scm psyntax.pp psyntax.ss
+emacs.scm expect.scm getopt-gnu-style.scm hcons.scm lineio.scm ls.scm \
+mapping.scm poe.scm q.scm readline.scm regex.scm runq.scm slib.scm \
+string-fun.scm tags.scm threads.scm r4rs.scm session.scm
 
 # These should be installed, but not distributed.
 ice9_generated = version.scm
diff --git a/ice-9/psyntax.pp b/ice-9/psyntax.pp
deleted file mode 100644 (file)
index 172342d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-(letrec ((lambda-var-list (lambda (vars203) (let lvl ((vars204 vars203) (ls (quote ())) (w205 (quote (())))) (cond ((pair? vars204) (lvl (cdr vars204) (cons (wrap (car vars204) w205) ls) w205)) ((id? vars204) (cons (wrap vars204 w205) ls)) ((null? vars204) ls) ((syntax-object? vars204) (lvl (syntax-object-expression vars204) ls (join-wraps w205 (syntax-object-wrap vars204)))) ((annotation? vars204) (lvl (annotation-expression vars204) ls w205)) (else (cons vars204 ls)))))) (gen-var (lambda (id206) (let ((id207 (if (syntax-object? id206) (syntax-object-expression id206) id206))) (if (annotation? id207) (gensym (annotation-expression id207) generated-symbols) (gensym id207 generated-symbols))))) (strip (lambda (x208 w209) (if (memq (quote top) (wrap-marks w209)) (if (or (annotation? x208) (and (pair? x208) (annotation? (car x208)))) (strip-annotation x208 (quote #f)) x208) (let f210 ((x211 x208)) (cond ((syntax-object? x211) (strip (syntax-object-expression x211) (syntax-object-wrap x211))) ((pair? x211) (let ((a (f210 (car x211))) (d (f210 (cdr x211)))) (if (and (eq? a (car x211)) (eq? d (cdr x211))) x211 (cons a d)))) ((vector? x211) (let ((old212 (vector->list x211))) (let ((new213 (map f210 old212))) (if (andmap eq? old212 new213) x211 (list->vector new213))))) (else x211)))))) (strip-annotation (lambda (x214 parent) (cond ((pair? x214) (let ((new215 (cons (quote #f) (quote #f)))) (begin (when parent (set-annotation-stripped! parent new215)) (set-car! new215 (strip-annotation (car x214) (quote #f))) (set-cdr! new215 (strip-annotation (cdr x214) (quote #f))) new215))) ((annotation? x214) (or (annotation-stripped x214) (strip-annotation (annotation-expression x214) x214))) ((vector? x214) (let ((new216 (make-vector (vector-length x214)))) (begin (when parent (set-annotation-stripped! parent new216)) (let loop ((i217 (- (vector-length x214) (quote 1)))) (unless (fx< i217 (quote 0)) (vector-set! new216 i217 (strip-annotation (vector-ref x214 i217) (quote #f))) (loop (fx- i217 (quote 1))))) new216))) (else x214)))) (ellipsis? (lambda (x218) (and (nonsymbol-id? x218) (free-id=? x218 (quote #(syntax-object ... ((top) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")) #(ribcage (lambda-var-list gen-var strip strip-annotation ellipsis? chi-void eval-local-transformer chi-local-syntax chi-lambda-clause chi-body chi-macro chi-application chi-expr chi chi-top syntax-type chi-when-list chi-install-global chi-top-sequence chi-sequence source-wrap wrap bound-id-member? distinct-bound-ids? valid-bound-ids? bound-id=? free-id=? id-var-name same-marks? join-marks join-wraps smart-append make-binding-wrap extend-ribcage! make-empty-ribcage new-mark anti-mark the-anti-mark top-marked? top-wrap empty-wrap set-ribcage-labels! set-ribcage-marks! set-ribcage-symnames! ribcage-labels ribcage-marks ribcage-symnames ribcage? make-ribcage gen-labels gen-label make-rename rename-marks rename-new rename-old subst-rename? wrap-subst wrap-marks make-wrap id-sym-name&marks id-sym-name id? nonsymbol-id? global-extend lookup macros-only-env extend-var-env extend-env null-env binding-value binding-type make-binding arg-check source-annotation no-source unannotate set-syntax-object-wrap! set-syntax-object-expression! syntax-object-wrap syntax-object-expression syntax-object? make-syntax-object self-evaluating? build-lexical-var build-letrec build-named-let build-let build-sequence build-data build-primref build-lambda build-global-definition build-global-assignment build-global-reference build-lexical-assignment build-lexical-reference build-conditional build-application get-global-definition-hook put-global-definition-hook gensym-hook error-hook local-eval-hook top-level-eval-hook annotation? fx< fx= fx- fx+ noexpand) ((top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top)) ("i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i")) #(ribcage (define-structure) ((top)) ("i"))))))))) (chi-void (lambda () (list (quote void)))) (eval-local-transformer (lambda (expanded) (let ((p (local-eval-hook expanded))) (if (procedure? p) p (syntax-error p (quote "nonprocedure transfomer")))))) (chi-local-syntax (lambda (rec? e219 r w220 s k) ((lambda (tmp221) ((lambda (tmp222) (if tmp222 (apply (lambda (_223 id224 val e1 e2) (let ((ids225 id224)) (if (not (valid-bound-ids? ids225)) (syntax-error e219 (quote "duplicate bound keyword in")) (let ((labels (gen-labels ids225))) (let ((new-w (make-binding-wrap ids225 labels w220))) (k (cons e1 e2) (extend-env labels (let ((w228 (if rec? new-w w220)) (trans-r (macros-only-env r))) (map (lambda (x229) (cons (quote macro) (eval-local-transformer (chi x229 trans-r w228)))) val)) r) new-w s)))))) tmp222) ((lambda (_231) (syntax-error (source-wrap e219 w220 s))) tmp221))) (syntax-dispatch tmp221 (quote (any #(each (any any)) any . each-any))))) e219))) (chi-lambda-clause (lambda (e232 c r233 w234 k235) ((lambda (tmp236) ((lambda (tmp237) (if tmp237 (apply (lambda (id238 e1239 e2240) (let ((ids241 id238)) (if (not (valid-bound-ids? ids241)) (syntax-error e232 (quote "invalid parameter list in")) (let ((labels243 (gen-labels ids241)) (new-vars (map gen-var ids241))) (k235 new-vars (chi-body (cons e1239 e2240) e232 (extend-var-env labels243 new-vars r233) (make-binding-wrap ids241 labels243 w234))))))) tmp237) ((lambda (tmp245) (if tmp245 (apply (lambda (ids246 e1247 e2248) (let ((old-ids (lambda-var-list ids246))) (if (not (valid-bound-ids? old-ids)) (syntax-error e232 (quote "invalid parameter list in")) (let ((labels249 (gen-labels old-ids)) (new-vars250 (map gen-var old-ids))) (k235 (let f251 ((ls1 (cdr new-vars250)) (ls2 (car new-vars250))) (if (null? ls1) ls2 (f251 (cdr ls1) (cons (car ls1) ls2)))) (chi-body (cons e1247 e2248) e232 (extend-var-env labels249 new-vars250 r233) (make-binding-wrap old-ids labels249 w234))))))) tmp245) ((lambda (_253) (syntax-error e232)) tmp236))) (syntax-dispatch tmp236 (quote (any any . each-any)))))) (syntax-dispatch tmp236 (quote (each-any any . each-any))))) c))) (chi-body (lambda (body outer-form r254 w255) (let ((r256 (cons (quote ("placeholder" placeholder)) r254))) (let ((ribcage (make-ribcage (quote ()) (quote ()) (quote ())))) (let ((w257 (make-wrap (wrap-marks w255) (cons ribcage (wrap-subst w255))))) (let parse ((body258 (map (lambda (x262) (cons r256 (wrap x262 w257))) body)) (ids259 (quote ())) (labels260 (quote ())) (vars261 (quote ())) (vals (quote ())) (bindings (quote ()))) (if (null? body258) (syntax-error outer-form (quote "no expressions in body")) (let ((e263 (cdar body258)) (er (caar body258))) (call-with-values (lambda () (syntax-type e263 er (quote (())) (quote #f) ribcage)) (lambda (type264 value265 e266 w267 s268) (let ((t type264)) (if (memv t (quote (define-form))) (let ((id269 (wrap value265 w267)) (label (gen-label))) (let ((var270 (gen-var id269))) (begin (extend-ribcage! ribcage id269 label) (parse (cdr body258) (cons id269 ids259) (cons label labels260) (cons var270 vars261) (cons (cons er (wrap e266 w267)) vals) (cons (cons (quote lexical) var270) bindings))))) (if (memv t (quote (define-syntax-form))) (let ((id271 (wrap value265 w267)) (label272 (gen-label))) (begin (extend-ribcage! ribcage id271 label272) (parse (cdr body258) (cons id271 ids259) (cons label272 labels260) vars261 vals (cons (cons (quote macro) (cons er (wrap e266 w267))) bindings)))) (if (memv t (quote (begin-form))) ((lambda (tmp273) ((lambda (tmp274) (if tmp274 (apply (lambda (_275 e1276) (parse (let f277 ((forms e1276)) (if (null? forms) (cdr body258) (cons (cons er (wrap (car forms) w267)) (f277 (cdr forms))))) ids259 labels260 vars261 vals bindings)) tmp274) (syntax-error tmp273))) (syntax-dispatch tmp273 (quote (any . each-any))))) e266) (if (memv t (quote (local-syntax-form))) (chi-local-syntax value265 e266 er w267 s268 (lambda (forms279 er280 w281 s282) (parse (let f283 ((forms284 forms279)) (if (null? forms284) (cdr body258) (cons (cons er280 (wrap (car forms284) w281)) (f283 (cdr forms284))))) ids259 labels260 vars261 vals bindings))) (if (null? ids259) (build-sequence (quote #f) (map (lambda (x285) (chi (cdr x285) (car x285) (quote (())))) (cons (cons er (source-wrap e266 w267 s268)) (cdr body258)))) (begin (if (not (valid-bound-ids? ids259)) (syntax-error outer-form (quote "invalid or duplicate identifier in definition"))) (let loop286 ((bs bindings) (er-cache (quote #f)) (r-cache (quote #f))) (if (not (null? bs)) (let ((b (car bs))) (if (eq? (car b) (quote macro)) (let ((er287 (cadr b))) (let ((r-cache288 (if (eq? er287 er-cache) r-cache (macros-only-env er287)))) (begin (set-cdr! b (eval-local-transformer (chi (cddr b) r-cache288 (quote (()))))) (loop286 (cdr bs) er287 r-cache288)))) (loop286 (cdr bs) er-cache r-cache))))) (set-cdr! r256 (extend-env labels260 bindings (cdr r256))) (build-letrec (quote #f) vars261 (map (lambda (x289) (chi (cdr x289) (car x289) (quote (())))) vals) (build-sequence (quote #f) (map (lambda (x290) (chi (cdr x290) (car x290) (quote (())))) (cons (cons er (source-wrap e266 w267 s268)) (cdr body258)))))))))))))))))))))) (chi-macro (lambda (p291 e292 r293 w294 rib) (letrec ((rebuild-macro-output (lambda (x295 m) (cond ((pair? x295) (cons (rebuild-macro-output (car x295) m) (rebuild-macro-output (cdr x295) m))) ((syntax-object? x295) (let ((w296 (syntax-object-wrap x295))) (let ((ms (wrap-marks w296)) (s297 (wrap-subst w296))) (make-syntax-object (syntax-object-expression x295) (if (and (pair? ms) (eq? (car ms) (quote #f))) (make-wrap (cdr ms) (if rib (cons rib (cdr s297)) (cdr s297))) (make-wrap (cons m ms) (if rib (cons rib (cons (quote shift) s297)) (cons (quote shift) s297)))))))) ((vector? x295) (let ((n (vector-length x295))) (let ((v (make-vector n))) (let doloop ((i298 (quote 0))) (if (fx= i298 n) v (begin (vector-set! v i298 (rebuild-macro-output (vector-ref x295 i298) m)) (doloop (fx+ i298 (quote 1))))))))) ((symbol? x295) (syntax-error x295 (quote "encountered raw symbol in macro output"))) (else x295))))) (rebuild-macro-output (p291 (wrap e292 (anti-mark w294))) (string (quote #\m)))))) (chi-application (lambda (x299 e300 r301 w302 s303) ((lambda (tmp304) ((lambda (tmp305) (if tmp305 (apply (lambda (e0 e1306) (cons x299 (map (lambda (e307) (chi e307 r301 w302)) e1306))) tmp305) (syntax-error tmp304))) (syntax-dispatch tmp304 (quote (any . each-any))))) e300))) (chi-expr (lambda (type309 value310 e311 r312 w313 s314) (let ((t315 type309)) (if (memv t315 (quote (lexical))) value310 (if (memv t315 (quote (core))) (value310 e311 r312 w313 s314) (if (memv t315 (quote (lexical-call))) (chi-application value310 e311 r312 w313 s314) (if (memv t315 (quote (global-call))) (chi-application value310 e311 r312 w313 s314) (if (memv t315 (quote (constant))) (list (quote quote) (strip (source-wrap e311 w313 s314) (quote (())))) (if (memv t315 (quote (global))) value310 (if (memv t315 (quote (call))) (chi-application (chi (car e311) r312 w313) e311 r312 w313 s314) (if (memv t315 (quote (begin-form))) ((lambda (tmp316) ((lambda (tmp317) (if tmp317 (apply (lambda (_318 e1319 e2320) (chi-sequence (cons e1319 e2320) r312 w313 s314)) tmp317) (syntax-error tmp316))) (syntax-dispatch tmp316 (quote (any any . each-any))))) e311) (if (memv t315 (quote (local-syntax-form))) (chi-local-syntax value310 e311 r312 w313 s314 chi-sequence) (if (memv t315 (quote (eval-when-form))) ((lambda (tmp322) ((lambda (tmp323) (if tmp323 (apply (lambda (_324 x325 e1326 e2327) (let ((when-list (chi-when-list e311 x325 w313))) (if (memq (quote eval) when-list) (chi-sequence (cons e1326 e2327) r312 w313 s314) (chi-void)))) tmp323) (syntax-error tmp322))) (syntax-dispatch tmp322 (quote (any each-any any . each-any))))) e311) (if (memv t315 (quote (define-form define-syntax-form))) (syntax-error (wrap value310 w313) (quote "invalid context for definition of")) (if (memv t315 (quote (syntax))) (syntax-error (source-wrap e311 w313 s314) (quote "reference to pattern variable outside syntax form")) (if (memv t315 (quote (displaced-lexical))) (syntax-error (source-wrap e311 w313 s314) (quote "reference to identifier outside its scope")) (syntax-error (source-wrap e311 w313 s314)))))))))))))))))) (chi (lambda (e330 r331 w332) (call-with-values (lambda () (syntax-type e330 r331 w332 (quote #f) (quote #f))) (lambda (type333 value334 e335 w336 s337) (chi-expr type333 value334 e335 r331 w336 s337))))) (chi-top (lambda (e338 r339 w340 m341 esew) (call-with-values (lambda () (syntax-type e338 r339 w340 (quote #f) (quote #f))) (lambda (type348 value349 e350 w351 s352) (let ((t353 type348)) (if (memv t353 (quote (begin-form))) ((lambda (tmp354) ((lambda (tmp355) (if tmp355 (apply (lambda (_356) (chi-void)) tmp355) ((lambda (tmp357) (if tmp357 (apply (lambda (_358 e1359 e2360) (chi-top-sequence (cons e1359 e2360) r339 w351 s352 m341 esew)) tmp357) (syntax-error tmp354))) (syntax-dispatch tmp354 (quote (any any . each-any)))))) (syntax-dispatch tmp354 (quote (any))))) e350) (if (memv t353 (quote (local-syntax-form))) (chi-local-syntax value349 e350 r339 w351 s352 (lambda (body362 r363 w364 s365) (chi-top-sequence body362 r363 w364 s365 m341 esew))) (if (memv t353 (quote (eval-when-form))) ((lambda (tmp366) ((lambda (tmp367) (if tmp367 (apply (lambda (_368 x369 e1370 e2371) (let ((when-list372 (chi-when-list e350 x369 w351)) (body373 (cons e1370 e2371))) (cond ((eq? m341 (quote e)) (if (memq (quote eval) when-list372) (chi-top-sequence body373 r339 w351 s352 (quote e) (quote (eval))) (chi-void))) ((memq (quote load) when-list372) (if (or (memq (quote compile) when-list372) (and (eq? m341 (quote c&e)) (memq (quote eval) when-list372))) (chi-top-sequence body373 r339 w351 s352 (quote c&e) (quote (compile load))) (if (memq m341 (quote (c c&e))) (chi-top-sequence body373 r339 w351 s352 (quote c) (quote (load))) (chi-void)))) ((or (memq (quote compile) when-list372) (and (eq? m341 (quote c&e)) (memq (quote eval) when-list372))) (top-level-eval-hook (chi-top-sequence body373 r339 w351 s352 (quote e) (quote (eval)))) (chi-void)) (else (chi-void))))) tmp367) (syntax-error tmp366))) (syntax-dispatch tmp366 (quote (any each-any any . each-any))))) e350) (if (memv t353 (quote (define-syntax-form))) (let ((n376 (id-var-name value349 w351)) (r377 (macros-only-env r339))) (let ((t378 m341)) (if (memv t378 (quote (c))) (if (memq (quote compile) esew) (let ((e379 (chi-install-global n376 (chi e350 r377 w351)))) (begin (top-level-eval-hook e379) (if (memq (quote load) esew) e379 (chi-void)))) (if (memq (quote load) esew) (chi-install-global n376 (chi e350 r377 w351)) (chi-void))) (if (memv t378 (quote (c&e))) (let ((e380 (chi-install-global n376 (chi e350 r377 w351)))) (begin (top-level-eval-hook e380) e380)) (begin (if (memq (quote eval) esew) (top-level-eval-hook (chi-install-global n376 (chi e350 r377 w351)))) (chi-void)))))) (if (memv t353 (quote (define-form))) (let ((n381 (id-var-name value349 w351))) (let ((t382 (binding-type (lookup n381 r339)))) (if (memv t382 (quote (global))) (let ((x383 (list (quote define) n381 (chi e350 r339 w351)))) (begin (if (eq? m341 (quote c&e)) (top-level-eval-hook x383)) x383)) (if (memv t382 (quote (displaced-lexical))) (syntax-error (wrap value349 w351) (quote "identifier out of context")) (syntax-error (wrap value349 w351) (quote "cannot define keyword at top level")))))) (let ((x384 (chi-expr type348 value349 e350 r339 w351 s352))) (begin (if (eq? m341 (quote c&e)) (top-level-eval-hook x384)) x384)))))))))))) (syntax-type (lambda (e385 r386 w387 s388 rib389) (cond ((symbol? e385) (let ((n390 (id-var-name e385 w387))) (let ((b391 (lookup n390 r386))) (let ((type392 (binding-type b391))) (let ((t393 type392)) (if (memv t393 (quote (lexical))) (values type392 (binding-value b391) e385 w387 s388) (if (memv t393 (quote (global))) (values type392 n390 e385 w387 s388) (if (memv t393 (quote (macro))) (syntax-type (chi-macro (binding-value b391) e385 r386 w387 rib389) r386 (quote (())) s388 rib389) (values type392 (binding-value b391) e385 w387 s388))))))))) ((pair? e385) (let ((first (car e385))) (if (id? first) (let ((n394 (id-var-name first w387))) (let ((b395 (lookup n394 r386))) (let ((type396 (binding-type b395))) (let ((t397 type396)) (if (memv t397 (quote (lexical))) (values (quote lexical-call) (binding-value b395) e385 w387 s388) (if (memv t397 (quote (global))) (values (quote global-call) n394 e385 w387 s388) (if (memv t397 (quote (macro))) (syntax-type (chi-macro (binding-value b395) e385 r386 w387 rib389) r386 (quote (())) s388 rib389) (if (memv t397 (quote (core))) (values type396 (binding-value b395) e385 w387 s388) (if (memv t397 (quote (local-syntax))) (values (quote local-syntax-form) (binding-value b395) e385 w387 s388) (if (memv t397 (quote (begin))) (values (quote begin-form) (quote #f) e385 w387 s388) (if (memv t397 (quote (eval-when))) (values (quote eval-when-form) (quote #f) e385 w387 s388) (if (memv t397 (quote (define))) ((lambda (tmp398) ((lambda (tmp399) (if (if tmp399 (apply (lambda (_400 name401 val402) (id? name401)) tmp399) (quote #f)) (apply (lambda (_403 name404 val405) (values (quote define-form) name404 val405 w387 s388)) tmp399) ((lambda (tmp406) (if (if tmp406 (apply (lambda (_407 name408 args409 e1410 e2411) (and (id? name408) (or (valid-bound-ids? (lambda-var-list args409)) (id? (lambda-var-list args409))))) tmp406) (quote #f)) (apply (lambda (_412 name413 args414 e1415 e2416) (values (quote define-form) (wrap name413 w387) (cons (quote #(syntax-object lambda ((top) #(ribcage #(_ name args e1 e2) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(t) #(("m" top)) #("i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(type) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(b) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(n) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(first) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(e r w s rib) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage (lambda-var-list gen-var strip strip-annotation ellipsis? chi-void eval-local-transformer chi-local-syntax chi-lambda-clause chi-body chi-macro chi-application chi-expr chi chi-top syntax-type chi-when-list chi-install-global chi-top-sequence chi-sequence source-wrap wrap bound-id-member? distinct-bound-ids? valid-bound-ids? bound-id=? free-id=? id-var-name same-marks? join-marks join-wraps smart-append make-binding-wrap extend-ribcage! make-empty-ribcage new-mark anti-mark the-anti-mark top-marked? top-wrap empty-wrap set-ribcage-labels! set-ribcage-marks! set-ribcage-symnames! ribcage-labels ribcage-marks ribcage-symnames ribcage? make-ribcage gen-labels gen-label make-rename rename-marks rename-new rename-old subst-rename? wrap-subst wrap-marks make-wrap id-sym-name&marks id-sym-name id? nonsymbol-id? global-extend lookup macros-only-env extend-var-env extend-env null-env binding-value binding-type make-binding arg-check source-annotation no-source unannotate set-syntax-object-wrap! set-syntax-object-expression! syntax-object-wrap syntax-object-expression syntax-object? make-syntax-object self-evaluating? build-lexical-var build-letrec build-named-let build-let build-sequence build-data build-primref build-lambda build-global-definition build-global-assignment build-global-reference build-lexical-assignment build-lexical-reference build-conditional build-application get-global-definition-hook put-global-definition-hook gensym-hook error-hook local-eval-hook top-level-eval-hook annotation? fx< fx= fx- fx+ noexpand) ((top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top)) ("i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i")) #(ribcage (define-structure) ((top)) ("i"))))) (wrap (cons args414 (cons e1415 e2416)) w387)) (quote (())) s388)) tmp406) ((lambda (tmp418) (if (if tmp418 (apply (lambda (_419 name420) (id? name420)) tmp418) (quote #f)) (apply (lambda (_421 name422) (values (quote define-form) (wrap name422 w387) (quote (#(syntax-object void ((top) #(ribcage #(_ name) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(t) #(("m" top)) #("i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(type) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(b) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(n) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(first) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(e r w s rib) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage (lambda-var-list gen-var strip strip-annotation ellipsis? chi-void eval-local-transformer chi-local-syntax chi-lambda-clause chi-body chi-macro chi-application chi-expr chi chi-top syntax-type chi-when-list chi-install-global chi-top-sequence chi-sequence source-wrap wrap bound-id-member? distinct-bound-ids? valid-bound-ids? bound-id=? free-id=? id-var-name same-marks? join-marks join-wraps smart-append make-binding-wrap extend-ribcage! make-empty-ribcage new-mark anti-mark the-anti-mark top-marked? top-wrap empty-wrap set-ribcage-labels! set-ribcage-marks! set-ribcage-symnames! ribcage-labels ribcage-marks ribcage-symnames ribcage? make-ribcage gen-labels gen-label make-rename rename-marks rename-new rename-old subst-rename? wrap-subst wrap-marks make-wrap id-sym-name&marks id-sym-name id? nonsymbol-id? global-extend lookup macros-only-env extend-var-env extend-env null-env binding-value binding-type make-binding arg-check source-annotation no-source unannotate set-syntax-object-wrap! set-syntax-object-expression! syntax-object-wrap syntax-object-expression syntax-object? make-syntax-object self-evaluating? build-lexical-var build-letrec build-named-let build-let build-sequence build-data build-primref build-lambda build-global-definition build-global-assignment build-global-reference build-lexical-assignment build-lexical-reference build-conditional build-application get-global-definition-hook put-global-definition-hook gensym-hook error-hook local-eval-hook top-level-eval-hook annotation? fx< fx= fx- fx+ noexpand) ((top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top)) ("i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i")) #(ribcage (define-structure) ((top)) ("i")))))) (quote (())) s388)) tmp418) (syntax-error tmp398))) (syntax-dispatch tmp398 (quote (any any)))))) (syntax-dispatch tmp398 (quote (any (any . any) any . each-any)))))) (syntax-dispatch tmp398 (quote (any any any))))) e385) (if (memv t397 (quote (define-syntax))) ((lambda (tmp423) ((lambda (tmp424) (if (if tmp424 (apply (lambda (_425 name426 val427) (id? name426)) tmp424) (quote #f)) (apply (lambda (_428 name429 val430) (values (quote define-syntax-form) name429 val430 w387 s388)) tmp424) (syntax-error tmp423))) (syntax-dispatch tmp423 (quote (any any any))))) e385) (values (quote call) (quote #f) e385 w387 s388)))))))))))))) (values (quote call) (quote #f) e385 w387 s388)))) ((syntax-object? e385) (syntax-type (syntax-object-expression e385) r386 (join-wraps w387 (syntax-object-wrap e385)) (quote #f) rib389)) ((annotation? e385) (syntax-type (annotation-expression e385) r386 w387 (annotation-source e385) rib389)) ((let ((x431 e385)) (or (boolean? x431) (number? x431) (string? x431) (char? x431) (null? x431) (keyword? x431))) (values (quote constant) (quote #f) e385 w387 s388)) (else (values (quote other) (quote #f) e385 w387 s388))))) (chi-when-list (lambda (e432 when-list433 w434) (let f435 ((when-list436 when-list433) (situations (quote ()))) (if (null? when-list436) situations (f435 (cdr when-list436) (cons (let ((x437 (car when-list436))) (cond ((free-id=? x437 (quote #(syntax-object compile ((top) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(f when-list situations) #((top) (top) (top)) #("i" "i" "i")) #(ribcage () () ()) #(ribcage #(e when-list w) #((top) (top) (top)) #("i" "i" "i")) #(ribcage (lambda-var-list gen-var strip strip-annotation ellipsis? chi-void eval-local-transformer chi-local-syntax chi-lambda-clause chi-body chi-macro chi-application chi-expr chi chi-top syntax-type chi-when-list chi-install-global chi-top-sequence chi-sequence source-wrap wrap bound-id-member? distinct-bound-ids? valid-bound-ids? bound-id=? free-id=? id-var-name same-marks? join-marks join-wraps smart-append make-binding-wrap extend-ribcage! make-empty-ribcage new-mark anti-mark the-anti-mark top-marked? top-wrap empty-wrap set-ribcage-labels! set-ribcage-marks! set-ribcage-symnames! ribcage-labels ribcage-marks ribcage-symnames ribcage? make-ribcage gen-labels gen-label make-rename rename-marks rename-new rename-old subst-rename? wrap-subst wrap-marks make-wrap id-sym-name&marks id-sym-name id? nonsymbol-id? global-extend lookup macros-only-env extend-var-env extend-env null-env binding-value binding-type make-binding arg-check source-annotation no-source unannotate set-syntax-object-wrap! set-syntax-object-expression! syntax-object-wrap syntax-object-expression syntax-object? make-syntax-object self-evaluating? build-lexical-var build-letrec build-named-let build-let build-sequence build-data build-primref build-lambda build-global-definition build-global-assignment build-global-reference build-lexical-assignment build-lexical-reference build-conditional build-application get-global-definition-hook put-global-definition-hook gensym-hook error-hook local-eval-hook top-level-eval-hook annotation? fx< fx= fx- fx+ noexpand) ((top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top)) ("i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i")) #(ribcage (define-structure) ((top)) ("i")))))) (quote compile)) ((free-id=? x437 (quote #(syntax-object load ((top) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(f when-list situations) #((top) (top) (top)) #("i" "i" "i")) #(ribcage () () ()) #(ribcage #(e when-list w) #((top) (top) (top)) #("i" "i" "i")) #(ribcage (lambda-var-list gen-var strip strip-annotation ellipsis? chi-void eval-local-transformer chi-local-syntax chi-lambda-clause chi-body chi-macro chi-application chi-expr chi chi-top syntax-type chi-when-list chi-install-global chi-top-sequence chi-sequence source-wrap wrap bound-id-member? distinct-bound-ids? valid-bound-ids? bound-id=? free-id=? id-var-name same-marks? join-marks join-wraps smart-append make-binding-wrap extend-ribcage! make-empty-ribcage new-mark anti-mark the-anti-mark top-marked? top-wrap empty-wrap set-ribcage-labels! set-ribcage-marks! set-ribcage-symnames! ribcage-labels ribcage-marks ribcage-symnames ribcage? make-ribcage gen-labels gen-label make-rename rename-marks rename-new rename-old subst-rename? wrap-subst wrap-marks make-wrap id-sym-name&marks id-sym-name id? nonsymbol-id? global-extend lookup macros-only-env extend-var-env extend-env null-env binding-value binding-type make-binding arg-check source-annotation no-source unannotate set-syntax-object-wrap! set-syntax-object-expression! syntax-object-wrap syntax-object-expression syntax-object? make-syntax-object self-evaluating? build-lexical-var build-letrec build-named-let build-let build-sequence build-data build-primref build-lambda build-global-definition build-global-assignment build-global-reference build-lexical-assignment build-lexical-reference build-conditional build-application get-global-definition-hook put-global-definition-hook gensym-hook error-hook local-eval-hook top-level-eval-hook annotation? fx< fx= fx- fx+ noexpand) ((top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top)) ("i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i")) #(ribcage (define-structure) ((top)) ("i")))))) (quote load)) ((free-id=? x437 (quote #(syntax-object eval ((top) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(f when-list situations) #((top) (top) (top)) #("i" "i" "i")) #(ribcage () () ()) #(ribcage #(e when-list w) #((top) (top) (top)) #("i" "i" "i")) #(ribcage (lambda-var-list gen-var strip strip-annotation ellipsis? chi-void eval-local-transformer chi-local-syntax chi-lambda-clause chi-body chi-macro chi-application chi-expr chi chi-top syntax-type chi-when-list chi-install-global chi-top-sequence chi-sequence source-wrap wrap bound-id-member? distinct-bound-ids? valid-bound-ids? bound-id=? free-id=? id-var-name same-marks? join-marks join-wraps smart-append make-binding-wrap extend-ribcage! make-empty-ribcage new-mark anti-mark the-anti-mark top-marked? top-wrap empty-wrap set-ribcage-labels! set-ribcage-marks! set-ribcage-symnames! ribcage-labels ribcage-marks ribcage-symnames ribcage? make-ribcage gen-labels gen-label make-rename rename-marks rename-new rename-old subst-rename? wrap-subst wrap-marks make-wrap id-sym-name&marks id-sym-name id? nonsymbol-id? global-extend lookup macros-only-env extend-var-env extend-env null-env binding-value binding-type make-binding arg-check source-annotation no-source unannotate set-syntax-object-wrap! set-syntax-object-expression! syntax-object-wrap syntax-object-expression syntax-object? make-syntax-object self-evaluating? build-lexical-var build-letrec build-named-let build-let build-sequence build-data build-primref build-lambda build-global-definition build-global-assignment build-global-reference build-lexical-assignment build-lexical-reference build-conditional build-application get-global-definition-hook put-global-definition-hook gensym-hook error-hook local-eval-hook top-level-eval-hook annotation? fx< fx= fx- fx+ noexpand) ((top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top)) ("i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i")) #(ribcage (define-structure) ((top)) ("i")))))) (quote eval)) (else (syntax-error (wrap x437 w434) (quote "invalid eval-when situation"))))) situations)))))) (chi-install-global (lambda (name438 e439) (list (quote install-global-transformer) (list (quote quote) name438) e439))) (chi-top-sequence (lambda (body440 r441 w442 s443 m444 esew445) (build-sequence s443 (let dobody ((body446 body440) (r447 r441) (w448 w442) (m449 m444) (esew450 esew445)) (if (null? body446) (quote ()) (let ((first451 (chi-top (car body446) r447 w448 m449 esew450))) (cons first451 (dobody (cdr body446) r447 w448 m449 esew450)))))))) (chi-sequence (lambda (body452 r453 w454 s455) (build-sequence s455 (let dobody456 ((body457 body452) (r458 r453) (w459 w454)) (if (null? body457) (quote ()) (let ((first460 (chi (car body457) r458 w459))) (cons first460 (dobody456 (cdr body457) r458 w459)))))))) (source-wrap (lambda (x461 w462 s463) (wrap (if s463 (make-annotation x461 s463 (quote #f)) x461) w462))) (wrap (lambda (x464 w465) (cond ((and (null? (wrap-marks w465)) (null? (wrap-subst w465))) x464) ((syntax-object? x464) (make-syntax-object (syntax-object-expression x464) (join-wraps w465 (syntax-object-wrap x464)))) ((null? x464) x464) (else (make-syntax-object x464 w465))))) (bound-id-member? (lambda (x466 list) (and (not (null? list)) (or (bound-id=? x466 (car list)) (bound-id-member? x466 (cdr list)))))) (distinct-bound-ids? (lambda (ids467) (let distinct? ((ids468 ids467)) (or (null? ids468) (and (not (bound-id-member? (car ids468) (cdr ids468))) (distinct? (cdr ids468))))))) (valid-bound-ids? (lambda (ids469) (and (let all-ids? ((ids470 ids469)) (or (null? ids470) (and (id? (car ids470)) (all-ids? (cdr ids470))))) (distinct-bound-ids? ids469)))) (bound-id=? (lambda (i471 j) (if (and (syntax-object? i471) (syntax-object? j)) (and (eq? (let ((e472 (syntax-object-expression i471))) (if (annotation? e472) (annotation-expression e472) e472)) (let ((e473 (syntax-object-expression j))) (if (annotation? e473) (annotation-expression e473) e473))) (same-marks? (wrap-marks (syntax-object-wrap i471)) (wrap-marks (syntax-object-wrap j)))) (eq? (let ((e474 i471)) (if (annotation? e474) (annotation-expression e474) e474)) (let ((e475 j)) (if (annotation? e475) (annotation-expression e475) e475)))))) (free-id=? (lambda (i476 j477) (and (eq? (let ((x478 i476)) (let ((e479 (if (syntax-object? x478) (syntax-object-expression x478) x478))) (if (annotation? e479) (annotation-expression e479) e479))) (let ((x480 j477)) (let ((e481 (if (syntax-object? x480) (syntax-object-expression x480) x480))) (if (annotation? e481) (annotation-expression e481) e481)))) (eq? (id-var-name i476 (quote (()))) (id-var-name j477 (quote (()))))))) (id-var-name (lambda (id482 w483) (letrec ((search-vector-rib (lambda (sym subst marks489 symnames ribcage490) (let ((n491 (vector-length symnames))) (let f492 ((i493 (quote 0))) (cond ((fx= i493 n491) (search sym (cdr subst) marks489)) ((and (eq? (vector-ref symnames i493) sym) (same-marks? marks489 (vector-ref (ribcage-marks ribcage490) i493))) (values (vector-ref (ribcage-labels ribcage490) i493) marks489)) (else (f492 (fx+ i493 (quote 1))))))))) (search-list-rib (lambda (sym494 subst495 marks496 symnames497 ribcage498) (let f499 ((symnames500 symnames497) (i501 (quote 0))) (cond ((null? symnames500) (search sym494 (cdr subst495) marks496)) ((and (eq? (car symnames500) sym494) (same-marks? marks496 (list-ref (ribcage-marks ribcage498) i501))) (values (list-ref (ribcage-labels ribcage498) i501) marks496)) (else (f499 (cdr symnames500) (fx+ i501 (quote 1)))))))) (search (lambda (sym502 subst503 marks504) (if (null? subst503) (values (quote #f) marks504) (let ((fst (car subst503))) (if (eq? fst (quote shift)) (search sym502 (cdr subst503) (cdr marks504)) (let ((symnames505 (ribcage-symnames fst))) (if (vector? symnames505) (search-vector-rib sym502 subst503 marks504 symnames505 fst) (search-list-rib sym502 subst503 marks504 symnames505 fst))))))))) (cond ((symbol? id482) (or (call-with-values (lambda () (search id482 (wrap-subst w483) (wrap-marks w483))) (lambda (x506 . ignore) x506)) id482)) ((syntax-object? id482) (let ((id507 (let ((e508 (syntax-object-expression id482))) (if (annotation? e508) (annotation-expression e508) e508))) (w1 (syntax-object-wrap id482))) (let ((marks509 (join-marks (wrap-marks w483) (wrap-marks w1)))) (call-with-values (lambda () (search id507 (wrap-subst w483) marks509)) (lambda (new-id marks510) (or new-id (call-with-values (lambda () (search id507 (wrap-subst w1) marks510)) (lambda (x512 . ignore511) x512)) id507)))))) ((annotation? id482) (let ((id513 (let ((e514 id482)) (if (annotation? e514) (annotation-expression e514) e514)))) (or (call-with-values (lambda () (search id513 (wrap-subst w483) (wrap-marks w483))) (lambda (x516 . ignore515) x516)) id513))) (else (error-hook (quote id-var-name) (quote "invalid id") id482)))))) (same-marks? (lambda (x517 y) (or (eq? x517 y) (and (not (null? x517)) (not (null? y)) (eq? (car x517) (car y)) (same-marks? (cdr x517) (cdr y)))))) (join-marks (lambda (m1 m2) (smart-append m1 m2))) (join-wraps (lambda (w1518 w2) (let ((m1519 (wrap-marks w1518)) (s1 (wrap-subst w1518))) (if (null? m1519) (if (null? s1) w2 (make-wrap (wrap-marks w2) (smart-append s1 (wrap-subst w2)))) (make-wrap (smart-append m1519 (wrap-marks w2)) (smart-append s1 (wrap-subst w2))))))) (smart-append (lambda (m1520 m2521) (if (null? m2521) m1520 (append m1520 m2521)))) (make-binding-wrap (lambda (ids522 labels523 w524) (if (null? ids522) w524 (make-wrap (wrap-marks w524) (cons (let ((labelvec (list->vector labels523))) (let ((n525 (vector-length labelvec))) (let ((symnamevec (make-vector n525)) (marksvec (make-vector n525))) (begin (let f526 ((ids527 ids522) (i528 (quote 0))) (if (not (null? ids527)) (call-with-values (lambda () (id-sym-name&marks (car ids527) w524)) (lambda (symname marks529) (begin (vector-set! symnamevec i528 symname) (vector-set! marksvec i528 marks529) (f526 (cdr ids527) (fx+ i528 (quote 1)))))))) (make-ribcage symnamevec marksvec labelvec))))) (wrap-subst w524)))))) (extend-ribcage! (lambda (ribcage530 id531 label532) (begin (set-ribcage-symnames! ribcage530 (cons (let ((e533 (syntax-object-expression id531))) (if (annotation? e533) (annotation-expression e533) e533)) (ribcage-symnames ribcage530))) (set-ribcage-marks! ribcage530 (cons (wrap-marks (syntax-object-wrap id531)) (ribcage-marks ribcage530))) (set-ribcage-labels! ribcage530 (cons label532 (ribcage-labels ribcage530)))))) (anti-mark (lambda (w534) (make-wrap (cons (quote #f) (wrap-marks w534)) (cons (quote shift) (wrap-subst w534))))) (set-ribcage-labels! (lambda (x535 update) (vector-set! x535 (quote 3) update))) (set-ribcage-marks! (lambda (x536 update537) (vector-set! x536 (quote 2) update537))) (set-ribcage-symnames! (lambda (x538 update539) (vector-set! x538 (quote 1) update539))) (ribcage-labels (lambda (x540) (vector-ref x540 (quote 3)))) (ribcage-marks (lambda (x541) (vector-ref x541 (quote 2)))) (ribcage-symnames (lambda (x542) (vector-ref x542 (quote 1)))) (ribcage? (lambda (x543) (and (vector? x543) (= (vector-length x543) (quote 4)) (eq? (vector-ref x543 (quote 0)) (quote ribcage))))) (make-ribcage (lambda (symnames544 marks545 labels546) (vector (quote ribcage) symnames544 marks545 labels546))) (gen-labels (lambda (ls547) (if (null? ls547) (quote ()) (cons (gen-label) (gen-labels (cdr ls547)))))) (gen-label (lambda () (string (quote #\i)))) (wrap-subst cdr) (wrap-marks car) (make-wrap cons) (id-sym-name&marks (lambda (x548 w549) (if (syntax-object? x548) (values (let ((e550 (syntax-object-expression x548))) (if (annotation? e550) (annotation-expression e550) e550)) (join-marks (wrap-marks w549) (wrap-marks (syntax-object-wrap x548)))) (values (let ((e551 x548)) (if (annotation? e551) (annotation-expression e551) e551)) (wrap-marks w549))))) (id? (lambda (x552) (cond ((symbol? x552) (quote #t)) ((syntax-object? x552) (symbol? (let ((e553 (syntax-object-expression x552))) (if (annotation? e553) (annotation-expression e553) e553)))) ((annotation? x552) (symbol? (annotation-expression x552))) (else (quote #f))))) (nonsymbol-id? (lambda (x554) (and (syntax-object? x554) (symbol? (let ((e555 (syntax-object-expression x554))) (if (annotation? e555) (annotation-expression e555) e555)))))) (global-extend (lambda (type556 sym557 val558) (put-global-definition-hook sym557 (cons type556 val558)))) (lookup (lambda (x559 r560) (cond ((assq x559 r560) => cdr) ((symbol? x559) (or (get-global-definition-hook x559) (quote (global)))) (else (quote (displaced-lexical)))))) (macros-only-env (lambda (r561) (if (null? r561) (quote ()) (let ((a562 (car r561))) (if (eq? (cadr a562) (quote macro)) (cons a562 (macros-only-env (cdr r561))) (macros-only-env (cdr r561))))))) (extend-var-env (lambda (labels563 vars564 r565) (if (null? labels563) r565 (extend-var-env (cdr labels563) (cdr vars564) (cons (cons (car labels563) (cons (quote lexical) (car vars564))) r565))))) (extend-env (lambda (labels566 bindings567 r568) (if (null? labels566) r568 (extend-env (cdr labels566) (cdr bindings567) (cons (cons (car labels566) (car bindings567)) r568))))) (binding-value cdr) (binding-type car) (source-annotation (lambda (x569) (cond ((annotation? x569) (annotation-source x569)) ((syntax-object? x569) (source-annotation (syntax-object-expression x569))) (else (quote #f))))) (set-syntax-object-wrap! (lambda (x570 update571) (vector-set! x570 (quote 2) update571))) (set-syntax-object-expression! (lambda (x572 update573) (vector-set! x572 (quote 1) update573))) (syntax-object-wrap (lambda (x574) (vector-ref x574 (quote 2)))) (syntax-object-expression (lambda (x575) (vector-ref x575 (quote 1)))) (syntax-object? (lambda (x576) (and (vector? x576) (= (vector-length x576) (quote 3)) (eq? (vector-ref x576 (quote 0)) (quote syntax-object))))) (make-syntax-object (lambda (expression wrap577) (vector (quote syntax-object) expression wrap577))) (build-letrec (lambda (src578 vars579 val-exps body-exp) (if (null? vars579) body-exp (list (quote letrec) (map list vars579 val-exps) body-exp)))) (build-named-let (lambda (src580 vars581 val-exps582 body-exp583) (if (null? vars581) body-exp583 (list (quote let) (car vars581) (map list (cdr vars581) val-exps582) body-exp583)))) (build-let (lambda (src584 vars585 val-exps586 body-exp587) (if (null? vars585) body-exp587 (list (quote let) (map list vars585 val-exps586) body-exp587)))) (build-sequence (lambda (src588 exps) (if (null? (cdr exps)) (car exps) (cons (quote begin) exps)))) (get-global-definition-hook (lambda (symbol) (getprop symbol (quote *sc-expander*)))) (put-global-definition-hook (lambda (symbol589 binding) (putprop symbol589 (quote *sc-expander*) binding))) (error-hook (lambda (who590 why what) (error who590 (quote "~a ~s") why what))) (local-eval-hook (lambda (x591) (eval (list noexpand x591)))) (top-level-eval-hook (lambda (x592) (eval (list noexpand x592)))) (annotation? (lambda (x593) (quote #f))) (fx< <) (fx= =) (fx- -) (fx+ +) (noexpand (quote "noexpand"))) (begin (global-extend (quote local-syntax) (quote letrec-syntax) (quote #t)) (global-extend (quote local-syntax) (quote let-syntax) (quote #f)) (global-extend (quote core) (quote fluid-let-syntax) (lambda (e594 r595 w596 s597) ((lambda (tmp598) ((lambda (tmp599) (if (if tmp599 (apply (lambda (_600 var601 val602 e1603 e2604) (valid-bound-ids? var601)) tmp599) (quote #f)) (apply (lambda (_606 var607 val608 e1609 e2610) (let ((names (map (lambda (x611) (id-var-name x611 w596)) var607))) (begin (for-each (lambda (id613 n614) (let ((t615 (binding-type (lookup n614 r595)))) (if (memv t615 (quote (displaced-lexical))) (syntax-error (source-wrap id613 w596 s597) (quote "identifier out of context"))))) var607 names) (chi-body (cons e1609 e2610) (source-wrap e594 w596 s597) (extend-env names (let ((trans-r618 (macros-only-env r595))) (map (lambda (x619) (cons (quote macro) (eval-local-transformer (chi x619 trans-r618 w596)))) val608)) r595) w596)))) tmp599) ((lambda (_621) (syntax-error (source-wrap e594 w596 s597))) tmp598))) (syntax-dispatch tmp598 (quote (any #(each (any any)) any . each-any))))) e594))) (global-extend (quote core) (quote quote) (lambda (e622 r623 w624 s625) ((lambda (tmp626) ((lambda (tmp627) (if tmp627 (apply (lambda (_628 e629) (list (quote quote) (strip e629 w624))) tmp627) ((lambda (_630) (syntax-error (source-wrap e622 w624 s625))) tmp626))) (syntax-dispatch tmp626 (quote (any any))))) e622))) (global-extend (quote core) (quote syntax) (letrec ((regen (lambda (x631) (let ((t632 (car x631))) (if (memv t632 (quote (ref))) (cadr x631) (if (memv t632 (quote (primitive))) (cadr x631) (if (memv t632 (quote (quote))) (list (quote quote) (cadr x631)) (if (memv t632 (quote (lambda))) (list (quote lambda) (cadr x631) (regen (caddr x631))) (if (memv t632 (quote (map))) (let ((ls633 (map regen (cdr x631)))) (cons (if (fx= (length ls633) (quote 2)) (quote map) (quote map)) ls633)) (cons (car x631) (map regen (cdr x631))))))))))) (gen-vector (lambda (x634) (cond ((eq? (car x634) (quote list)) (cons (quote vector) (cdr x634))) ((eq? (car x634) (quote quote)) (list (quote quote) (list->vector (cadr x634)))) (else (list (quote list->vector) x634))))) (gen-append (lambda (x635 y636) (if (equal? y636 (quote (quote ()))) x635 (list (quote append) x635 y636)))) (gen-cons (lambda (x637 y638) (let ((t639 (car y638))) (if (memv t639 (quote (quote))) (if (eq? (car x637) (quote quote)) (list (quote quote) (cons (cadr x637) (cadr y638))) (if (eq? (cadr y638) (quote ())) (list (quote list) x637) (list (quote cons) x637 y638))) (if (memv t639 (quote (list))) (cons (quote list) (cons x637 (cdr y638))) (list (quote cons) x637 y638)))))) (gen-map (lambda (e640 map-env) (let ((formals (map cdr map-env)) (actuals (map (lambda (x641) (list (quote ref) (car x641))) map-env))) (cond ((eq? (car e640) (quote ref)) (car actuals)) ((andmap (lambda (x642) (and (eq? (car x642) (quote ref)) (memq (cadr x642) formals))) (cdr e640)) (cons (quote map) (cons (list (quote primitive) (car e640)) (map (let ((r643 (map cons formals actuals))) (lambda (x644) (cdr (assq (cadr x644) r643)))) (cdr e640))))) (else (cons (quote map) (cons (list (quote lambda) formals e640) actuals))))))) (gen-mappend (lambda (e645 map-env646) (list (quote apply) (quote (primitive append)) (gen-map e645 map-env646)))) (gen-ref (lambda (src647 var648 level649 maps) (if (fx= level649 (quote 0)) (values var648 maps) (if (null? maps) (syntax-error src647 (quote "missing ellipsis in syntax form")) (call-with-values (lambda () (gen-ref src647 var648 (fx- level649 (quote 1)) (cdr maps))) (lambda (outer-var outer-maps) (let ((b650 (assq outer-var (car maps)))) (if b650 (values (cdr b650) maps) (let ((inner-var (gen-var (quote tmp)))) (values inner-var (cons (cons (cons outer-var inner-var) (car maps)) outer-maps))))))))))) (gen-syntax (lambda (src651 e652 r653 maps654 ellipsis?655) (if (id? e652) (let ((label656 (id-var-name e652 (quote (()))))) (let ((b657 (lookup label656 r653))) (if (eq? (binding-type b657) (quote syntax)) (call-with-values (lambda () (let ((var.lev (binding-value b657))) (gen-ref src651 (car var.lev) (cdr var.lev) maps654))) (lambda (var658 maps659) (values (list (quote ref) var658) maps659))) (if (ellipsis?655 e652) (syntax-error src651 (quote "misplaced ellipsis in syntax form")) (values (list (quote quote) e652) maps654))))) ((lambda (tmp660) ((lambda (tmp661) (if (if tmp661 (apply (lambda (dots e662) (ellipsis?655 dots)) tmp661) (quote #f)) (apply (lambda (dots663 e664) (gen-syntax src651 e664 r653 maps654 (lambda (x665) (quote #f)))) tmp661) ((lambda (tmp666) (if (if tmp666 (apply (lambda (x667 dots668 y669) (ellipsis?655 dots668)) tmp666) (quote #f)) (apply (lambda (x670 dots671 y672) (let f673 ((y674 y672) (k675 (lambda (maps676) (call-with-values (lambda () (gen-syntax src651 x670 r653 (cons (quote ()) maps676) ellipsis?655)) (lambda (x677 maps678) (if (null? (car maps678)) (syntax-error src651 (quote "extra ellipsis in syntax form")) (values (gen-map x677 (car maps678)) (cdr maps678)))))))) ((lambda (tmp679) ((lambda (tmp680) (if (if tmp680 (apply (lambda (dots681 y682) (ellipsis?655 dots681)) tmp680) (quote #f)) (apply (lambda (dots683 y684) (f673 y684 (lambda (maps685) (call-with-values (lambda () (k675 (cons (quote ()) maps685))) (lambda (x686 maps687) (if (null? (car maps687)) (syntax-error src651 (quote "extra ellipsis in syntax form")) (values (gen-mappend x686 (car maps687)) (cdr maps687)))))))) tmp680) ((lambda (_688) (call-with-values (lambda () (gen-syntax src651 y674 r653 maps654 ellipsis?655)) (lambda (y689 maps690) (call-with-values (lambda () (k675 maps690)) (lambda (x691 maps692) (values (gen-append x691 y689) maps692)))))) tmp679))) (syntax-dispatch tmp679 (quote (any . any))))) y674))) tmp666) ((lambda (tmp693) (if tmp693 (apply (lambda (x694 y695) (call-with-values (lambda () (gen-syntax src651 x694 r653 maps654 ellipsis?655)) (lambda (x696 maps697) (call-with-values (lambda () (gen-syntax src651 y695 r653 maps697 ellipsis?655)) (lambda (y698 maps699) (values (gen-cons x696 y698) maps699)))))) tmp693) ((lambda (tmp700) (if tmp700 (apply (lambda (e1701 e2702) (call-with-values (lambda () (gen-syntax src651 (cons e1701 e2702) r653 maps654 ellipsis?655)) (lambda (e704 maps705) (values (gen-vector e704) maps705)))) tmp700) ((lambda (_706) (values (list (quote quote) e652) maps654)) tmp660))) (syntax-dispatch tmp660 (quote #(vector (any . each-any))))))) (syntax-dispatch tmp660 (quote (any . any)))))) (syntax-dispatch tmp660 (quote (any any . any)))))) (syntax-dispatch tmp660 (quote (any any))))) e652))))) (lambda (e707 r708 w709 s710) (let ((e711 (source-wrap e707 w709 s710))) ((lambda (tmp712) ((lambda (tmp713) (if tmp713 (apply (lambda (_714 x715) (call-with-values (lambda () (gen-syntax e711 x715 r708 (quote ()) ellipsis?)) (lambda (e716 maps717) (regen e716)))) tmp713) ((lambda (_718) (syntax-error e711)) tmp712))) (syntax-dispatch tmp712 (quote (any any))))) e711))))) (global-extend (quote core) (quote lambda) (lambda (e719 r720 w721 s722) ((lambda (tmp723) ((lambda (tmp724) (if tmp724 (apply (lambda (_725 c726) (chi-lambda-clause (source-wrap e719 w721 s722) c726 r720 w721 (lambda (vars727 body728) (list (quote lambda) vars727 body728)))) tmp724) (syntax-error tmp723))) (syntax-dispatch tmp723 (quote (any . any))))) e719))) (global-extend (quote core) (quote let) (letrec ((chi-let (lambda (e729 r730 w731 s732 constructor733 ids734 vals735 exps736) (if (not (valid-bound-ids? ids734)) (syntax-error e729 (quote "duplicate bound variable in")) (let ((labels737 (gen-labels ids734)) (new-vars738 (map gen-var ids734))) (let ((nw (make-binding-wrap ids734 labels737 w731)) (nr (extend-var-env labels737 new-vars738 r730))) (constructor733 s732 new-vars738 (map (lambda (x739) (chi x739 r730 w731)) vals735) (chi-body exps736 (source-wrap e729 nw s732) nr nw)))))))) (lambda (e740 r741 w742 s743) ((lambda (tmp744) ((lambda (tmp745) (if tmp745 (apply (lambda (_746 id747 val748 e1749 e2750) (chi-let e740 r741 w742 s743 build-let id747 val748 (cons e1749 e2750))) tmp745) ((lambda (tmp754) (if (if tmp754 (apply (lambda (_755 f756 id757 val758 e1759 e2760) (id? f756)) tmp754) (quote #f)) (apply (lambda (_761 f762 id763 val764 e1765 e2766) (chi-let e740 r741 w742 s743 build-named-let (cons f762 id763) val764 (cons e1765 e2766))) tmp754) ((lambda (_770) (syntax-error (source-wrap e740 w742 s743))) tmp744))) (syntax-dispatch tmp744 (quote (any any #(each (any any)) any . each-any)))))) (syntax-dispatch tmp744 (quote (any #(each (any any)) any . each-any))))) e740)))) (global-extend (quote core) (quote letrec) (lambda (e771 r772 w773 s774) ((lambda (tmp775) ((lambda (tmp776) (if tmp776 (apply (lambda (_777 id778 val779 e1780 e2781) (let ((ids782 id778)) (if (not (valid-bound-ids? ids782)) (syntax-error e771 (quote "duplicate bound variable in")) (let ((labels784 (gen-labels ids782)) (new-vars785 (map gen-var ids782))) (let ((w786 (make-binding-wrap ids782 labels784 w773)) (r787 (extend-var-env labels784 new-vars785 r772))) (build-letrec s774 new-vars785 (map (lambda (x788) (chi x788 r787 w786)) val779) (chi-body (cons e1780 e2781) (source-wrap e771 w786 s774) r787 w786))))))) tmp776) ((lambda (_791) (syntax-error (source-wrap e771 w773 s774))) tmp775))) (syntax-dispatch tmp775 (quote (any #(each (any any)) any . each-any))))) e771))) (global-extend (quote core) (quote set!) (lambda (e792 r793 w794 s795) ((lambda (tmp796) ((lambda (tmp797) (if (if tmp797 (apply (lambda (_798 id799 val800) (id? id799)) tmp797) (quote #f)) (apply (lambda (_801 id802 val803) (let ((val804 (chi val803 r793 w794)) (n805 (id-var-name id802 w794))) (let ((b806 (lookup n805 r793))) (let ((t807 (binding-type b806))) (if (memv t807 (quote (lexical))) (list (quote set!) (binding-value b806) val804) (if (memv t807 (quote (global))) (list (quote set!) n805 val804) (if (memv t807 (quote (displaced-lexical))) (syntax-error (wrap id802 w794) (quote "identifier out of context")) (syntax-error (source-wrap e792 w794 s795))))))))) tmp797) ((lambda (_808) (syntax-error (source-wrap e792 w794 s795))) tmp796))) (syntax-dispatch tmp796 (quote (any any any))))) e792))) (global-extend (quote begin) (quote begin) (quote ())) (global-extend (quote define) (quote define) (quote ())) (global-extend (quote define-syntax) (quote define-syntax) (quote ())) (global-extend (quote eval-when) (quote eval-when) (quote ())) (global-extend (quote core) (quote syntax-case) (letrec ((gen-syntax-case (lambda (x809 keys clauses r810) (if (null? clauses) (list (quote syntax-error) x809) ((lambda (tmp811) ((lambda (tmp812) (if tmp812 (apply (lambda (pat exp813) (if (and (id? pat) (andmap (lambda (x814) (not (free-id=? pat x814))) (cons (quote #(syntax-object ... ((top) #(ribcage #(pat exp) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(x keys clauses r) #((top) (top) (top) (top)) #("i" "i" "i" "i")) #(ribcage (gen-syntax-case gen-clause build-dispatch-call convert-pattern) ((top) (top) (top) (top)) ("i" "i" "i" "i")) #(ribcage (lambda-var-list gen-var strip strip-annotation ellipsis? chi-void eval-local-transformer chi-local-syntax chi-lambda-clause chi-body chi-macro chi-application chi-expr chi chi-top syntax-type chi-when-list chi-install-global chi-top-sequence chi-sequence source-wrap wrap bound-id-member? distinct-bound-ids? valid-bound-ids? bound-id=? free-id=? id-var-name same-marks? join-marks join-wraps smart-append make-binding-wrap extend-ribcage! make-empty-ribcage new-mark anti-mark the-anti-mark top-marked? top-wrap empty-wrap set-ribcage-labels! set-ribcage-marks! set-ribcage-symnames! ribcage-labels ribcage-marks ribcage-symnames ribcage? make-ribcage gen-labels gen-label make-rename rename-marks rename-new rename-old subst-rename? wrap-subst wrap-marks make-wrap id-sym-name&marks id-sym-name id? nonsymbol-id? global-extend lookup macros-only-env extend-var-env extend-env null-env binding-value binding-type make-binding arg-check source-annotation no-source unannotate set-syntax-object-wrap! set-syntax-object-expression! syntax-object-wrap syntax-object-expression syntax-object? make-syntax-object self-evaluating? build-lexical-var build-letrec build-named-let build-let build-sequence build-data build-primref build-lambda build-global-definition build-global-assignment build-global-reference build-lexical-assignment build-lexical-reference build-conditional build-application get-global-definition-hook put-global-definition-hook gensym-hook error-hook local-eval-hook top-level-eval-hook annotation? fx< fx= fx- fx+ noexpand) ((top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top) (top)) ("i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i" "i")) #(ribcage (define-structure) ((top)) ("i"))))) keys))) (let ((labels815 (list (gen-label))) (var816 (gen-var pat))) (list (list (quote lambda) (list var816) (chi exp813 (extend-env labels815 (list (cons (quote syntax) (cons var816 (quote 0)))) r810) (make-binding-wrap (list pat) labels815 (quote (()))))) x809)) (gen-clause x809 keys (cdr clauses) r810 pat (quote #t) exp813))) tmp812) ((lambda (tmp817) (if tmp817 (apply (lambda (pat818 fender exp819) (gen-clause x809 keys (cdr clauses) r810 pat818 fender exp819)) tmp817) ((lambda (_820) (syntax-error (car clauses) (quote "invalid syntax-case clause"))) tmp811))) (syntax-dispatch tmp811 (quote (any any any)))))) (syntax-dispatch tmp811 (quote (any any))))) (car clauses))))) (gen-clause (lambda (x821 keys822 clauses823 r824 pat825 fender826 exp827) (call-with-values (lambda () (convert-pattern pat825 keys822)) (lambda (p828 pvars) (cond ((not (distinct-bound-ids? (map car pvars))) (syntax-error pat825 (quote "duplicate pattern variable in syntax-case pattern"))) ((not (andmap (lambda (x829) (not (ellipsis? (car x829)))) pvars)) (syntax-error pat825 (quote "misplaced ellipsis in syntax-case pattern"))) (else (let ((y830 (gen-var (quote tmp)))) (list (list (quote lambda) (list y830) (let ((y831 y830)) (list (quote if) ((lambda (tmp832) ((lambda (tmp833) (if tmp833 (apply (lambda () y831) tmp833) ((lambda (_834) (list (quote if) y831 (build-dispatch-call pvars fender826 y831 r824) (list (quote quote) (quote #f)))) tmp832))) (syntax-dispatch tmp832 (quote #(atom #t))))) fender826) (build-dispatch-call pvars exp827 y831 r824) (gen-syntax-case x821 keys822 clauses823 r824)))) (if (eq? p828 (quote any)) (list (quote list) x821) (list (quote syntax-dispatch) x821 (list (quote quote) p828))))))))))) (build-dispatch-call (lambda (pvars835 exp836 y837 r838) (let ((ids839 (map car pvars835)) (levels (map cdr pvars835))) (let ((labels840 (gen-labels ids839)) (new-vars841 (map gen-var ids839))) (list (quote apply) (list (quote lambda) new-vars841 (chi exp836 (extend-env labels840 (map (lambda (var842 level843) (cons (quote syntax) (cons var842 level843))) new-vars841 (map cdr pvars835)) r838) (make-binding-wrap ids839 labels840 (quote (()))))) y837))))) (convert-pattern (lambda (pattern keys844) (let cvt ((p845 pattern) (n846 (quote 0)) (ids847 (quote ()))) (if (id? p845) (if (bound-id-member? p845 keys844) (values (vector (quote free-id) p845) ids847) (values (quote any) (cons (cons p845 n846) ids847))) ((lambda (tmp848) ((lambda (tmp849) (if (if tmp849 (apply (lambda (x850 dots851) (ellipsis? dots851)) tmp849) (quote #f)) (apply (lambda (x852 dots853) (call-with-values (lambda () (cvt x852 (fx+ n846 (quote 1)) ids847)) (lambda (p854 ids855) (values (if (eq? p854 (quote any)) (quote each-any) (vector (quote each) p854)) ids855)))) tmp849) ((lambda (tmp856) (if tmp856 (apply (lambda (x857 y858) (call-with-values (lambda () (cvt y858 n846 ids847)) (lambda (y859 ids860) (call-with-values (lambda () (cvt x857 n846 ids860)) (lambda (x861 ids862) (values (cons x861 y859) ids862)))))) tmp856) ((lambda (tmp863) (if tmp863 (apply (lambda () (values (quote ()) ids847)) tmp863) ((lambda (tmp864) (if tmp864 (apply (lambda (x865) (call-with-values (lambda () (cvt x865 n846 ids847)) (lambda (p867 ids868) (values (vector (quote vector) p867) ids868)))) tmp864) ((lambda (x869) (values (vector (quote atom) (strip p845 (quote (())))) ids847)) tmp848))) (syntax-dispatch tmp848 (quote #(vector each-any)))))) (syntax-dispatch tmp848 (quote ()))))) (syntax-dispatch tmp848 (quote (any . any)))))) (syntax-dispatch tmp848 (quote (any any))))) p845)))))) (lambda (e870 r871 w872 s873) (let ((e874 (source-wrap e870 w872 s873))) ((lambda (tmp875) ((lambda (tmp876) (if tmp876 (apply (lambda (_877 val878 key m879) (if (andmap (lambda (x880) (and (id? x880) (not (ellipsis? x880)))) key) (let ((x882 (gen-var (quote tmp)))) (list (list (quote lambda) (list x882) (gen-syntax-case x882 key m879 r871)) (chi val878 r871 (quote (()))))) (syntax-error e874 (quote "invalid literals list in")))) tmp876) (syntax-error tmp875))) (syntax-dispatch tmp875 (quote (any any each-any . each-any))))) e874))))) (set! sc-expand (let ((m885 (quote e)) (esew886 (quote (eval)))) (lambda (x887) (if (and (pair? x887) (equal? (car x887) noexpand)) (cadr x887) (chi-top x887 (quote ()) (quote ((top))) m885 esew886))))) (set! sc-expand3 (let ((m888 (quote e)) (esew889 (quote (eval)))) (lambda (x890 . rest) (if (and (pair? x890) (equal? (car x890) noexpand)) (cadr x890) (chi-top x890 (quote ()) (quote ((top))) (if (null? rest) m888 (car rest)) (if (or (null? rest) (null? (cdr rest))) esew889 (cadr rest))))))) (set! identifier? (lambda (x891) (nonsymbol-id? x891))) (set! datum->syntax-object (lambda (id892 datum) (begin (let ((x893 id892)) (if (not (nonsymbol-id? x893)) (error-hook (quote datum->syntax-object) (quote "invalid argument") x893))) (make-syntax-object datum (syntax-object-wrap id892))))) (set! syntax-object->datum (lambda (x894) (strip x894 (quote (()))))) (set! generate-temporaries (lambda (ls895) (begin (let ((x896 ls895)) (if (not (list? x896)) (error-hook (quote generate-temporaries) (quote "invalid argument") x896))) (map (lambda (x897) (wrap (gensym) (quote ((top))))) ls895)))) (set! free-identifier=? (lambda (x898 y899) (begin (let ((x900 x898)) (if (not (nonsymbol-id? x900)) (error-hook (quote free-identifier=?) (quote "invalid argument") x900))) (let ((x901 y899)) (if (not (nonsymbol-id? x901)) (error-hook (quote free-identifier=?) (quote "invalid argument") x901))) (free-id=? x898 y899)))) (set! bound-identifier=? (lambda (x902 y903) (begin (let ((x904 x902)) (if (not (nonsymbol-id? x904)) (error-hook (quote bound-identifier=?) (quote "invalid argument") x904))) (let ((x905 y903)) (if (not (nonsymbol-id? x905)) (error-hook (quote bound-identifier=?) (quote "invalid argument") x905))) (bound-id=? x902 y903)))) (set! syntax-error (lambda (object . messages) (begin (for-each (lambda (x906) (let ((x907 x906)) (if (not (string? x907)) (error-hook (quote syntax-error) (quote "invalid argument") x907)))) messages) (let ((message (if (null? messages) (quote "invalid syntax") (apply string-append messages)))) (error-hook (quote #f) message (strip object (quote (())))))))) (set! install-global-transformer (lambda (sym908 v909) (begin (let ((x910 sym908)) (if (not (symbol? x910)) (error-hook (quote define-syntax) (quote "invalid argument") x910))) (let ((x911 v909)) (if (not (procedure? x911)) (error-hook (quote define-syntax) (quote "invalid argument") x911))) (global-extend (quote macro) sym908 v909)))) (letrec ((match (lambda (e912 p913 w914 r915) (cond ((not r915) (quote #f)) ((eq? p913 (quote any)) (cons (wrap e912 w914) r915)) ((syntax-object? e912) (match* (let ((e916 (syntax-object-expression e912))) (if (annotation? e916) (annotation-expression e916) e916)) p913 (join-wraps w914 (syntax-object-wrap e912)) r915)) (else (match* (let ((e917 e912)) (if (annotation? e917) (annotation-expression e917) e917)) p913 w914 r915))))) (match* (lambda (e918 p919 w920 r921) (cond ((null? p919) (and (null? e918) r921)) ((pair? p919) (and (pair? e918) (match (car e918) (car p919) w920 (match (cdr e918) (cdr p919) w920 r921)))) ((eq? p919 (quote each-any)) (let ((l (match-each-any e918 w920))) (and l (cons l r921)))) (else (let ((t922 (vector-ref p919 (quote 0)))) (if (memv t922 (quote (each))) (if (null? e918) (match-empty (vector-ref p919 (quote 1)) r921) (let ((l923 (match-each e918 (vector-ref p919 (quote 1)) w920))) (and l923 (let collect ((l924 l923)) (if (null? (car l924)) r921 (cons (map car l924) (collect (map cdr l924)))))))) (if (memv t922 (quote (free-id))) (and (id? e918) (free-id=? (wrap e918 w920) (vector-ref p919 (quote 1))) r921) (if (memv t922 (quote (atom))) (and (equal? (vector-ref p919 (quote 1)) (strip e918 w920)) r921) (if (memv t922 (quote (vector))) (and (vector? e918) (match (vector->list e918) (vector-ref p919 (quote 1)) w920 r921))))))))))) (match-empty (lambda (p925 r926) (cond ((null? p925) r926) ((eq? p925 (quote any)) (cons (quote ()) r926)) ((pair? p925) (match-empty (car p925) (match-empty (cdr p925) r926))) ((eq? p925 (quote each-any)) (cons (quote ()) r926)) (else (let ((t927 (vector-ref p925 (quote 0)))) (if (memv t927 (quote (each))) (match-empty (vector-ref p925 (quote 1)) r926) (if (memv t927 (quote (free-id atom))) r926 (if (memv t927 (quote (vector))) (match-empty (vector-ref p925 (quote 1)) r926))))))))) (match-each-any (lambda (e928 w929) (cond ((annotation? e928) (match-each-any (annotation-expression e928) w929)) ((pair? e928) (let ((l930 (match-each-any (cdr e928) w929))) (and l930 (cons (wrap (car e928) w929) l930)))) ((null? e928) (quote ())) ((syntax-object? e928) (match-each-any (syntax-object-expression e928) (join-wraps w929 (syntax-object-wrap e928)))) (else (quote #f))))) (match-each (lambda (e931 p932 w933) (cond ((annotation? e931) (match-each (annotation-expression e931) p932 w933)) ((pair? e931) (let ((first934 (match (car e931) p932 w933 (quote ())))) (and first934 (let ((rest935 (match-each (cdr e931) p932 w933))) (and rest935 (cons first934 rest935)))))) ((null? e931) (quote ())) ((syntax-object? e931) (match-each (syntax-object-expression e931) p932 (join-wraps w933 (syntax-object-wrap e931)))) (else (quote #f)))))) (set! syntax-dispatch (lambda (e936 p937) (cond ((eq? p937 (quote any)) (list e936)) ((syntax-object? e936) (match* (let ((e938 (syntax-object-expression e936))) (if (annotation? e938) (annotation-expression e938) e938)) p937 (syntax-object-wrap e936) (quote ()))) (else (match* (let ((e939 e936)) (if (annotation? e939) (annotation-expression e939) e939)) p937 (quote (())) (quote ())))))))))
-(install-global-transformer (quote with-syntax) (lambda (x940) ((lambda (tmp941) ((lambda (tmp942) (if tmp942 (apply (lambda (_943 e1944 e2945) (cons (quote #(syntax-object begin ((top) #(ribcage #(_ e1 e2) #((top) (top) (top)) #("i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (cons e1944 e2945))) tmp942) ((lambda (tmp947) (if tmp947 (apply (lambda (_948 out in e1949 e2950) (list (quote #(syntax-object syntax-case ((top) #(ribcage #(_ out in e1 e2) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) in (quote ()) (list out (cons (quote #(syntax-object begin ((top) #(ribcage #(_ out in e1 e2) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (cons e1949 e2950))))) tmp947) ((lambda (tmp952) (if tmp952 (apply (lambda (_953 out954 in955 e1956 e2957) (list (quote #(syntax-object syntax-case ((top) #(ribcage #(_ out in e1 e2) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (cons (quote #(syntax-object list ((top) #(ribcage #(_ out in e1 e2) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) in955) (quote ()) (list out954 (cons (quote #(syntax-object begin ((top) #(ribcage #(_ out in e1 e2) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (cons e1956 e2957))))) tmp952) (syntax-error tmp941))) (syntax-dispatch tmp941 (quote (any #(each (any any)) any . each-any)))))) (syntax-dispatch tmp941 (quote (any ((any any)) any . each-any)))))) (syntax-dispatch tmp941 (quote (any () any . each-any))))) x940)))
-(install-global-transformer (quote syntax-rules) (lambda (x961) ((lambda (tmp962) ((lambda (tmp963) (if tmp963 (apply (lambda (_964 k965 keyword pattern966 template) (list (quote #(syntax-object lambda ((top) #(ribcage #(_ k keyword pattern template) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (quote (#(syntax-object x ((top) #(ribcage #(_ k keyword pattern template) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")))))) (cons (quote #(syntax-object syntax-case ((top) #(ribcage #(_ k keyword pattern template) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (cons (quote #(syntax-object x ((top) #(ribcage #(_ k keyword pattern template) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (cons k965 (map (lambda (tmp969 tmp968) (list (cons (quote #(syntax-object dummy ((top) #(ribcage #(_ k keyword pattern template) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) tmp968) (list (quote #(syntax-object syntax ((top) #(ribcage #(_ k keyword pattern template) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) tmp969))) template pattern966)))))) tmp963) (syntax-error tmp962))) (syntax-dispatch tmp962 (quote (any each-any . #(each ((any . any) any))))))) x961)))
-(install-global-transformer (quote let*) (lambda (x970) ((lambda (tmp971) ((lambda (tmp972) (if (if tmp972 (apply (lambda (let* x973 v974 e1975 e2976) (andmap identifier? x973)) tmp972) (quote #f)) (apply (lambda (let*978 x979 v980 e1981 e2982) (let f983 ((bindings984 (map list x979 v980))) (if (null? bindings984) (cons (quote #(syntax-object let ((top) #(ribcage () () ()) #(ribcage #(f bindings) #((top) (top)) #("i" "i")) #(ribcage #(let* x v e1 e2) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (cons (quote ()) (cons e1981 e2982))) ((lambda (tmp988) ((lambda (tmp989) (if tmp989 (apply (lambda (body binding) (list (quote #(syntax-object let ((top) #(ribcage #(body binding) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(f bindings) #((top) (top)) #("i" "i")) #(ribcage #(let* x v e1 e2) #((top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (list binding) body)) tmp989) (syntax-error tmp988))) (syntax-dispatch tmp988 (quote (any any))))) (list (f983 (cdr bindings984)) (car bindings984)))))) tmp972) (syntax-error tmp971))) (syntax-dispatch tmp971 (quote (any #(each (any any)) any . each-any))))) x970)))
-(install-global-transformer (quote do) (lambda (orig-x) ((lambda (tmp990) ((lambda (tmp991) (if tmp991 (apply (lambda (_992 var init step e0 e1 c) ((lambda (tmp993) ((lambda (tmp994) (if tmp994 (apply (lambda (step995) ((lambda (tmp996) ((lambda (tmp997) (if tmp997 (apply (lambda () (list (quote #(syntax-object let ((top) #(ribcage #(step) #((top)) #("i")) #(ribcage #(_ var init step e0 e1 c) #((top) (top) (top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(orig-x) #((top)) #("i"))))) (quote #(syntax-object doloop ((top) #(ribcage #(step) #((top)) #("i")) #(ribcage #(_ var init step e0 e1 c) #((top) (top) (top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(orig-x) #((top)) #("i"))))) (map list var init) (list (quote #(syntax-object if ((top) #(ribcage #(step) #((top)) #("i")) #(ribcage #(_ var init step e0 e1 c) #((top) (top) (top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(orig-x) #((top)) #("i"))))) (list (quote #(syntax-object not ((top) #(ribcage #(step) #((top)) #("i")) #(ribcage #(_ var init step e0 e1 c) #((top) (top) (top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(orig-x) #((top)) #("i"))))) e0) (cons (quote #(syntax-object begin ((top) #(ribcage #(step) #((top)) #("i")) #(ribcage #(_ var init step e0 e1 c) #((top) (top) (top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(orig-x) #((top)) #("i"))))) (append c (list (cons (quote #(syntax-object doloop ((top) #(ribcage #(step) #((top)) #("i")) #(ribcage #(_ var init step e0 e1 c) #((top) (top) (top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(orig-x) #((top)) #("i"))))) step995))))))) tmp997) ((lambda (tmp1002) (if tmp1002 (apply (lambda (e11003 e2) (list (quote #(syntax-object let ((top) #(ribcage #(e1 e2) #((top) (top)) #("i" "i")) #(ribcage #(step) #((top)) #("i")) #(ribcage #(_ var init step e0 e1 c) #((top) (top) (top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(orig-x) #((top)) #("i"))))) (quote #(syntax-object doloop ((top) #(ribcage #(e1 e2) #((top) (top)) #("i" "i")) #(ribcage #(step) #((top)) #("i")) #(ribcage #(_ var init step e0 e1 c) #((top) (top) (top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(orig-x) #((top)) #("i"))))) (map list var init) (list (quote #(syntax-object if ((top) #(ribcage #(e1 e2) #((top) (top)) #("i" "i")) #(ribcage #(step) #((top)) #("i")) #(ribcage #(_ var init step e0 e1 c) #((top) (top) (top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(orig-x) #((top)) #("i"))))) e0 (cons (quote #(syntax-object begin ((top) #(ribcage #(e1 e2) #((top) (top)) #("i" "i")) #(ribcage #(step) #((top)) #("i")) #(ribcage #(_ var init step e0 e1 c) #((top) (top) (top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(orig-x) #((top)) #("i"))))) (cons e11003 e2)) (cons (quote #(syntax-object begin ((top) #(ribcage #(e1 e2) #((top) (top)) #("i" "i")) #(ribcage #(step) #((top)) #("i")) #(ribcage #(_ var init step e0 e1 c) #((top) (top) (top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(orig-x) #((top)) #("i"))))) (append c (list (cons (quote #(syntax-object doloop ((top) #(ribcage #(e1 e2) #((top) (top)) #("i" "i")) #(ribcage #(step) #((top)) #("i")) #(ribcage #(_ var init step e0 e1 c) #((top) (top) (top) (top) (top) (top) (top)) #("i" "i" "i" "i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(orig-x) #((top)) #("i"))))) step995))))))) tmp1002) (syntax-error tmp996))) (syntax-dispatch tmp996 (quote (any . each-any)))))) (syntax-dispatch tmp996 (quote ())))) e1)) tmp994) (syntax-error tmp993))) (syntax-dispatch tmp993 (quote each-any)))) (map (lambda (v s) ((lambda (tmp1010) ((lambda (tmp1011) (if tmp1011 (apply (lambda () v) tmp1011) ((lambda (tmp1012) (if tmp1012 (apply (lambda (e) e) tmp1012) ((lambda (_1013) (syntax-error orig-x)) tmp1010))) (syntax-dispatch tmp1010 (quote (any)))))) (syntax-dispatch tmp1010 (quote ())))) s)) var step))) tmp991) (syntax-error tmp990))) (syntax-dispatch tmp990 (quote (any #(each (any any . any)) (any . each-any) . each-any))))) orig-x)))
-(install-global-transformer (quote quasiquote) (letrec ((quasicons (lambda (x1016 y) ((lambda (tmp1017) ((lambda (tmp1018) (if tmp1018 (apply (lambda (x1019 y1020) ((lambda (tmp1021) ((lambda (tmp1022) (if tmp1022 (apply (lambda (dy) ((lambda (tmp1023) ((lambda (tmp1024) (if tmp1024 (apply (lambda (dx) (list (quote #(syntax-object quote ((top) #(ribcage #(dx) #((top)) #("i")) #(ribcage #(dy) #((top)) #("i")) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) (cons dx dy))) tmp1024) ((lambda (_1025) (if (null? dy) (list (quote #(syntax-object list ((top) #(ribcage #(_) #((top)) #("i")) #(ribcage #(dy) #((top)) #("i")) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) x1019) (list (quote #(syntax-object cons ((top) #(ribcage #(_) #((top)) #("i")) #(ribcage #(dy) #((top)) #("i")) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) x1019 y1020))) tmp1023))) (syntax-dispatch tmp1023 (quote (#(free-id #(syntax-object quote ((top) #(ribcage #(dy) #((top)) #("i")) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) any))))) x1019)) tmp1022) ((lambda (tmp) (if tmp (apply (lambda (stuff) (cons (quote #(syntax-object list ((top) #(ribcage #(stuff) #((top)) #("i")) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) (cons x1019 stuff))) tmp) ((lambda (else) (list (quote #(syntax-object cons ((top) #(ribcage #(else) #((top)) #("i")) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) x1019 y1020)) tmp1021))) (syntax-dispatch tmp1021 (quote (#(free-id #(syntax-object list ((top) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) . any)))))) (syntax-dispatch tmp1021 (quote (#(free-id #(syntax-object quote ((top) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) any))))) y1020)) tmp1018) (syntax-error tmp1017))) (syntax-dispatch tmp1017 (quote (any any))))) (list x1016 y)))) (quasiappend (lambda (x y1026) ((lambda (tmp1027) ((lambda (tmp1028) (if tmp1028 (apply (lambda (x1029 y1030) ((lambda (tmp1031) ((lambda (tmp1032) (if tmp1032 (apply (lambda () x1029) tmp1032) ((lambda (_) (list (quote #(syntax-object append ((top) #(ribcage #(_) #((top)) #("i")) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) x1029 y1030)) tmp1031))) (syntax-dispatch tmp1031 (quote (#(free-id #(syntax-object quote ((top) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x y) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) ()))))) y1030)) tmp1028) (syntax-error tmp1027))) (syntax-dispatch tmp1027 (quote (any any))))) (list x y1026)))) (quasivector (lambda (x1033) ((lambda (tmp1034) ((lambda (x1035) ((lambda (tmp1036) ((lambda (tmp1037) (if tmp1037 (apply (lambda (x1038) (list (quote #(syntax-object quote ((top) #(ribcage #(x) #((top)) #("i")) #(ribcage #(x) #((top)) #("i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) (list->vector x1038))) tmp1037) ((lambda (tmp1040) (if tmp1040 (apply (lambda (x1041) (cons (quote #(syntax-object vector ((top) #(ribcage #(x) #((top)) #("i")) #(ribcage #(x) #((top)) #("i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) x1041)) tmp1040) ((lambda (_1043) (list (quote #(syntax-object list->vector ((top) #(ribcage #(_) #((top)) #("i")) #(ribcage #(x) #((top)) #("i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) x1035)) tmp1036))) (syntax-dispatch tmp1036 (quote (#(free-id #(syntax-object list ((top) #(ribcage #(x) #((top)) #("i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) . each-any)))))) (syntax-dispatch tmp1036 (quote (#(free-id #(syntax-object quote ((top) #(ribcage #(x) #((top)) #("i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) each-any))))) x1035)) tmp1034)) x1033))) (quasi (lambda (p lev) ((lambda (tmp1044) ((lambda (tmp1045) (if tmp1045 (apply (lambda (p1046) (if (= lev (quote 0)) p1046 (quasicons (quote (#(syntax-object quote ((top) #(ribcage #(p) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(p lev) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i")))) #(syntax-object unquote ((top) #(ribcage #(p) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(p lev) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i")))))) (quasi (list p1046) (- lev (quote 1)))))) tmp1045) ((lambda (tmp1047) (if tmp1047 (apply (lambda (p1048 q) (if (= lev (quote 0)) (quasiappend p1048 (quasi q lev)) (quasicons (quasicons (quote (#(syntax-object quote ((top) #(ribcage #(p q) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(p lev) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i")))) #(syntax-object unquote-splicing ((top) #(ribcage #(p q) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(p lev) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i")))))) (quasi (list p1048) (- lev (quote 1)))) (quasi q lev)))) tmp1047) ((lambda (tmp1049) (if tmp1049 (apply (lambda (p1050) (quasicons (quote (#(syntax-object quote ((top) #(ribcage #(p) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(p lev) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i")))) #(syntax-object quasiquote ((top) #(ribcage #(p) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(p lev) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i")))))) (quasi (list p1050) (+ lev (quote 1))))) tmp1049) ((lambda (tmp1051) (if tmp1051 (apply (lambda (p1052 q1053) (quasicons (quasi p1052 lev) (quasi q1053 lev))) tmp1051) ((lambda (tmp1054) (if tmp1054 (apply (lambda (x1055) (quasivector (quasi x1055 lev))) tmp1054) ((lambda (p1057) (list (quote #(syntax-object quote ((top) #(ribcage #(p) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(p lev) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) p1057)) tmp1044))) (syntax-dispatch tmp1044 (quote #(vector each-any)))))) (syntax-dispatch tmp1044 (quote (any . any)))))) (syntax-dispatch tmp1044 (quote (#(free-id #(syntax-object quasiquote ((top) #(ribcage () () ()) #(ribcage #(p lev) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) any)))))) (syntax-dispatch tmp1044 (quote ((#(free-id #(syntax-object unquote-splicing ((top) #(ribcage () () ()) #(ribcage #(p lev) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) any) . any)))))) (syntax-dispatch tmp1044 (quote (#(free-id #(syntax-object unquote ((top) #(ribcage () () ()) #(ribcage #(p lev) #((top) (top)) #("i" "i")) #(ribcage #(quasicons quasiappend quasivector quasi) #((top) (top) (top) (top)) #("i" "i" "i" "i"))))) any))))) p)))) (lambda (x1058) ((lambda (tmp1059) ((lambda (tmp1060) (if tmp1060 (apply (lambda (_1061 e1062) (quasi e1062 (quote 0))) tmp1060) (syntax-error tmp1059))) (syntax-dispatch tmp1059 (quote (any any))))) x1058))))
-(install-global-transformer (quote include) (lambda (x1063) (letrec ((read-file (lambda (fn k) (let ((p1064 (open-input-file fn))) (let f ((x1065 (read p1064))) (if (eof-object? x1065) (begin (close-input-port p1064) (quote ())) (cons (datum->syntax-object k x1065) (f (read p1064))))))))) ((lambda (tmp1066) ((lambda (tmp1067) (if tmp1067 (apply (lambda (k1068 filename) (let ((fn1069 (syntax-object->datum filename))) ((lambda (tmp1070) ((lambda (tmp1071) (if tmp1071 (apply (lambda (exp) (cons (quote #(syntax-object begin ((top) #(ribcage #(exp) #((top)) #("i")) #(ribcage () () ()) #(ribcage () () ()) #(ribcage #(fn) #((top)) #("i")) #(ribcage #(k filename) #((top) (top)) #("i" "i")) #(ribcage (read-file) ((top)) ("i")) #(ribcage #(x) #((top)) #("i"))))) exp)) tmp1071) (syntax-error tmp1070))) (syntax-dispatch tmp1070 (quote each-any)))) (read-file fn1069 k1068)))) tmp1067) (syntax-error tmp1066))) (syntax-dispatch tmp1066 (quote (any any))))) x1063))))
-(install-global-transformer (quote unquote) (lambda (x1073) ((lambda (tmp1074) ((lambda (tmp1075) (if tmp1075 (apply (lambda (_1076 e1077) (error (quote unquote) (quote "expression ,~s not valid outside of quasiquote") (syntax-object->datum e1077))) tmp1075) (syntax-error tmp1074))) (syntax-dispatch tmp1074 (quote (any any))))) x1073)))
-(install-global-transformer (quote unquote-splicing) (lambda (x1078) ((lambda (tmp1079) ((lambda (tmp1080) (if tmp1080 (apply (lambda (_1081 e1082) (error (quote unquote-splicing) (quote "expression ,@~s not valid outside of quasiquote") (syntax-object->datum e1082))) tmp1080) (syntax-error tmp1079))) (syntax-dispatch tmp1079 (quote (any any))))) x1078)))
-(install-global-transformer (quote case) (lambda (x1083) ((lambda (tmp1084) ((lambda (tmp1085) (if tmp1085 (apply (lambda (_1086 e1087 m1 m2) ((lambda (tmp1088) ((lambda (body1089) (list (quote #(syntax-object let ((top) #(ribcage #(body) #((top)) #("i")) #(ribcage #(_ e m1 m2) #((top) (top) (top) (top)) #("i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (list (list (quote #(syntax-object t ((top) #(ribcage #(body) #((top)) #("i")) #(ribcage #(_ e m1 m2) #((top) (top) (top) (top)) #("i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) e1087)) body1089)) tmp1088)) (let f1090 ((clause m1) (clauses m2)) (if (null? clauses) ((lambda (tmp1092) ((lambda (tmp1093) (if tmp1093 (apply (lambda (e11094 e21095) (cons (quote #(syntax-object begin ((top) #(ribcage #(e1 e2) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(f clause clauses) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(_ e m1 m2) #((top) (top) (top) (top)) #("i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (cons e11094 e21095))) tmp1093) ((lambda (tmp1097) (if tmp1097 (apply (lambda (k1098 e11099 e21100) (list (quote #(syntax-object if ((top) #(ribcage #(k e1 e2) #((top) (top) (top)) #("i" "i" "i")) #(ribcage () () ()) #(ribcage #(f clause clauses) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(_ e m1 m2) #((top) (top) (top) (top)) #("i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (list (quote #(syntax-object memv ((top) #(ribcage #(k e1 e2) #((top) (top) (top)) #("i" "i" "i")) #(ribcage () () ()) #(ribcage #(f clause clauses) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(_ e m1 m2) #((top) (top) (top) (top)) #("i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (quote #(syntax-object t ((top) #(ribcage #(k e1 e2) #((top) (top) (top)) #("i" "i" "i")) #(ribcage () () ()) #(ribcage #(f clause clauses) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(_ e m1 m2) #((top) (top) (top) (top)) #("i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (list (quote #(syntax-object quote ((top) #(ribcage #(k e1 e2) #((top) (top) (top)) #("i" "i" "i")) #(ribcage () () ()) #(ribcage #(f clause clauses) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(_ e m1 m2) #((top) (top) (top) (top)) #("i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) k1098)) (cons (quote #(syntax-object begin ((top) #(ribcage #(k e1 e2) #((top) (top) (top)) #("i" "i" "i")) #(ribcage () () ()) #(ribcage #(f clause clauses) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(_ e m1 m2) #((top) (top) (top) (top)) #("i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (cons e11099 e21100)))) tmp1097) ((lambda (_1103) (syntax-error x1083)) tmp1092))) (syntax-dispatch tmp1092 (quote (each-any any . each-any)))))) (syntax-dispatch tmp1092 (quote (#(free-id #(syntax-object else ((top) #(ribcage () () ()) #(ribcage #(f clause clauses) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(_ e m1 m2) #((top) (top) (top) (top)) #("i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) any . each-any))))) clause) ((lambda (tmp1104) ((lambda (rest) ((lambda (tmp1105) ((lambda (tmp1106) (if tmp1106 (apply (lambda (k1107 e11108 e21109) (list (quote #(syntax-object if ((top) #(ribcage #(k e1 e2) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(rest) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(f clause clauses) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(_ e m1 m2) #((top) (top) (top) (top)) #("i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (list (quote #(syntax-object memv ((top) #(ribcage #(k e1 e2) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(rest) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(f clause clauses) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(_ e m1 m2) #((top) (top) (top) (top)) #("i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (quote #(syntax-object t ((top) #(ribcage #(k e1 e2) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(rest) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(f clause clauses) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(_ e m1 m2) #((top) (top) (top) (top)) #("i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (list (quote #(syntax-object quote ((top) #(ribcage #(k e1 e2) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(rest) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(f clause clauses) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(_ e m1 m2) #((top) (top) (top) (top)) #("i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) k1107)) (cons (quote #(syntax-object begin ((top) #(ribcage #(k e1 e2) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(rest) #((top)) #("i")) #(ribcage () () ()) #(ribcage #(f clause clauses) #((top) (top) (top)) #("i" "i" "i")) #(ribcage #(_ e m1 m2) #((top) (top) (top) (top)) #("i" "i" "i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (cons e11108 e21109)) rest)) tmp1106) ((lambda (_1112) (syntax-error x1083)) tmp1105))) (syntax-dispatch tmp1105 (quote (each-any any . each-any))))) clause)) tmp1104)) (f1090 (car clauses) (cdr clauses))))))) tmp1085) (syntax-error tmp1084))) (syntax-dispatch tmp1084 (quote (any any any . each-any))))) x1083)))
-(install-global-transformer (quote identifier-syntax) (lambda (x1113) ((lambda (tmp1114) ((lambda (tmp1115) (if tmp1115 (apply (lambda (_1116 e1117) (list (quote #(syntax-object lambda ((top) #(ribcage #(_ e) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (quote (#(syntax-object x ((top) #(ribcage #(_ e) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")))))) (list (quote #(syntax-object syntax-case ((top) #(ribcage #(_ e) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (quote #(syntax-object x ((top) #(ribcage #(_ e) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (quote ()) (list (quote #(syntax-object id ((top) #(ribcage #(_ e) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (quote (#(syntax-object identifier? ((top) #(ribcage #(_ e) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")))) (#(syntax-object syntax ((top) #(ribcage #(_ e) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")))) #(syntax-object id ((top) #(ribcage #(_ e) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))))) (list (quote #(syntax-object syntax ((top) #(ribcage #(_ e) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) e1117)) (list (cons _1116 (quote (#(syntax-object x ((top) #(ribcage #(_ e) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")))) #(syntax-object ... ((top) #(ribcage #(_ e) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))))) (list (quote #(syntax-object syntax ((top) #(ribcage #(_ e) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i"))))) (cons e1117 (quote (#(syntax-object x ((top) #(ribcage #(_ e) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")))) #(syntax-object ... ((top) #(ribcage #(_ e) #((top) (top)) #("i" "i")) #(ribcage () () ()) #(ribcage #(x) #((top)) #("i")))))))))))) tmp1115) (syntax-error tmp1114))) (syntax-dispatch tmp1114 (quote (any any))))) x1113)))
diff --git a/ice-9/psyntax.ss b/ice-9/psyntax.ss
deleted file mode 100644 (file)
index f45ac91..0000000
+++ /dev/null
@@ -1,2179 +0,0 @@
-;;; Portable implementation of syntax-case
-;;; Extracted from Chez Scheme Version 5.9f
-;;; Authors: R. Kent Dybvig, Oscar Waddell, Bob Hieb, Carl Bruggeman
-
-;;; Copyright (c) 1992-1997 Cadence Research Systems
-;;; Permission to copy this software, in whole or in part, to use this
-;;; software for any lawful purpose, and to redistribute this software
-;;; is granted subject to the restriction that all copies made of this
-;;; software must include this copyright notice in full.  This software
-;;; is provided AS IS, with NO WARRANTY, EITHER EXPRESS OR IMPLIED,
-;;; INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY
-;;; OR FITNESS FOR ANY PARTICULAR PURPOSE.  IN NO EVENT SHALL THE
-;;; AUTHORS BE LIABLE FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES OF ANY
-;;; NATURE WHATSOEVER.
-
-
-;;; Before attempting to port this code to a new implementation of
-;;; Scheme, please read the notes below carefully.
-
-
-;;; This file defines the syntax-case expander, sc-expand, and a set
-;;; of associated syntactic forms and procedures.  Of these, the
-;;; following are documented in The Scheme Programming Language,
-;;; Second Edition (R. Kent Dybvig, Prentice Hall, 1996).  Most are
-;;; also documented in the R4RS and draft R5RS.
-;;;
-;;;   bound-identifier=?
-;;;   datum->syntax-object
-;;;   define-syntax
-;;;   fluid-let-syntax
-;;;   free-identifier=?
-;;;   generate-temporaries
-;;;   identifier?
-;;;   identifier-syntax
-;;;   let-syntax
-;;;   letrec-syntax
-;;;   syntax
-;;;   syntax-case
-;;;   syntax-object->datum
-;;;   syntax-rules
-;;;   with-syntax
-;;;
-;;; All standard Scheme syntactic forms are supported by the expander
-;;; or syntactic abstractions defined in this file.  Only the R4RS
-;;; delay is omitted, since its expansion is implementation-dependent.
-
-;;; The remaining exports are listed below:
-;;;
-;;;   (sc-expand datum)
-;;;      if datum represents a valid expression, sc-expand returns an
-;;;      expanded version of datum in a core language that includes no
-;;;      syntactic abstractions.  The core language includes begin,
-;;;      define, if, lambda, letrec, quote, and set!.
-;;;   (eval-when situations expr ...)
-;;;      conditionally evaluates expr ... at compile-time or run-time
-;;;      depending upon situations (see the Chez Scheme System Manual,
-;;;      Revision 3, for a complete description)
-;;;   (syntax-error object message)
-;;;      used to report errors found during expansion
-;;;   (install-global-transformer symbol value)
-;;;      used by expanded code to install top-level syntactic abstractions
-;;;   (syntax-dispatch e p)
-;;;      used by expanded code to handle syntax-case matching
-
-;;; The following nonstandard procedures must be provided by the
-;;; implementation for this code to run.
-;;;
-;;; (void)
-;;; returns the implementation's cannonical "unspecified value".  This
-;;; usually works: (define void (lambda () (if #f #f))).
-;;;
-;;; (andmap proc list1 list2 ...)
-;;; returns true if proc returns true when applied to each element of list1
-;;; along with the corresponding elements of list2 ....
-;;; The following definition works but does no error checking:
-;;;
-;;; (define andmap
-;;;   (lambda (f first . rest)
-;;;     (or (null? first)
-;;;         (if (null? rest)
-;;;             (let andmap ((first first))
-;;;               (let ((x (car first)) (first (cdr first)))
-;;;                 (if (null? first)
-;;;                     (f x)
-;;;                     (and (f x) (andmap first)))))
-;;;             (let andmap ((first first) (rest rest))
-;;;               (let ((x (car first))
-;;;                     (xr (map car rest))
-;;;                     (first (cdr first))
-;;;                     (rest (map cdr rest)))
-;;;                 (if (null? first)
-;;;                     (apply f (cons x xr))
-;;;                     (and (apply f (cons x xr)) (andmap first rest)))))))))
-;;;
-;;; The following nonstandard procedures must also be provided by the
-;;; implementation for this code to run using the standard portable
-;;; hooks and output constructors.  They are not used by expanded code,
-;;; and so need be present only at expansion time.
-;;;
-;;; (eval x)
-;;; where x is always in the form ("noexpand" expr).
-;;; returns the value of expr.  the "noexpand" flag is used to tell the
-;;; evaluator/expander that no expansion is necessary, since expr has
-;;; already been fully expanded to core forms.
-;;;
-;;; eval will not be invoked during the loading of psyntax.pp.  After
-;;; psyntax.pp has been loaded, the expansion of any macro definition,
-;;; whether local or global, will result in a call to eval.  If, however,
-;;; sc-expand has already been registered as the expander to be used
-;;; by eval, and eval accepts one argument, nothing special must be done
-;;; to support the "noexpand" flag, since it is handled by sc-expand.
-;;;
-;;; (error who format-string why what)
-;;; where who is either a symbol or #f, format-string is always "~a ~s",
-;;; why is always a string, and what may be any object.  error should
-;;; signal an error with a message something like
-;;;
-;;;    "error in <who>: <why> <what>"
-;;;
-;;; (gensym)
-;;; returns a unique symbol each time it's called
-;;;
-;;; (putprop symbol key value)
-;;; (getprop symbol key)
-;;; key is always the symbol *sc-expander*; value may be any object.
-;;; putprop should associate the given value with the given symbol in
-;;; some way that it can be retrieved later with getprop.
-
-;;; When porting to a new Scheme implementation, you should define the
-;;; procedures listed above, load the expanded version of psyntax.ss
-;;; (psyntax.pp, which should be available whereever you found
-;;; psyntax.ss), and register sc-expand as the current expander (how
-;;; you do this depends upon your implementation of Scheme).  You may
-;;; change the hooks and constructors defined toward the beginning of
-;;; the code below, but to avoid bootstrapping problems, do so only
-;;; after you have a working version of the expander.
-
-;;; Chez Scheme allows the syntactic form (syntax <template>) to be
-;;; abbreviated to #'<template>, just as (quote <datum>) may be
-;;; abbreviated to '<datum>.  The #' syntax makes programs written
-;;; using syntax-case shorter and more readable and draws out the
-;;; intuitive connection between syntax and quote.
-
-;;; If you find that this code loads or runs slowly, consider
-;;; switching to faster hardware or a faster implementation of
-;;; Scheme.  In Chez Scheme on a 200Mhz Pentium Pro, expanding,
-;;; compiling (with full optimization), and loading this file takes
-;;; between one and two seconds.
-
-;;; In the expander implementation, we sometimes use syntactic abstractions
-;;; when procedural abstractions would suffice.  For example, we define
-;;; top-wrap and top-marked? as
-;;;   (define-syntax top-wrap (identifier-syntax '((top))))
-;;;   (define-syntax top-marked?
-;;;     (syntax-rules ()
-;;;       ((_ w) (memq 'top (wrap-marks w)))))
-;;; rather than
-;;;   (define top-wrap '((top)))
-;;;   (define top-marked?
-;;;     (lambda (w) (memq 'top (wrap-marks w))))
-;;; On ther other hand, we don't do this consistently; we define make-wrap,
-;;; wrap-marks, and wrap-subst simply as
-;;;   (define make-wrap cons)
-;;;   (define wrap-marks car)
-;;;   (define wrap-subst cdr)
-;;; In Chez Scheme, the syntactic and procedural forms of these
-;;; abstractions are equivalent, since the optimizer consistently
-;;; integrates constants and small procedures.  Some Scheme
-;;; implementations, however, may benefit from more consistent use 
-;;; of one form or the other.
-
-
-;;; implementation information:
-
-;;; "begin" is treated as a splicing construct at top level and at
-;;; the beginning of bodies.  Any sequence of expressions that would
-;;; be allowed where the "begin" occurs is allowed.
-
-;;; "let-syntax" and "letrec-syntax" are also treated as splicing
-;;; constructs, in violation of the R4RS appendix and probably the R5RS
-;;; when it comes out.  A consequence, let-syntax and letrec-syntax do
-;;; not create local contours, as do let and letrec.  Although the
-;;; functionality is greater as it is presently implemented, we will
-;;; probably change it to conform to the R4RS/expected R5RS.
-
-;;; Objects with no standard print syntax, including objects containing
-;;; cycles and syntax object, are allowed in quoted data as long as they
-;;; are contained within a syntax form or produced by datum->syntax-object.
-;;; Such objects are never copied.
-
-;;; All identifiers that don't have macro definitions and are not bound
-;;; lexically are assumed to be global variables
-
-;;; Top-level definitions of macro-introduced identifiers are allowed.
-;;; This may not be appropriate for implementations in which the
-;;; model is that bindings are created by definitions, as opposed to
-;;; one in which initial values are assigned by definitions.
-
-;;; Top-level variable definitions of syntax keywords is not permitted.
-;;; Any solution allowing this would be kludgey and would yield
-;;; surprising results in some cases.  We can provide an undefine-syntax
-;;; form.  The questions is, should define be an implicit undefine-syntax?
-;;; We've decided no for now.
-
-;;; Identifiers and syntax objects are implemented as vectors for
-;;; portability.  As a result, it is possible to "forge" syntax
-;;; objects.
-
-;;; The implementation of generate-temporaries assumes that it is possible
-;;; to generate globally unique symbols (gensyms).
-
-;;; The input to sc-expand may contain "annotations" describing, e.g., the
-;;; source file and character position from where each object was read if
-;;; it was read from a file.  These annotations are handled properly by
-;;; sc-expand only if the annotation? hook (see hooks below) is implemented
-;;; properly and the operators make-annotation, annotation-expression,
-;;; annotation-source, annotation-stripped, and set-annotation-stripped!
-;;; are supplied.  If annotations are supplied, the proper annotation
-;;; source is passed to the various output constructors, allowing
-;;; implementations to accurately correlate source and expanded code.
-;;; Contact one of the authors for details if you wish to make use of
-;;; this feature.
-
-
-
-;;; Bootstrapping:
-
-;;; When changing syntax-object representations, it is necessary to support
-;;; both old and new syntax-object representations in id-var-name.  It
-;;; should be sufficient to recognize old representations and treat
-;;; them as not lexically bound.
-
-
-
-(let ()
-(define-syntax define-structure
-  (lambda (x)
-    (define construct-name
-      (lambda (template-identifier . args)
-        (datum->syntax-object
-          template-identifier
-          (string->symbol
-            (apply string-append
-                   (map (lambda (x)
-                          (if (string? x)
-                              x
-                              (symbol->string (syntax-object->datum x))))
-                        args))))))
-    (syntax-case x ()
-      ((_ (name id1 ...))
-       (andmap identifier? (syntax (name id1 ...)))
-       (with-syntax
-         ((constructor (construct-name (syntax name) "make-" (syntax name)))
-          (predicate (construct-name (syntax name) (syntax name) "?"))
-          ((access ...)
-           (map (lambda (x) (construct-name x (syntax name) "-" x))
-                (syntax (id1 ...))))
-          ((assign ...)
-           (map (lambda (x)
-                  (construct-name x "set-" (syntax name) "-" x "!"))
-                (syntax (id1 ...))))
-          (structure-length
-           (+ (length (syntax (id1 ...))) 1))
-          ((index ...)
-           (let f ((i 1) (ids (syntax (id1 ...))))
-              (if (null? ids)
-                  '()
-                  (cons i (f (+ i 1) (cdr ids)))))))
-         (syntax (begin
-                   (define constructor
-                     (lambda (id1 ...)
-                       (vector 'name id1 ... )))
-                   (define predicate
-                     (lambda (x)
-                       (and (vector? x)
-                            (= (vector-length x) structure-length)
-                            (eq? (vector-ref x 0) 'name))))
-                   (define access
-                     (lambda (x)
-                       (vector-ref x index)))
-                   ...
-                   (define assign
-                     (lambda (x update)
-                       (vector-set! x index update)))
-                   ...)))))))
-
-(let ()
-(define noexpand "noexpand")
-
-;;; hooks to nonportable run-time helpers
-(begin
-(define fx+ +)
-(define fx- -)
-(define fx= =)
-(define fx< <)
-
-(define annotation? (lambda (x) #f))
-
-(define top-level-eval-hook
-  (lambda (x)
-    (eval `(,noexpand ,x))))
-
-(define local-eval-hook
-  (lambda (x)
-    (eval `(,noexpand ,x))))
-
-(define error-hook
-  (lambda (who why what)
-    (error who "~a ~s" why what)))
-
-(define-syntax gensym-hook
-  (syntax-rules ()
-    ((_) (gensym))))
-
-(define put-global-definition-hook
-  (lambda (symbol binding)
-     (putprop symbol '*sc-expander* binding)))
-
-(define get-global-definition-hook
-  (lambda (symbol)
-     (getprop symbol '*sc-expander*)))
-)
-
-
-;;; output constructors
-(begin
-(define-syntax build-application
-  (syntax-rules ()
-    ((_ source fun-exp arg-exps)
-     `(,fun-exp . ,arg-exps))))
-
-(define-syntax build-conditional
-  (syntax-rules ()
-    ((_ source test-exp then-exp else-exp)
-     `(if ,test-exp ,then-exp ,else-exp))))
-
-(define-syntax build-lexical-reference
-  (syntax-rules ()
-    ((_ type source var)
-     var)))
-
-(define-syntax build-lexical-assignment
-  (syntax-rules ()
-    ((_ source var exp)
-     `(set! ,var ,exp))))
-
-(define-syntax build-global-reference
-  (syntax-rules ()
-    ((_ source var)
-     var)))
-
-(define-syntax build-global-assignment
-  (syntax-rules ()
-    ((_ source var exp)
-     `(set! ,var ,exp))))
-
-(define-syntax build-global-definition
-  (syntax-rules ()
-    ((_ source var exp)
-     `(define ,var ,exp))))
-
-(define-syntax build-lambda
-  (syntax-rules ()
-    ((_ src vars exp)
-     `(lambda ,vars ,exp))))
-
-(define-syntax build-primref
-  (syntax-rules ()
-    ((_ src name) name)
-    ((_ src level name) name)))
-
-(define-syntax build-data
-  (syntax-rules ()
-    ((_ src exp) `',exp)))
-
-(define build-sequence
-  (lambda (src exps)
-    (if (null? (cdr exps))
-        (car exps)
-        `(begin ,@exps))))
-
-(define build-let
-  (lambda (src vars val-exps body-exp)
-    (if (null? vars)
-       body-exp
-       `(let ,(map list vars val-exps) ,body-exp))))
-
-(define build-named-let
-  (lambda (src vars val-exps body-exp)
-    (if (null? vars)
-       body-exp
-       `(let ,(car vars) ,(map list (cdr vars) val-exps) ,body-exp))))
-
-(define build-letrec
-  (lambda (src vars val-exps body-exp)
-    (if (null? vars)
-        body-exp
-        `(letrec ,(map list vars val-exps) ,body-exp))))
-
-(define-syntax build-lexical-var
-  (syntax-rules ()
-    ((_ src id) (gensym id generated-symbols))))
-
-(define-syntax self-evaluating?
-  (syntax-rules ()
-    ((_ e)
-     (let ((x e))
-       (or (boolean? x) (number? x) (string? x) (char? x) (null? x) (keyword? x))))))
-)
-
-(define-structure (syntax-object expression wrap))
-
-(define-syntax unannotate
-  (syntax-rules ()
-    ((_ x)
-     (let ((e x))
-       (if (annotation? e)
-           (annotation-expression e)
-           e)))))
-
-(define-syntax no-source (identifier-syntax #f))
-
-(define source-annotation
-  (lambda (x)
-     (cond
-       ((annotation? x) (annotation-source x))
-       ((syntax-object? x) (source-annotation (syntax-object-expression x)))
-       (else no-source))))
-
-(define-syntax arg-check
-  (syntax-rules ()
-    ((_ pred? e who)
-     (let ((x e))
-       (if (not (pred? x)) (error-hook who "invalid argument" x))))))
-
-;;; compile-time environments
-
-;;; wrap and environment comprise two level mapping.
-;;;   wrap : id --> label
-;;;   env : label --> <element>
-
-;;; environments are represented in two parts: a lexical part and a global
-;;; part.  The lexical part is a simple list of associations from labels
-;;; to bindings.  The global part is implemented by
-;;; {put,get}-global-definition-hook and associates symbols with
-;;; bindings.
-
-;;; global (assumed global variable) and displaced-lexical (see below)
-;;; do not show up in any environment; instead, they are fabricated by
-;;; lookup when it finds no other bindings.
-
-;;; <environment>              ::= ((<label> . <binding>)*)
-
-;;; identifier bindings include a type and a value
-
-;;; <binding> ::= (macro . <procedure>)           macros
-;;;               (core . <procedure>)            core forms
-;;;               (begin)                         begin
-;;;               (define)                        define
-;;;               (define-syntax)                 define-syntax
-;;;               (local-syntax . rec?)           let-syntax/letrec-syntax
-;;;               (eval-when)                     eval-when
-;;;               (syntax . (<var> . <level>))    pattern variables
-;;;               (global)                        assumed global variable
-;;;               (lexical . <var>)               lexical variables
-;;;               (displaced-lexical)             displaced lexicals
-;;; <level>   ::= <nonnegative integer>
-;;; <var>     ::= variable returned by build-lexical-var
-
-;;; a macro is a user-defined syntactic-form.  a core is a system-defined
-;;; syntactic form.  begin, define, define-syntax, and eval-when are
-;;; treated specially since they are sensitive to whether the form is
-;;; at top-level and (except for eval-when) can denote valid internal
-;;; definitions.
-
-;;; a pattern variable is a variable introduced by syntax-case and can
-;;; be referenced only within a syntax form.
-
-;;; any identifier for which no top-level syntax definition or local
-;;; binding of any kind has been seen is assumed to be a global
-;;; variable.
-
-;;; a lexical variable is a lambda- or letrec-bound variable.
-
-;;; a displaced-lexical identifier is a lexical identifier removed from
-;;; it's scope by the return of a syntax object containing the identifier.
-;;; a displaced lexical can also appear when a letrec-syntax-bound
-;;; keyword is referenced on the rhs of one of the letrec-syntax clauses.
-;;; a displaced lexical should never occur with properly written macros.
-
-(define-syntax make-binding
-  (syntax-rules (quote)
-    ((_ type value) (cons type value))
-    ((_ 'type) '(type))
-    ((_ type) (cons type '()))))
-(define binding-type car)
-(define binding-value cdr)
-
-(define-syntax null-env (identifier-syntax '()))
-
-(define extend-env
-  (lambda (labels bindings r) 
-    (if (null? labels)
-        r
-        (extend-env (cdr labels) (cdr bindings)
-          (cons (cons (car labels) (car bindings)) r)))))
-
-(define extend-var-env
-  ; variant of extend-env that forms "lexical" binding
-  (lambda (labels vars r)
-    (if (null? labels)
-        r
-        (extend-var-env (cdr labels) (cdr vars)
-          (cons (cons (car labels) (make-binding 'lexical (car vars))) r)))))
-
-;;; we use a "macros only" environment in expansion of local macro
-;;; definitions so that their definitions can use local macros without
-;;; attempting to use other lexical identifiers.
-(define macros-only-env
-  (lambda (r)
-    (if (null? r)
-        '()
-        (let ((a (car r)))
-          (if (eq? (cadr a) 'macro)
-              (cons a (macros-only-env (cdr r)))
-              (macros-only-env (cdr r)))))))
-
-(define lookup
-  ; x may be a label or a symbol
-  ; although symbols are usually global, we check the environment first
-  ; anyway because a temporary binding may have been established by
-  ; fluid-let-syntax
-  (lambda (x r)
-    (cond
-      ((assq x r) => cdr)
-      ((symbol? x)
-       (or (get-global-definition-hook x) (make-binding 'global)))
-      (else (make-binding 'displaced-lexical)))))
-
-(define global-extend
-  (lambda (type sym val)
-    (put-global-definition-hook sym (make-binding type val))))
-
-
-;;; Conceptually, identifiers are always syntax objects.  Internally,
-;;; however, the wrap is sometimes maintained separately (a source of
-;;; efficiency and confusion), so that symbols are also considered
-;;; identifiers by id?.  Externally, they are always wrapped.
-
-(define nonsymbol-id?
-  (lambda (x)
-    (and (syntax-object? x)
-         (symbol? (unannotate (syntax-object-expression x))))))
-
-(define id?
-  (lambda (x)
-    (cond
-      ((symbol? x) #t)
-      ((syntax-object? x) (symbol? (unannotate (syntax-object-expression x))))
-      ((annotation? x) (symbol? (annotation-expression x)))
-      (else #f))))
-
-(define-syntax id-sym-name
-  (syntax-rules ()
-    ((_ e)
-     (let ((x e))
-       (unannotate (if (syntax-object? x) (syntax-object-expression x) x))))))
-
-(define id-sym-name&marks
-  (lambda (x w)
-    (if (syntax-object? x)
-        (values
-          (unannotate (syntax-object-expression x))
-          (join-marks (wrap-marks w) (wrap-marks (syntax-object-wrap x))))
-        (values (unannotate x) (wrap-marks w)))))
-
-;;; syntax object wraps
-
-;;;         <wrap> ::= ((<mark> ...) . (<subst> ...))
-;;;        <subst> ::= <shift> | <subs>
-;;;         <subs> ::= #(<old name> <label> (<mark> ...))
-;;;        <shift> ::= positive fixnum
-
-(define make-wrap cons)
-(define wrap-marks car)
-(define wrap-subst cdr)
-
-(define-syntax subst-rename? (identifier-syntax vector?))
-(define-syntax rename-old (syntax-rules () ((_ x) (vector-ref x 0))))
-(define-syntax rename-new (syntax-rules () ((_ x) (vector-ref x 1))))
-(define-syntax rename-marks (syntax-rules () ((_ x) (vector-ref x 2))))
-(define-syntax make-rename
-  (syntax-rules ()
-    ((_ old new marks) (vector old new marks))))
-
-;;; labels must be comparable with "eq?" and distinct from symbols.
-(define gen-label
-  (lambda () (string #\i)))
-
-(define gen-labels
-  (lambda (ls)
-    (if (null? ls)
-        '()
-        (cons (gen-label) (gen-labels (cdr ls))))))
-
-(define-structure (ribcage symnames marks labels))
-
-(define-syntax empty-wrap (identifier-syntax '(())))
-
-(define-syntax top-wrap (identifier-syntax '((top))))
-
-(define-syntax top-marked?
-  (syntax-rules ()
-    ((_ w) (memq 'top (wrap-marks w)))))
-
-;;; Marks must be comparable with "eq?" and distinct from pairs and
-;;; the symbol top.  We do not use integers so that marks will remain
-;;; unique even across file compiles.
-
-(define-syntax the-anti-mark (identifier-syntax #f))
-
-(define anti-mark
-  (lambda (w)
-    (make-wrap (cons the-anti-mark (wrap-marks w))
-               (cons 'shift (wrap-subst w)))))
-
-(define-syntax new-mark
-  (syntax-rules ()
-    ((_) (string #\m))))
-
-;;; make-empty-ribcage and extend-ribcage maintain list-based ribcages for
-;;; internal definitions, in which the ribcages are built incrementally
-(define-syntax make-empty-ribcage
-  (syntax-rules ()
-    ((_) (make-ribcage '() '() '()))))
-
-(define extend-ribcage!
-  ; must receive ids with complete wraps
-  (lambda (ribcage id label)
-    (set-ribcage-symnames! ribcage
-      (cons (unannotate (syntax-object-expression id))
-            (ribcage-symnames ribcage)))
-    (set-ribcage-marks! ribcage
-      (cons (wrap-marks (syntax-object-wrap id))
-            (ribcage-marks ribcage)))
-    (set-ribcage-labels! ribcage
-      (cons label (ribcage-labels ribcage)))))
-
-;;; make-binding-wrap creates vector-based ribcages
-(define make-binding-wrap
-  (lambda (ids labels w)
-    (if (null? ids)
-        w
-        (make-wrap
-          (wrap-marks w)
-          (cons
-            (let ((labelvec (list->vector labels)))
-              (let ((n (vector-length labelvec)))
-                (let ((symnamevec (make-vector n)) (marksvec (make-vector n)))
-                  (let f ((ids ids) (i 0))
-                    (if (not (null? ids))
-                        (call-with-values
-                          (lambda () (id-sym-name&marks (car ids) w))
-                          (lambda (symname marks)
-                            (vector-set! symnamevec i symname)
-                            (vector-set! marksvec i marks)
-                            (f (cdr ids) (fx+ i 1))))))
-                  (make-ribcage symnamevec marksvec labelvec))))
-            (wrap-subst w))))))
-
-(define smart-append
-  (lambda (m1 m2)
-    (if (null? m2)
-        m1
-        (append m1 m2))))
-
-(define join-wraps
-  (lambda (w1 w2)
-    (let ((m1 (wrap-marks w1)) (s1 (wrap-subst w1)))
-      (if (null? m1)
-          (if (null? s1)
-              w2
-              (make-wrap
-                (wrap-marks w2)
-                (smart-append s1 (wrap-subst w2))))
-          (make-wrap
-            (smart-append m1 (wrap-marks w2))
-            (smart-append s1 (wrap-subst w2)))))))
-
-(define join-marks
-  (lambda (m1 m2)
-    (smart-append m1 m2)))
-
-(define same-marks?
-  (lambda (x y)
-    (or (eq? x y)
-        (and (not (null? x))
-             (not (null? y))
-             (eq? (car x) (car y))
-             (same-marks? (cdr x) (cdr y))))))
-
-(define id-var-name
-  (lambda (id w)
-    (define-syntax first
-      (syntax-rules ()
-        ((_ e) (call-with-values (lambda () e) (lambda (x . ignore) x)))))
-    (define search
-      (lambda (sym subst marks)
-        (if (null? subst)
-            (values #f marks)
-            (let ((fst (car subst)))
-              (if (eq? fst 'shift)
-                  (search sym (cdr subst) (cdr marks))
-                  (let ((symnames (ribcage-symnames fst)))
-                    (if (vector? symnames)
-                        (search-vector-rib sym subst marks symnames fst)
-                        (search-list-rib sym subst marks symnames fst))))))))
-    (define search-list-rib
-      (lambda (sym subst marks symnames ribcage)
-        (let f ((symnames symnames) (i 0))
-          (cond
-            ((null? symnames) (search sym (cdr subst) marks))
-            ((and (eq? (car symnames) sym)
-                  (same-marks? marks (list-ref (ribcage-marks ribcage) i)))
-             (values (list-ref (ribcage-labels ribcage) i) marks))
-            (else (f (cdr symnames) (fx+ i 1)))))))
-    (define search-vector-rib
-      (lambda (sym subst marks symnames ribcage)
-        (let ((n (vector-length symnames)))
-          (let f ((i 0))
-            (cond
-              ((fx= i n) (search sym (cdr subst) marks))
-              ((and (eq? (vector-ref symnames i) sym)
-                    (same-marks? marks (vector-ref (ribcage-marks ribcage) i)))
-               (values (vector-ref (ribcage-labels ribcage) i) marks))
-              (else (f (fx+ i 1))))))))
-    (cond
-      ((symbol? id)
-       (or (first (search id (wrap-subst w) (wrap-marks w))) id))
-      ((syntax-object? id)
-        (let ((id (unannotate (syntax-object-expression id)))
-              (w1 (syntax-object-wrap id)))
-          (let ((marks (join-marks (wrap-marks w) (wrap-marks w1))))
-            (call-with-values (lambda () (search id (wrap-subst w) marks))
-              (lambda (new-id marks)
-                (or new-id
-                    (first (search id (wrap-subst w1) marks))
-                    id))))))
-      ((annotation? id)
-       (let ((id (unannotate id)))
-         (or (first (search id (wrap-subst w) (wrap-marks w))) id)))
-      (else (error-hook 'id-var-name "invalid id" id)))))
-
-;;; free-id=? must be passed fully wrapped ids since (free-id=? x y)
-;;; may be true even if (free-id=? (wrap x w) (wrap y w)) is not.
-
-(define free-id=?
-  (lambda (i j)
-    (and (eq? (id-sym-name i) (id-sym-name j)) ; accelerator
-         (eq? (id-var-name i empty-wrap) (id-var-name j empty-wrap)))))
-
-;;; bound-id=? may be passed unwrapped (or partially wrapped) ids as
-;;; long as the missing portion of the wrap is common to both of the ids
-;;; since (bound-id=? x y) iff (bound-id=? (wrap x w) (wrap y w))
-
-(define bound-id=?
-  (lambda (i j)
-    (if (and (syntax-object? i) (syntax-object? j))
-        (and (eq? (unannotate (syntax-object-expression i))
-                  (unannotate (syntax-object-expression j)))
-             (same-marks? (wrap-marks (syntax-object-wrap i))
-                  (wrap-marks (syntax-object-wrap j))))
-        (eq? (unannotate i) (unannotate j)))))
-
-;;; "valid-bound-ids?" returns #t if it receives a list of distinct ids.
-;;; valid-bound-ids? may be passed unwrapped (or partially wrapped) ids
-;;; as long as the missing portion of the wrap is common to all of the
-;;; ids.
-
-(define valid-bound-ids?
-  (lambda (ids)
-     (and (let all-ids? ((ids ids))
-            (or (null? ids)
-                (and (id? (car ids))
-                     (all-ids? (cdr ids)))))
-          (distinct-bound-ids? ids))))
-
-;;; distinct-bound-ids? expects a list of ids and returns #t if there are
-;;; no duplicates.  It is quadratic on the length of the id list; long
-;;; lists could be sorted to make it more efficient.  distinct-bound-ids?
-;;; may be passed unwrapped (or partially wrapped) ids as long as the
-;;; missing portion of the wrap is common to all of the ids.
-
-(define distinct-bound-ids?
-  (lambda (ids)
-    (let distinct? ((ids ids))
-      (or (null? ids)
-          (and (not (bound-id-member? (car ids) (cdr ids)))
-               (distinct? (cdr ids)))))))
-
-(define bound-id-member?
-   (lambda (x list)
-      (and (not (null? list))
-           (or (bound-id=? x (car list))
-               (bound-id-member? x (cdr list))))))
-
-;;; wrapping expressions and identifiers
-
-(define wrap
-  (lambda (x w)
-    (cond
-      ((and (null? (wrap-marks w)) (null? (wrap-subst w))) x)
-      ((syntax-object? x)
-       (make-syntax-object
-         (syntax-object-expression x)
-         (join-wraps w (syntax-object-wrap x))))
-      ((null? x) x)
-      (else (make-syntax-object x w)))))
-
-(define source-wrap
-  (lambda (x w s)
-    (wrap (if s (make-annotation x s #f) x) w)))
-
-;;; expanding
-
-(define chi-sequence
-  (lambda (body r w s)
-    (build-sequence s
-      (let dobody ((body body) (r r) (w w))
-        (if (null? body)
-            '()
-            (let ((first (chi (car body) r w)))
-              (cons first (dobody (cdr body) r w))))))))
-
-(define chi-top-sequence
-  (lambda (body r w s m esew)
-    (build-sequence s
-      (let dobody ((body body) (r r) (w w) (m m) (esew esew))
-        (if (null? body)
-            '()
-            (let ((first (chi-top (car body) r w m esew)))
-              (cons first (dobody (cdr body) r w m esew))))))))
-
-(define chi-install-global
-  (lambda (name e)
-    (build-application no-source
-      (build-primref no-source 'install-global-transformer)
-      (list (build-data no-source name) e))))
-
-(define chi-when-list
-  (lambda (e when-list w)
-    ; when-list is syntax'd version of list of situations
-    (let f ((when-list when-list) (situations '()))
-      (if (null? when-list)
-          situations
-          (f (cdr when-list)
-             (cons (let ((x (car when-list)))
-                     (cond
-                       ((free-id=? x (syntax compile)) 'compile)
-                       ((free-id=? x (syntax load)) 'load)
-                       ((free-id=? x (syntax eval)) 'eval)
-                       (else (syntax-error (wrap x w)
-                               "invalid eval-when situation"))))
-                   situations))))))
-
-;;; syntax-type returns five values: type, value, e, w, and s.  The first
-;;; two are described in the table below.
-;;;
-;;;    type                   value         explanation
-;;;    -------------------------------------------------------------------
-;;;    core                   procedure     core form (including singleton)
-;;;    lexical                name          lexical variable reference
-;;;    global                 name          global variable reference
-;;;    begin                  none          begin keyword
-;;;    define                 none          define keyword
-;;;    define-syntax          none          define-syntax keyword
-;;;    local-syntax           rec?          letrec-syntax/let-syntax keyword
-;;;    eval-when              none          eval-when keyword
-;;;    syntax                 level         pattern variable
-;;;    displaced-lexical      none          displaced lexical identifier
-;;;    lexical-call           name          call to lexical variable
-;;;    global-call            name          call to global variable
-;;;    call                   none          any other call
-;;;    begin-form             none          begin expression
-;;;    define-form            id            variable definition
-;;;    define-syntax-form     id            syntax definition
-;;;    local-syntax-form      rec?          syntax definition
-;;;    eval-when-form         none          eval-when form
-;;;    constant               none          self-evaluating datum
-;;;    other                  none          anything else
-;;;
-;;; For define-form and define-syntax-form, e is the rhs expression.
-;;; For all others, e is the entire form.  w is the wrap for e.
-;;; s is the source for the entire form.
-;;;
-;;; syntax-type expands macros and unwraps as necessary to get to
-;;; one of the forms above.  It also parses define and define-syntax
-;;; forms, although perhaps this should be done by the consumer.
-
-(define syntax-type
-  (lambda (e r w s rib)
-    (cond
-      ((symbol? e)
-       (let* ((n (id-var-name e w))
-              (b (lookup n r))
-              (type (binding-type b)))
-         (case type
-           ((lexical) (values type (binding-value b) e w s))
-           ((global) (values type n e w s))
-           ((macro)
-            (syntax-type (chi-macro (binding-value b) e r w rib) r empty-wrap s rib))
-           (else (values type (binding-value b) e w s)))))
-      ((pair? e)
-       (let ((first (car e)))
-         (if (id? first)
-             (let* ((n (id-var-name first w))
-                    (b (lookup n r))
-                    (type (binding-type b)))
-               (case type
-                 ((lexical) (values 'lexical-call (binding-value b) e w s))
-                 ((global) (values 'global-call n e w s))
-                 ((macro)
-                  (syntax-type (chi-macro (binding-value b) e r w rib)
-                    r empty-wrap s rib))
-                 ((core) (values type (binding-value b) e w s))
-                 ((local-syntax)
-                  (values 'local-syntax-form (binding-value b) e w s))
-                 ((begin) (values 'begin-form #f e w s))
-                 ((eval-when) (values 'eval-when-form #f e w s))
-                 ((define)
-                  (syntax-case e ()
-                    ((_ name val)
-                     (id? (syntax name))
-                     (values 'define-form (syntax name) (syntax val) w s))
-                    ((_ (name . args) e1 e2 ...)
-                     (and (id? (syntax name))
-                          (valid-bound-ids? (lambda-var-list (syntax args))))
-                     ; need lambda here...
-                     (values 'define-form (wrap (syntax name) w)
-                       (cons (syntax lambda) (wrap (syntax (args e1 e2 ...)) w))
-                       empty-wrap s))
-                    ((_ name)
-                     (id? (syntax name))
-                     (values 'define-form (wrap (syntax name) w)
-                       (syntax (void))
-                       empty-wrap s))))
-                 ((define-syntax)
-                  (syntax-case e ()
-                    ((_ name val)
-                     (id? (syntax name))
-                     (values 'define-syntax-form (syntax name)
-                       (syntax val) w s))))
-                 (else (values 'call #f e w s))))
-             (values 'call #f e w s))))
-      ((syntax-object? e)
-       ;; s can't be valid source if we've unwrapped
-       (syntax-type (syntax-object-expression e)
-                    r
-                    (join-wraps w (syntax-object-wrap e))
-                    no-source rib))
-      ((annotation? e)
-       (syntax-type (annotation-expression e) r w (annotation-source e) rib))
-      ((self-evaluating? e) (values 'constant #f e w s))
-      (else (values 'other #f e w s)))))
-
-(define chi-top
-  (lambda (e r w m esew)
-    (define-syntax eval-if-c&e
-      (syntax-rules ()
-        ((_ m e)
-         (let ((x e))
-           (if (eq? m 'c&e) (top-level-eval-hook x))
-           x))))
-    (call-with-values
-      (lambda () (syntax-type e r w no-source #f))
-      (lambda (type value e w s)
-        (case type
-          ((begin-form)
-           (syntax-case e ()
-             ((_) (chi-void))
-             ((_ e1 e2 ...)
-              (chi-top-sequence (syntax (e1 e2 ...)) r w s m esew))))
-          ((local-syntax-form)
-           (chi-local-syntax value e r w s
-             (lambda (body r w s)
-               (chi-top-sequence body r w s m esew))))
-          ((eval-when-form)
-           (syntax-case e ()
-             ((_ (x ...) e1 e2 ...)
-              (let ((when-list (chi-when-list e (syntax (x ...)) w))
-                    (body (syntax (e1 e2 ...))))
-                (cond
-                  ((eq? m 'e)
-                   (if (memq 'eval when-list)
-                       (chi-top-sequence body r w s 'e '(eval))
-                       (chi-void)))
-                  ((memq 'load when-list)
-                   (if (or (memq 'compile when-list)
-                           (and (eq? m 'c&e) (memq 'eval when-list)))
-                       (chi-top-sequence body r w s 'c&e '(compile load))
-                       (if (memq m '(c c&e))
-                           (chi-top-sequence body r w s 'c '(load))
-                           (chi-void))))
-                  ((or (memq 'compile when-list)
-                       (and (eq? m 'c&e) (memq 'eval when-list)))
-                   (top-level-eval-hook
-                     (chi-top-sequence body r w s 'e '(eval)))
-                   (chi-void))
-                  (else (chi-void)))))))
-          ((define-syntax-form)
-           (let ((n (id-var-name value w)) (r (macros-only-env r)))
-             (case m
-               ((c)
-                (if (memq 'compile esew)
-                    (let ((e (chi-install-global n (chi e r w))))
-                      (top-level-eval-hook e)
-                      (if (memq 'load esew) e (chi-void)))
-                    (if (memq 'load esew)
-                        (chi-install-global n (chi e r w))
-                        (chi-void))))
-               ((c&e)
-                (let ((e (chi-install-global n (chi e r w))))
-                  (top-level-eval-hook e)
-                  e))
-               (else
-                (if (memq 'eval esew)
-                    (top-level-eval-hook
-                      (chi-install-global n (chi e r w))))
-                (chi-void)))))
-          ((define-form)
-           (let ((n (id-var-name value w)))
-             (case (binding-type (lookup n r))
-               ((global)
-                (eval-if-c&e m
-                  (build-global-definition s n (chi e r w))))
-               ((displaced-lexical)
-                (syntax-error (wrap value w) "identifier out of context"))
-               (else (syntax-error (wrap value w)
-                       "cannot define keyword at top level")))))
-          (else (eval-if-c&e m (chi-expr type value e r w s))))))))
-
-(define chi
-  (lambda (e r w)
-    (call-with-values
-      (lambda () (syntax-type e r w no-source #f))
-      (lambda (type value e w s)
-        (chi-expr type value e r w s)))))
-
-(define chi-expr
-  (lambda (type value e r w s)
-    (case type
-      ((lexical)
-       (build-lexical-reference 'value s value))
-      ((core) (value e r w s))
-      ((lexical-call)
-       (chi-application
-         (build-lexical-reference 'fun (source-annotation (car e)) value)
-         e r w s))
-      ((global-call)
-       (chi-application
-         (build-global-reference (source-annotation (car e)) value)
-         e r w s))
-      ((constant) (build-data s (strip (source-wrap e w s) empty-wrap)))
-      ((global) (build-global-reference s value))
-      ((call) (chi-application (chi (car e) r w) e r w s))
-      ((begin-form)
-       (syntax-case e ()
-         ((_ e1 e2 ...) (chi-sequence (syntax (e1 e2 ...)) r w s))))
-      ((local-syntax-form)
-       (chi-local-syntax value e r w s chi-sequence))
-      ((eval-when-form)
-       (syntax-case e ()
-         ((_ (x ...) e1 e2 ...)
-          (let ((when-list (chi-when-list e (syntax (x ...)) w)))
-            (if (memq 'eval when-list)
-                (chi-sequence (syntax (e1 e2 ...)) r w s)
-                (chi-void))))))
-      ((define-form define-syntax-form)
-       (syntax-error (wrap value w) "invalid context for definition of"))
-      ((syntax)
-       (syntax-error (source-wrap e w s)
-         "reference to pattern variable outside syntax form"))
-      ((displaced-lexical)
-       (syntax-error (source-wrap e w s)
-         "reference to identifier outside its scope"))
-      (else (syntax-error (source-wrap e w s))))))
-
-(define chi-application
-  (lambda (x e r w s)
-    (syntax-case e ()
-      ((e0 e1 ...)
-       (build-application s x
-         (map (lambda (e) (chi e r w)) (syntax (e1 ...))))))))
-
-(define chi-macro
-  (lambda (p e r w rib)
-    (define rebuild-macro-output
-      (lambda (x m)
-        (cond ((pair? x)
-               (cons (rebuild-macro-output (car x) m)
-                     (rebuild-macro-output (cdr x) m)))
-              ((syntax-object? x)
-               (let ((w (syntax-object-wrap x)))
-                 (let ((ms (wrap-marks w)) (s (wrap-subst w)))
-                   (make-syntax-object (syntax-object-expression x)
-                     (if (and (pair? ms) (eq? (car ms) the-anti-mark))
-                         (make-wrap (cdr ms)
-                           (if rib (cons rib (cdr s)) (cdr s)))
-                         (make-wrap (cons m ms)
-                           (if rib
-                               (cons rib (cons 'shift s))
-                               (cons 'shift s))))))))
-              ((vector? x)
-               (let* ((n (vector-length x)) (v (make-vector n)))
-                 (do ((i 0 (fx+ i 1)))
-                     ((fx= i n) v)
-                     (vector-set! v i
-                       (rebuild-macro-output (vector-ref x i) m)))))
-              ((symbol? x)
-               (syntax-error x "encountered raw symbol in macro output"))
-              (else x))))
-    (rebuild-macro-output (p (wrap e (anti-mark w))) (new-mark))))
-
-(define chi-body
-  ;; In processing the forms of the body, we create a new, empty wrap.
-  ;; This wrap is augmented (destructively) each time we discover that
-  ;; the next form is a definition.  This is done:
-  ;;
-  ;;   (1) to allow the first nondefinition form to be a call to
-  ;;       one of the defined ids even if the id previously denoted a
-  ;;       definition keyword or keyword for a macro expanding into a
-  ;;       definition;
-  ;;   (2) to prevent subsequent definition forms (but unfortunately
-  ;;       not earlier ones) and the first nondefinition form from
-  ;;       confusing one of the bound identifiers for an auxiliary
-  ;;       keyword; and
-  ;;   (3) so that we do not need to restart the expansion of the
-  ;;       first nondefinition form, which is problematic anyway
-  ;;       since it might be the first element of a begin that we
-  ;;       have just spliced into the body (meaning if we restarted,
-  ;;       we'd really need to restart with the begin or the macro
-  ;;       call that expanded into the begin, and we'd have to give
-  ;;       up allowing (begin <defn>+ <expr>+), which is itself
-  ;;       problematic since we don't know if a begin contains only
-  ;;       definitions until we've expanded it).
-  ;;
-  ;; Before processing the body, we also create a new environment
-  ;; containing a placeholder for the bindings we will add later and
-  ;; associate this environment with each form.  In processing a
-  ;; let-syntax or letrec-syntax, the associated environment may be
-  ;; augmented with local keyword bindings, so the environment may
-  ;; be different for different forms in the body.  Once we have
-  ;; gathered up all of the definitions, we evaluate the transformer
-  ;; expressions and splice into r at the placeholder the new variable
-  ;; and keyword bindings.  This allows let-syntax or letrec-syntax
-  ;; forms local to a portion or all of the body to shadow the
-  ;; definition bindings.
-  ;;
-  ;; Subforms of a begin, let-syntax, or letrec-syntax are spliced
-  ;; into the body.
-  ;;
-  ;; outer-form is fully wrapped w/source
-  (lambda (body outer-form r w)
-    (let* ((r (cons '("placeholder" . (placeholder)) r))
-           (ribcage (make-empty-ribcage))
-           (w (make-wrap (wrap-marks w) (cons ribcage (wrap-subst w)))))
-      (let parse ((body (map (lambda (x) (cons r (wrap x w))) body))
-                  (ids '()) (labels '()) (vars '()) (vals '()) (bindings '()))
-        (if (null? body)
-            (syntax-error outer-form "no expressions in body")
-            (let ((e (cdar body)) (er (caar body)))
-              (call-with-values
-                (lambda () (syntax-type e er empty-wrap no-source ribcage))
-                (lambda (type value e w s)
-                  (case type
-                    ((define-form)
-                     (let ((id (wrap value w)) (label (gen-label)))
-                       (let ((var (gen-var id)))
-                         (extend-ribcage! ribcage id label)
-                         (parse (cdr body)
-                           (cons id ids) (cons label labels)
-                           (cons var vars) (cons (cons er (wrap e w)) vals)
-                           (cons (make-binding 'lexical var) bindings)))))
-                    ((define-syntax-form)
-                     (let ((id (wrap value w)) (label (gen-label)))
-                       (extend-ribcage! ribcage id label)
-                       (parse (cdr body)
-                         (cons id ids) (cons label labels)
-                         vars vals
-                         (cons (make-binding 'macro (cons er (wrap e w)))
-                               bindings))))
-                    ((begin-form)
-                     (syntax-case e ()
-                       ((_ e1 ...)
-                        (parse (let f ((forms (syntax (e1 ...))))
-                                 (if (null? forms)
-                                     (cdr body)
-                                     (cons (cons er (wrap (car forms) w))
-                                           (f (cdr forms)))))
-                          ids labels vars vals bindings))))
-                    ((local-syntax-form)
-                     (chi-local-syntax value e er w s
-                       (lambda (forms er w s)
-                         (parse (let f ((forms forms))
-                                  (if (null? forms)
-                                      (cdr body)
-                                      (cons (cons er (wrap (car forms) w))
-                                            (f (cdr forms)))))
-                           ids labels vars vals bindings))))
-                    (else ; found a non-definition
-                     (if (null? ids)
-                         (build-sequence no-source
-                           (map (lambda (x)
-                                  (chi (cdr x) (car x) empty-wrap))
-                                (cons (cons er (source-wrap e w s))
-                                      (cdr body))))
-                         (begin
-                           (if (not (valid-bound-ids? ids))
-                               (syntax-error outer-form
-                                 "invalid or duplicate identifier in definition"))
-                           (let loop ((bs bindings) (er-cache #f) (r-cache #f))
-                             (if (not (null? bs))
-                                 (let* ((b (car bs)))
-                                   (if (eq? (car b) 'macro)
-                                       (let* ((er (cadr b))
-                                              (r-cache
-                                                (if (eq? er er-cache)
-                                                    r-cache
-                                                    (macros-only-env er))))
-                                         (set-cdr! b
-                                           (eval-local-transformer
-                                             (chi (cddr b) r-cache empty-wrap)))
-                                         (loop (cdr bs) er r-cache))
-                                       (loop (cdr bs) er-cache r-cache)))))
-                           (set-cdr! r (extend-env labels bindings (cdr r)))
-                           (build-letrec no-source
-                             vars
-                             (map (lambda (x)
-                                    (chi (cdr x) (car x) empty-wrap))
-                                  vals)
-                             (build-sequence no-source
-                               (map (lambda (x)
-                                      (chi (cdr x) (car x) empty-wrap))
-                                    (cons (cons er (source-wrap e w s))
-                                          (cdr body)))))))))))))))))
-
-(define chi-lambda-clause
-  (lambda (e c r w k)
-    (syntax-case c ()
-      (((id ...) e1 e2 ...)
-       (let ((ids (syntax (id ...))))
-         (if (not (valid-bound-ids? ids))
-             (syntax-error e "invalid parameter list in")
-             (let ((labels (gen-labels ids))
-                   (new-vars (map gen-var ids)))
-               (k new-vars
-                  (chi-body (syntax (e1 e2 ...))
-                            e
-                            (extend-var-env labels new-vars r)
-                            (make-binding-wrap ids labels w)))))))
-      ((ids e1 e2 ...)
-       (let ((old-ids (lambda-var-list (syntax ids))))
-         (if (not (valid-bound-ids? old-ids))
-             (syntax-error e "invalid parameter list in")
-             (let ((labels (gen-labels old-ids))
-                   (new-vars (map gen-var old-ids)))
-               (k (let f ((ls1 (cdr new-vars)) (ls2 (car new-vars)))
-                    (if (null? ls1)
-                        ls2
-                        (f (cdr ls1) (cons (car ls1) ls2))))
-                  (chi-body (syntax (e1 e2 ...))
-                            e
-                            (extend-var-env labels new-vars r)
-                            (make-binding-wrap old-ids labels w)))))))
-      (_ (syntax-error e)))))
-
-(define chi-local-syntax
-  (lambda (rec? e r w s k)
-    (syntax-case e ()
-      ((_ ((id val) ...) e1 e2 ...)
-       (let ((ids (syntax (id ...))))
-         (if (not (valid-bound-ids? ids))
-             (syntax-error e "duplicate bound keyword in")
-             (let ((labels (gen-labels ids)))
-               (let ((new-w (make-binding-wrap ids labels w)))
-                 (k (syntax (e1 e2 ...))
-                    (extend-env
-                      labels
-                      (let ((w (if rec? new-w w))
-                            (trans-r (macros-only-env r)))
-                        (map (lambda (x)
-                               (make-binding 'macro
-                                 (eval-local-transformer (chi x trans-r w))))
-                             (syntax (val ...))))
-                      r)
-                    new-w
-                    s))))))
-      (_ (syntax-error (source-wrap e w s))))))
-
-(define eval-local-transformer
-  (lambda (expanded)
-    (let ((p (local-eval-hook expanded)))
-      (if (procedure? p)
-          p
-          (syntax-error p "nonprocedure transfomer")))))
-
-(define chi-void
-  (lambda ()
-    (build-application no-source (build-primref no-source 'void) '())))
-
-(define ellipsis?
-  (lambda (x)
-    (and (nonsymbol-id? x)
-         (free-id=? x (syntax (... ...))))))
-
-;;; data
-
-;;; strips all annotations from potentially circular reader output
-
-(define strip-annotation
-  (lambda (x parent)
-    (cond
-      ((pair? x)
-       (let ((new (cons #f #f)))
-         (when parent (set-annotation-stripped! parent new))
-         (set-car! new (strip-annotation (car x) #f))
-         (set-cdr! new (strip-annotation (cdr x) #f))
-         new))
-      ((annotation? x)
-       (or (annotation-stripped x)
-           (strip-annotation (annotation-expression x) x)))
-      ((vector? x)
-       (let ((new (make-vector (vector-length x))))
-         (when parent (set-annotation-stripped! parent new))
-         (let loop ((i (- (vector-length x) 1)))
-           (unless (fx< i 0)
-             (vector-set! new i (strip-annotation (vector-ref x i) #f))
-             (loop (fx- i 1))))
-         new))
-      (else x))))
-
-;;; strips syntax-objects down to top-wrap; if top-wrap is layered directly
-;;; on an annotation, strips the annotation as well.
-;;; since only the head of a list is annotated by the reader, not each pair
-;;; in the spine, we also check for pairs whose cars are annotated in case
-;;; we've been passed the cdr of an annotated list
-
-(define strip
-  (lambda (x w)
-    (if (top-marked? w)
-        (if (or (annotation? x) (and (pair? x) (annotation? (car x))))
-            (strip-annotation x #f)
-            x)
-        (let f ((x x))
-          (cond
-            ((syntax-object? x)
-             (strip (syntax-object-expression x) (syntax-object-wrap x)))
-            ((pair? x)
-             (let ((a (f (car x))) (d (f (cdr x))))
-               (if (and (eq? a (car x)) (eq? d (cdr x)))
-                   x
-                   (cons a d))))
-            ((vector? x)
-             (let ((old (vector->list x)))
-                (let ((new (map f old)))
-                   (if (andmap eq? old new) x (list->vector new)))))
-            (else x))))))
-
-;;; lexical variables
-
-(define gen-var
-  (lambda (id)
-    (let ((id (if (syntax-object? id) (syntax-object-expression id) id)))
-      (if (annotation? id)
-          (build-lexical-var (annotation-source id) (annotation-expression id))
-          (build-lexical-var no-source id)))))
-
-(define lambda-var-list
-  (lambda (vars)
-    (let lvl ((vars vars) (ls '()) (w empty-wrap))
-       (cond
-         ((pair? vars) (lvl (cdr vars) (cons (wrap (car vars) w) ls) w))
-         ((id? vars) (cons (wrap vars w) ls))
-         ((null? vars) ls)
-         ((syntax-object? vars)
-          (lvl (syntax-object-expression vars)
-               ls
-               (join-wraps w (syntax-object-wrap vars))))
-         ((annotation? vars)
-          (lvl (annotation-expression vars) ls w))
-       ; include anything else to be caught by subsequent error
-       ; checking
-         (else (cons vars ls))))))
-
-;;; core transformers
-
-(global-extend 'local-syntax 'letrec-syntax #t)
-(global-extend 'local-syntax 'let-syntax #f)
-
-(global-extend 'core 'fluid-let-syntax
-  (lambda (e r w s)
-    (syntax-case e ()
-      ((_ ((var val) ...) e1 e2 ...)
-       (valid-bound-ids? (syntax (var ...)))
-       (let ((names (map (lambda (x) (id-var-name x w)) (syntax (var ...)))))
-         (for-each
-           (lambda (id n)
-             (case (binding-type (lookup n r))
-               ((displaced-lexical)
-                (syntax-error (source-wrap id w s)
-                  "identifier out of context"))))
-           (syntax (var ...))
-           names)
-         (chi-body
-           (syntax (e1 e2 ...))
-           (source-wrap e w s)
-           (extend-env
-             names
-             (let ((trans-r (macros-only-env r)))
-               (map (lambda (x)
-                      (make-binding 'macro
-                        (eval-local-transformer (chi x trans-r w))))
-                    (syntax (val ...))))
-             r)
-           w)))
-      (_ (syntax-error (source-wrap e w s))))))
-
-(global-extend 'core 'quote
-   (lambda (e r w s)
-      (syntax-case e ()
-         ((_ e) (build-data s (strip (syntax e) w)))
-         (_ (syntax-error (source-wrap e w s))))))
-
-(global-extend 'core 'syntax
-  (let ()
-    (define gen-syntax
-      (lambda (src e r maps ellipsis?)
-        (if (id? e)
-            (let ((label (id-var-name e empty-wrap)))
-              (let ((b (lookup label r)))
-                (if (eq? (binding-type b) 'syntax)
-                    (call-with-values
-                      (lambda ()
-                        (let ((var.lev (binding-value b)))
-                          (gen-ref src (car var.lev) (cdr var.lev) maps)))
-                      (lambda (var maps) (values `(ref ,var) maps)))
-                    (if (ellipsis? e)
-                        (syntax-error src "misplaced ellipsis in syntax form")
-                        (values `(quote ,e) maps)))))
-            (syntax-case e ()
-              ((dots e)
-               (ellipsis? (syntax dots))
-               (gen-syntax src (syntax e) r maps (lambda (x) #f)))
-              ((x dots . y)
-               ; this could be about a dozen lines of code, except that we
-               ; choose to handle (syntax (x ... ...)) forms
-               (ellipsis? (syntax dots))
-               (let f ((y (syntax y))
-                       (k (lambda (maps)
-                            (call-with-values
-                              (lambda ()
-                                (gen-syntax src (syntax x) r
-                                  (cons '() maps) ellipsis?))
-                              (lambda (x maps)
-                                (if (null? (car maps))
-                                    (syntax-error src
-                                      "extra ellipsis in syntax form")
-                                    (values (gen-map x (car maps))
-                                            (cdr maps))))))))
-                 (syntax-case y ()
-                   ((dots . y)
-                    (ellipsis? (syntax dots))
-                    (f (syntax y)
-                       (lambda (maps)
-                         (call-with-values
-                           (lambda () (k (cons '() maps)))
-                           (lambda (x maps)
-                             (if (null? (car maps))
-                                 (syntax-error src
-                                   "extra ellipsis in syntax form")
-                                 (values (gen-mappend x (car maps))
-                                         (cdr maps))))))))
-                   (_ (call-with-values
-                        (lambda () (gen-syntax src y r maps ellipsis?))
-                        (lambda (y maps)
-                          (call-with-values
-                            (lambda () (k maps))
-                            (lambda (x maps)
-                              (values (gen-append x y) maps)))))))))
-              ((x . y)
-               (call-with-values
-                 (lambda () (gen-syntax src (syntax x) r maps ellipsis?))
-                 (lambda (x maps)
-                   (call-with-values
-                     (lambda () (gen-syntax src (syntax y) r maps ellipsis?))
-                     (lambda (y maps) (values (gen-cons x y) maps))))))
-              (#(e1 e2 ...)
-               (call-with-values
-                 (lambda ()
-                   (gen-syntax src (syntax (e1 e2 ...)) r maps ellipsis?))
-                 (lambda (e maps) (values (gen-vector e) maps))))
-              (_ (values `(quote ,e) maps))))))
-
-    (define gen-ref
-      (lambda (src var level maps)
-        (if (fx= level 0)
-            (values var maps)
-            (if (null? maps)
-                (syntax-error src "missing ellipsis in syntax form")
-                (call-with-values
-                  (lambda () (gen-ref src var (fx- level 1) (cdr maps)))
-                  (lambda (outer-var outer-maps)
-                    (let ((b (assq outer-var (car maps))))
-                      (if b
-                          (values (cdr b) maps)
-                          (let ((inner-var (gen-var 'tmp)))
-                            (values inner-var
-                                    (cons (cons (cons outer-var inner-var)
-                                                (car maps))
-                                          outer-maps)))))))))))
-
-    (define gen-mappend
-      (lambda (e map-env)
-        `(apply (primitive append) ,(gen-map e map-env))))
-
-    (define gen-map
-      (lambda (e map-env)
-        (let ((formals (map cdr map-env))
-              (actuals (map (lambda (x) `(ref ,(car x))) map-env)))
-          (cond
-            ((eq? (car e) 'ref)
-             ; identity map equivalence:
-             ; (map (lambda (x) x) y) == y
-             (car actuals))
-            ((andmap
-                (lambda (x) (and (eq? (car x) 'ref) (memq (cadr x) formals)))
-                (cdr e))
-             ; eta map equivalence:
-             ; (map (lambda (x ...) (f x ...)) y ...) == (map f y ...)
-             `(map (primitive ,(car e))
-                   ,@(map (let ((r (map cons formals actuals)))
-                            (lambda (x) (cdr (assq (cadr x) r))))
-                          (cdr e))))
-            (else `(map (lambda ,formals ,e) ,@actuals))))))
-
-    (define gen-cons
-      (lambda (x y)
-        (case (car y)
-          ((quote)
-           (if (eq? (car x) 'quote)
-               `(quote (,(cadr x) . ,(cadr y)))
-               (if (eq? (cadr y) '())
-                   `(list ,x)
-                   `(cons ,x ,y))))
-          ((list) `(list ,x ,@(cdr y)))
-          (else `(cons ,x ,y)))))
-
-    (define gen-append
-      (lambda (x y)
-        (if (equal? y '(quote ()))
-            x
-            `(append ,x ,y))))
-
-    (define gen-vector
-      (lambda (x)
-        (cond
-          ((eq? (car x) 'list) `(vector ,@(cdr x)))
-          ((eq? (car x) 'quote) `(quote #(,@(cadr x))))
-          (else `(list->vector ,x)))))
-
-
-    (define regen
-      (lambda (x)
-        (case (car x)
-          ((ref) (build-lexical-reference 'value no-source (cadr x)))
-          ((primitive) (build-primref no-source (cadr x)))
-          ((quote) (build-data no-source (cadr x)))
-          ((lambda) (build-lambda no-source (cadr x) (regen (caddr x))))
-          ((map) (let ((ls (map regen (cdr x))))
-                   (build-application no-source
-                     (if (fx= (length ls) 2)
-                         (build-primref no-source 'map)
-                        ; really need to do our own checking here
-                         (build-primref no-source 2 'map)) ; require error check
-                     ls)))
-          (else (build-application no-source
-                  (build-primref no-source (car x))
-                  (map regen (cdr x)))))))
-
-    (lambda (e r w s)
-      (let ((e (source-wrap e w s)))
-        (syntax-case e ()
-          ((_ x)
-           (call-with-values
-             (lambda () (gen-syntax e (syntax x) r '() ellipsis?))
-             (lambda (e maps) (regen e))))
-          (_ (syntax-error e)))))))
-
-
-(global-extend 'core 'lambda
-   (lambda (e r w s)
-      (syntax-case e ()
-         ((_ . c)
-          (chi-lambda-clause (source-wrap e w s) (syntax c) r w
-            (lambda (vars body) (build-lambda s vars body)))))))
-
-
-(global-extend 'core 'let
-  (let ()
-    (define (chi-let e r w s constructor ids vals exps)
-      (if (not (valid-bound-ids? ids))
-         (syntax-error e "duplicate bound variable in")
-         (let ((labels (gen-labels ids))
-               (new-vars (map gen-var ids)))
-           (let ((nw (make-binding-wrap ids labels w))
-                 (nr (extend-var-env labels new-vars r)))
-             (constructor s
-                          new-vars
-                          (map (lambda (x) (chi x r w)) vals)
-                          (chi-body exps (source-wrap e nw s) nr nw))))))
-    (lambda (e r w s)
-      (syntax-case e ()
-       ((_ ((id val) ...) e1 e2 ...)
-        (chi-let e r w s
-                 build-let
-                 (syntax (id ...))
-                 (syntax (val ...))
-                 (syntax (e1 e2 ...))))
-       ((_ f ((id val) ...) e1 e2 ...)
-        (id? (syntax f))
-        (chi-let e r w s
-                 build-named-let
-                 (syntax (f id ...))
-                 (syntax (val ...))
-                 (syntax (e1 e2 ...))))
-       (_ (syntax-error (source-wrap e w s)))))))
-
-
-(global-extend 'core 'letrec
-  (lambda (e r w s)
-    (syntax-case e ()
-      ((_ ((id val) ...) e1 e2 ...)
-       (let ((ids (syntax (id ...))))
-         (if (not (valid-bound-ids? ids))
-             (syntax-error e "duplicate bound variable in")
-             (let ((labels (gen-labels ids))
-                   (new-vars (map gen-var ids)))
-               (let ((w (make-binding-wrap ids labels w))
-                    (r (extend-var-env labels new-vars r)))
-                 (build-letrec s
-                   new-vars
-                   (map (lambda (x) (chi x r w)) (syntax (val ...)))
-                   (chi-body (syntax (e1 e2 ...)) (source-wrap e w s) r w)))))))
-      (_ (syntax-error (source-wrap e w s))))))
-
-
-(global-extend 'core 'set!
-  (lambda (e r w s)
-    (syntax-case e ()
-      ((_ id val)
-       (id? (syntax id))
-       (let ((val (chi (syntax val) r w))
-             (n (id-var-name (syntax id) w)))
-         (let ((b (lookup n r)))
-           (case (binding-type b)
-             ((lexical)
-              (build-lexical-assignment s (binding-value b) val))
-             ((global) (build-global-assignment s n val))
-             ((displaced-lexical)
-              (syntax-error (wrap (syntax id) w)
-                "identifier out of context"))
-             (else (syntax-error (source-wrap e w s)))))))
-      (_ (syntax-error (source-wrap e w s))))))
-
-(global-extend 'begin 'begin '())
-
-(global-extend 'define 'define '())
-
-(global-extend 'define-syntax 'define-syntax '())
-
-(global-extend 'eval-when 'eval-when '())
-
-(global-extend 'core 'syntax-case
-  (let ()
-    (define convert-pattern
-      ; accepts pattern & keys
-      ; returns syntax-dispatch pattern & ids
-      (lambda (pattern keys)
-        (let cvt ((p pattern) (n 0) (ids '()))
-          (if (id? p)
-              (if (bound-id-member? p keys)
-                  (values (vector 'free-id p) ids)
-                  (values 'any (cons (cons p n) ids)))
-              (syntax-case p ()
-                ((x dots)
-                 (ellipsis? (syntax dots))
-                 (call-with-values
-                   (lambda () (cvt (syntax x) (fx+ n 1) ids))
-                   (lambda (p ids)
-                     (values (if (eq? p 'any) 'each-any (vector 'each p))
-                             ids))))
-                ((x . y)
-                 (call-with-values
-                   (lambda () (cvt (syntax y) n ids))
-                   (lambda (y ids)
-                     (call-with-values
-                       (lambda () (cvt (syntax x) n ids))
-                       (lambda (x ids)
-                         (values (cons x y) ids))))))
-                (() (values '() ids))
-                (#(x ...)
-                 (call-with-values
-                   (lambda () (cvt (syntax (x ...)) n ids))
-                   (lambda (p ids) (values (vector 'vector p) ids))))
-                (x (values (vector 'atom (strip p empty-wrap)) ids)))))))
-
-    (define build-dispatch-call
-      (lambda (pvars exp y r)
-        (let ((ids (map car pvars)) (levels (map cdr pvars)))
-          (let ((labels (gen-labels ids)) (new-vars (map gen-var ids)))
-            (build-application no-source
-              (build-primref no-source 'apply)
-              (list (build-lambda no-source new-vars
-                      (chi exp
-                         (extend-env
-                             labels
-                             (map (lambda (var level)
-                                    (make-binding 'syntax `(,var . ,level)))
-                                  new-vars
-                                  (map cdr pvars))
-                             r)
-                           (make-binding-wrap ids labels empty-wrap)))
-                    y))))))
-
-    (define gen-clause
-      (lambda (x keys clauses r pat fender exp)
-        (call-with-values
-          (lambda () (convert-pattern pat keys))
-          (lambda (p pvars)
-            (cond
-              ((not (distinct-bound-ids? (map car pvars)))
-               (syntax-error pat
-                 "duplicate pattern variable in syntax-case pattern"))
-              ((not (andmap (lambda (x) (not (ellipsis? (car x)))) pvars))
-               (syntax-error pat
-                 "misplaced ellipsis in syntax-case pattern"))
-              (else
-               (let ((y (gen-var 'tmp)))
-                 ; fat finger binding and references to temp variable y
-                 (build-application no-source
-                   (build-lambda no-source (list y)
-                     (let ((y (build-lexical-reference 'value no-source y)))
-                       (build-conditional no-source
-                         (syntax-case fender ()
-                           (#t y)
-                           (_ (build-conditional no-source
-                                y
-                                (build-dispatch-call pvars fender y r)
-                                (build-data no-source #f))))
-                         (build-dispatch-call pvars exp y r)
-                         (gen-syntax-case x keys clauses r))))
-                   (list (if (eq? p 'any)
-                             (build-application no-source
-                               (build-primref no-source 'list)
-                               (list x))
-                             (build-application no-source
-                               (build-primref no-source 'syntax-dispatch)
-                               (list x (build-data no-source p)))))))))))))
-
-    (define gen-syntax-case
-      (lambda (x keys clauses r)
-        (if (null? clauses)
-            (build-application no-source
-              (build-primref no-source 'syntax-error)
-              (list x))
-            (syntax-case (car clauses) ()
-              ((pat exp)
-               (if (and (id? (syntax pat))
-                        (andmap (lambda (x) (not (free-id=? (syntax pat) x)))
-                          (cons (syntax (... ...)) keys)))
-                   (let ((labels (list (gen-label)))
-                         (var (gen-var (syntax pat))))
-                     (build-application no-source
-                       (build-lambda no-source (list var)
-                         (chi (syntax exp)
-                              (extend-env labels
-                                (list (make-binding 'syntax `(,var . 0)))
-                                r)
-                              (make-binding-wrap (syntax (pat))
-                                labels empty-wrap)))
-                       (list x)))
-                   (gen-clause x keys (cdr clauses) r
-                     (syntax pat) #t (syntax exp))))
-              ((pat fender exp)
-               (gen-clause x keys (cdr clauses) r
-                 (syntax pat) (syntax fender) (syntax exp)))
-              (_ (syntax-error (car clauses) "invalid syntax-case clause"))))))
-
-    (lambda (e r w s)
-      (let ((e (source-wrap e w s)))
-        (syntax-case e ()
-          ((_ val (key ...) m ...)
-           (if (andmap (lambda (x) (and (id? x) (not (ellipsis? x))))
-                       (syntax (key ...)))
-               (let ((x (gen-var 'tmp)))
-                 ; fat finger binding and references to temp variable x
-                 (build-application s
-                   (build-lambda no-source (list x)
-                     (gen-syntax-case (build-lexical-reference 'value no-source x)
-                       (syntax (key ...)) (syntax (m ...))
-                       r))
-                   (list (chi (syntax val) r empty-wrap))))
-               (syntax-error e "invalid literals list in"))))))))
-
-;;; The portable sc-expand seeds chi-top's mode m with 'e (for
-;;; evaluating) and esew (which stands for "eval syntax expanders
-;;; when") with '(eval).  In Chez Scheme, m is set to 'c instead of e
-;;; if we are compiling a file, and esew is set to
-;;; (eval-syntactic-expanders-when), which defaults to the list
-;;; '(compile load eval).  This means that, by default, top-level
-;;; syntactic definitions are evaluated immediately after they are
-;;; expanded, and the expanded definitions are also residualized into
-;;; the object file if we are compiling a file.
-(set! sc-expand
-  (let ((m 'e) (esew '(eval)))
-    (lambda (x)
-      (if (and (pair? x) (equal? (car x) noexpand))
-          (cadr x)
-          (chi-top x null-env top-wrap m esew)))))
-
-(set! sc-expand3
-  (let ((m 'e) (esew '(eval)))
-    (lambda (x . rest)
-      (if (and (pair? x) (equal? (car x) noexpand))
-          (cadr x)
-          (chi-top x
-                  null-env
-                  top-wrap
-                  (if (null? rest) m (car rest))
-                  (if (or (null? rest) (null? (cdr rest)))
-                      esew
-                      (cadr rest)))))))
-
-(set! identifier?
-  (lambda (x)
-    (nonsymbol-id? x)))
-
-(set! datum->syntax-object
-  (lambda (id datum)
-    (arg-check nonsymbol-id? id 'datum->syntax-object)
-    (make-syntax-object datum (syntax-object-wrap id))))
-
-(set! syntax-object->datum
-  ; accepts any object, since syntax objects may consist partially
-  ; or entirely of unwrapped, nonsymbolic data
-  (lambda (x)
-    (strip x empty-wrap)))
-
-(set! generate-temporaries
-  (lambda (ls)
-    (arg-check list? ls 'generate-temporaries)
-    (map (lambda (x) (wrap (gensym-hook) top-wrap)) ls)))
-
-(set! free-identifier=?
-   (lambda (x y)
-      (arg-check nonsymbol-id? x 'free-identifier=?)
-      (arg-check nonsymbol-id? y 'free-identifier=?)
-      (free-id=? x y)))
-
-(set! bound-identifier=?
-   (lambda (x y)
-      (arg-check nonsymbol-id? x 'bound-identifier=?)
-      (arg-check nonsymbol-id? y 'bound-identifier=?)
-      (bound-id=? x y)))
-
-(set! syntax-error
-  (lambda (object . messages)
-    (for-each (lambda (x) (arg-check string? x 'syntax-error)) messages)
-    (let ((message (if (null? messages)
-                       "invalid syntax"
-                       (apply string-append messages))))
-      (error-hook #f message (strip object empty-wrap)))))
-
-(set! install-global-transformer
-  (lambda (sym v)
-    (arg-check symbol? sym 'define-syntax)
-    (arg-check procedure? v 'define-syntax)
-    (global-extend 'macro sym v)))
-
-;;; syntax-dispatch expects an expression and a pattern.  If the expression
-;;; matches the pattern a list of the matching expressions for each
-;;; "any" is returned.  Otherwise, #f is returned.  (This use of #f will
-;;; not work on r4rs implementations that violate the ieee requirement
-;;; that #f and () be distinct.)
-
-;;; The expression is matched with the pattern as follows:
-
-;;; pattern:                           matches:
-;;;   ()                                 empty list
-;;;   any                                anything
-;;;   (<pattern>1 . <pattern>2)          (<pattern>1 . <pattern>2)
-;;;   each-any                           (any*)
-;;;   #(free-id <key>)                   <key> with free-identifier=?
-;;;   #(each <pattern>)                  (<pattern>*)
-;;;   #(vector <pattern>)                (list->vector <pattern>)
-;;;   #(atom <object>)                   <object> with "equal?"
-
-;;; Vector cops out to pair under assumption that vectors are rare.  If
-;;; not, should convert to:
-;;;   #(vector <pattern>*)               #(<pattern>*)
-
-(let ()
-
-(define match-each
-  (lambda (e p w)
-    (cond
-      ((annotation? e)
-       (match-each (annotation-expression e) p w))
-      ((pair? e)
-       (let ((first (match (car e) p w '())))
-         (and first
-              (let ((rest (match-each (cdr e) p w)))
-                 (and rest (cons first rest))))))
-      ((null? e) '())
-      ((syntax-object? e)
-       (match-each (syntax-object-expression e)
-                   p
-                   (join-wraps w (syntax-object-wrap e))))
-      (else #f))))
-
-(define match-each-any
-  (lambda (e w)
-    (cond
-      ((annotation? e)
-       (match-each-any (annotation-expression e) w))
-      ((pair? e)
-       (let ((l (match-each-any (cdr e) w)))
-         (and l (cons (wrap (car e) w) l))))
-      ((null? e) '())
-      ((syntax-object? e)
-       (match-each-any (syntax-object-expression e)
-                       (join-wraps w (syntax-object-wrap e))))
-      (else #f))))
-
-(define match-empty
-  (lambda (p r)
-    (cond
-      ((null? p) r)
-      ((eq? p 'any) (cons '() r))
-      ((pair? p) (match-empty (car p) (match-empty (cdr p) r)))
-      ((eq? p 'each-any) (cons '() r))
-      (else
-       (case (vector-ref p 0)
-         ((each) (match-empty (vector-ref p 1) r))
-         ((free-id atom) r)
-         ((vector) (match-empty (vector-ref p 1) r)))))))
-
-(define match*
-  (lambda (e p w r)
-    (cond
-      ((null? p) (and (null? e) r))
-      ((pair? p)
-       (and (pair? e) (match (car e) (car p) w
-                        (match (cdr e) (cdr p) w r))))
-      ((eq? p 'each-any)
-       (let ((l (match-each-any e w))) (and l (cons l r))))
-      (else
-       (case (vector-ref p 0)
-         ((each)
-          (if (null? e)
-              (match-empty (vector-ref p 1) r)
-              (let ((l (match-each e (vector-ref p 1) w)))
-                (and l
-                     (let collect ((l l))
-                       (if (null? (car l))
-                           r
-                           (cons (map car l) (collect (map cdr l)))))))))
-         ((free-id) (and (id? e) (free-id=? (wrap e w) (vector-ref p 1)) r))
-         ((atom) (and (equal? (vector-ref p 1) (strip e w)) r))
-         ((vector)
-          (and (vector? e)
-               (match (vector->list e) (vector-ref p 1) w r))))))))
-
-(define match
-  (lambda (e p w r)
-    (cond
-      ((not r) #f)
-      ((eq? p 'any) (cons (wrap e w) r))
-      ((syntax-object? e)
-       (match*
-         (unannotate (syntax-object-expression e))
-         p
-         (join-wraps w (syntax-object-wrap e))
-         r))
-      (else (match* (unannotate e) p w r)))))
-
-(set! syntax-dispatch
-  (lambda (e p)
-    (cond
-      ((eq? p 'any) (list e))
-      ((syntax-object? e)
-       (match* (unannotate (syntax-object-expression e))
-         p (syntax-object-wrap e) '()))
-      (else (match* (unannotate e) p empty-wrap '())))))
-))
-)
-
-(define-syntax with-syntax
-   (lambda (x)
-      (syntax-case x ()
-         ((_ () e1 e2 ...)
-          (syntax (begin e1 e2 ...)))
-         ((_ ((out in)) e1 e2 ...)
-          (syntax (syntax-case in () (out (begin e1 e2 ...)))))
-         ((_ ((out in) ...) e1 e2 ...)
-          (syntax (syntax-case (list in ...) ()
-                     ((out ...) (begin e1 e2 ...))))))))
-
-(define-syntax syntax-rules
-  (lambda (x)
-    (syntax-case x ()
-      ((_ (k ...) ((keyword . pattern) template) ...)
-       (syntax (lambda (x)
-                (syntax-case x (k ...)
-                  ((dummy . pattern) (syntax template))
-                  ...)))))))
-
-(define-syntax let*
-  (lambda (x)
-    (syntax-case x ()
-      ((let* ((x v) ...) e1 e2 ...)
-       (andmap identifier? (syntax (x ...)))
-       (let f ((bindings (syntax ((x v)  ...))))
-         (if (null? bindings)
-             (syntax (let () e1 e2 ...))
-             (with-syntax ((body (f (cdr bindings)))
-                           (binding (car bindings)))
-               (syntax (let (binding) body)))))))))
-
-(define-syntax do
-   (lambda (orig-x)
-      (syntax-case orig-x ()
-         ((_ ((var init . step) ...) (e0 e1 ...) c ...)
-          (with-syntax (((step ...)
-                         (map (lambda (v s)
-                                 (syntax-case s ()
-                                    (() v)
-                                    ((e) (syntax e))
-                                    (_ (syntax-error orig-x))))
-                              (syntax (var ...))
-                              (syntax (step ...)))))
-             (syntax-case (syntax (e1 ...)) ()
-                (() (syntax (let doloop ((var init) ...)
-                               (if (not e0)
-                                   (begin c ... (doloop step ...))))))
-                ((e1 e2 ...)
-                 (syntax (let doloop ((var init) ...)
-                            (if e0
-                                (begin e1 e2 ...)
-                                (begin c ... (doloop step ...))))))))))))
-
-(define-syntax quasiquote
-   (letrec
-      ((quasicons
-        (lambda (x y)
-          (with-syntax ((x x) (y y))
-            (syntax-case (syntax y) (quote list)
-              ((quote dy)
-               (syntax-case (syntax x) (quote)
-                 ((quote dx) (syntax (quote (dx . dy))))
-                 (_ (if (null? (syntax dy))
-                        (syntax (list x))
-                        (syntax (cons x y))))))
-              ((list . stuff) (syntax (list x . stuff)))
-              (else (syntax (cons x y)))))))
-       (quasiappend
-        (lambda (x y)
-          (with-syntax ((x x) (y y))
-            (syntax-case (syntax y) (quote)
-              ((quote ()) (syntax x))
-              (_ (syntax (append x y)))))))
-       (quasivector
-        (lambda (x)
-          (with-syntax ((x x))
-            (syntax-case (syntax x) (quote list)
-              ((quote (x ...)) (syntax (quote #(x ...))))
-              ((list x ...) (syntax (vector x ...)))
-              (_ (syntax (list->vector x)))))))
-       (quasi
-        (lambda (p lev)
-           (syntax-case p (unquote unquote-splicing quasiquote)
-              ((unquote p)
-               (if (= lev 0)
-                   (syntax p)
-                   (quasicons (syntax (quote unquote))
-                              (quasi (syntax (p)) (- lev 1)))))
-              (((unquote-splicing p) . q)
-               (if (= lev 0)
-                   (quasiappend (syntax p) (quasi (syntax q) lev))
-                   (quasicons (quasicons (syntax (quote unquote-splicing))
-                                         (quasi (syntax (p)) (- lev 1)))
-                              (quasi (syntax q) lev))))
-              ((quasiquote p)
-               (quasicons (syntax (quote quasiquote))
-                          (quasi (syntax (p)) (+ lev 1))))
-              ((p . q)
-               (quasicons (quasi (syntax p) lev) (quasi (syntax q) lev)))
-              (#(x ...) (quasivector (quasi (syntax (x ...)) lev)))
-              (p (syntax (quote p)))))))
-    (lambda (x)
-       (syntax-case x ()
-          ((_ e) (quasi (syntax e) 0))))))
-
-(define-syntax include
-  (lambda (x)
-    (define read-file
-      (lambda (fn k)
-        (let ((p (open-input-file fn)))
-          (let f ((x (read p)))
-            (if (eof-object? x)
-                (begin (close-input-port p) '())
-                (cons (datum->syntax-object k x)
-                      (f (read p))))))))
-    (syntax-case x ()
-      ((k filename)
-       (let ((fn (syntax-object->datum (syntax filename))))
-         (with-syntax (((exp ...) (read-file fn (syntax k))))
-           (syntax (begin exp ...))))))))
-
-(define-syntax unquote
-   (lambda (x)
-      (syntax-case x ()
-         ((_ e)
-          (error 'unquote
-                "expression ,~s not valid outside of quasiquote"
-                (syntax-object->datum (syntax e)))))))
-
-(define-syntax unquote-splicing
-   (lambda (x)
-      (syntax-case x ()
-         ((_ e)
-          (error 'unquote-splicing
-                "expression ,@~s not valid outside of quasiquote"
-                (syntax-object->datum (syntax e)))))))
-
-(define-syntax case
-  (lambda (x)
-    (syntax-case x ()
-      ((_ e m1 m2 ...)
-       (with-syntax
-         ((body (let f ((clause (syntax m1)) (clauses (syntax (m2 ...))))
-                  (if (null? clauses)
-                      (syntax-case clause (else)
-                        ((else e1 e2 ...) (syntax (begin e1 e2 ...)))
-                        (((k ...) e1 e2 ...)
-                         (syntax (if (memv t '(k ...)) (begin e1 e2 ...))))
-                        (_ (syntax-error x)))
-                      (with-syntax ((rest (f (car clauses) (cdr clauses))))
-                        (syntax-case clause (else)
-                          (((k ...) e1 e2 ...)
-                           (syntax (if (memv t '(k ...))
-                                       (begin e1 e2 ...)
-                                       rest)))
-                          (_ (syntax-error x))))))))
-         (syntax (let ((t e)) body)))))))
-
-(define-syntax identifier-syntax
-  (lambda (x)
-    (syntax-case x ()
-      ((_ e)
-       (syntax
-         (lambda (x)
-           (syntax-case x ()
-             (id
-              (identifier? (syntax id))
-              (syntax e))
-             ((_ x (... ...))
-              (syntax (e x (... ...)))))))))))
-
diff --git a/ice-9/syncase.scm b/ice-9/syncase.scm
deleted file mode 100644 (file)
index 427f722..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-;;;;   Copyright (C) 1997 Free Software Foundation, Inc.
-;;;; 
-;;;; This program is free software; you can redistribute it and/or modify
-;;;; it under the terms of the GNU General Public License as published by
-;;;; the Free Software Foundation; either version 2, or (at your option)
-;;;; any later version.
-;;;; 
-;;;; This program is distributed in the hope that it will be useful,
-;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;;; GNU General Public License for more details.
-;;;; 
-;;;; You should have received a copy of the GNU General Public License
-;;;; along with this software; see the file COPYING.  If not, write to
-;;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-;;;; 
-\f
-
-(define-module (ice-9 syncase)
-  :use-module (ice-9 debug))
-
-\f
-
-(define-public sc-macro
-  (procedure->memoizing-macro
-    (lambda (exp env)
-      (sc-expand exp))))
-
-;;; Exported variables
-
-(define-public sc-expand #f)
-(define-public sc-expand3 #f)
-(define-public install-global-transformer #f)
-(define-public syntax-dispatch #f)
-(define-public syntax-error #f)
-
-(define-public bound-identifier=? #f)
-(define-public datum->syntax-object #f)
-(define-public define-syntax sc-macro)
-(define-public eval-when sc-macro)
-(define-public fluid-let-syntax sc-macro)
-(define-public free-identifier=? #f)
-(define-public generate-temporaries #f)
-(define-public identifier? #f)
-(define-public identifier-syntax sc-macro)
-(define-public let-syntax sc-macro)
-(define-public letrec-syntax sc-macro)
-(define-public syntax sc-macro)
-(define-public syntax-case sc-macro)
-(define-public syntax-object->datum #f)
-(define-public syntax-rules sc-macro)
-(define-public with-syntax sc-macro)
-(define-public include sc-macro)
-
-(define primitive-syntax '(quote lambda letrec if set! begin define or
-                             and let let* cond do quasiquote unquote
-                             unquote-splicing case))
-
-(for-each (lambda (symbol)
-           (set-symbol-property! symbol 'primitive-syntax #t))
-         primitive-syntax)
-
-;;; Hooks needed by the syntax-case macro package
-
-(define-public (void) *unspecified*)
-
-(define andmap
-  (lambda (f first . rest)
-    (or (null? first)
-        (if (null? rest)
-            (let andmap ((first first))
-              (let ((x (car first)) (first (cdr first)))
-                (if (null? first)
-                    (f x)
-                    (and (f x) (andmap first)))))
-            (let andmap ((first first) (rest rest))
-              (let ((x (car first))
-                    (xr (map car rest))
-                    (first (cdr first))
-                    (rest (map cdr rest)))
-                (if (null? first)
-                    (apply f (cons x xr))
-                    (and (apply f (cons x xr)) (andmap first rest)))))))))
-
-(define (error who format-string why what)
-  (start-stack 'syncase-stack
-              (scm-error 'misc-error
-                         who
-                         "%s %S"
-                         (list why what)
-                         '())))
-
-(define the-syncase-module (current-module))
-
-(define (putprop symbol key binding)
-  (let* ((m (current-module))
-        (v (or (module-variable m symbol)
-               (module-make-local-var! m symbol))))
-    (if (assq 'primitive-syntax (symbol-pref symbol))
-       (if (eq? (current-module) the-syncase-module)
-           (set-object-property! (module-variable the-root-module symbol)
-                                 key
-                                 binding))
-       (variable-set! v sc-macro))
-    (set-object-property! v key binding)))
-
-(define (getprop symbol key)
-  (let* ((m (current-module))
-        (v (module-variable m symbol)))
-    (and v (or (object-property v key)
-              (let ((root-v (module-local-variable the-root-module symbol)))
-                (and (equal? root-v v)
-                     (object-property root-v key)))))))
-
-(define generated-symbols (make-weak-key-hash-table 1019))
-
-;;; Compatibility
-
-(define values:*values-rtd*
-  (make-record-type "values"
-                   '(values)))
-
-(define values
-  (let ((make-values (record-constructor values:*values-rtd*)))
-    (lambda x
-      (if (and (not (null? x))
-              (null? (cdr x)))
-         (car x)
-         (make-values x)))))
-
-(define call-with-values
-  (let ((access-values (record-accessor values:*values-rtd* 'values))
-       (values-predicate? (record-predicate values:*values-rtd*)))
-    (lambda (producer consumer)
-      (let ((result (producer)))
-       (if (values-predicate? result)
-           (apply consumer (access-values result))
-           (consumer result))))))
-
-;;; Utilities
-
-(define (psyncomp)
-  (system "mv -f psyntax.pp psyntax.pp~")
-  (let ((in (open-input-file "psyntax.ss"))
-       (out (open-output-file "psyntax.pp")))
-    (let loop ((x (read in)))
-      (if (eof-object? x)
-         (begin
-           (close-port out)
-           (close-port in))
-         (begin
-           (write (sc-expand3 x 'c '(compile load eval)) out)
-           (newline out)
-           (loop (read in)))))))
-
-;;; Load the preprocessed code
-
-(let ((old-debug #f)
-      (old-read #f))
-  (dynamic-wind (lambda ()
-                 (set! old-debug (debug-options))
-                 (set! old-read (read-options)))
-               (lambda ()
-                 (debug-disable 'debug 'procnames)
-                 (read-disable 'positions)
-                 (load-from-path "ice-9/psyntax.pp"))
-               (lambda ()
-                 (debug-options old-debug)
-                 (read-options old-read))))
-
-
-;;; The following line is necessary only if we start making changes
-;; (load-from-path "ice-9/psyntax.ss")
-
-(define internal-eval (nested-ref the-scm-module '(app modules guile eval)))
-
-(define-public (eval x)
-  (internal-eval (if (and (pair? x)
-                         (string=? (car x) "noexpand"))
-                    (cadr x)
-                    (sc-expand x))))
-
-;;; Hack to make syncase macros work in the slib module
-(let ((m (nested-ref the-root-module '(app modules ice-9 slib))))
-  (if m
-      (set-object-property! (module-local-variable m 'define)
-                           '*sc-expander*
-                           '(define))))
-
-(define-public syncase sc-expand)