diff --git a/contrib/60.repl/repl.scm b/contrib/60.repl/repl.scm index 5bbbacd2..9fd1ebcd 100644 --- a/contrib/60.repl/repl.scm +++ b/contrib/60.repl/repl.scm @@ -35,6 +35,7 @@ (scheme time) (scheme eval) (scheme r5rs) + (picrin pretty-print) (picrin macro)) '(picrin user))) diff --git a/lib/ext/boot.c b/lib/ext/boot.c index 2b052e60..2803bd59 100644 --- a/lib/ext/boot.c +++ b/lib/ext/boot.c @@ -3,422 +3,612 @@ #if PIC_USE_EVAL static const char boot_compile_rom[][80] = { -"(core#begin (core#define make-identifier #undefined) (core#begin (core#define id", -"entifier? #undefined) (core#begin (core#define identifier=? #undefined) (core#be", -"gin (core#define identifier-name #undefined) (core#begin (core#define identifier", -"-environment #undefined) (core#begin (core#define make-environment #undefined) (", -"core#begin (core#define default-environment #undefined) (core#begin (core#define", -" environment? #undefined) (core#begin (core#define find-identifier #undefined) (", -"core#begin (core#define add-identifier! #undefined) (core#begin (core#define set", -"-identifier! #undefined) (core#begin (core#define macro-objects #undefined) (cor", -"e#begin (core#define compile #undefined) (core#begin (core#define eval #undefine", -"d) (call-with-values (core#lambda () ((core#lambda () (core#begin (core#begin (c", -"ore#define .make-identifier.2149 (core#lambda (.name.2177 .env.2178) (make-recor", -"d (core#quote identifier) (vector .name.2177 .env.2178)))) (core#begin (core#def", -"ine .%identifier?.2150 (core#lambda (.obj.2179) (core#if (record? .obj.2179) (eq", -"? (record-type .obj.2179) (core#quote identifier)) #f))) (core#begin (core#defin", -"e .identifier-environment.2151 (core#lambda (.obj.2180) (core#if (.%identifier?.", -"2150 .obj.2180) (vector-ref (record-datum .obj.2180) 1) (error \"record type mism", -"atch\" .obj.2180 (core#quote identifier))))) (core#define .identifier-name.2152 (", -"core#lambda (.obj.2181) (core#if (.%identifier?.2150 .obj.2181) (vector-ref (rec", -"ord-datum .obj.2181) 0) (error \"record type mismatch\" .obj.2181 (core#quote iden", -"tifier)))))))) (core#begin (core#define .identifier?.2153 (core#lambda (.obj.218", -"2) ((core#lambda (.it.2183) (core#if .it.2183 .it.2183 ((core#lambda (.it.2184) ", -"(core#if .it.2184 .it.2184 #f)) (.%identifier?.2150 .obj.2182)))) (symbol? .obj.", -"2182)))) (core#begin (core#define .identifier=?.2154 (core#lambda (.id1.2185 .id", -"2.2186) (core#if (core#if (symbol? .id1.2185) (symbol? .id2.2186) #f) (eq? .id1.", -"2185 .id2.2186) (core#if (core#if (.%identifier?.2150 .id1.2185) (.%identifier?.", -"2150 .id2.2186) #f) (eq? (.find-identifier.2161 (.identifier-name.2152 .id1.2185", -") (.identifier-environment.2151 .id1.2185)) (.find-identifier.2161 (.identifier-", -"name.2152 .id2.2186) (.identifier-environment.2151 .id2.2186))) #f)))) (core#beg", -"in (core#set! equal? ((core#lambda (.e?.2187) (core#lambda (.x.2188 .y.2189) (co", -"re#if (.%identifier?.2150 .x.2188) (.identifier=?.2154 .x.2188 .y.2189) (.e?.218", -"7 .x.2188 .y.2189)))) equal?)) (core#begin (core#begin (core#define .%make-envir", -"onment.2155 (core#lambda (.parent.2190 .prefix.2191 .binding.2192) (make-record ", -"(core#quote environment) (vector .parent.2190 .prefix.2191 .binding.2192)))) (co", -"re#begin (core#define .environment?.2156 (core#lambda (.obj.2193) (core#if (reco", -"rd? .obj.2193) (eq? (record-type .obj.2193) (core#quote environment)) #f))) (cor", -"e#begin (core#define .environment-binding.2157 (core#lambda (.obj.2194) (core#if", -" (.environment?.2156 .obj.2194) (vector-ref (record-datum .obj.2194) 2) (error \"", -"record type mismatch\" .obj.2194 (core#quote environment))))) (core#begin (core#d", -"efine .environment-prefix.2158 (core#lambda (.obj.2195) (core#if (.environment?.", -"2156 .obj.2195) (vector-ref (record-datum .obj.2195) 1) (error \"record type mism", -"atch\" .obj.2195 (core#quote environment))))) (core#define .environment-parent.21", -"59 (core#lambda (.obj.2196) (core#if (.environment?.2156 .obj.2196) (vector-ref ", -"(record-datum .obj.2196) 0) (error \"record type mismatch\" .obj.2196 (core#quote ", -"environment))))))))) (core#begin (core#define .search-scope.2160 (core#lambda (.", -"id.2197 .env.2198) ((.environment-binding.2157 .env.2198) .id.2197))) (core#begi", -"n (core#define .find-identifier.2161 (core#lambda (.id.2199 .env.2200) ((core#la", -"mbda (.it.2201) (core#if .it.2201 .it.2201 ((core#lambda (.it.2202) (core#if .it", -".2202 .it.2202 #f)) ((core#lambda (.parent.2203) (core#if .parent.2203 (.find-id", -"entifier.2161 .id.2199 .parent.2203) (core#if (symbol? .id.2199) (.add-identifie", -"r!.2162 .id.2199 .env.2200) (.find-identifier.2161 (.identifier-name.2152 .id.21", -"99) (.identifier-environment.2151 .id.2199))))) (.environment-parent.2159 .env.2", -"200))))) (.search-scope.2160 .id.2199 .env.2200)))) (core#begin (core#define .ad", -"d-identifier!.2162 ((core#lambda (.uniq.2204) (core#lambda (.id.2205 .env.2206) ", -"((core#lambda (.it.2207) (core#if .it.2207 .it.2207 ((core#lambda (.it.2208) (co", -"re#if .it.2208 .it.2208 #f)) (core#if (core#if (not (.environment-parent.2159 .e", -"nv.2206)) (symbol? .id.2205) #f) (string->symbol (string-append (.environment-pr", -"efix.2158 .env.2206) (symbol->string .id.2205))) ((core#lambda (.uid.2209) (core", -"#begin (.set-identifier!.2163 .id.2205 .uid.2209 .env.2206) .uid.2209)) (.uniq.2", -"204 .id.2205)))))) (.search-scope.2160 .id.2205 .env.2206)))) ((core#lambda (.n.", -"2210) (core#lambda (.id.2211) ((core#lambda (.m.2212) (core#begin (core#set! .n.", -"2210 (+ .n.2210 1)) (string->symbol (string-append \".\" (symbol->string ((core#la", -"mbda () (core#begin (core#define .loop.2213 (core#lambda (.id.2214) (core#if (sy", -"mbol? .id.2214) .id.2214 (.loop.2213 (.identifier-name.2152 .id.2214))))) (.loop", -".2213 .id.2211))))) \".\" (number->string .m.2212))))) .n.2210))) 0))) (core#begin", -" (core#define .set-identifier!.2163 (core#lambda (.id.2215 .uid.2216 .env.2217) ", -"((.environment-binding.2157 .env.2217) .id.2215 .uid.2216))) (core#begin (core#d", -"efine .make-environment.2164 (core#lambda (.prefix.2218) (.%make-environment.215", -"5 #f (symbol->string .prefix.2218) (make-ephemeron-table)))) (core#begin (core#d", -"efine .default-environment.2165 ((core#lambda (.env.2219) (core#begin (for-each ", -"(core#lambda (.x.2220) (.set-identifier!.2163 .x.2220 .x.2220 .env.2219)) (core#", -"quote (core#define core#set! core#quote core#lambda core#if core#begin core#defi", -"ne-macro))) .env.2219)) (.make-environment.2164 (string->symbol \"\")))) (core#beg", -"in (core#define .extend-environment.2166 (core#lambda (.parent.2221) (.%make-env", -"ironment.2155 .parent.2221 #f (make-ephemeron-table)))) (core#begin (core#define", -" .global-macro-table.2167 (make-dictionary)) (core#begin (core#define .find-macr", -"o.2168 (core#lambda (.uid.2222) (core#if (dictionary-has? .global-macro-table.21", -"67 .uid.2222) (dictionary-ref .global-macro-table.2167 .uid.2222) #f))) (core#be", -"gin (core#define .add-macro!.2169 (core#lambda (.uid.2223 .expander.2224) (dicti", -"onary-set! .global-macro-table.2167 .uid.2223 .expander.2224))) (core#begin (cor", -"e#define .shadow-macro!.2170 (core#lambda (.uid.2225) (core#if (dictionary-has? ", -".global-macro-table.2167 .uid.2225) (dictionary-delete! .global-macro-table.2167", -" .uid.2225) #undefined))) (core#begin (core#define .macro-objects.2171 (core#lam", -"bda () .global-macro-table.2167)) (core#begin (core#define .expand.2172 ((core#l", -"ambda (.task-queue.2226) (core#begin (core#define .queue.2227 (core#lambda (.tas", -"k.2240) ((core#lambda (.tmp.2241) (core#begin (.task-queue.2226 (cons (cons .tmp", -".2241 .task.2240) (.task-queue.2226))) .tmp.2241)) (cons #f #f)))) (core#begin (", -"core#define .run-all.2228 (core#lambda () (for-each (core#lambda (.x.2242) ((cor", -"e#lambda (.task.2243 .skelton.2244) ((core#lambda (.x.2245) (core#begin (set-car", -"! .skelton.2244 (car .x.2245)) (set-cdr! .skelton.2244 (cdr .x.2245)))) (.task.2", -"243))) (cdr .x.2242) (car .x.2242))) (reverse (.task-queue.2226))))) (core#begin", -" (core#define .caddr.2229 (core#lambda (.x.2246) (car (cddr .x.2246)))) (core#be", -"gin (core#define .map*.2230 (core#lambda (.proc.2247 .list*.2248) (core#if (null", -"? .list*.2248) .list*.2248 (core#if (pair? .list*.2248) (cons (.proc.2247 (car .", -"list*.2248)) (.map*.2230 .proc.2247 (cdr .list*.2248))) (.proc.2247 .list*.2248)", -")))) (core#begin (core#define .literal?.2231 (core#lambda (.x.2249) (not ((core#", -"lambda (.it.2250) (core#if .it.2250 .it.2250 ((core#lambda (.it.2251) (core#if .", -"it.2251 .it.2251 #f)) (pair? .x.2249)))) (.identifier?.2153 .x.2249))))) (core#b", -"egin (core#define .call?.2232 (core#lambda (.x.2252) (core#if (list? .x.2252) (c", -"ore#if (not (null? .x.2252)) (.identifier?.2153 (car .x.2252)) #f) #f))) (core#b", -"egin (core#define .expand-variable.2233 (core#lambda (.var.2253 .env.2254) ((cor", -"e#lambda (.x.2255) ((core#lambda (.m.2256) (core#if .m.2256 (.expand-node.2238 (", -".m.2256 .var.2253 .env.2254) .env.2254) .x.2255)) (.find-macro.2168 .x.2255))) (", -".find-identifier.2161 .var.2253 .env.2254)))) (core#begin (core#define .expand-q", -"uote.2234 (core#lambda (.obj.2257) (cons (core#quote core#quote) (cons .obj.2257", -" (core#quote ()))))) (core#begin (core#define .expand-define.2235 (core#lambda (", -".var.2258 .form.2259 .env.2260) ((core#lambda (.uid.2261) (core#begin (.shadow-m", -"acro!.2170 .uid.2261) (cons (core#quote core#define) (cons .uid.2261 (cons (.exp", -"and-node.2238 .form.2259 .env.2260) (core#quote ())))))) (.add-identifier!.2162 ", -".var.2258 .env.2260)))) (core#begin (core#define .expand-lambda.2236 (core#lambd", -"a (.args.2262 .body.2263 .env.2264) ((core#lambda (.env.2265) ((core#lambda (.ar", -"gs.2266) (with-dynamic-environment (list (cons .task-queue.2226 (core#quote ()))", -") (core#lambda () ((core#lambda (.body.2267) (core#begin (.run-all.2228) (cons (", -"core#quote core#lambda) (cons .args.2266 (cons .body.2267 (core#quote ())))))) (", -".expand-node.2238 .body.2263 .env.2265))))) (.map*.2230 (core#lambda (.var.2268)", -" (.add-identifier!.2162 .var.2268 .env.2265)) .args.2262))) (.extend-environment", -".2166 .env.2264)))) (core#begin (core#define .expand-define-macro.2237 (core#lam", -"bda (.var.2269 .transformer.2270 .env.2271) ((core#lambda (.uid.2272) ((core#lam", -"bda (.expander.2273) (core#begin (.add-macro!.2169 .uid.2272 .expander.2273) #un", -"defined)) (load (.expand.2239 .transformer.2270 .env.2271)))) (.add-identifier!.", -"2162 .var.2269 .env.2271)))) (core#begin (core#define .expand-node.2238 (core#la", -"mbda (.expr.2274 .env.2275) (core#if (.literal?.2231 .expr.2274) .expr.2274 (cor", -"e#if (.identifier?.2153 .expr.2274) (.expand-variable.2233 .expr.2274 .env.2275)", -" (core#if (.call?.2232 .expr.2274) ((core#lambda (.functor.2276) ((core#lambda (", -".key.2277) (core#if ((core#lambda (.it.2278) (core#if .it.2278 .it.2278 #f)) (eq", -"v? .key.2277 (core#quote core#quote))) (.expand-quote.2234 (cadr .expr.2274)) (c", -"ore#if ((core#lambda (.it.2279) (core#if .it.2279 .it.2279 #f)) (eqv? .key.2277 ", -"(core#quote core#define))) (.expand-define.2235 (cadr .expr.2274) (.caddr.2229 .", -"expr.2274) .env.2275) (core#if ((core#lambda (.it.2280) (core#if .it.2280 .it.22", -"80 #f)) (eqv? .key.2277 (core#quote core#lambda))) (.queue.2227 (core#lambda () ", -"(.expand-lambda.2236 (cadr .expr.2274) (.caddr.2229 .expr.2274) .env.2275))) (co", -"re#if ((core#lambda (.it.2281) (core#if .it.2281 .it.2281 #f)) (eqv? .key.2277 (", -"core#quote core#define-macro))) (.expand-define-macro.2237 (cadr .expr.2274) (.c", -"addr.2229 .expr.2274) .env.2275) (core#if #t ((core#lambda (.m.2282) (core#if .m", -".2282 (.expand-node.2238 (.m.2282 .expr.2274 .env.2275) .env.2275) (map (core#la", -"mbda (.x.2283) (.expand-node.2238 .x.2283 .env.2275)) .expr.2274))) (.find-macro", -".2168 .functor.2276)) #undefined)))))) .functor.2276)) (.find-identifier.2161 (c", -"ar .expr.2274) .env.2275)) (core#if (list? .expr.2274) (map (core#lambda (.x.228", -"4) (.expand-node.2238 .x.2284 .env.2275)) .expr.2274) (error \"invalid expression", -"\" .expr.2274))))))) (core#begin (core#define .expand.2239 (core#lambda (.expr.22", -"85 .env.2286) ((core#lambda (.x.2287) (core#begin (.run-all.2228) .x.2287)) (.ex", -"pand-node.2238 .expr.2285 .env.2286)))) .expand.2239)))))))))))))) (make-paramet", -"er (core#quote ())))) (core#begin (core#define .compile.2173 (core#lambda (.expr", -".2288 . .env.2289) (.expand.2172 .expr.2288 (core#if (null? .env.2289) .default-", -"environment.2165 (car .env.2289))))) (core#begin (core#define .eval.2174 (core#l", -"ambda (.expr.2290 . .env.2291) (load (.compile.2173 .expr.2290 (core#if (null? .", -"env.2291) .default-environment.2165 (car .env.2291)))))) (core#begin (core#defin", -"e .define-transformer.2175 (core#lambda (.name.2292 .transformer.2293) (dictiona", -"ry-set! .global-macro-table.2167 .name.2292 .transformer.2293))) (core#begin (co", -"re#define .the.2176 (core#lambda (.var.2294) (.make-identifier.2149 .var.2294 .d", -"efault-environment.2165))) (core#begin ((core#lambda (.the-core-define.2295 .the", -"-core-lambda.2296 .the-core-begin.2297 .the-core-quote.2298 .the-core-set!.2299 ", -".the-core-if.2300 .the-core-define-macro.2301 .the-define.2302 .the-lambda.2303 ", -".the-begin.2304 .the-quote.2305 .the-set!.2306 .the-if.2307 .the-define-macro.23", -"08) (core#begin (.define-transformer.2175 (core#quote quote) (core#lambda (.form", -".2313 .env.2314) (core#if (= (length .form.2313) 2) (cons .the-core-quote.2298 (", -"cons (cadr .form.2313) (core#quote ()))) (error \"malformed quote\" .form.2313))))", -" (core#begin (.define-transformer.2175 (core#quote if) (core#lambda (.form.2315 ", -".env.2316) ((core#lambda (.len.2317) (core#if (= .len.2317 3) (append .form.2315", -" (cons (core#quote #undefined) (core#quote ()))) (core#if (= .len.2317 4) (cons ", -".the-core-if.2300 (cdr .form.2315)) (error \"malformed if\" .form.2315)))) (length", -" .form.2315)))) (core#begin (.define-transformer.2175 (core#quote begin) (core#l", -"ambda (.form.2318 .env.2319) ((core#lambda (.len.2320) (core#if (= .len.2320 1) ", -"#undefined (core#if (= .len.2320 2) (cadr .form.2318) (core#if (= .len.2320 3) (", -"cons .the-core-begin.2297 (cdr .form.2318)) (cons .the-core-begin.2297 (cons (ca", -"dr .form.2318) (cons (cons .the-begin.2304 (cddr .form.2318)) (core#quote ()))))", -")))) (length .form.2318)))) (core#begin (.define-transformer.2175 (core#quote se", -"t!) (core#lambda (.form.2321 .env.2322) (core#if (core#if (= (length .form.2321)", -" 3) (.identifier?.2153 (cadr .form.2321)) #f) (cons .the-core-set!.2299 (cdr .fo", -"rm.2321)) (error \"malformed set!\" .form.2321)))) (core#begin (core#define .check", -"-formal.2309 (core#lambda (.formal.2323) ((core#lambda (.it.2324) (core#if .it.2", -"324 .it.2324 ((core#lambda (.it.2325) (core#if .it.2325 .it.2325 ((core#lambda (", -".it.2326) (core#if .it.2326 .it.2326 #f)) (core#if (pair? .formal.2323) (core#if", -" (.identifier?.2153 (car .formal.2323)) (.check-formal.2309 (cdr .formal.2323)) ", -"#f) #f)))) (.identifier?.2153 .formal.2323)))) (null? .formal.2323)))) (core#beg", -"in (.define-transformer.2175 (core#quote lambda) (core#lambda (.form.2327 .env.2", -"328) (core#if (= (length .form.2327) 1) (error \"malformed lambda\" .form.2327) (c", -"ore#if (.check-formal.2309 (cadr .form.2327)) (cons .the-core-lambda.2296 (cons ", -"(cadr .form.2327) (cons (cons .the-begin.2304 (cddr .form.2327)) (core#quote ())", -"))) (error \"malformed lambda\" .form.2327))))) (core#begin (.define-transformer.2", -"175 (core#quote define) (core#lambda (.form.2329 .env.2330) ((core#lambda (.len.", -"2331) (core#if (= .len.2331 1) (error \"malformed define\" .form.2329) ((core#lamb", -"da (.formal.2332) (core#if (.identifier?.2153 .formal.2332) (core#if (= .len.233", -"1 3) (cons .the-core-define.2295 (cdr .form.2329)) (error \"malformed define\" .fo", -"rm.2329)) (core#if (pair? .formal.2332) (cons .the-define.2302 (cons (car .forma", -"l.2332) (cons (cons .the-lambda.2303 (cons (cdr .formal.2332) (cddr .form.2329))", -") (core#quote ())))) (error \"define: binding to non-varaible object\" .form.2329)", -"))) (cadr .form.2329)))) (length .form.2329)))) (core#begin (.define-transformer", -".2175 (core#quote define-macro) (core#lambda (.form.2333 .env.2334) (core#if (= ", -"(length .form.2333) 3) (core#if (.identifier?.2153 (cadr .form.2333)) (cons .the", -"-core-define-macro.2301 (cdr .form.2333)) (error \"define-macro: binding to non-v", -"ariable object\" .form.2333)) (error \"malformed define-macro\" .form.2333)))) (cor", -"e#begin #undefined (core#begin (.define-transformer.2175 (core#quote else) (core", -"#lambda ._.2335 (error \"invalid use of auxiliary syntax\" (core#quote else)))) (c", -"ore#begin (.define-transformer.2175 (core#quote =>) (core#lambda ._.2336 (error ", -"\"invalid use of auxiliary syntax\" (core#quote =>)))) (core#begin (.define-transf", -"ormer.2175 (core#quote unquote) (core#lambda ._.2337 (error \"invalid use of auxi", -"liary syntax\" (core#quote unquote)))) (core#begin (.define-transformer.2175 (cor", -"e#quote unquote-splicing) (core#lambda ._.2338 (error \"invalid use of auxiliary ", -"syntax\" (core#quote unquote-splicing)))) (core#begin (.define-transformer.2175 (", -"core#quote let) (core#lambda (.form.2339 .env.2340) (core#if (.identifier?.2153 ", -"(cadr .form.2339)) ((core#lambda (.name.2341 .formal.2342 .body.2343) (cons (con", -"s .the-lambda.2303 (cons (core#quote ()) (cons (cons .the-define.2302 (cons (con", -"s .name.2341 (map car .formal.2342)) .body.2343)) (cons (cons .name.2341 (map ca", -"dr .formal.2342)) (core#quote ()))))) (core#quote ()))) (car (cdr .form.2339)) (", -"car (cdr (cdr .form.2339))) (cdr (cdr (cdr .form.2339)))) ((core#lambda (.formal", -".2344 .body.2345) (cons (cons .the-lambda.2303 (cons (map car .formal.2344) .bod", -"y.2345)) (map cadr .formal.2344))) (car (cdr .form.2339)) (cdr (cdr .form.2339))", -")))) (core#begin (.define-transformer.2175 (core#quote and) (core#lambda (.form.", -"2346 .env.2347) (core#if (null? (cdr .form.2346)) #t (core#if (null? (cddr .form", -".2346)) (cadr .form.2346) (cons .the-if.2307 (cons (cadr .form.2346) (cons (cons", -" (.the.2176 (core#quote and)) (cddr .form.2346)) (cons (core#quote #f) (core#quo", -"te ()))))))))) (core#begin (.define-transformer.2175 (core#quote or) (core#lambd", -"a (.form.2348 .env.2349) (core#if (null? (cdr .form.2348)) #f ((core#lambda (.tm", -"p.2350) (cons (.the.2176 (core#quote let)) (cons (cons (cons .tmp.2350 (cons (ca", -"dr .form.2348) (core#quote ()))) (core#quote ())) (cons (cons .the-if.2307 (cons", -" .tmp.2350 (cons .tmp.2350 (cons (cons (.the.2176 (core#quote or)) (cddr .form.2", -"348)) (core#quote ()))))) (core#quote ()))))) (.make-identifier.2149 (core#quote", -" it) .env.2349))))) (core#begin (.define-transformer.2175 (core#quote cond) (cor", -"e#lambda (.form.2351 .env.2352) ((core#lambda (.clauses.2353) (core#if (null? .c", -"lauses.2353) #undefined ((core#lambda (.clause.2354) (core#if (core#if (.identif", -"ier?.2153 (car .clause.2354)) (.identifier=?.2154 (.the.2176 (core#quote else)) ", -"(.make-identifier.2149 (car .clause.2354) .env.2352)) #f) (cons .the-begin.2304 ", -"(cdr .clause.2354)) (core#if (null? (cdr .clause.2354)) (cons (.the.2176 (core#q", -"uote or)) (cons (car .clause.2354) (cons (cons (.the.2176 (core#quote cond)) (cd", -"r .clauses.2353)) (core#quote ())))) (core#if (core#if (.identifier?.2153 (cadr ", -".clause.2354)) (.identifier=?.2154 (.the.2176 (core#quote =>)) (.make-identifier", -".2149 (cadr .clause.2354) .env.2352)) #f) ((core#lambda (.tmp.2355) (cons (.the.", -"2176 (core#quote let)) (cons (cons (cons .tmp.2355 (cons (car .clause.2354) (cor", -"e#quote ()))) (core#quote ())) (cons (cons .the-if.2307 (cons .tmp.2355 (cons (c", -"ons (cadr (cdr .clause.2354)) (cons .tmp.2355 (core#quote ()))) (cons (cons (.th", -"e.2176 (core#quote cond)) (cddr .form.2351)) (core#quote ()))))) (core#quote ())", -")))) (.make-identifier.2149 (core#quote tmp) .env.2352)) (cons .the-if.2307 (con", -"s (car .clause.2354) (cons (cons .the-begin.2304 (cdr .clause.2354)) (cons (cons", -" (.the.2176 (core#quote cond)) (cdr .clauses.2353)) (core#quote ()))))))))) (car", -" .clauses.2353)))) (cdr .form.2351)))) (core#begin (.define-transformer.2175 (co", -"re#quote quasiquote) (core#lambda (.form.2356 .env.2357) (core#begin (core#defin", -"e .quasiquote?.2358 (core#lambda (.form.2362) (core#if (pair? .form.2362) (core#", -"if (.identifier?.2153 (car .form.2362)) (.identifier=?.2154 (.the.2176 (core#quo", -"te quasiquote)) (.make-identifier.2149 (car .form.2362) .env.2357)) #f) #f))) (c", -"ore#begin (core#define .unquote?.2359 (core#lambda (.form.2363) (core#if (pair? ", -".form.2363) (core#if (.identifier?.2153 (car .form.2363)) (.identifier=?.2154 (.", -"the.2176 (core#quote unquote)) (.make-identifier.2149 (car .form.2363) .env.2357", -")) #f) #f))) (core#begin (core#define .unquote-splicing?.2360 (core#lambda (.for", -"m.2364) (core#if (pair? .form.2364) (core#if (pair? (car .form.2364)) (core#if (", -".identifier?.2153 (caar .form.2364)) (.identifier=?.2154 (.the.2176 (core#quote ", -"unquote-splicing)) (.make-identifier.2149 (caar .form.2364) .env.2357)) #f) #f) ", -"#f))) (core#begin (core#define .qq.2361 (core#lambda (.depth.2365 .expr.2366) (c", -"ore#if (.unquote?.2359 .expr.2366) (core#if (= .depth.2365 1) (cadr .expr.2366) ", -"(list (.the.2176 (core#quote list)) (list (.the.2176 (core#quote quote)) (.the.2", -"176 (core#quote unquote))) (.qq.2361 (- .depth.2365 1) (car (cdr .expr.2366)))))", -" (core#if (.unquote-splicing?.2360 .expr.2366) (core#if (= .depth.2365 1) (list ", -"(.the.2176 (core#quote append)) (car (cdr (car .expr.2366))) (.qq.2361 .depth.23", -"65 (cdr .expr.2366))) (list (.the.2176 (core#quote cons)) (list (.the.2176 (core", -"#quote list)) (list (.the.2176 (core#quote quote)) (.the.2176 (core#quote unquot", -"e-splicing))) (.qq.2361 (- .depth.2365 1) (car (cdr (car .expr.2366))))) (.qq.23", -"61 .depth.2365 (cdr .expr.2366)))) (core#if (.quasiquote?.2358 .expr.2366) (list", -" (.the.2176 (core#quote list)) (list (.the.2176 (core#quote quote)) (.the.2176 (", -"core#quote quasiquote))) (.qq.2361 (+ .depth.2365 1) (car (cdr .expr.2366)))) (c", -"ore#if (pair? .expr.2366) (list (.the.2176 (core#quote cons)) (.qq.2361 .depth.2", -"365 (car .expr.2366)) (.qq.2361 .depth.2365 (cdr .expr.2366))) (core#if (vector?", -" .expr.2366) (list (.the.2176 (core#quote list->vector)) (.qq.2361 .depth.2365 (", -"vector->list .expr.2366))) (list (.the.2176 (core#quote quote)) .expr.2366))))))", -")) ((core#lambda (.x.2367) (.qq.2361 1 .x.2367)) (cadr .form.2356)))))))) (core#", -"begin (.define-transformer.2175 (core#quote let*) (core#lambda (.form.2368 .env.", -"2369) ((core#lambda (.bindings.2370 .body.2371) (core#if (null? .bindings.2370) ", -"(cons (.the.2176 (core#quote let)) (cons (core#quote ()) .body.2371)) (cons (.th", -"e.2176 (core#quote let)) (cons (cons (cons (car (car .bindings.2370)) (cdr (car ", -".bindings.2370))) (core#quote ())) (cons (cons (.the.2176 (core#quote let*)) (co", -"ns (cdr .bindings.2370) .body.2371)) (core#quote ())))))) (car (cdr .form.2368))", -" (cdr (cdr .form.2368))))) (core#begin (.define-transformer.2175 (core#quote let", -"rec) (core#lambda (.form.2372 .env.2373) (cons (.the.2176 (core#quote letrec*)) ", -"(cdr .form.2372)))) (core#begin (.define-transformer.2175 (core#quote letrec*) (", -"core#lambda (.form.2374 .env.2375) ((core#lambda (.bindings.2376 .body.2377) ((c", -"ore#lambda (.variables.2378 .initials.2379) (cons (.the.2176 (core#quote let)) (", -"cons .variables.2378 (append .initials.2379 (append .body.2377 (core#quote ())))", -"))) (map (core#lambda (.v.2380) (cons .v.2380 (cons (core#quote #undefined) (cor", -"e#quote ())))) (map car .bindings.2376)) (map (core#lambda (.v.2381) (cons (.the", -".2176 (core#quote set!)) (append .v.2381 (core#quote ())))) .bindings.2376))) (c", -"ar (cdr .form.2374)) (cdr (cdr .form.2374))))) (core#begin (.define-transformer.", -"2175 (core#quote let-values) (core#lambda (.form.2382 .env.2383) (cons (.the.217", -"6 (core#quote let*-values)) (append (cdr .form.2382) (core#quote ()))))) (core#b", -"egin (.define-transformer.2175 (core#quote let*-values) (core#lambda (.form.2384", -" .env.2385) ((core#lambda (.formals.2386 .body.2387) (core#if (null? .formals.23", -"86) (cons (.the.2176 (core#quote let)) (cons (core#quote ()) (append .body.2387 ", -"(core#quote ())))) ((core#lambda (.formal.2388) (cons (.the.2176 (core#quote cal", -"l-with-values)) (cons (cons .the-lambda.2303 (cons (core#quote ()) (cdr .formal.", -"2388))) (cons (cons (.the.2176 (core#quote lambda)) (cons (car .formal.2388) (co", -"ns (cons (.the.2176 (core#quote let*-values)) (cons (cdr .formals.2386) .body.23", -"87)) (core#quote ())))) (core#quote ()))))) (car .formals.2386)))) (cadr .form.2", -"384) (cddr .form.2384)))) (core#begin (.define-transformer.2175 (core#quote defi", -"ne-values) (core#lambda (.form.2389 .env.2390) ((core#lambda (.formal.2391 .body", -".2392) ((core#lambda (.tmps.2393) (cons .the-begin.2304 (append ((core#lambda ()", -" (core#begin (core#define .loop.2394 (core#lambda (.formal.2395) (core#if (.iden", -"tifier?.2153 .formal.2395) (cons (cons .the-define.2302 (cons .formal.2395 (cons", -" (core#quote #undefined) (core#quote ())))) (core#quote ())) (core#if (pair? .fo", -"rmal.2395) (cons (cons .the-define.2302 (cons (car .formal.2395) (cons (core#quo", -"te #undefined) (core#quote ())))) (.loop.2394 (cdr .formal.2395))) (core#quote (", -")))))) (.loop.2394 .formal.2391)))) (cons (cons (.the.2176 (core#quote call-with", -"-values)) (cons (cons .the-lambda.2303 (cons (core#quote ()) .body.2392)) (cons ", -"(cons .the-lambda.2303 (cons .tmps.2393 ((core#lambda () (core#begin (core#defin", -"e .loop.2396 (core#lambda (.formal.2397 .tmps.2398) (core#if (.identifier?.2153 ", -".formal.2397) (cons (cons .the-set!.2306 (cons .formal.2397 (cons .tmps.2398 (co", -"re#quote ())))) (core#quote ())) (core#if (pair? .formal.2397) (cons (cons .the-", -"set!.2306 (cons (car .formal.2397) (cons (car .tmps.2398) (core#quote ())))) (.l", -"oop.2396 (cdr .formal.2397) (cdr .tmps.2398))) (core#quote ()))))) (.loop.2396 .", -"formal.2391 .tmps.2393)))))) (core#quote ())))) (core#quote ()))))) ((core#lambd", -"a () (core#begin (core#define .loop.2399 (core#lambda (.formal.2400) (core#if (.", -"identifier?.2153 .formal.2400) (.make-identifier.2149 .formal.2400 .env.2390) (c", -"ore#if (pair? .formal.2400) (cons (.make-identifier.2149 (car .formal.2400) .env", -".2390) (.loop.2399 (cdr .formal.2400))) (core#quote ()))))) (.loop.2399 .formal.", -"2391)))))) (cadr .form.2389) (cddr .form.2389)))) (core#begin (.define-transform", -"er.2175 (core#quote do) (core#lambda (.form.2401 .env.2402) ((core#lambda (.bind", -"ings.2403 .test.2404 .cleanup.2405 .body.2406) ((core#lambda (.loop.2407) (cons ", -"(.the.2176 (core#quote let)) (cons .loop.2407 (cons (map (core#lambda (.x.2408) ", -"(cons (car .x.2408) (cons (cadr .x.2408) (core#quote ())))) .bindings.2403) (con", -"s (cons .the-if.2307 (cons .test.2404 (cons (cons .the-begin.2304 .cleanup.2405)", -" (cons (cons .the-begin.2304 (append .body.2406 (cons (cons .loop.2407 (map (cor", -"e#lambda (.x.2409) (core#if (null? (cdr (cdr .x.2409))) (car .x.2409) (car (cdr ", -"(cdr .x.2409))))) .bindings.2403)) (core#quote ())))) (core#quote ()))))) (core#", -"quote ())))))) (.make-identifier.2149 (core#quote loop) .env.2402))) (car (cdr .", -"form.2401)) (car (car (cdr (cdr .form.2401)))) (cdr (car (cdr (cdr .form.2401)))", -") (cdr (cdr (cdr .form.2401)))))) (core#begin (.define-transformer.2175 (core#qu", -"ote when) (core#lambda (.form.2410 .env.2411) ((core#lambda (.test.2412 .body.24", -"13) (cons .the-if.2307 (cons .test.2412 (cons (cons .the-begin.2304 (append .bod", -"y.2413 (core#quote ()))) (cons (core#quote #undefined) (core#quote ())))))) (car", -" (cdr .form.2410)) (cdr (cdr .form.2410))))) (core#begin (.define-transformer.21", -"75 (core#quote unless) (core#lambda (.form.2414 .env.2415) ((core#lambda (.test.", -"2416 .body.2417) (cons .the-if.2307 (cons .test.2416 (cons (core#quote #undefine", -"d) (cons (cons .the-begin.2304 (append .body.2417 (core#quote ()))) (core#quote ", -"())))))) (car (cdr .form.2414)) (cdr (cdr .form.2414))))) (core#begin (.define-t", -"ransformer.2175 (core#quote case) (core#lambda (.form.2418 .env.2419) ((core#lam", -"bda (.key.2420 .clauses.2421) ((core#lambda (.the-key.2422) (cons (.the.2176 (co", -"re#quote let)) (cons (cons (cons .the-key.2422 (cons .key.2420 (core#quote ())))", -" (core#quote ())) (cons ((core#lambda () (core#begin (core#define .loop.2423 (co", -"re#lambda (.clauses.2424) (core#if (null? .clauses.2424) #undefined ((core#lambd", -"a (.clause.2425) (cons .the-if.2307 (cons (core#if (core#if (.identifier?.2153 (", -"car .clause.2425)) (.identifier=?.2154 (.the.2176 (core#quote else)) (.make-iden", -"tifier.2149 (car .clause.2425) .env.2419)) #f) #t (cons (.the.2176 (core#quote o", -"r)) (append (map (core#lambda (.x.2426) (cons (.the.2176 (core#quote eqv?)) (con", -"s .the-key.2422 (cons (cons .the-quote.2305 (cons .x.2426 (core#quote ()))) (cor", -"e#quote ()))))) (car .clause.2425)) (core#quote ())))) (cons (core#if (core#if (", -".identifier?.2153 (cadr .clause.2425)) (.identifier=?.2154 (.the.2176 (core#quot", -"e =>)) (.make-identifier.2149 (cadr .clause.2425) .env.2419)) #f) (cons (car (cd", -"r (cdr .clause.2425))) (cons .the-key.2422 (core#quote ()))) (cons .the-begin.23", -"04 (append (cdr .clause.2425) (core#quote ())))) (cons (.loop.2423 (cdr .clauses", -".2424)) (core#quote ())))))) (car .clauses.2424))))) (.loop.2423 .clauses.2421))", -")) (core#quote ()))))) (.make-identifier.2149 (core#quote key) .env.2419))) (car", -" (cdr .form.2418)) (cdr (cdr .form.2418))))) (core#begin (.define-transformer.21", -"75 (core#quote parameterize) (core#lambda (.form.2427 .env.2428) ((core#lambda (", -".formal.2429 .body.2430) (cons (.the.2176 (core#quote with-dynamic-environment))", -" (cons (cons (.the.2176 (core#quote list)) (append (map (core#lambda (.x.2431) (", -"cons (.the.2176 (core#quote cons)) (cons (car .x.2431) (cons (cadr .x.2431) (cor", -"e#quote ()))))) .formal.2429) (core#quote ()))) (cons (cons .the-lambda.2303 (co", -"ns (core#quote ()) (append .body.2430 (core#quote ())))) (core#quote ()))))) (ca", -"r (cdr .form.2427)) (cdr (cdr .form.2427))))) (.define-transformer.2175 (core#qu", -"ote define-record-type) (core#lambda (.form.2432 .env.2433) ((core#lambda (.type", -".2434 .ctor.2435 .pred.2436 .fields.2437) (cons .the-begin.2304 (cons (cons .the", -"-define.2302 (cons .ctor.2435 (cons (cons (.the.2176 (core#quote make-record)) (", -"cons (cons (core#quote quote) (cons .type.2434 (core#quote ()))) (cons (cons (.t", -"he.2176 (core#quote vector)) (map (core#lambda (.field.2438) (core#if (memq (car", -" .field.2438) (cdr .ctor.2435)) (car .field.2438) #undefined)) .fields.2437)) (c", -"ore#quote ())))) (core#quote ())))) (cons (cons .the-define.2302 (cons .pred.243", -"6 (cons (cons (.the.2176 (core#quote lambda)) (cons (cons (core#quote obj) (core", -"#quote ())) (cons (cons (.the.2176 (core#quote and)) (cons (cons (.the.2176 (cor", -"e#quote record?)) (cons (core#quote obj) (core#quote ()))) (cons (cons (.the.217", -"6 (core#quote eq?)) (cons (cons (.the.2176 (core#quote record-type)) (cons (core", -"#quote obj) (core#quote ()))) (cons (cons (core#quote quote) (cons .type.2434 (c", -"ore#quote ()))) (core#quote ())))) (core#quote ())))) (core#quote ())))) (core#q", -"uote ())))) ((core#lambda () (core#begin (core#define .loop.2439 (core#lambda (.", -"fields.2440 .pos.2441 .acc.2442) (core#if (null? .fields.2440) .acc.2442 ((core#", -"lambda (.field.2443) ((core#lambda (.defs.2444) (.loop.2439 (cdr .fields.2440) (", -"+ .pos.2441 1) (append .defs.2444 .acc.2442))) (cons (cons .the-define.2302 (con", -"s (cons (cadr .field.2443) (cons (core#quote obj) (core#quote ()))) (cons (cons ", -".the-if.2307 (cons (cons .pred.2436 (cons (core#quote obj) (core#quote ()))) (co", -"ns (cons (.the.2176 (core#quote vector-ref)) (cons (cons (.the.2176 (core#quote ", -"record-datum)) (cons (core#quote obj) (core#quote ()))) (cons .pos.2441 (core#qu", -"ote ())))) (cons (cons (.the.2176 (core#quote error)) (cons (core#quote \"record ", -"type mismatch\") (cons (core#quote obj) (cons (cons (core#quote quote) (cons .typ", -"e.2434 (core#quote ()))) (core#quote ()))))) (core#quote ()))))) (core#quote ())", -"))) (core#if (null? (cddr .field.2443)) (core#quote ()) (cons (cons .the-define.", -"2302 (cons (cons (car (cddr .field.2443)) (cons (core#quote obj) (cons (core#quo", -"te value) (core#quote ())))) (cons (cons .the-if.2307 (cons (cons .pred.2436 (co", -"ns (core#quote obj) (core#quote ()))) (cons (cons (.the.2176 (core#quote vector-", -"set!)) (cons (cons (.the.2176 (core#quote record-datum)) (cons (core#quote obj) ", -"(core#quote ()))) (cons .pos.2441 (cons (core#quote value) (core#quote ()))))) (", -"cons (cons (.the.2176 (core#quote error)) (cons (core#quote \"record type mismatc", -"h\") (cons (core#quote obj) (cons (cons (core#quote quote) (cons .type.2434 (core", -"#quote ()))) (core#quote ()))))) (core#quote ()))))) (core#quote ())))) (core#qu", -"ote ())))))) (car .fields.2440))))) (.loop.2439 .fields.2437 0 (core#quote ())))", -")))))) (car (cdr .form.2432)) (car (cdr (cdr .form.2432))) (car (cdr (cdr (cdr .", -"form.2432)))) (cdr (cdr (cdr (cdr .form.2432))))))))))))))))))))))))))))))))))))", -") (.the.2176 (core#quote core#define)) (.the.2176 (core#quote core#lambda)) (.th", -"e.2176 (core#quote core#begin)) (.the.2176 (core#quote core#quote)) (.the.2176 (", -"core#quote core#set!)) (.the.2176 (core#quote core#if)) (.the.2176 (core#quote c", -"ore#define-macro)) (.the.2176 (core#quote define)) (.the.2176 (core#quote lambda", -")) (.the.2176 (core#quote begin)) (.the.2176 (core#quote quote)) (.the.2176 (cor", -"e#quote set!)) (.the.2176 (core#quote if)) (.the.2176 (core#quote define-macro))", -") (values .make-identifier.2149 .identifier?.2153 .identifier=?.2154 .identifier", -"-name.2152 .identifier-environment.2151 .make-environment.2164 .default-environm", -"ent.2165 .environment?.2156 .find-identifier.2161 .add-identifier!.2162 .set-ide", -"ntifier!.2163 .macro-objects.2171 .compile.2173 .eval.2174))))))))))))))))))))))", -"))))) (core#lambda (.make-identifier.2445 .identifier?.2446 .identifier=?.2447 .", -"identifier-name.2448 .identifier-environment.2449 .make-environment.2450 .defaul", -"t-environment.2451 .environment?.2452 .find-identifier.2453 .add-identifier!.245", -"4 .set-identifier!.2455 .macro-objects.2456 .compile.2457 .eval.2458) (core#begi", -"n (core#set! make-identifier .make-identifier.2445) (core#begin (core#set! ident", -"ifier? .identifier?.2446) (core#begin (core#set! identifier=? .identifier=?.2447", -") (core#begin (core#set! identifier-name .identifier-name.2448) (core#begin (cor", -"e#set! identifier-environment .identifier-environment.2449) (core#begin (core#se", -"t! make-environment .make-environment.2450) (core#begin (core#set! default-envir", -"onment .default-environment.2451) (core#begin (core#set! environment? .environme", -"nt?.2452) (core#begin (core#set! find-identifier .find-identifier.2453) (core#be", -"gin (core#set! add-identifier! .add-identifier!.2454) (core#begin (core#set! set", -"-identifier! .set-identifier!.2455) (core#begin (core#set! macro-objects .macro-", -"objects.2456) (core#begin (core#set! compile .compile.2457) (core#set! eval .eva", -"l.2458))))))))))))))))))))))))))))))", +"(core#begin (core#begin (core#define make-identifier #undefined) (core#begin (co", +"re#define identifier? #undefined) (core#begin (core#define identifier=? #undefin", +"ed) (core#begin (core#define identifier-name #undefined) (core#begin (core#defin", +"e identifier-environment #undefined) (core#begin (core#define make-environment #", +"undefined) (core#begin (core#define default-environment #undefined) (core#begin ", +"(core#define environment? #undefined) (core#begin (core#define find-identifier #", +"undefined) (core#begin (core#define add-identifier! #undefined) (core#begin (cor", +"e#define set-identifier! #undefined) (core#begin (core#define macro-objects #und", +"efined) (core#begin (core#define expand #undefined) (call-with-values (core#lamb", +"da () ((core#lambda () (core#begin (core#begin (core#define .make-identifier.214", +"9 (core#lambda (.name.2173 .env.2174) (make-record (core#quote identifier) (vect", +"or .name.2173 .env.2174)))) (core#begin (core#define .%identifier?.2150 (core#la", +"mbda (.obj.2175) (core#if (record? .obj.2175) (eq? (record-type .obj.2175) (core", +"#quote identifier)) #f))) (core#begin (core#define .identifier-environment.2151 ", +"(core#lambda (.obj.2176) (core#if (.%identifier?.2150 .obj.2176) (vector-ref (re", +"cord-datum .obj.2176) 1) (error \"record type mismatch\" .obj.2176 (core#quote ide", +"ntifier))))) (core#define .identifier-name.2152 (core#lambda (.obj.2177) (core#i", +"f (.%identifier?.2150 .obj.2177) (vector-ref (record-datum .obj.2177) 0) (error ", +"\"record type mismatch\" .obj.2177 (core#quote identifier)))))))) (core#begin (cor", +"e#define .identifier?.2153 (core#lambda (.obj.2178) ((core#lambda (.it.2179) (co", +"re#if .it.2179 .it.2179 ((core#lambda (.it.2180) (core#if .it.2180 .it.2180 #f))", +" (.%identifier?.2150 .obj.2178)))) (symbol? .obj.2178)))) (core#begin (core#defi", +"ne .identifier=?.2154 (core#lambda (.id1.2181 .id2.2182) (core#if (core#if (symb", +"ol? .id1.2181) (symbol? .id2.2182) #f) (eq? .id1.2181 .id2.2182) (core#if (core#", +"if (.%identifier?.2150 .id1.2181) (.%identifier?.2150 .id2.2182) #f) (eq? (.find", +"-identifier.2161 (.identifier-name.2152 .id1.2181) (.identifier-environment.2151", +" .id1.2181)) (.find-identifier.2161 (.identifier-name.2152 .id2.2182) (.identifi", +"er-environment.2151 .id2.2182))) #f)))) (core#begin (core#set! equal? ((core#lam", +"bda (.e?.2183) (core#lambda (.x.2184 .y.2185) (core#if (.%identifier?.2150 .x.21", +"84) (.identifier=?.2154 .x.2184 .y.2185) (.e?.2183 .x.2184 .y.2185)))) equal?)) ", +"(core#begin (core#begin (core#define .%make-environment.2155 (core#lambda (.pare", +"nt.2186 .prefix.2187 .binding.2188) (make-record (core#quote environment) (vecto", +"r .parent.2186 .prefix.2187 .binding.2188)))) (core#begin (core#define .environm", +"ent?.2156 (core#lambda (.obj.2189) (core#if (record? .obj.2189) (eq? (record-typ", +"e .obj.2189) (core#quote environment)) #f))) (core#begin (core#define .environme", +"nt-binding.2157 (core#lambda (.obj.2190) (core#if (.environment?.2156 .obj.2190)", +" (vector-ref (record-datum .obj.2190) 2) (error \"record type mismatch\" .obj.2190", +" (core#quote environment))))) (core#begin (core#define .environment-prefix.2158 ", +"(core#lambda (.obj.2191) (core#if (.environment?.2156 .obj.2191) (vector-ref (re", +"cord-datum .obj.2191) 1) (error \"record type mismatch\" .obj.2191 (core#quote env", +"ironment))))) (core#define .environment-parent.2159 (core#lambda (.obj.2192) (co", +"re#if (.environment?.2156 .obj.2192) (vector-ref (record-datum .obj.2192) 0) (er", +"ror \"record type mismatch\" .obj.2192 (core#quote environment))))))))) (core#begi", +"n (core#define .search-scope.2160 (core#lambda (.id.2193 .env.2194) ((.environme", +"nt-binding.2157 .env.2194) .id.2193))) (core#begin (core#define .find-identifier", +".2161 (core#lambda (.id.2195 .env.2196) ((core#lambda (.it.2197) (core#if .it.21", +"97 .it.2197 ((core#lambda (.it.2198) (core#if .it.2198 .it.2198 #f)) ((core#lamb", +"da (.parent.2199) (core#if .parent.2199 (.find-identifier.2161 .id.2195 .parent.", +"2199) (core#if (symbol? .id.2195) (.add-identifier!.2162 .id.2195 .env.2196) (.f", +"ind-identifier.2161 (.identifier-name.2152 .id.2195) (.identifier-environment.21", +"51 .id.2195))))) (.environment-parent.2159 .env.2196))))) (.search-scope.2160 .i", +"d.2195 .env.2196)))) (core#begin (core#define .add-identifier!.2162 ((core#lambd", +"a (.uniq.2200) (core#lambda (.id.2201 .env.2202) ((core#lambda (.it.2203) (core#", +"if .it.2203 .it.2203 ((core#lambda (.it.2204) (core#if .it.2204 .it.2204 #f)) (c", +"ore#if (core#if (not (.environment-parent.2159 .env.2202)) (symbol? .id.2201) #f", +") (string->symbol (string-append (.environment-prefix.2158 .env.2202) (symbol->s", +"tring .id.2201))) ((core#lambda (.uid.2205) (core#begin (.set-identifier!.2163 .", +"id.2201 .uid.2205 .env.2202) .uid.2205)) (.uniq.2200 .id.2201)))))) (.search-sco", +"pe.2160 .id.2201 .env.2202)))) ((core#lambda (.n.2206) (core#lambda (.id.2207) (", +"(core#lambda (.m.2208) (core#begin (core#set! .n.2206 (+ .n.2206 1)) (string->sy", +"mbol (string-append \".\" (symbol->string ((core#lambda () (core#begin (core#defin", +"e .loop.2209 (core#lambda (.id.2210) (core#if (symbol? .id.2210) .id.2210 (.loop", +".2209 (.identifier-name.2152 .id.2210))))) (.loop.2209 .id.2207))))) \".\" (number", +"->string .m.2208))))) .n.2206))) 0))) (core#begin (core#define .set-identifier!.", +"2163 (core#lambda (.id.2211 .uid.2212 .env.2213) ((.environment-binding.2157 .en", +"v.2213) .id.2211 .uid.2212))) (core#begin (core#define .make-environment.2164 (c", +"ore#lambda (.prefix.2214) (.%make-environment.2155 #f (symbol->string .prefix.22", +"14) (make-ephemeron-table)))) (core#begin (core#define .default-environment.2165", +" ((core#lambda (.env.2215) (core#begin (for-each (core#lambda (.x.2216) (.set-id", +"entifier!.2163 .x.2216 .x.2216 .env.2215)) (core#quote (core#define core#set! co", +"re#quote core#lambda core#if core#begin core#define-macro))) .env.2215)) (.make-", +"environment.2164 (string->symbol \"\")))) (core#begin (core#define .extend-environ", +"ment.2166 (core#lambda (.parent.2217) (.%make-environment.2155 .parent.2217 #f (", +"make-ephemeron-table)))) (core#begin (core#define .global-macro-table.2167 (make", +"-dictionary)) (core#begin (core#define .find-macro.2168 (core#lambda (.uid.2218)", +" (core#if (dictionary-has? .global-macro-table.2167 .uid.2218) (dictionary-ref .", +"global-macro-table.2167 .uid.2218) #f))) (core#begin (core#define .add-macro!.21", +"69 (core#lambda (.uid.2219 .expander.2220) (dictionary-set! .global-macro-table.", +"2167 .uid.2219 .expander.2220))) (core#begin (core#define .shadow-macro!.2170 (c", +"ore#lambda (.uid.2221) (core#if (dictionary-has? .global-macro-table.2167 .uid.2", +"221) (dictionary-delete! .global-macro-table.2167 .uid.2221) #undefined))) (core", +"#begin (core#define .macro-objects.2171 (core#lambda () .global-macro-table.2167", +")) (core#begin (core#define .expand.2172 ((core#lambda (.task-queue.2222) (core#", +"begin (core#define .queue.2223 (core#lambda (.task.2236) ((core#lambda (.tmp.223", +"7) (core#begin (.task-queue.2222 (cons (cons .tmp.2237 .task.2236) (.task-queue.", +"2222))) .tmp.2237)) (cons #f #f)))) (core#begin (core#define .run-all.2224 (core", +"#lambda () (for-each (core#lambda (.x.2238) ((core#lambda (.task.2239 .skelton.2", +"240) ((core#lambda (.x.2241) (core#begin (set-car! .skelton.2240 (car .x.2241)) ", +"(set-cdr! .skelton.2240 (cdr .x.2241)))) (.task.2239))) (cdr .x.2238) (car .x.22", +"38))) (reverse (.task-queue.2222))))) (core#begin (core#define .caddr.2225 (core", +"#lambda (.x.2242) (car (cddr .x.2242)))) (core#begin (core#define .map*.2226 (co", +"re#lambda (.proc.2243 .list*.2244) (core#if (null? .list*.2244) .list*.2244 (cor", +"e#if (pair? .list*.2244) (cons (.proc.2243 (car .list*.2244)) (.map*.2226 .proc.", +"2243 (cdr .list*.2244))) (.proc.2243 .list*.2244))))) (core#begin (core#define .", +"literal?.2227 (core#lambda (.x.2245) (not ((core#lambda (.it.2246) (core#if .it.", +"2246 .it.2246 ((core#lambda (.it.2247) (core#if .it.2247 .it.2247 #f)) (pair? .x", +".2245)))) (.identifier?.2153 .x.2245))))) (core#begin (core#define .call?.2228 (", +"core#lambda (.x.2248) (core#if (list? .x.2248) (core#if (not (null? .x.2248)) (.", +"identifier?.2153 (car .x.2248)) #f) #f))) (core#begin (core#define .expand-varia", +"ble.2229 (core#lambda (.var.2249 .env.2250) ((core#lambda (.x.2251) ((core#lambd", +"a (.m.2252) (core#if .m.2252 (.expand-node.2234 (.m.2252 .var.2249 .env.2250) .e", +"nv.2250) .x.2251)) (.find-macro.2168 .x.2251))) (.find-identifier.2161 .var.2249", +" .env.2250)))) (core#begin (core#define .expand-quote.2230 (core#lambda (.obj.22", +"53) (cons (core#quote core#quote) (cons .obj.2253 (core#quote ()))))) (core#begi", +"n (core#define .expand-define.2231 (core#lambda (.var.2254 .form.2255 .env.2256)", +" ((core#lambda (.uid.2257) (core#begin (.shadow-macro!.2170 .uid.2257) (cons (co", +"re#quote core#define) (cons .uid.2257 (cons (.expand-node.2234 .form.2255 .env.2", +"256) (core#quote ())))))) (.add-identifier!.2162 .var.2254 .env.2256)))) (core#b", +"egin (core#define .expand-lambda.2232 (core#lambda (.args.2258 .body.2259 .env.2", +"260) ((core#lambda (.env.2261) ((core#lambda (.args.2262) (with-dynamic-environm", +"ent (list (cons .task-queue.2222 (core#quote ()))) (core#lambda () ((core#lambda", +" (.body.2263) (core#begin (.run-all.2224) (cons (core#quote core#lambda) (cons .", +"args.2262 (cons .body.2263 (core#quote ())))))) (.expand-node.2234 .body.2259 .e", +"nv.2261))))) (.map*.2226 (core#lambda (.var.2264) (.add-identifier!.2162 .var.22", +"64 .env.2261)) .args.2258))) (.extend-environment.2166 .env.2260)))) (core#begin", +" (core#define .expand-define-macro.2233 (core#lambda (.var.2265 .transformer.226", +"6 .env.2267) ((core#lambda (.uid.2268) ((core#lambda (.expander.2269) (core#begi", +"n (.add-macro!.2169 .uid.2268 .expander.2269) #undefined)) (load (.expand.2235 .", +"transformer.2266 .env.2267)))) (.add-identifier!.2162 .var.2265 .env.2267)))) (c", +"ore#begin (core#define .expand-node.2234 (core#lambda (.expr.2270 .env.2271) (co", +"re#if (.literal?.2227 .expr.2270) .expr.2270 (core#if (.identifier?.2153 .expr.2", +"270) (.expand-variable.2229 .expr.2270 .env.2271) (core#if (.call?.2228 .expr.22", +"70) ((core#lambda (.functor.2272) ((core#lambda (.key.2273) (core#if ((core#lamb", +"da (.it.2274) (core#if .it.2274 .it.2274 #f)) (eqv? .key.2273 (core#quote core#q", +"uote))) (.expand-quote.2230 (cadr .expr.2270)) (core#if ((core#lambda (.it.2275)", +" (core#if .it.2275 .it.2275 #f)) (eqv? .key.2273 (core#quote core#define))) (.ex", +"pand-define.2231 (cadr .expr.2270) (.caddr.2225 .expr.2270) .env.2271) (core#if ", +"((core#lambda (.it.2276) (core#if .it.2276 .it.2276 #f)) (eqv? .key.2273 (core#q", +"uote core#lambda))) (.queue.2223 (core#lambda () (.expand-lambda.2232 (cadr .exp", +"r.2270) (.caddr.2225 .expr.2270) .env.2271))) (core#if ((core#lambda (.it.2277) ", +"(core#if .it.2277 .it.2277 #f)) (eqv? .key.2273 (core#quote core#define-macro)))", +" (.expand-define-macro.2233 (cadr .expr.2270) (.caddr.2225 .expr.2270) .env.2271", +") (core#if #t ((core#lambda (.m.2278) (core#if .m.2278 (.expand-node.2234 (.m.22", +"78 .expr.2270 .env.2271) .env.2271) (map (core#lambda (.x.2279) (.expand-node.22", +"34 .x.2279 .env.2271)) .expr.2270))) (.find-macro.2168 .functor.2272)) #undefine", +"d)))))) .functor.2272)) (.find-identifier.2161 (car .expr.2270) .env.2271)) (cor", +"e#if (list? .expr.2270) (map (core#lambda (.x.2280) (.expand-node.2234 .x.2280 .", +"env.2271)) .expr.2270) (error \"invalid expression\" .expr.2270))))))) (core#begin", +" (core#define .expand.2235 (core#lambda (.expr.2281 .env.2282) ((core#lambda (.x", +".2283) (core#begin (.run-all.2224) .x.2283)) (.expand-node.2234 .expr.2281 .env.", +"2282)))) .expand.2235)))))))))))))) (make-parameter (core#quote ())))) (values .", +"make-identifier.2149 .identifier?.2153 .identifier=?.2154 .identifier-name.2152 ", +".identifier-environment.2151 .make-environment.2164 .default-environment.2165 .e", +"nvironment?.2156 .find-identifier.2161 .add-identifier!.2162 .set-identifier!.21", +"63 .macro-objects.2171 .expand.2172)))))))))))))))))))))) (core#lambda (.make-id", +"entifier.2284 .identifier?.2285 .identifier=?.2286 .identifier-name.2287 .identi", +"fier-environment.2288 .make-environment.2289 .default-environment.2290 .environm", +"ent?.2291 .find-identifier.2292 .add-identifier!.2293 .set-identifier!.2294 .mac", +"ro-objects.2295 .expand.2296) (core#begin (core#set! make-identifier .make-ident", +"ifier.2284) (core#begin (core#set! identifier? .identifier?.2285) (core#begin (c", +"ore#set! identifier=? .identifier=?.2286) (core#begin (core#set! identifier-name", +" .identifier-name.2287) (core#begin (core#set! identifier-environment .identifie", +"r-environment.2288) (core#begin (core#set! make-environment .make-environment.22", +"89) (core#begin (core#set! default-environment .default-environment.2290) (core#", +"begin (core#set! environment? .environment?.2291) (core#begin (core#set! find-id", +"entifier .find-identifier.2292) (core#begin (core#set! add-identifier! .add-iden", +"tifier!.2293) (core#begin (core#set! set-identifier! .set-identifier!.2294) (cor", +"e#begin (core#set! macro-objects .macro-objects.2295) (core#set! expand .expand.", +"2296)))))))))))))))))))))))))))) (core#begin ((core#lambda () (core#begin (core#", +"define .define-transformer.2297 (core#lambda (.name.2299 .transformer.2300) (dic", +"tionary-set! (macro-objects) .name.2299 .transformer.2300))) (core#begin (core#d", +"efine .the.2298 (core#lambda (.var.2301) (make-identifier .var.2301 default-envi", +"ronment))) ((core#lambda (.the-core-define.2302 .the-core-lambda.2303 .the-core-", +"begin.2304 .the-core-quote.2305 .the-core-set!.2306 .the-core-if.2307 .the-core-", +"define-macro.2308 .the-define.2309 .the-lambda.2310 .the-begin.2311 .the-quote.2", +"312 .the-set!.2313 .the-if.2314 .the-define-macro.2315) (core#begin (.define-tra", +"nsformer.2297 (core#quote quote) (core#lambda (.form.2320 .env.2321) (core#if (=", +" (length .form.2320) 2) (cons .the-core-quote.2305 (cons (cadr .form.2320) (core", +"#quote ()))) (error \"malformed quote\" .form.2320)))) (core#begin (.define-transf", +"ormer.2297 (core#quote if) (core#lambda (.form.2322 .env.2323) ((core#lambda (.l", +"en.2324) (core#if (= .len.2324 3) (append .form.2322 (cons (core#quote #undefine", +"d) (core#quote ()))) (core#if (= .len.2324 4) (cons .the-core-if.2307 (cdr .form", +".2322)) (error \"malformed if\" .form.2322)))) (length .form.2322)))) (core#begin ", +"(.define-transformer.2297 (core#quote begin) (core#lambda (.form.2325 .env.2326)", +" ((core#lambda (.len.2327) (core#if (= .len.2327 1) #undefined (core#if (= .len.", +"2327 2) (cadr .form.2325) (core#if (= .len.2327 3) (cons .the-core-begin.2304 (c", +"dr .form.2325)) (cons .the-core-begin.2304 (cons (cadr .form.2325) (cons (cons .", +"the-begin.2311 (cddr .form.2325)) (core#quote ())))))))) (length .form.2325)))) ", +"(core#begin (.define-transformer.2297 (core#quote set!) (core#lambda (.form.2328", +" .env.2329) (core#if (core#if (= (length .form.2328) 3) (identifier? (cadr .form", +".2328)) #f) (cons .the-core-set!.2306 (cdr .form.2328)) (error \"malformed set!\" ", +".form.2328)))) (core#begin (core#define .check-formal.2316 (core#lambda (.formal", +".2330) ((core#lambda (.it.2331) (core#if .it.2331 .it.2331 ((core#lambda (.it.23", +"32) (core#if .it.2332 .it.2332 ((core#lambda (.it.2333) (core#if .it.2333 .it.23", +"33 #f)) (core#if (pair? .formal.2330) (core#if (identifier? (car .formal.2330)) ", +"(.check-formal.2316 (cdr .formal.2330)) #f) #f)))) (identifier? .formal.2330))))", +" (null? .formal.2330)))) (core#begin (.define-transformer.2297 (core#quote lambd", +"a) (core#lambda (.form.2334 .env.2335) (core#if (= (length .form.2334) 1) (error", +" \"malformed lambda\" .form.2334) (core#if (.check-formal.2316 (cadr .form.2334)) ", +"(cons .the-core-lambda.2303 (cons (cadr .form.2334) (cons (cons .the-begin.2311 ", +"(cddr .form.2334)) (core#quote ())))) (error \"malformed lambda\" .form.2334))))) ", +"(core#begin (.define-transformer.2297 (core#quote define) (core#lambda (.form.23", +"36 .env.2337) ((core#lambda (.len.2338) (core#if (= .len.2338 1) (error \"malform", +"ed define\" .form.2336) ((core#lambda (.formal.2339) (core#if (identifier? .forma", +"l.2339) (core#if (= .len.2338 3) (cons .the-core-define.2302 (cdr .form.2336)) (", +"error \"malformed define\" .form.2336)) (core#if (pair? .formal.2339) (cons .the-d", +"efine.2309 (cons (car .formal.2339) (cons (cons .the-lambda.2310 (cons (cdr .for", +"mal.2339) (cddr .form.2336))) (core#quote ())))) (error \"define: binding to non-", +"varaible object\" .form.2336)))) (cadr .form.2336)))) (length .form.2336)))) (cor", +"e#begin (.define-transformer.2297 (core#quote define-macro) (core#lambda (.form.", +"2340 .env.2341) (core#if (= (length .form.2340) 3) (core#if (identifier? (cadr .", +"form.2340)) (cons .the-core-define-macro.2308 (cdr .form.2340)) (error \"define-m", +"acro: binding to non-variable object\" .form.2340)) (error \"malformed define-macr", +"o\" .form.2340)))) (core#begin #undefined (core#begin (.define-transformer.2297 (", +"core#quote else) (core#lambda ._.2342 (error \"invalid use of auxiliary syntax\" (", +"core#quote else)))) (core#begin (.define-transformer.2297 (core#quote =>) (core#", +"lambda ._.2343 (error \"invalid use of auxiliary syntax\" (core#quote =>)))) (core", +"#begin (.define-transformer.2297 (core#quote unquote) (core#lambda ._.2344 (erro", +"r \"invalid use of auxiliary syntax\" (core#quote unquote)))) (core#begin (.define", +"-transformer.2297 (core#quote unquote-splicing) (core#lambda ._.2345 (error \"inv", +"alid use of auxiliary syntax\" (core#quote unquote-splicing)))) (core#begin (.def", +"ine-transformer.2297 (core#quote let) (core#lambda (.form.2346 .env.2347) (core#", +"if (identifier? (cadr .form.2346)) ((core#lambda (.name.2348 .formal.2349 .body.", +"2350) (cons (cons .the-lambda.2310 (cons (core#quote ()) (cons (cons .the-define", +".2309 (cons (cons .name.2348 (map car .formal.2349)) .body.2350)) (cons (cons .n", +"ame.2348 (map cadr .formal.2349)) (core#quote ()))))) (core#quote ()))) (car (cd", +"r .form.2346)) (car (cdr (cdr .form.2346))) (cdr (cdr (cdr .form.2346)))) ((core", +"#lambda (.formal.2351 .body.2352) (cons (cons .the-lambda.2310 (cons (map car .f", +"ormal.2351) .body.2352)) (map cadr .formal.2351))) (car (cdr .form.2346)) (cdr (", +"cdr .form.2346)))))) (core#begin (.define-transformer.2297 (core#quote and) (cor", +"e#lambda (.form.2353 .env.2354) (core#if (null? (cdr .form.2353)) #t (core#if (n", +"ull? (cddr .form.2353)) (cadr .form.2353) (cons .the-if.2314 (cons (cadr .form.2", +"353) (cons (cons (.the.2298 (core#quote and)) (cddr .form.2353)) (cons (core#quo", +"te #f) (core#quote ()))))))))) (core#begin (.define-transformer.2297 (core#quote", +" or) (core#lambda (.form.2355 .env.2356) (core#if (null? (cdr .form.2355)) #f ((", +"core#lambda (.tmp.2357) (cons (.the.2298 (core#quote let)) (cons (cons (cons .tm", +"p.2357 (cons (cadr .form.2355) (core#quote ()))) (core#quote ())) (cons (cons .t", +"he-if.2314 (cons .tmp.2357 (cons .tmp.2357 (cons (cons (.the.2298 (core#quote or", +")) (cddr .form.2355)) (core#quote ()))))) (core#quote ()))))) (make-identifier (", +"core#quote it) .env.2356))))) (core#begin (.define-transformer.2297 (core#quote ", +"cond) (core#lambda (.form.2358 .env.2359) ((core#lambda (.clauses.2360) (core#if", +" (null? .clauses.2360) #undefined ((core#lambda (.clause.2361) (core#if (core#if", +" (identifier? (car .clause.2361)) (identifier=? (.the.2298 (core#quote else)) (m", +"ake-identifier (car .clause.2361) .env.2359)) #f) (cons .the-begin.2311 (cdr .cl", +"ause.2361)) (core#if (null? (cdr .clause.2361)) (cons (.the.2298 (core#quote or)", +") (cons (car .clause.2361) (cons (cons (.the.2298 (core#quote cond)) (cdr .claus", +"es.2360)) (core#quote ())))) (core#if (core#if (identifier? (cadr .clause.2361))", +" (identifier=? (.the.2298 (core#quote =>)) (make-identifier (cadr .clause.2361) ", +".env.2359)) #f) ((core#lambda (.tmp.2362) (cons (.the.2298 (core#quote let)) (co", +"ns (cons (cons .tmp.2362 (cons (car .clause.2361) (core#quote ()))) (core#quote ", +"())) (cons (cons .the-if.2314 (cons .tmp.2362 (cons (cons (cadr (cdr .clause.236", +"1)) (cons .tmp.2362 (core#quote ()))) (cons (cons (.the.2298 (core#quote cond)) ", +"(cddr .form.2358)) (core#quote ()))))) (core#quote ()))))) (make-identifier (cor", +"e#quote tmp) .env.2359)) (cons .the-if.2314 (cons (car .clause.2361) (cons (cons", +" .the-begin.2311 (cdr .clause.2361)) (cons (cons (.the.2298 (core#quote cond)) (", +"cdr .clauses.2360)) (core#quote ()))))))))) (car .clauses.2360)))) (cdr .form.23", +"58)))) (core#begin (.define-transformer.2297 (core#quote quasiquote) (core#lambd", +"a (.form.2363 .env.2364) (core#begin (core#define .quasiquote?.2365 (core#lambda", +" (.form.2369) (core#if (pair? .form.2369) (core#if (identifier? (car .form.2369)", +") (identifier=? (.the.2298 (core#quote quasiquote)) (make-identifier (car .form.", +"2369) .env.2364)) #f) #f))) (core#begin (core#define .unquote?.2366 (core#lambda", +" (.form.2370) (core#if (pair? .form.2370) (core#if (identifier? (car .form.2370)", +") (identifier=? (.the.2298 (core#quote unquote)) (make-identifier (car .form.237", +"0) .env.2364)) #f) #f))) (core#begin (core#define .unquote-splicing?.2367 (core#", +"lambda (.form.2371) (core#if (pair? .form.2371) (core#if (pair? (car .form.2371)", +") (core#if (identifier? (caar .form.2371)) (identifier=? (.the.2298 (core#quote ", +"unquote-splicing)) (make-identifier (caar .form.2371) .env.2364)) #f) #f) #f))) ", +"(core#begin (core#define .qq.2368 (core#lambda (.depth.2372 .expr.2373) (core#if", +" (.unquote?.2366 .expr.2373) (core#if (= .depth.2372 1) (cadr .expr.2373) (list ", +"(.the.2298 (core#quote list)) (list (.the.2298 (core#quote quote)) (.the.2298 (c", +"ore#quote unquote))) (.qq.2368 (- .depth.2372 1) (car (cdr .expr.2373))))) (core", +"#if (.unquote-splicing?.2367 .expr.2373) (core#if (= .depth.2372 1) (list (.the.", +"2298 (core#quote append)) (car (cdr (car .expr.2373))) (.qq.2368 .depth.2372 (cd", +"r .expr.2373))) (list (.the.2298 (core#quote cons)) (list (.the.2298 (core#quote", +" list)) (list (.the.2298 (core#quote quote)) (.the.2298 (core#quote unquote-spli", +"cing))) (.qq.2368 (- .depth.2372 1) (car (cdr (car .expr.2373))))) (.qq.2368 .de", +"pth.2372 (cdr .expr.2373)))) (core#if (.quasiquote?.2365 .expr.2373) (list (.the", +".2298 (core#quote list)) (list (.the.2298 (core#quote quote)) (.the.2298 (core#q", +"uote quasiquote))) (.qq.2368 (+ .depth.2372 1) (car (cdr .expr.2373)))) (core#if", +" (pair? .expr.2373) (list (.the.2298 (core#quote cons)) (.qq.2368 .depth.2372 (c", +"ar .expr.2373)) (.qq.2368 .depth.2372 (cdr .expr.2373))) (core#if (vector? .expr", +".2373) (list (.the.2298 (core#quote list->vector)) (.qq.2368 .depth.2372 (vector", +"->list .expr.2373))) (list (.the.2298 (core#quote quote)) .expr.2373)))))))) ((c", +"ore#lambda (.x.2374) (.qq.2368 1 .x.2374)) (cadr .form.2363)))))))) (core#begin ", +"(.define-transformer.2297 (core#quote let*) (core#lambda (.form.2375 .env.2376) ", +"((core#lambda (.bindings.2377 .body.2378) (core#if (null? .bindings.2377) (cons ", +"(.the.2298 (core#quote let)) (cons (core#quote ()) .body.2378)) (cons (.the.2298", +" (core#quote let)) (cons (cons (cons (car (car .bindings.2377)) (cdr (car .bindi", +"ngs.2377))) (core#quote ())) (cons (cons (.the.2298 (core#quote let*)) (cons (cd", +"r .bindings.2377) .body.2378)) (core#quote ())))))) (car (cdr .form.2375)) (cdr ", +"(cdr .form.2375))))) (core#begin (.define-transformer.2297 (core#quote letrec) (", +"core#lambda (.form.2379 .env.2380) (cons (.the.2298 (core#quote letrec*)) (cdr .", +"form.2379)))) (core#begin (.define-transformer.2297 (core#quote letrec*) (core#l", +"ambda (.form.2381 .env.2382) ((core#lambda (.bindings.2383 .body.2384) ((core#la", +"mbda (.variables.2385 .initials.2386) (cons (.the.2298 (core#quote let)) (cons .", +"variables.2385 (append .initials.2386 (append .body.2384 (core#quote ())))))) (m", +"ap (core#lambda (.v.2387) (cons .v.2387 (cons (core#quote #undefined) (core#quot", +"e ())))) (map car .bindings.2383)) (map (core#lambda (.v.2388) (cons (.the.2298 ", +"(core#quote set!)) (append .v.2388 (core#quote ())))) .bindings.2383))) (car (cd", +"r .form.2381)) (cdr (cdr .form.2381))))) (core#begin (.define-transformer.2297 (", +"core#quote let-values) (core#lambda (.form.2389 .env.2390) (cons (.the.2298 (cor", +"e#quote let*-values)) (append (cdr .form.2389) (core#quote ()))))) (core#begin (", +".define-transformer.2297 (core#quote let*-values) (core#lambda (.form.2391 .env.", +"2392) ((core#lambda (.formals.2393 .body.2394) (core#if (null? .formals.2393) (c", +"ons (.the.2298 (core#quote let)) (cons (core#quote ()) (append .body.2394 (core#", +"quote ())))) ((core#lambda (.formal.2395) (cons (.the.2298 (core#quote call-with", +"-values)) (cons (cons .the-lambda.2310 (cons (core#quote ()) (cdr .formal.2395))", +") (cons (cons (.the.2298 (core#quote lambda)) (cons (car .formal.2395) (cons (co", +"ns (.the.2298 (core#quote let*-values)) (cons (cdr .formals.2393) .body.2394)) (", +"core#quote ())))) (core#quote ()))))) (car .formals.2393)))) (cadr .form.2391) (", +"cddr .form.2391)))) (core#begin (.define-transformer.2297 (core#quote define-val", +"ues) (core#lambda (.form.2396 .env.2397) ((core#lambda (.formal.2398 .body.2399)", +" ((core#lambda (.tmps.2400) (cons .the-begin.2311 (append ((core#lambda () (core", +"#begin (core#define .loop.2401 (core#lambda (.formal.2402) (core#if (identifier?", +" .formal.2402) (cons (cons .the-define.2309 (cons .formal.2402 (cons (core#quote", +" #undefined) (core#quote ())))) (core#quote ())) (core#if (pair? .formal.2402) (", +"cons (cons .the-define.2309 (cons (car .formal.2402) (cons (core#quote #undefine", +"d) (core#quote ())))) (.loop.2401 (cdr .formal.2402))) (core#quote ()))))) (.loo", +"p.2401 .formal.2398)))) (cons (cons (.the.2298 (core#quote call-with-values)) (c", +"ons (cons .the-lambda.2310 (cons (core#quote ()) .body.2399)) (cons (cons .the-l", +"ambda.2310 (cons .tmps.2400 ((core#lambda () (core#begin (core#define .loop.2403", +" (core#lambda (.formal.2404 .tmps.2405) (core#if (identifier? .formal.2404) (con", +"s (cons .the-set!.2313 (cons .formal.2404 (cons .tmps.2405 (core#quote ())))) (c", +"ore#quote ())) (core#if (pair? .formal.2404) (cons (cons .the-set!.2313 (cons (c", +"ar .formal.2404) (cons (car .tmps.2405) (core#quote ())))) (.loop.2403 (cdr .for", +"mal.2404) (cdr .tmps.2405))) (core#quote ()))))) (.loop.2403 .formal.2398 .tmps.", +"2400)))))) (core#quote ())))) (core#quote ()))))) ((core#lambda () (core#begin (", +"core#define .loop.2406 (core#lambda (.formal.2407) (core#if (identifier? .formal", +".2407) (make-identifier .formal.2407 .env.2397) (core#if (pair? .formal.2407) (c", +"ons (make-identifier (car .formal.2407) .env.2397) (.loop.2406 (cdr .formal.2407", +"))) (core#quote ()))))) (.loop.2406 .formal.2398)))))) (cadr .form.2396) (cddr .", +"form.2396)))) (core#begin (.define-transformer.2297 (core#quote do) (core#lambda", +" (.form.2408 .env.2409) ((core#lambda (.bindings.2410 .test.2411 .cleanup.2412 .", +"body.2413) ((core#lambda (.loop.2414) (cons (.the.2298 (core#quote let)) (cons .", +"loop.2414 (cons (map (core#lambda (.x.2415) (cons (car .x.2415) (cons (cadr .x.2", +"415) (core#quote ())))) .bindings.2410) (cons (cons .the-if.2314 (cons .test.241", +"1 (cons (cons .the-begin.2311 .cleanup.2412) (cons (cons .the-begin.2311 (append", +" .body.2413 (cons (cons .loop.2414 (map (core#lambda (.x.2416) (core#if (null? (", +"cdr (cdr .x.2416))) (car .x.2416) (car (cdr (cdr .x.2416))))) .bindings.2410)) (", +"core#quote ())))) (core#quote ()))))) (core#quote ())))))) (make-identifier (cor", +"e#quote loop) .env.2409))) (car (cdr .form.2408)) (car (car (cdr (cdr .form.2408", +")))) (cdr (car (cdr (cdr .form.2408)))) (cdr (cdr (cdr .form.2408)))))) (core#be", +"gin (.define-transformer.2297 (core#quote when) (core#lambda (.form.2417 .env.24", +"18) ((core#lambda (.test.2419 .body.2420) (cons .the-if.2314 (cons .test.2419 (c", +"ons (cons .the-begin.2311 (append .body.2420 (core#quote ()))) (cons (core#quote", +" #undefined) (core#quote ())))))) (car (cdr .form.2417)) (cdr (cdr .form.2417)))", +")) (core#begin (.define-transformer.2297 (core#quote unless) (core#lambda (.form", +".2421 .env.2422) ((core#lambda (.test.2423 .body.2424) (cons .the-if.2314 (cons ", +".test.2423 (cons (core#quote #undefined) (cons (cons .the-begin.2311 (append .bo", +"dy.2424 (core#quote ()))) (core#quote ())))))) (car (cdr .form.2421)) (cdr (cdr ", +".form.2421))))) (core#begin (.define-transformer.2297 (core#quote case) (core#la", +"mbda (.form.2425 .env.2426) ((core#lambda (.key.2427 .clauses.2428) ((core#lambd", +"a (.the-key.2429) (cons (.the.2298 (core#quote let)) (cons (cons (cons .the-key.", +"2429 (cons .key.2427 (core#quote ()))) (core#quote ())) (cons ((core#lambda () (", +"core#begin (core#define .loop.2430 (core#lambda (.clauses.2431) (core#if (null? ", +".clauses.2431) #undefined ((core#lambda (.clause.2432) (cons .the-if.2314 (cons ", +"(core#if (core#if (identifier? (car .clause.2432)) (identifier=? (.the.2298 (cor", +"e#quote else)) (make-identifier (car .clause.2432) .env.2426)) #f) #t (cons (.th", +"e.2298 (core#quote or)) (append (map (core#lambda (.x.2433) (cons (.the.2298 (co", +"re#quote eqv?)) (cons .the-key.2429 (cons (cons .the-quote.2312 (cons .x.2433 (c", +"ore#quote ()))) (core#quote ()))))) (car .clause.2432)) (core#quote ())))) (cons", +" (core#if (core#if (identifier? (cadr .clause.2432)) (identifier=? (.the.2298 (c", +"ore#quote =>)) (make-identifier (cadr .clause.2432) .env.2426)) #f) (cons (car (", +"cdr (cdr .clause.2432))) (cons .the-key.2429 (core#quote ()))) (cons .the-begin.", +"2311 (append (cdr .clause.2432) (core#quote ())))) (cons (.loop.2430 (cdr .claus", +"es.2431)) (core#quote ())))))) (car .clauses.2431))))) (.loop.2430 .clauses.2428", +")))) (core#quote ()))))) (make-identifier (core#quote key) .env.2426))) (car (cd", +"r .form.2425)) (cdr (cdr .form.2425))))) (core#begin (.define-transformer.2297 (", +"core#quote parameterize) (core#lambda (.form.2434 .env.2435) ((core#lambda (.for", +"mal.2436 .body.2437) (cons (.the.2298 (core#quote with-dynamic-environment)) (co", +"ns (cons (.the.2298 (core#quote list)) (append (map (core#lambda (.x.2438) (cons", +" (.the.2298 (core#quote cons)) (cons (car .x.2438) (cons (cadr .x.2438) (core#qu", +"ote ()))))) .formal.2436) (core#quote ()))) (cons (cons .the-lambda.2310 (cons (", +"core#quote ()) (append .body.2437 (core#quote ())))) (core#quote ()))))) (car (c", +"dr .form.2434)) (cdr (cdr .form.2434))))) (.define-transformer.2297 (core#quote ", +"define-record-type) (core#lambda (.form.2439 .env.2440) ((core#lambda (.type.244", +"1 .ctor.2442 .pred.2443 .fields.2444) (cons .the-begin.2311 (cons (cons .the-def", +"ine.2309 (cons .ctor.2442 (cons (cons (.the.2298 (core#quote make-record)) (cons", +" (cons (core#quote quote) (cons .type.2441 (core#quote ()))) (cons (cons (.the.2", +"298 (core#quote vector)) (map (core#lambda (.field.2445) (core#if (memq (car .fi", +"eld.2445) (cdr .ctor.2442)) (car .field.2445) #undefined)) .fields.2444)) (core#", +"quote ())))) (core#quote ())))) (cons (cons .the-define.2309 (cons .pred.2443 (c", +"ons (cons (.the.2298 (core#quote lambda)) (cons (cons (core#quote obj) (core#quo", +"te ())) (cons (cons (.the.2298 (core#quote and)) (cons (cons (.the.2298 (core#qu", +"ote record?)) (cons (core#quote obj) (core#quote ()))) (cons (cons (.the.2298 (c", +"ore#quote eq?)) (cons (cons (.the.2298 (core#quote record-type)) (cons (core#quo", +"te obj) (core#quote ()))) (cons (cons (core#quote quote) (cons .type.2441 (core#", +"quote ()))) (core#quote ())))) (core#quote ())))) (core#quote ())))) (core#quote", +" ())))) ((core#lambda () (core#begin (core#define .loop.2446 (core#lambda (.fiel", +"ds.2447 .pos.2448 .acc.2449) (core#if (null? .fields.2447) .acc.2449 ((core#lamb", +"da (.field.2450) ((core#lambda (.defs.2451) (.loop.2446 (cdr .fields.2447) (+ .p", +"os.2448 1) (append .defs.2451 .acc.2449))) (cons (cons .the-define.2309 (cons (c", +"ons (cadr .field.2450) (cons (core#quote obj) (core#quote ()))) (cons (cons .the", +"-if.2314 (cons (cons .pred.2443 (cons (core#quote obj) (core#quote ()))) (cons (", +"cons (.the.2298 (core#quote vector-ref)) (cons (cons (.the.2298 (core#quote reco", +"rd-datum)) (cons (core#quote obj) (core#quote ()))) (cons .pos.2448 (core#quote ", +"())))) (cons (cons (.the.2298 (core#quote error)) (cons (core#quote \"record type", +" mismatch\") (cons (core#quote obj) (cons (cons (core#quote quote) (cons .type.24", +"41 (core#quote ()))) (core#quote ()))))) (core#quote ()))))) (core#quote ())))) ", +"(core#if (null? (cddr .field.2450)) (core#quote ()) (cons (cons .the-define.2309", +" (cons (cons (car (cddr .field.2450)) (cons (core#quote obj) (cons (core#quote v", +"alue) (core#quote ())))) (cons (cons .the-if.2314 (cons (cons .pred.2443 (cons (", +"core#quote obj) (core#quote ()))) (cons (cons (.the.2298 (core#quote vector-set!", +")) (cons (cons (.the.2298 (core#quote record-datum)) (cons (core#quote obj) (cor", +"e#quote ()))) (cons .pos.2448 (cons (core#quote value) (core#quote ()))))) (cons", +" (cons (.the.2298 (core#quote error)) (cons (core#quote \"record type mismatch\") ", +"(cons (core#quote obj) (cons (cons (core#quote quote) (cons .type.2441 (core#quo", +"te ()))) (core#quote ()))))) (core#quote ()))))) (core#quote ())))) (core#quote ", +"())))))) (car .fields.2447))))) (.loop.2446 .fields.2444 0 (core#quote ())))))))", +")) (car (cdr .form.2439)) (car (cdr (cdr .form.2439))) (car (cdr (cdr (cdr .form", +".2439)))) (cdr (cdr (cdr (cdr .form.2439))))))))))))))))))))))))))))))))))))) (.", +"the.2298 (core#quote core#define)) (.the.2298 (core#quote core#lambda)) (.the.22", +"98 (core#quote core#begin)) (.the.2298 (core#quote core#quote)) (.the.2298 (core", +"#quote core#set!)) (.the.2298 (core#quote core#if)) (.the.2298 (core#quote core#", +"define-macro)) (.the.2298 (core#quote define)) (.the.2298 (core#quote lambda)) (", +".the.2298 (core#quote begin)) (.the.2298 (core#quote quote)) (.the.2298 (core#qu", +"ote set!)) (.the.2298 (core#quote if)) (.the.2298 (core#quote define-macro))))))", +") (core#begin (core#begin (core#define compile #undefined) (call-with-values (co", +"re#lambda () ((core#lambda () (core#begin (core#define .caddr.2452 (core#lambda ", +"(.x.2459) (car (cddr .x.2459)))) (core#begin (core#define .cadddr.2453 (core#lam", +"bda (.x.2460) (cadr (cddr .x.2460)))) (core#begin (core#define .max.2454 (core#l", +"ambda (.a.2461 .b.2462) (core#if (< .a.2461 .b.2462) .b.2462 .a.2461))) (core#be", +"gin (core#define .integer?.2455 (core#lambda (.n.2463) (core#if (number? .n.2463", +") (exact? .n.2463) #f))) (core#begin (core#define .normalize.2456 ((core#lambda ", +"(.defs.2464) (core#begin (core#define .normalize.2465 (core#lambda (.e.2466) (co", +"re#if (symbol? .e.2466) (cons (core#quote ref) (cons .e.2466 (core#quote ()))) (", +"core#if (not (pair? .e.2466)) (cons (core#quote quote) (cons .e.2466 (core#quote", +" ()))) ((core#lambda (.key.2467) (core#if ((core#lambda (.it.2468) (core#if .it.", +"2468 .it.2468 #f)) (eqv? .key.2467 (core#quote core#quote))) (cons (core#quote q", +"uote) (cdr .e.2466)) (core#if ((core#lambda (.it.2469) (core#if .it.2469 .it.246", +"9 #f)) (eqv? .key.2467 (core#quote core#define))) ((core#lambda (.var.2470 .val.", +"2471) (core#begin (.defs.2464 (cons .var.2470 (.defs.2464))) (cons (core#quote s", +"et!) (cons .var.2470 (cons (.normalize.2465 .val.2471) (core#quote ())))))) (cad", +"r .e.2466) (.caddr.2452 .e.2466)) (core#if ((core#lambda (.it.2472) (core#if .it", +".2472 .it.2472 #f)) (eqv? .key.2467 (core#quote core#lambda))) ((core#lambda (.a", +"rgs.2473 .body.2474) (with-dynamic-environment (list (cons .defs.2464 (core#quot", +"e ()))) (core#lambda () ((core#lambda (.body.2475) (core#if (null? (.defs.2464))", +" (cons (core#quote lambda) (cons .args.2473 (cons .body.2475 (core#quote ())))) ", +"(cons (core#quote lambda) (cons .args.2473 (cons (cons (cons (core#quote lambda)", +" (cons (.defs.2464) (cons .body.2475 (core#quote ())))) (append (map (core#lambd", +"a (._.2476) #f) (.defs.2464)) (core#quote ()))) (core#quote ())))))) (.normalize", +".2465 .body.2474))))) (cadr .e.2466) (.caddr.2452 .e.2466)) (core#if ((core#lamb", +"da (.it.2477) (core#if .it.2477 .it.2477 #f)) (eqv? .key.2467 (core#quote core#s", +"et!))) (cons (core#quote set!) (map .normalize.2465 (cdr .e.2466))) (core#if ((c", +"ore#lambda (.it.2478) (core#if .it.2478 .it.2478 #f)) (eqv? .key.2467 (core#quot", +"e core#if))) (cons (core#quote if) (map .normalize.2465 (cdr .e.2466))) (core#if", +" ((core#lambda (.it.2479) (core#if .it.2479 .it.2479 #f)) (eqv? .key.2467 (core#", +"quote core#begin))) (cons (core#quote begin) (map .normalize.2465 (cdr .e.2466))", +") (core#if #t (map .normalize.2465 .e.2466) #undefined)))))))) (car .e.2466)))))", +") .normalize.2465)) (make-parameter (core#quote ())))) (core#begin (core#define ", +".transform.2457 ((core#lambda () (core#begin (core#define .uniq.2480 ((core#lamb", +"da (.n.2485) (core#lambda () (core#begin (core#set! .n.2485 (+ .n.2485 1)) (stri", +"ng->symbol (string-append \"$\" (number->string .n.2485)))))) 0)) (core#begin (cor", +"e#define .transform-k.2481 (core#lambda (.e.2486 .k.2487) ((core#lambda (.key.24", +"88) (core#if ((core#lambda (.it.2489) (core#if .it.2489 .it.2489 ((core#lambda (", +".it.2490) (core#if .it.2490 .it.2490 ((core#lambda (.it.2491) (core#if .it.2491 ", +".it.2491 #f)) (eqv? .key.2488 (core#quote quote))))) (eqv? .key.2488 (core#quote", +" lambda))))) (eqv? .key.2488 (core#quote ref))) (.k.2487 (.transform-v.2484 .e.2", +"486)) (core#if ((core#lambda (.it.2492) (core#if .it.2492 .it.2492 #f)) (eqv? .k", +"ey.2488 (core#quote begin))) (.transform-k.2481 (cadr .e.2486) (core#lambda (._.", +"2493) (.transform-k.2481 (.caddr.2452 .e.2486) .k.2487))) (core#if ((core#lambda", +" (.it.2494) (core#if .it.2494 .it.2494 #f)) (eqv? .key.2488 (core#quote set!))) ", +"(.transform-k.2481 (.caddr.2452 .e.2486) (core#lambda (.v.2495) (cons (core#quot", +"e set!) (cons (cadr .e.2486) (cons .v.2495 (cons (.k.2487 (core#quote (undefined", +"))) (core#quote ()))))))) (core#if ((core#lambda (.it.2496) (core#if .it.2496 .i", +"t.2496 #f)) (eqv? .key.2488 (core#quote if))) ((core#lambda (.v.2497 .c.2498) (c", +"ons (cons (core#quote lambda) (cons (cons .c.2498 (core#quote ())) (cons (.trans", +"form-k.2481 (cadr .e.2486) (core#lambda (.x.2499) (cons (core#quote if) (cons .x", +".2499 (cons (.transform-c.2483 (.caddr.2452 .e.2486) .c.2498) (cons (.transform-", +"c.2483 (.cadddr.2453 .e.2486) .c.2498) (core#quote ()))))))) (core#quote ())))) ", +"(cons (cons (core#quote lambda) (cons (cons .v.2497 (core#quote ())) (cons (.k.2", +"487 (cons (core#quote ref) (cons .v.2497 (core#quote ())))) (core#quote ())))) (", +"core#quote ())))) (.uniq.2480) (cons (core#quote ref) (cons (.uniq.2480) (core#q", +"uote ())))) (core#if #t ((core#lambda (.v.2500) ((core#lambda (.c.2501) ((core#l", +"ambda () (.transform-k.2481 (car .e.2486) (core#lambda (.f.2502) (.transform*-k.", +"2482 (cdr .e.2486) (core#lambda (.args.2503) (cons .f.2502 (cons .c.2501 (append", +" .args.2503 (core#quote ()))))))))))) (cons (core#quote lambda) (cons (cons .v.2", +"500 (core#quote ())) (cons (.k.2487 (cons (core#quote ref) (cons .v.2500 (core#q", +"uote ())))) (core#quote ())))))) (.uniq.2480)) #undefined)))))) (car .e.2486))))", +" (core#begin (core#define .transform*-k.2482 (core#lambda (.es.2504 .k.2505) (co", +"re#if (null? .es.2504) (.k.2505 (core#quote ())) (.transform-k.2481 (car .es.250", +"4) (core#lambda (.x.2506) (.transform*-k.2482 (cdr .es.2504) (core#lambda (.xs.2", +"507) (.k.2505 (cons .x.2506 .xs.2507))))))))) (core#begin (core#define .transfor", +"m-c.2483 (core#lambda (.e.2508 .c.2509) ((core#lambda (.key.2510) (core#if ((cor", +"e#lambda (.it.2511) (core#if .it.2511 .it.2511 ((core#lambda (.it.2512) (core#if", +" .it.2512 .it.2512 ((core#lambda (.it.2513) (core#if .it.2513 .it.2513 #f)) (eqv", +"? .key.2510 (core#quote quote))))) (eqv? .key.2510 (core#quote lambda))))) (eqv?", +" .key.2510 (core#quote ref))) (cons .c.2509 (cons (.transform-v.2484 .e.2508) (c", +"ore#quote ()))) (core#if ((core#lambda (.it.2514) (core#if .it.2514 .it.2514 #f)", +") (eqv? .key.2510 (core#quote begin))) (.transform-k.2481 (cadr .e.2508) (core#l", +"ambda (._.2515) (.transform-c.2483 (.caddr.2452 .e.2508) .c.2509))) (core#if ((c", +"ore#lambda (.it.2516) (core#if .it.2516 .it.2516 #f)) (eqv? .key.2510 (core#quot", +"e set!))) (.transform-k.2481 (.caddr.2452 .e.2508) (core#lambda (.v.2517) (cons ", +"(core#quote set!) (cons (cadr .e.2508) (cons .v.2517 (cons (cons .c.2509 (cons (", +"cons (core#quote undefined) (core#quote ())) (core#quote ()))) (core#quote ())))", +")))) (core#if ((core#lambda (.it.2518) (core#if .it.2518 .it.2518 #f)) (eqv? .ke", +"y.2510 (core#quote if))) (core#if (core#if (pair? .c.2509) (eq? (core#quote lamb", +"da) (car .c.2509)) #f) ((core#lambda (.k.2519) (cons (cons (core#quote lambda) (", +"cons (cons .k.2519 (core#quote ())) (cons (.transform-k.2481 (cadr .e.2508) (cor", +"e#lambda (.x.2520) (cons (core#quote if) (cons .x.2520 (cons (.transform-c.2483 ", +"(.caddr.2452 .e.2508) .k.2519) (cons (.transform-c.2483 (.cadddr.2453 .e.2508) .", +"k.2519) (core#quote ()))))))) (core#quote ())))) (cons .c.2509 (core#quote ())))", +") (cons (core#quote ref) (cons (.uniq.2480) (core#quote ())))) (.transform-k.248", +"1 (cadr .e.2508) (core#lambda (.x.2521) (cons (core#quote if) (cons .x.2521 (con", +"s (.transform-c.2483 (.caddr.2452 .e.2508) .c.2509) (cons (.transform-c.2483 (.c", +"adddr.2453 .e.2508) .c.2509) (core#quote ())))))))) (core#if #t (.transform-k.24", +"81 (car .e.2508) (core#lambda (.f.2522) (.transform*-k.2482 (cdr .e.2508) (core#", +"lambda (.args.2523) (cons .f.2522 (cons .c.2509 (append .args.2523 (core#quote (", +"))))))))) #undefined)))))) (car .e.2508)))) (core#begin (core#define .transform-", +"v.2484 (core#lambda (.e.2524) ((core#lambda (.key.2525) (core#if ((core#lambda (", +".it.2526) (core#if .it.2526 .it.2526 ((core#lambda (.it.2527) (core#if .it.2527 ", +".it.2527 #f)) (eqv? .key.2525 (core#quote quote))))) (eqv? .key.2525 (core#quote", +" ref))) .e.2524 (core#if ((core#lambda (.it.2528) (core#if .it.2528 .it.2528 #f)", +") (eqv? .key.2525 (core#quote lambda))) ((core#lambda (.k.2529) (cons (core#quot", +"e lambda) (cons (cons .k.2529 (append (cadr .e.2524) (core#quote ()))) (cons (.t", +"ransform-c.2483 (.caddr.2452 .e.2524) (cons (core#quote ref) (cons .k.2529 (core", +"#quote ())))) (core#quote ()))))) (.uniq.2480)) #undefined))) (car .e.2524)))) (", +"core#lambda (.e.2530) ((core#lambda (.k.2531) (cons (core#quote lambda) (cons (c", +"ons .k.2531 (core#quote ())) (cons (.transform-c.2483 .e.2530 (cons (core#quote ", +"ref) (cons .k.2531 (core#quote ())))) (core#quote ()))))) (.uniq.2480)))))))))))", +" (core#begin (core#define .codegen.2458 ((core#lambda () (core#begin (core#defin", +"e .lookup.2532 (core#lambda (.var.2544 .env.2545) ((core#lambda () (core#begin (", +"core#define .up.2546 (core#lambda (.depth.2547 .env.2548) (core#if (null? .env.2", +"548) (cons (core#quote global) (cons (.emit-objs.2539 .var.2544) (core#quote ())", +")) ((core#lambda () (core#begin (core#define .loop.2549 (core#lambda (.index.255", +"0 .binding.2551) (core#if (symbol? .binding.2551) (core#if (eq? .var.2544 .bindi", +"ng.2551) (cons (core#quote local) (cons .depth.2547 (cons .index.2550 (core#quot", +"e ())))) (.up.2546 (+ .depth.2547 1) (cdr .env.2548))) (core#if (null? .binding.", +"2551) (.up.2546 (+ .depth.2547 1) (cdr .env.2548)) (core#if (eq? .var.2544 (car ", +".binding.2551)) (cons (core#quote local) (cons .depth.2547 (cons .index.2550 (co", +"re#quote ())))) (.loop.2549 (+ .index.2550 1) (cdr .binding.2551))))))) (.loop.2", +"549 1 (car .env.2548)))))))) (.up.2546 0 .env.2545)))))) (core#begin (core#defin", +"e .env.2533 (make-parameter (core#quote ()))) (core#begin (core#define .code.253", +"4 (make-parameter (core#quote ()))) (core#begin (core#define .reps.2535 (make-pa", +"rameter (core#quote ()))) (core#begin (core#define .objs.2536 (make-parameter (c", +"ore#quote ()))) (core#begin (core#define .emit.2537 (core#lambda (.inst.2552) (.", +"code.2534 (cons .inst.2552 (.code.2534))))) (core#begin (core#define .emit-irep.", +"2538 (core#lambda (.irep.2553) ((core#lambda (.n.2554) (core#begin (.reps.2535 (", +"cons .irep.2553 (.reps.2535))) .n.2554)) (length (.reps.2535))))) (core#begin (c", +"ore#define .emit-objs.2539 (core#lambda (.obj.2555) ((core#lambda (.n.2556) (cor", +"e#begin (.objs.2536 (cons .obj.2555 (.objs.2536))) .n.2556)) (length (.objs.2536", +"))))) (core#begin (core#define .make-label.2540 ((core#lambda (.n.2557) (core#la", +"mbda () ((core#lambda (.m.2558) (core#begin (core#set! .n.2557 (+ .n.2557 1)) .m", +".2558)) .n.2557))) 0)) (core#begin (core#define .emit-label.2541 (core#lambda (.", +"label.2559) (.code.2534 (cons .label.2559 (.code.2534))))) (core#begin (core#def", +"ine .codegen-e.2542 (core#lambda (.e.2560) ((core#lambda (.key.2561) (core#if ((", +"core#lambda (.it.2562) (core#if .it.2562 .it.2562 ((core#lambda (.it.2563) (core", +"#if .it.2563 .it.2563 ((core#lambda (.it.2564) (core#if .it.2564 .it.2564 ((core", +"#lambda (.it.2565) (core#if .it.2565 .it.2565 #f)) (eqv? .key.2561 (core#quote u", +"ndefined))))) (eqv? .key.2561 (core#quote quote))))) (eqv? .key.2561 (core#quote", +" lambda))))) (eqv? .key.2561 (core#quote ref))) (.codegen-a.2543 .e.2560 0) (cor", +"e#if ((core#lambda (.it.2566) (core#if .it.2566 .it.2566 #f)) (eqv? .key.2561 (c", +"ore#quote set!))) (core#begin (.codegen-a.2543 (.caddr.2452 .e.2560) 0) (core#be", +"gin ((core#lambda (.x.2567) ((core#lambda (.op.2568) ((core#lambda () (.emit.253", +"7 (cons .op.2568 (cons (core#quote 0) (cdr .x.2567))))))) (core#if (eq? (core#qu", +"ote global) (car .x.2567)) (core#quote GSET) (core#quote LSET)))) (.lookup.2532 ", +"(cadr .e.2560) (.env.2533))) (.codegen-e.2542 (.cadddr.2453 .e.2560)))) (core#if", +" ((core#lambda (.it.2569) (core#if .it.2569 .it.2569 #f)) (eqv? .key.2561 (core#", +"quote if))) (core#begin (.codegen-a.2543 (cadr .e.2560) 0) ((core#lambda (.label", +".2570) (core#begin (.emit.2537 (cons (core#quote COND) (cons (core#quote 0) (con", +"s .label.2570 (core#quote ()))))) (core#begin (.codegen-e.2542 (.caddr.2452 .e.2", +"560)) (core#begin (.emit-label.2541 .label.2570) (.codegen-e.2542 (.cadddr.2453 ", +".e.2560)))))) (.make-label.2540))) (core#if #t (core#begin ((core#lambda () (cor", +"e#begin (core#define .loop.2571 (core#lambda (.i.2572 .e.2573) (core#if (null? .", +"e.2573) #undefined (core#begin (.codegen-a.2543 (car .e.2573) .i.2572) (.loop.25", +"71 (+ .i.2572 1) (cdr .e.2573)))))) (.loop.2571 0 .e.2560)))) (.emit.2537 (cons ", +"(core#quote CALL) (cons (length .e.2560) (core#quote ()))))) #undefined))))) (ca", +"r .e.2560)))) (core#begin (core#define .codegen-a.2543 (core#lambda (.e.2574 .i.", +"2575) ((core#lambda (.key.2576) (core#if ((core#lambda (.it.2577) (core#if .it.2", +"577 .it.2577 #f)) (eqv? .key.2576 (core#quote ref))) ((core#lambda (.x.2578) ((c", +"ore#lambda (.op.2579) ((core#lambda () (.emit.2537 (cons .op.2579 (cons .i.2575 ", +"(cdr .x.2578))))))) (core#if (eq? (core#quote global) (car .x.2578)) (core#quote", +" GREF) (core#quote LREF)))) (.lookup.2532 (cadr .e.2574) (.env.2533))) (core#if ", +"((core#lambda (.it.2580) (core#if .it.2580 .it.2580 #f)) (eqv? .key.2576 (core#q", +"uote quote))) ((core#lambda (.obj.2581) (core#if (eq? #t .obj.2581) (.emit.2537 ", +"(cons (core#quote LOADT) (cons .i.2575 (core#quote ())))) (core#if (eq? #f .obj.", +"2581) (.emit.2537 (cons (core#quote LOADF) (cons .i.2575 (core#quote ())))) (cor", +"e#if (null? .obj.2581) (.emit.2537 (cons (core#quote LOADN) (cons .i.2575 (core#", +"quote ())))) (core#if (core#if (.integer?.2455 .obj.2581) (<= -128 .obj.2581 127", +") #f) (.emit.2537 (cons (core#quote LOADI) (cons .i.2575 (cons .obj.2581 (core#q", +"uote ()))))) ((core#lambda (.n.2582) (.emit.2537 (cons (core#quote LOAD) (cons .", +"i.2575 (cons .n.2582 (core#quote ())))))) (emit-obj .obj.2581))))))) (cadr .e.25", +"74)) (core#if ((core#lambda (.it.2583) (core#if .it.2583 .it.2583 #f)) (eqv? .ke", +"y.2576 (core#quote undefined))) (.emit.2537 (cons (core#quote LOADU) (cons .i.25", +"75 (core#quote ())))) (core#if ((core#lambda (.it.2584) (core#if .it.2584 .it.25", +"84 #f)) (eqv? .key.2576 (core#quote lambda))) ((core#lambda (.frame-size.2585 .a", +"rgc-varg.2586) ((core#lambda (.irep.2587) ((core#lambda (.n.2588) (.emit.2537 (c", +"ons (core#quote PROC) (cons .i.2575 (cons .n.2588 (core#quote ())))))) (.emit-ir", +"ep.2538 .irep.2587))) (with-dynamic-environment (list (cons .code.2534 (core#quo", +"te ())) (cons .env.2533 (cons (cadr .e.2574) (.env.2533))) (cons .reps.2535 (cor", +"e#quote ())) (cons .objs.2536 (core#quote ()))) (core#lambda () (core#begin (.co", +"degen-e.2542 (.caddr.2452 .e.2574)) (list (reverse (.code.2534)) (reverse (.reps", +".2535)) (reverse (.objs.2536)) .argc-varg.2586 .frame-size.2585)))))) ((core#lam", +"bda () (core#begin (core#define .loop.2589 (core#lambda (.e.2590) ((core#lambda ", +"(.key.2591) (core#if ((core#lambda (.it.2592) (core#if .it.2592 .it.2592 ((core#", +"lambda (.it.2593) (core#if .it.2593 .it.2593 ((core#lambda (.it.2594) (core#if .", +"it.2594 .it.2594 ((core#lambda (.it.2595) (core#if .it.2595 .it.2595 #f)) (eqv? ", +".key.2591 (core#quote undefined))))) (eqv? .key.2591 (core#quote quote))))) (eqv", +"? .key.2591 (core#quote lambda))))) (eqv? .key.2591 (core#quote ref))) 1 (core#i", +"f ((core#lambda (.it.2596) (core#if .it.2596 .it.2596 #f)) (eqv? .key.2591 (core", +"#quote if))) (.max.2454 (.loop.2589 (.caddr.2452 .e.2590)) (.loop.2589 (.cadddr.", +"2453 .e.2590))) (core#if ((core#lambda (.it.2597) (core#if .it.2597 .it.2597 #f)", +") (eqv? .key.2591 (core#quote set!))) (.loop.2589 (.cadddr.2453 .e.2590)) (core#", +"if #t (+ 1 (length .e.2590)) #undefined))))) (car .e.2590)))) (.loop.2589 (.cadd", +"r.2452 .e.2574))))) ((core#lambda () (core#begin (core#define .loop.2598 (core#l", +"ambda (.args.2599 .c.2600) (core#if (symbol? .args.2599) (cons (+ 1 .c.2600) #t)", +" (core#if (null? .args.2599) (cons .c.2600 #f) (.loop.2598 (cdr .args.2599) (+ 1", +" .c.2600)))))) (.loop.2598 (cadr .e.2574) 0))))) #undefined))))) (car .e.2574)))", +") (core#lambda (.e.2601) (with-dynamic-environment (list (cons .code.2534 (core#", +"quote ())) (cons .env.2533 (core#quote ())) (cons .reps.2535 (core#quote ())) (c", +"ons .objs.2536 (core#quote ()))) (core#lambda () (core#begin (.codegen-e.2542 .e", +".2601) (car (.reps.2535))))))))))))))))))))) (core#lambda (.e.2602) (.codegen.24", +"58 (.transform.2457 (.normalize.2456 .e.2602)))))))))))))) (core#lambda (.compil", +"e.2603) (core#set! compile .compile.2603)))) (core#define eval (core#lambda (.ex", +"pr.2604 . .env.2605) (load (expand .expr.2604 (core#if (null? .env.2605) default", +"-environment (car .env.2605)))))))))", }; #endif @@ -429,154 +619,154 @@ static const char boot_library_rom[][80] = { "egin (core#define library-environment #undefined) (core#begin (core#define libra", "ry-exports #undefined) (core#begin (core#define library-import #undefined) (core", "#begin (core#define library-export #undefined) (call-with-values (core#lambda ()", -" ((core#lambda () (core#begin (core#define .mangle.2459 (core#lambda (.name.2468", -") (core#begin (core#if (null? .name.2468) (error \"library name should be a list ", -"of at least one symbols\" .name.2468) #undefined) (core#begin (core#define .->str", -"ing.2469 (core#lambda (.n.2471) (core#if (symbol? .n.2471) ((core#lambda (.str.2", -"472) (core#begin (string-for-each (core#lambda (.c.2473) (core#if ((core#lambda ", -"(.it.2474) (core#if .it.2474 .it.2474 ((core#lambda (.it.2475) (core#if .it.2475", -" .it.2475 #f)) (char=? .c.2473 #\\:)))) (char=? .c.2473 #\\.)) (error \"elements of", -" library name may not contain '.' or ':'\" .n.2471) #undefined)) .str.2472) .str.", -"2472)) (symbol->string .n.2471)) (core#if (core#if (number? .n.2471) (core#if (e", -"xact? .n.2471) (<= 0 .n.2471) #f) #f) (number->string .n.2471) (error \"symbol or", -" non-negative integer is required\" .n.2471))))) (core#begin (core#define .join.2", -"470 (core#lambda (.strs.2476 .delim.2477) ((core#lambda () (core#begin (core#def", -"ine .loop.2478 (core#lambda (.res.2479 .strs.2480) (core#if (null? .strs.2480) .", -"res.2479 (.loop.2478 (string-append .res.2479 .delim.2477 (car .strs.2480)) (cdr", -" .strs.2480))))) (.loop.2478 (car .strs.2476) (cdr .strs.2476))))))) (core#if (s", -"ymbol? .name.2468) .name.2468 (string->symbol (.join.2470 (map .->string.2469 .n", -"ame.2468) \".\")))))))) (core#begin (core#define .current-library.2460 (make-param", -"eter (core#quote (picrin user)) .mangle.2459)) (core#begin (core#define .*librar", -"ies*.2461 (make-dictionary)) (core#begin (core#define .find-library.2462 (core#l", -"ambda (.name.2481) (dictionary-has? .*libraries*.2461 (.mangle.2459 .name.2481))", -")) (core#begin (core#define .make-library.2463 (core#lambda (.name.2482) ((core#", -"lambda (.name.2483) ((core#lambda (.env.2484 .exports.2485) (core#begin (set-ide", -"ntifier! (core#quote define-library) (core#quote define-library) .env.2484) (cor", -"e#begin (set-identifier! (core#quote import) (core#quote import) .env.2484) (cor", -"e#begin (set-identifier! (core#quote export) (core#quote export) .env.2484) (cor", +" ((core#lambda () (core#begin (core#define .mangle.2606 (core#lambda (.name.2615", +") (core#begin (core#if (null? .name.2615) (error \"library name should be a list ", +"of at least one symbols\" .name.2615) #undefined) (core#begin (core#define .->str", +"ing.2616 (core#lambda (.n.2618) (core#if (symbol? .n.2618) ((core#lambda (.str.2", +"619) (core#begin (string-for-each (core#lambda (.c.2620) (core#if ((core#lambda ", +"(.it.2621) (core#if .it.2621 .it.2621 ((core#lambda (.it.2622) (core#if .it.2622", +" .it.2622 #f)) (char=? .c.2620 #\\:)))) (char=? .c.2620 #\\.)) (error \"elements of", +" library name may not contain '.' or ':'\" .n.2618) #undefined)) .str.2619) .str.", +"2619)) (symbol->string .n.2618)) (core#if (core#if (number? .n.2618) (core#if (e", +"xact? .n.2618) (<= 0 .n.2618) #f) #f) (number->string .n.2618) (error \"symbol or", +" non-negative integer is required\" .n.2618))))) (core#begin (core#define .join.2", +"617 (core#lambda (.strs.2623 .delim.2624) ((core#lambda () (core#begin (core#def", +"ine .loop.2625 (core#lambda (.res.2626 .strs.2627) (core#if (null? .strs.2627) .", +"res.2626 (.loop.2625 (string-append .res.2626 .delim.2624 (car .strs.2627)) (cdr", +" .strs.2627))))) (.loop.2625 (car .strs.2623) (cdr .strs.2623))))))) (core#if (s", +"ymbol? .name.2615) .name.2615 (string->symbol (.join.2617 (map .->string.2616 .n", +"ame.2615) \".\")))))))) (core#begin (core#define .current-library.2607 (make-param", +"eter (core#quote (picrin user)) .mangle.2606)) (core#begin (core#define .*librar", +"ies*.2608 (make-dictionary)) (core#begin (core#define .find-library.2609 (core#l", +"ambda (.name.2628) (dictionary-has? .*libraries*.2608 (.mangle.2606 .name.2628))", +")) (core#begin (core#define .make-library.2610 (core#lambda (.name.2629) ((core#", +"lambda (.name.2630) ((core#lambda (.env.2631 .exports.2632) (core#begin (set-ide", +"ntifier! (core#quote define-library) (core#quote define-library) .env.2631) (cor", +"e#begin (set-identifier! (core#quote import) (core#quote import) .env.2631) (cor", +"e#begin (set-identifier! (core#quote export) (core#quote export) .env.2631) (cor", "e#begin (set-identifier! (core#quote cond-expand) (core#quote cond-expand) .env.", -"2484) (dictionary-set! .*libraries*.2461 .name.2483 (cons .env.2484 .exports.248", -"5))))))) (make-environment (string->symbol (string-append (symbol->string .name.", -"2483) \":\"))) (make-dictionary))) (.mangle.2459 .name.2482)))) (core#begin (core#", -"define .library-environment.2464 (core#lambda (.name.2486) (car (dictionary-ref ", -".*libraries*.2461 (.mangle.2459 .name.2486))))) (core#begin (core#define .librar", -"y-exports.2465 (core#lambda (.name.2487) (cdr (dictionary-ref .*libraries*.2461 ", -"(.mangle.2459 .name.2487))))) (core#begin (core#define .library-import.2466 (cor", -"e#lambda (.name.2488 .sym.2489 .alias.2490) ((core#lambda (.uid.2491) ((core#lam", -"bda (.env.2492) (set-identifier! .alias.2490 .uid.2491 .env.2492)) (.library-env", -"ironment.2464 (.current-library.2460)))) (dictionary-ref (.library-exports.2465 ", -".name.2488) .sym.2489)))) (core#begin (core#define .library-export.2467 (core#la", -"mbda (.sym.2493 .alias.2494) ((core#lambda (.env.2495 .exports.2496) (dictionary", -"-set! .exports.2496 .alias.2494 (find-identifier .sym.2493 .env.2495))) (.librar", -"y-environment.2464 (.current-library.2460)) (.library-exports.2465 (.current-lib", -"rary.2460))))) (core#begin ((core#lambda (.define-transformer.2497) (core#begin ", -"(.define-transformer.2497 (core#quote define-library) (core#lambda (.form.2498 .", -"_.2499) ((core#lambda (.name.2500 .body.2501) (core#begin ((core#lambda (.it.250", -"2) (core#if .it.2502 .it.2502 ((core#lambda (.it.2503) (core#if .it.2503 .it.250", -"3 #f)) (.make-library.2463 .name.2500)))) (.find-library.2462 .name.2500)) (with", -"-dynamic-environment (list (cons .current-library.2460 .name.2500)) (core#lambda", -" () (for-each (core#lambda (.expr.2504) (eval .expr.2504 .name.2500)) .body.2501", -"))))) (cadr .form.2498) (cddr .form.2498)))) (core#begin (.define-transformer.24", -"97 (core#quote cond-expand) (core#lambda (.form.2505 ._.2506) ((core#lambda (.te", -"st.2507) (core#begin (core#set! .test.2507 (core#lambda (.form.2508) ((core#lamb", -"da (.it.2509) (core#if .it.2509 .it.2509 ((core#lambda (.it.2510) (core#if .it.2", -"510 .it.2510 ((core#lambda (.it.2511) (core#if .it.2511 .it.2511 #f)) (core#if (", -"pair? .form.2508) ((core#lambda (.key.2512) (core#if ((core#lambda (.it.2513) (c", -"ore#if .it.2513 .it.2513 #f)) (eqv? .key.2512 (core#quote library))) (.find-libr", -"ary.2462 (cadr .form.2508)) (core#if ((core#lambda (.it.2514) (core#if .it.2514 ", -".it.2514 #f)) (eqv? .key.2512 (core#quote not))) (not (.test.2507 (cadr .form.25", -"08))) (core#if ((core#lambda (.it.2515) (core#if .it.2515 .it.2515 #f)) (eqv? .k", -"ey.2512 (core#quote and))) ((core#lambda () (core#begin (core#define .loop.2516 ", -"(core#lambda (.form.2517) ((core#lambda (.it.2518) (core#if .it.2518 .it.2518 ((", -"core#lambda (.it.2519) (core#if .it.2519 .it.2519 #f)) (core#if (.test.2507 (car", -" .form.2517)) (.loop.2516 (cdr .form.2517)) #f)))) (null? .form.2517)))) (.loop.", -"2516 (cdr .form.2508))))) (core#if ((core#lambda (.it.2520) (core#if .it.2520 .i", -"t.2520 #f)) (eqv? .key.2512 (core#quote or))) ((core#lambda () (core#begin (core", -"#define .loop.2521 (core#lambda (.form.2522) (core#if (pair? .form.2522) ((core#", -"lambda (.it.2523) (core#if .it.2523 .it.2523 ((core#lambda (.it.2524) (core#if .", -"it.2524 .it.2524 #f)) (.loop.2521 (cdr .form.2522))))) (.test.2507 (car .form.25", -"22))) #f))) (.loop.2521 (cdr .form.2508))))) (core#if #t #f #undefined)))))) (ca", -"r .form.2508)) #f)))) (core#if (symbol? .form.2508) (memq .form.2508 (features))", -" #f)))) (eq? .form.2508 (core#quote else))))) ((core#lambda () (core#begin (core", -"#define .loop.2525 (core#lambda (.clauses.2526) (core#if (null? .clauses.2526) #", -"undefined (core#if (.test.2507 (caar .clauses.2526)) (cons (make-identifier (cor", -"e#quote begin) default-environment) (append (cdar .clauses.2526) (core#quote ())", -")) (.loop.2525 (cdr .clauses.2526)))))) (.loop.2525 (cdr .form.2505))))))) #unde", -"fined))) (core#begin (.define-transformer.2497 (core#quote import) (core#lambda ", -"(.form.2527 ._.2528) ((core#lambda (.caddr.2529 .prefix.2530 .getlib.2531) ((cor", -"e#lambda (.extract.2532 .collect.2533) (core#begin (core#set! .extract.2532 (cor", -"e#lambda (.spec.2534) ((core#lambda (.key.2535) (core#if ((core#lambda (.it.2536", -") (core#if .it.2536 .it.2536 ((core#lambda (.it.2537) (core#if .it.2537 .it.2537", -" ((core#lambda (.it.2538) (core#if .it.2538 .it.2538 ((core#lambda (.it.2539) (c", -"ore#if .it.2539 .it.2539 #f)) (eqv? .key.2535 (core#quote except))))) (eqv? .key", -".2535 (core#quote prefix))))) (eqv? .key.2535 (core#quote rename))))) (eqv? .key", -".2535 (core#quote only))) (.extract.2532 (cadr .spec.2534)) (core#if #t (.getlib", -".2531 .spec.2534) #undefined))) (car .spec.2534)))) (core#begin (core#set! .coll", -"ect.2533 (core#lambda (.spec.2540) ((core#lambda (.key.2541) (core#if ((core#lam", -"bda (.it.2542) (core#if .it.2542 .it.2542 #f)) (eqv? .key.2541 (core#quote only)", -")) ((core#lambda (.alist.2543) (map (core#lambda (.var.2544) (assq .var.2544 .al", -"ist.2543)) (cddr .spec.2540))) (.collect.2533 (cadr .spec.2540))) (core#if ((cor", -"e#lambda (.it.2545) (core#if .it.2545 .it.2545 #f)) (eqv? .key.2541 (core#quote ", -"rename))) ((core#lambda (.alist.2546 .renames.2547) (map (core#lambda (.s.2548) ", -"((core#lambda (.it.2549) (core#if .it.2549 .it.2549 ((core#lambda (.it.2550) (co", -"re#if .it.2550 .it.2550 #f)) .s.2548))) (assq (car .s.2548) .renames.2547))) .al", -"ist.2546)) (.collect.2533 (cadr .spec.2540)) (map (core#lambda (.x.2551) (cons (", -"car .x.2551) (cadr .x.2551))) (cddr .spec.2540))) (core#if ((core#lambda (.it.25", -"52) (core#if .it.2552 .it.2552 #f)) (eqv? .key.2541 (core#quote prefix))) ((core", -"#lambda (.alist.2553) (map (core#lambda (.s.2554) (cons (.prefix.2530 (.caddr.25", -"29 .spec.2540) (car .s.2554)) (cdr .s.2554))) .alist.2553)) (.collect.2533 (cadr", -" .spec.2540))) (core#if ((core#lambda (.it.2555) (core#if .it.2555 .it.2555 #f))", -" (eqv? .key.2541 (core#quote except))) ((core#lambda (.alist.2556) ((core#lambda", -" () (core#begin (core#define .loop.2557 (core#lambda (.alist.2558) (core#if (nul", -"l? .alist.2558) (core#quote ()) (core#if (memq (caar .alist.2558) (cddr .spec.25", -"40)) (.loop.2557 (cdr .alist.2558)) (cons (car .alist.2558) (.loop.2557 (cdr .al", -"ist.2558))))))) (.loop.2557 .alist.2556))))) (.collect.2533 (cadr .spec.2540))) ", -"(core#if #t (dictionary-map (core#lambda (.x.2559) (cons .x.2559 .x.2559)) (.lib", -"rary-exports.2465 (.getlib.2531 .spec.2540))) #undefined)))))) (car .spec.2540))", -")) ((core#lambda (.import.2560) (core#begin (core#set! .import.2560 (core#lambda", -" (.spec.2561) ((core#lambda (.lib.2562 .alist.2563) (for-each (core#lambda (.slo", -"t.2564) (.library-import.2466 .lib.2562 (cdr .slot.2564) (car .slot.2564))) .ali", -"st.2563)) (.extract.2532 .spec.2561) (.collect.2533 .spec.2561)))) (for-each .im", -"port.2560 (cdr .form.2527)))) #undefined)))) #undefined #undefined)) (core#lambd", -"a (.x.2565) (car (cdr (cdr .x.2565)))) (core#lambda (.prefix.2566 .symbol.2567) ", -"(string->symbol (string-append (symbol->string .prefix.2566) (symbol->string .sy", -"mbol.2567)))) (core#lambda (.name.2568) (core#if (.find-library.2462 .name.2568)", -" .name.2568 (error \"library not found\" .name.2568)))))) (.define-transformer.249", -"7 (core#quote export) (core#lambda (.form.2569 ._.2570) ((core#lambda (.collect.", -"2571 .export.2572) (core#begin (core#set! .collect.2571 (core#lambda (.spec.2573", -") (core#if (symbol? .spec.2573) (cons .spec.2573 .spec.2573) (core#if (core#if (", -"list? .spec.2573) (core#if (= (length .spec.2573) 3) (eq? (car .spec.2573) (core", -"#quote rename)) #f) #f) (cons (list-ref .spec.2573 1) (list-ref .spec.2573 2)) (", -"error \"malformed export\"))))) (core#begin (core#set! .export.2572 (core#lambda (", -".spec.2574) ((core#lambda (.slot.2575) (.library-export.2467 (car .slot.2575) (c", -"dr .slot.2575))) (.collect.2571 .spec.2574)))) (for-each .export.2572 (cdr .form", -".2569))))) #undefined #undefined))))))) (core#lambda (.name.2576 .macro.2577) (d", -"ictionary-set! (macro-objects) .name.2576 .macro.2577))) (core#begin ((core#lamb", -"da () (core#begin (.make-library.2463 (core#quote (picrin base))) (core#begin (s", -"et-car! (dictionary-ref .*libraries*.2461 (.mangle.2459 (core#quote (picrin base", -")))) default-environment) (core#begin ((core#lambda (.exports.2578) ((core#lambd", -"a (.export-keyword.2579) ((core#lambda () (core#begin (for-each .export-keyword.", -"2579 (core#quote (define lambda quote set! if begin define-macro let let* letrec", +"2631) (dictionary-set! .*libraries*.2608 .name.2630 (cons .env.2631 .exports.263", +"2))))))) (make-environment (string->symbol (string-append (symbol->string .name.", +"2630) \":\"))) (make-dictionary))) (.mangle.2606 .name.2629)))) (core#begin (core#", +"define .library-environment.2611 (core#lambda (.name.2633) (car (dictionary-ref ", +".*libraries*.2608 (.mangle.2606 .name.2633))))) (core#begin (core#define .librar", +"y-exports.2612 (core#lambda (.name.2634) (cdr (dictionary-ref .*libraries*.2608 ", +"(.mangle.2606 .name.2634))))) (core#begin (core#define .library-import.2613 (cor", +"e#lambda (.name.2635 .sym.2636 .alias.2637) ((core#lambda (.uid.2638) ((core#lam", +"bda (.env.2639) (set-identifier! .alias.2637 .uid.2638 .env.2639)) (.library-env", +"ironment.2611 (.current-library.2607)))) (dictionary-ref (.library-exports.2612 ", +".name.2635) .sym.2636)))) (core#begin (core#define .library-export.2614 (core#la", +"mbda (.sym.2640 .alias.2641) ((core#lambda (.env.2642 .exports.2643) (dictionary", +"-set! .exports.2643 .alias.2641 (find-identifier .sym.2640 .env.2642))) (.librar", +"y-environment.2611 (.current-library.2607)) (.library-exports.2612 (.current-lib", +"rary.2607))))) (core#begin ((core#lambda (.define-transformer.2644) (core#begin ", +"(.define-transformer.2644 (core#quote define-library) (core#lambda (.form.2645 .", +"_.2646) ((core#lambda (.name.2647 .body.2648) (core#begin ((core#lambda (.it.264", +"9) (core#if .it.2649 .it.2649 ((core#lambda (.it.2650) (core#if .it.2650 .it.265", +"0 #f)) (.make-library.2610 .name.2647)))) (.find-library.2609 .name.2647)) (with", +"-dynamic-environment (list (cons .current-library.2607 .name.2647)) (core#lambda", +" () (for-each (core#lambda (.expr.2651) (eval .expr.2651 .name.2647)) .body.2648", +"))))) (cadr .form.2645) (cddr .form.2645)))) (core#begin (.define-transformer.26", +"44 (core#quote cond-expand) (core#lambda (.form.2652 ._.2653) ((core#lambda (.te", +"st.2654) (core#begin (core#set! .test.2654 (core#lambda (.form.2655) ((core#lamb", +"da (.it.2656) (core#if .it.2656 .it.2656 ((core#lambda (.it.2657) (core#if .it.2", +"657 .it.2657 ((core#lambda (.it.2658) (core#if .it.2658 .it.2658 #f)) (core#if (", +"pair? .form.2655) ((core#lambda (.key.2659) (core#if ((core#lambda (.it.2660) (c", +"ore#if .it.2660 .it.2660 #f)) (eqv? .key.2659 (core#quote library))) (.find-libr", +"ary.2609 (cadr .form.2655)) (core#if ((core#lambda (.it.2661) (core#if .it.2661 ", +".it.2661 #f)) (eqv? .key.2659 (core#quote not))) (not (.test.2654 (cadr .form.26", +"55))) (core#if ((core#lambda (.it.2662) (core#if .it.2662 .it.2662 #f)) (eqv? .k", +"ey.2659 (core#quote and))) ((core#lambda () (core#begin (core#define .loop.2663 ", +"(core#lambda (.form.2664) ((core#lambda (.it.2665) (core#if .it.2665 .it.2665 ((", +"core#lambda (.it.2666) (core#if .it.2666 .it.2666 #f)) (core#if (.test.2654 (car", +" .form.2664)) (.loop.2663 (cdr .form.2664)) #f)))) (null? .form.2664)))) (.loop.", +"2663 (cdr .form.2655))))) (core#if ((core#lambda (.it.2667) (core#if .it.2667 .i", +"t.2667 #f)) (eqv? .key.2659 (core#quote or))) ((core#lambda () (core#begin (core", +"#define .loop.2668 (core#lambda (.form.2669) (core#if (pair? .form.2669) ((core#", +"lambda (.it.2670) (core#if .it.2670 .it.2670 ((core#lambda (.it.2671) (core#if .", +"it.2671 .it.2671 #f)) (.loop.2668 (cdr .form.2669))))) (.test.2654 (car .form.26", +"69))) #f))) (.loop.2668 (cdr .form.2655))))) (core#if #t #f #undefined)))))) (ca", +"r .form.2655)) #f)))) (core#if (symbol? .form.2655) (memq .form.2655 (features))", +" #f)))) (eq? .form.2655 (core#quote else))))) ((core#lambda () (core#begin (core", +"#define .loop.2672 (core#lambda (.clauses.2673) (core#if (null? .clauses.2673) #", +"undefined (core#if (.test.2654 (caar .clauses.2673)) (cons (make-identifier (cor", +"e#quote begin) default-environment) (append (cdar .clauses.2673) (core#quote ())", +")) (.loop.2672 (cdr .clauses.2673)))))) (.loop.2672 (cdr .form.2652))))))) #unde", +"fined))) (core#begin (.define-transformer.2644 (core#quote import) (core#lambda ", +"(.form.2674 ._.2675) ((core#lambda (.caddr.2676 .prefix.2677 .getlib.2678) ((cor", +"e#lambda (.extract.2679 .collect.2680) (core#begin (core#set! .extract.2679 (cor", +"e#lambda (.spec.2681) ((core#lambda (.key.2682) (core#if ((core#lambda (.it.2683", +") (core#if .it.2683 .it.2683 ((core#lambda (.it.2684) (core#if .it.2684 .it.2684", +" ((core#lambda (.it.2685) (core#if .it.2685 .it.2685 ((core#lambda (.it.2686) (c", +"ore#if .it.2686 .it.2686 #f)) (eqv? .key.2682 (core#quote except))))) (eqv? .key", +".2682 (core#quote prefix))))) (eqv? .key.2682 (core#quote rename))))) (eqv? .key", +".2682 (core#quote only))) (.extract.2679 (cadr .spec.2681)) (core#if #t (.getlib", +".2678 .spec.2681) #undefined))) (car .spec.2681)))) (core#begin (core#set! .coll", +"ect.2680 (core#lambda (.spec.2687) ((core#lambda (.key.2688) (core#if ((core#lam", +"bda (.it.2689) (core#if .it.2689 .it.2689 #f)) (eqv? .key.2688 (core#quote only)", +")) ((core#lambda (.alist.2690) (map (core#lambda (.var.2691) (assq .var.2691 .al", +"ist.2690)) (cddr .spec.2687))) (.collect.2680 (cadr .spec.2687))) (core#if ((cor", +"e#lambda (.it.2692) (core#if .it.2692 .it.2692 #f)) (eqv? .key.2688 (core#quote ", +"rename))) ((core#lambda (.alist.2693 .renames.2694) (map (core#lambda (.s.2695) ", +"((core#lambda (.it.2696) (core#if .it.2696 .it.2696 ((core#lambda (.it.2697) (co", +"re#if .it.2697 .it.2697 #f)) .s.2695))) (assq (car .s.2695) .renames.2694))) .al", +"ist.2693)) (.collect.2680 (cadr .spec.2687)) (map (core#lambda (.x.2698) (cons (", +"car .x.2698) (cadr .x.2698))) (cddr .spec.2687))) (core#if ((core#lambda (.it.26", +"99) (core#if .it.2699 .it.2699 #f)) (eqv? .key.2688 (core#quote prefix))) ((core", +"#lambda (.alist.2700) (map (core#lambda (.s.2701) (cons (.prefix.2677 (.caddr.26", +"76 .spec.2687) (car .s.2701)) (cdr .s.2701))) .alist.2700)) (.collect.2680 (cadr", +" .spec.2687))) (core#if ((core#lambda (.it.2702) (core#if .it.2702 .it.2702 #f))", +" (eqv? .key.2688 (core#quote except))) ((core#lambda (.alist.2703) ((core#lambda", +" () (core#begin (core#define .loop.2704 (core#lambda (.alist.2705) (core#if (nul", +"l? .alist.2705) (core#quote ()) (core#if (memq (caar .alist.2705) (cddr .spec.26", +"87)) (.loop.2704 (cdr .alist.2705)) (cons (car .alist.2705) (.loop.2704 (cdr .al", +"ist.2705))))))) (.loop.2704 .alist.2703))))) (.collect.2680 (cadr .spec.2687))) ", +"(core#if #t (dictionary-map (core#lambda (.x.2706) (cons .x.2706 .x.2706)) (.lib", +"rary-exports.2612 (.getlib.2678 .spec.2687))) #undefined)))))) (car .spec.2687))", +")) ((core#lambda (.import.2707) (core#begin (core#set! .import.2707 (core#lambda", +" (.spec.2708) ((core#lambda (.lib.2709 .alist.2710) (for-each (core#lambda (.slo", +"t.2711) (.library-import.2613 .lib.2709 (cdr .slot.2711) (car .slot.2711))) .ali", +"st.2710)) (.extract.2679 .spec.2708) (.collect.2680 .spec.2708)))) (for-each .im", +"port.2707 (cdr .form.2674)))) #undefined)))) #undefined #undefined)) (core#lambd", +"a (.x.2712) (car (cdr (cdr .x.2712)))) (core#lambda (.prefix.2713 .symbol.2714) ", +"(string->symbol (string-append (symbol->string .prefix.2713) (symbol->string .sy", +"mbol.2714)))) (core#lambda (.name.2715) (core#if (.find-library.2609 .name.2715)", +" .name.2715 (error \"library not found\" .name.2715)))))) (.define-transformer.264", +"4 (core#quote export) (core#lambda (.form.2716 ._.2717) ((core#lambda (.collect.", +"2718 .export.2719) (core#begin (core#set! .collect.2718 (core#lambda (.spec.2720", +") (core#if (symbol? .spec.2720) (cons .spec.2720 .spec.2720) (core#if (core#if (", +"list? .spec.2720) (core#if (= (length .spec.2720) 3) (eq? (car .spec.2720) (core", +"#quote rename)) #f) #f) (cons (list-ref .spec.2720 1) (list-ref .spec.2720 2)) (", +"error \"malformed export\"))))) (core#begin (core#set! .export.2719 (core#lambda (", +".spec.2721) ((core#lambda (.slot.2722) (.library-export.2614 (car .slot.2722) (c", +"dr .slot.2722))) (.collect.2718 .spec.2721)))) (for-each .export.2719 (cdr .form", +".2716))))) #undefined #undefined))))))) (core#lambda (.name.2723 .macro.2724) (d", +"ictionary-set! (macro-objects) .name.2723 .macro.2724))) (core#begin ((core#lamb", +"da () (core#begin (.make-library.2610 (core#quote (picrin base))) (core#begin (s", +"et-car! (dictionary-ref .*libraries*.2608 (.mangle.2606 (core#quote (picrin base", +")))) default-environment) (core#begin ((core#lambda (.exports.2725) ((core#lambd", +"a (.export-keyword.2726) ((core#lambda () (core#begin (for-each .export-keyword.", +"2726 (core#quote (define lambda quote set! if begin define-macro let let* letrec", " letrec* let-values let*-values define-values quasiquote unquote unquote-splicin", "g and or cond case else => do when unless parameterize define-record-type))) (co", -"re#begin (.export-keyword.2579 (core#quote boolean?)) (dictionary-for-each .expo", -"rt-keyword.2579 (global-objects))))))) (core#lambda (.keyword.2580) (dictionary-", -"set! .exports.2578 .keyword.2580 .keyword.2580)))) (.library-exports.2465 (core#", -"quote (picrin base)))) (core#begin (core#set! eval ((core#lambda (.e.2581) (core", -"#lambda (.expr.2582 . .lib.2583) ((core#lambda (.lib.2584) (with-dynamic-environ", -"ment (list (cons .current-library.2460 .lib.2584)) (core#lambda () (.e.2581 .exp", -"r.2582 (.library-environment.2464 .lib.2584))))) (core#if (null? .lib.2583) (.cu", -"rrent-library.2460) (car .lib.2583))))) eval)) (.make-library.2463 (core#quote (", -"picrin user))))))))) (values .current-library.2460 .find-library.2462 .make-libr", -"ary.2463 .library-environment.2464 .library-exports.2465 .library-import.2466 .l", -"ibrary-export.2467))))))))))))))) (core#lambda (.current-library.2585 .find-libr", -"ary.2586 .make-library.2587 .library-environment.2588 .library-exports.2589 .lib", -"rary-import.2590 .library-export.2591) (core#begin (core#set! current-library .c", -"urrent-library.2585) (core#begin (core#set! find-library .find-library.2586) (co", -"re#begin (core#set! make-library .make-library.2587) (core#begin (core#set! libr", -"ary-environment .library-environment.2588) (core#begin (core#set! library-export", -"s .library-exports.2589) (core#begin (core#set! library-import .library-import.2", -"590) (core#set! library-export .library-export.2591))))))))))))))))", +"re#begin (.export-keyword.2726 (core#quote boolean?)) (dictionary-for-each .expo", +"rt-keyword.2726 (global-objects))))))) (core#lambda (.keyword.2727) (dictionary-", +"set! .exports.2725 .keyword.2727 .keyword.2727)))) (.library-exports.2612 (core#", +"quote (picrin base)))) (core#begin (core#set! eval ((core#lambda (.e.2728) (core", +"#lambda (.expr.2729 . .lib.2730) ((core#lambda (.lib.2731) (with-dynamic-environ", +"ment (list (cons .current-library.2607 .lib.2731)) (core#lambda () (.e.2728 .exp", +"r.2729 (.library-environment.2611 .lib.2731))))) (core#if (null? .lib.2730) (.cu", +"rrent-library.2607) (car .lib.2730))))) eval)) (.make-library.2610 (core#quote (", +"picrin user))))))))) (values .current-library.2607 .find-library.2609 .make-libr", +"ary.2610 .library-environment.2611 .library-exports.2612 .library-import.2613 .l", +"ibrary-export.2614))))))))))))))) (core#lambda (.current-library.2732 .find-libr", +"ary.2733 .make-library.2734 .library-environment.2735 .library-exports.2736 .lib", +"rary-import.2737 .library-export.2738) (core#begin (core#set! current-library .c", +"urrent-library.2732) (core#begin (core#set! find-library .find-library.2733) (co", +"re#begin (core#set! make-library .make-library.2734) (core#begin (core#set! libr", +"ary-environment .library-environment.2735) (core#begin (core#set! library-export", +"s .library-exports.2736) (core#begin (core#set! library-import .library-import.2", +"737) (core#set! library-export .library-export.2738))))))))))))))))", }; #endif diff --git a/piclib/compile.scm b/piclib/compile.scm index 8ebe5d91..b25717ab 100644 --- a/piclib/compile.scm +++ b/piclib/compile.scm @@ -1,246 +1,256 @@ -(define-values (make-identifier - identifier? - identifier=? - identifier-name - identifier-environment - make-environment - default-environment - environment? - find-identifier - add-identifier! - set-identifier! - macro-objects - compile - eval) +(begin + + ;; expand + + (define-values (make-identifier + identifier? + identifier=? + identifier-name + identifier-environment + make-environment + default-environment + environment? + find-identifier + add-identifier! + set-identifier! + macro-objects + expand) + (let () + + ;; identifier + + (define-record-type identifier + (make-identifier name env) + %identifier? + (name identifier-name) + (env identifier-environment)) + + (define (identifier? obj) + (or (symbol? obj) (%identifier? obj))) + + (define (identifier=? id1 id2) + (cond + ((and (symbol? id1) (symbol? id2)) + (eq? id1 id2)) + ((and (%identifier? id1) (%identifier? id2)) + (eq? (find-identifier (identifier-name id1) (identifier-environment id1)) + (find-identifier (identifier-name id2) (identifier-environment id2)))) + (else + #f))) + + (set! equal? + (let ((e? equal?)) + (lambda (x y) + (if (%identifier? x) + (identifier=? x y) + (e? x y))))) + + + ;; environment + + (define-record-type environment + (%make-environment parent prefix binding) + environment? + (parent environment-parent) + (prefix environment-prefix) + (binding environment-binding)) + + (define (search-scope id env) + ((environment-binding env) id)) + + (define (find-identifier id env) + (or (search-scope id env) + (let ((parent (environment-parent env))) + (if parent + (find-identifier id parent) + (if (symbol? id) + (add-identifier! id env) + (find-identifier (identifier-name id) + (identifier-environment id))))))) + + (define add-identifier! + (let ((uniq + (let ((n 0)) + (lambda (id) + (let ((m n)) + (set! n (+ n 1)) + (string->symbol + (string-append + "." + (symbol->string + (let loop ((id id)) + (if (symbol? id) + id + (loop (identifier-name id))))) + "." + (number->string m)))))))) + (lambda (id env) + (or (search-scope id env) + (if (and (not (environment-parent env)) (symbol? id)) + (string->symbol + (string-append + (environment-prefix env) + (symbol->string id))) + (let ((uid (uniq id))) + (set-identifier! id uid env) + uid)))))) + + (define (set-identifier! id uid env) + ((environment-binding env) id uid)) + + (define (make-environment prefix) + (%make-environment #f (symbol->string prefix) (make-ephemeron-table))) + + (define default-environment + (let ((env (make-environment (string->symbol "")))) + (for-each + (lambda (x) (set-identifier! x x env)) + '(core#define + core#set! + core#quote + core#lambda + core#if + core#begin + core#define-macro)) + env)) + + (define (extend-environment parent) + (%make-environment parent #f (make-ephemeron-table))) + + + ;; macro + + (define global-macro-table + (make-dictionary)) + + (define (find-macro uid) + (and (dictionary-has? global-macro-table uid) + (dictionary-ref global-macro-table uid))) + + (define (add-macro! uid expander) ; TODO warn on redefinition + (dictionary-set! global-macro-table uid expander)) + + (define (shadow-macro! uid) + (when (dictionary-has? global-macro-table uid) + (dictionary-delete! global-macro-table uid))) + + (define (macro-objects) + global-macro-table) + + + ;; expander + + (define expand + (let ((task-queue (make-parameter '()))) + + (define (queue task) + (let ((tmp (cons #f #f))) + (task-queue `((,tmp . ,task) . ,(task-queue))) + tmp)) + + (define (run-all) + (for-each + (lambda (x) + (let ((task (cdr x)) (skelton (car x))) + (let ((x (task))) + (set-car! skelton (car x)) + (set-cdr! skelton (cdr x))))) + (reverse (task-queue)))) + + (define (caddr x) (car (cddr x))) + + (define (map* proc list*) + (cond + ((null? list*) list*) + ((pair? list*) (cons (proc (car list*)) (map* proc (cdr list*)))) + (else (proc list*)))) + + (define (literal? x) + (not (or (identifier? x) (pair? x)))) + + (define (call? x) + (and (list? x) + (not (null? x)) + (identifier? (car x)))) + + (define (expand-variable var env) + (let ((x (find-identifier var env))) + (let ((m (find-macro x))) + (if m + (expand-node (m var env) env) + x)))) + + (define (expand-quote obj) + `(core#quote ,obj)) + + (define (expand-define var form env) + (let ((uid (add-identifier! var env))) + (shadow-macro! uid) + `(core#define ,uid ,(expand-node form env)))) + + (define (expand-lambda args body env) + (let ((env (extend-environment env))) + (let ((args (map* (lambda (var) (add-identifier! var env)) args))) + (parameterize ((task-queue '())) + (let ((body (expand-node body env))) + (run-all) + `(core#lambda ,args ,body)))))) + + (define (expand-define-macro var transformer env) + (let ((uid (add-identifier! var env))) + (let ((expander (load (expand transformer env)))) + (add-macro! uid expander) + #undefined))) + + (define (expand-node expr env) + (cond + ((literal? expr) expr) + ((identifier? expr) (expand-variable expr env)) + ((call? expr) + (let ((functor (find-identifier (car expr) env))) + (case functor + ((core#quote) (expand-quote (cadr expr))) + ((core#define) (expand-define (cadr expr) (caddr expr) env)) + ((core#lambda) (queue (lambda () (expand-lambda (cadr expr) (caddr expr) env)))) + ((core#define-macro) (expand-define-macro (cadr expr) (caddr expr) env)) + (else + (let ((m (find-macro functor))) + (if m + (expand-node (m expr env) env) + (map (lambda (x) (expand-node x env)) expr))))))) + ((list? expr) + (map (lambda (x) (expand-node x env)) expr)) + (else + (error "invalid expression" expr)))) + + (define (expand expr env) + (let ((x (expand-node expr env))) + (run-all) + x)) + + expand)) + + (values make-identifier + identifier? + identifier=? + identifier-name + identifier-environment + make-environment + default-environment + environment? + find-identifier + add-identifier! + set-identifier! + macro-objects + expand))) + + + ;; built-in macros + (let () - ;; identifier - - (define-record-type identifier - (make-identifier name env) - %identifier? - (name identifier-name) - (env identifier-environment)) - - (define (identifier? obj) - (or (symbol? obj) (%identifier? obj))) - - (define (identifier=? id1 id2) - (cond - ((and (symbol? id1) (symbol? id2)) - (eq? id1 id2)) - ((and (%identifier? id1) (%identifier? id2)) - (eq? (find-identifier (identifier-name id1) (identifier-environment id1)) - (find-identifier (identifier-name id2) (identifier-environment id2)))) - (else - #f))) - - (set! equal? - (let ((e? equal?)) - (lambda (x y) - (if (%identifier? x) - (identifier=? x y) - (e? x y))))) - - - ;; environment - - (define-record-type environment - (%make-environment parent prefix binding) - environment? - (parent environment-parent) - (prefix environment-prefix) - (binding environment-binding)) - - (define (search-scope id env) - ((environment-binding env) id)) - - (define (find-identifier id env) - (or (search-scope id env) - (let ((parent (environment-parent env))) - (if parent - (find-identifier id parent) - (if (symbol? id) - (add-identifier! id env) - (find-identifier (identifier-name id) - (identifier-environment id))))))) - - (define add-identifier! - (let ((uniq - (let ((n 0)) - (lambda (id) - (let ((m n)) - (set! n (+ n 1)) - (string->symbol - (string-append - "." - (symbol->string - (let loop ((id id)) - (if (symbol? id) - id - (loop (identifier-name id))))) - "." - (number->string m)))))))) - (lambda (id env) - (or (search-scope id env) - (if (and (not (environment-parent env)) (symbol? id)) - (string->symbol - (string-append - (environment-prefix env) - (symbol->string id))) - (let ((uid (uniq id))) - (set-identifier! id uid env) - uid)))))) - - (define (set-identifier! id uid env) - ((environment-binding env) id uid)) - - (define (make-environment prefix) - (%make-environment #f (symbol->string prefix) (make-ephemeron-table))) - - (define default-environment - (let ((env (make-environment (string->symbol "")))) - (for-each - (lambda (x) (set-identifier! x x env)) - '(core#define - core#set! - core#quote - core#lambda - core#if - core#begin - core#define-macro)) - env)) - - (define (extend-environment parent) - (%make-environment parent #f (make-ephemeron-table))) - - - ;; macro - - (define global-macro-table - (make-dictionary)) - - (define (find-macro uid) - (and (dictionary-has? global-macro-table uid) - (dictionary-ref global-macro-table uid))) - - (define (add-macro! uid expander) ; TODO warn on redefinition - (dictionary-set! global-macro-table uid expander)) - - (define (shadow-macro! uid) - (when (dictionary-has? global-macro-table uid) - (dictionary-delete! global-macro-table uid))) - - (define (macro-objects) - global-macro-table) - - - ;; expander - - (define expand - (let ((task-queue (make-parameter '()))) - - (define (queue task) - (let ((tmp (cons #f #f))) - (task-queue `((,tmp . ,task) . ,(task-queue))) - tmp)) - - (define (run-all) - (for-each - (lambda (x) - (let ((task (cdr x)) (skelton (car x))) - (let ((x (task))) - (set-car! skelton (car x)) - (set-cdr! skelton (cdr x))))) - (reverse (task-queue)))) - - (define (caddr x) (car (cddr x))) - - (define (map* proc list*) - (cond - ((null? list*) list*) - ((pair? list*) (cons (proc (car list*)) (map* proc (cdr list*)))) - (else (proc list*)))) - - (define (literal? x) - (not (or (identifier? x) (pair? x)))) - - (define (call? x) - (and (list? x) - (not (null? x)) - (identifier? (car x)))) - - (define (expand-variable var env) - (let ((x (find-identifier var env))) - (let ((m (find-macro x))) - (if m - (expand-node (m var env) env) - x)))) - - (define (expand-quote obj) - `(core#quote ,obj)) - - (define (expand-define var form env) - (let ((uid (add-identifier! var env))) - (shadow-macro! uid) - `(core#define ,uid ,(expand-node form env)))) - - (define (expand-lambda args body env) - (let ((env (extend-environment env))) - (let ((args (map* (lambda (var) (add-identifier! var env)) args))) - (parameterize ((task-queue '())) - (let ((body (expand-node body env))) - (run-all) - `(core#lambda ,args ,body)))))) - - (define (expand-define-macro var transformer env) - (let ((uid (add-identifier! var env))) - (let ((expander (load (expand transformer env)))) - (add-macro! uid expander) - #undefined))) - - (define (expand-node expr env) - (cond - ((literal? expr) expr) - ((identifier? expr) (expand-variable expr env)) - ((call? expr) - (let ((functor (find-identifier (car expr) env))) - (case functor - ((core#quote) (expand-quote (cadr expr))) - ((core#define) (expand-define (cadr expr) (caddr expr) env)) - ((core#lambda) (queue (lambda () (expand-lambda (cadr expr) (caddr expr) env)))) - ((core#define-macro) (expand-define-macro (cadr expr) (caddr expr) env)) - (else - (let ((m (find-macro functor))) - (if m - (expand-node (m expr env) env) - (map (lambda (x) (expand-node x env)) expr))))))) - ((list? expr) - (map (lambda (x) (expand-node x env)) expr)) - (else - (error "invalid expression" expr)))) - - (define (expand expr env) - (let ((x (expand-node expr env))) - (run-all) - x)) - - expand)) - - ;; compile - - (define (compile expr . env) - (expand expr (if (null? env) default-environment (car env)))) - - ;; eval - - (define (eval expr . env) - (load (compile expr (if (null? env) default-environment (car env))))) - - ;; built-in macros - (define (define-transformer name transformer) - (dictionary-set! global-macro-table name transformer)) + (dictionary-set! (macro-objects) name transformer)) (define (the var) (make-identifier var default-environment)) @@ -601,20 +611,275 @@ (,the-if (,pred obj) (,(the 'vector-set!) (,(the 'record-datum) obj) ,pos value) (,(the 'error) "record type mismatch" obj ',type)))))))) - (loop (cdr fields) (+ pos 1) `(,@defs . ,acc))))))))))) + (loop (cdr fields) (+ pos 1) `(,@defs . ,acc)))))))))))) - (values make-identifier - identifier? - identifier=? - identifier-name - identifier-environment - make-environment - default-environment - environment? - find-identifier - add-identifier! - set-identifier! - macro-objects - compile - eval))) + ;; compile + + (define-values (compile) + (let () + + (define (caddr x) (car (cddr x))) + (define (cadddr x) (cadr (cddr x))) + (define (max a b) (if (< a b) b a)) + (define (integer? n) (and (number? n) (exact? n))) + + (define normalize + (let ((defs (make-parameter '()))) + + ;; 1. remove core# prefix from keywords + ;; 2. eliminates internal definitions by replacing with equivalent let & set! + ;; 3. transform a var into (ref var) + ;; 4. wrap raw constants with quote + + ;; TODO: warn redefinition, warn duplicate variables + + (define (normalize e) + (cond + ((symbol? e) `(ref ,e)) + ((not (pair? e)) `(quote ,e)) + (else + (case (car e) + ((core#quote) `(quote . ,(cdr e))) + ((core#define) + (let ((var (cadr e)) (val (caddr e))) + (defs (cons var (defs))) + `(set! ,var ,(normalize val)))) + ((core#lambda) + (let ((args (cadr e)) (body (caddr e))) + (parameterize ((defs '())) + (let ((body (normalize body))) + (if (null? (defs)) + `(lambda ,args ,body) + `(lambda ,args + ((lambda ,(defs) ,body) ,@(map (lambda (_) #f) (defs))))))))) + ((core#set!) `(set! . ,(map normalize (cdr e)))) + ((core#if) `(if . ,(map normalize (cdr e)))) + ((core#begin) `(begin . ,(map normalize (cdr e)))) + (else + (map normalize e)))))) + + normalize)) + + + (define transform + (let () + + ;; tail-conscious higher-order CPS transformation + + ;; target language + ;; E ::= A + ;; | (if A E E) + ;; | (set! v A E) + ;; | (A A ...) + ;; A ::= (lambda (var ...) E) + ;; | (ref v) + ;; | (quote x) + ;; | (undefined) + + (define uniq + (let ((n 0)) + (lambda () + (set! n (+ n 1)) + (string->symbol + (string-append "$" (number->string n)))))) + + (define (transform-k e k) + (case (car e) + ((ref lambda quote) (k (transform-v e))) + ((begin) (transform-k (cadr e) + (lambda (_) + (transform-k (caddr e) k)))) + ((set!) (transform-k (caddr e) + (lambda (v) + `(set! ,(cadr e) ,v ,(k '(undefined)))))) + ((if) (let ((v (uniq)) + (c `(ref ,(uniq)))) + `((lambda (,c) + ,(transform-k (cadr e) + (lambda (x) + `(if ,x + ,(transform-c (caddr e) c) + ,(transform-c (cadddr e) c))))) + (lambda (,v) ,(k `(ref ,v)))))) + (else + (let* ((v (uniq)) + (c `(lambda (,v) ,(k `(ref ,v))))) + (transform-k (car e) + (lambda (f) + (transform*-k (cdr e) + (lambda (args) + `(,f ,c ,@args))))))))) + + (define (transform*-k es k) + (if (null? es) + (k '()) + (transform-k (car es) + (lambda (x) + (transform*-k (cdr es) + (lambda (xs) + (k (cons x xs)))))))) + + (define (transform-c e c) + (case (car e) + ((ref lambda quote) `(,c ,(transform-v e))) + ((begin) (transform-k (cadr e) + (lambda (_) + (transform-c (caddr e) c)))) + ((set!) (transform-k (caddr e) + (lambda (v) + `(set! ,(cadr e) ,v (,c (undefined)))))) + ((if) (if (and (pair? c) (eq? 'lambda (car c))) + (let ((k `(ref ,(uniq)))) + `((lambda (,k) + ,(transform-k (cadr e) + (lambda (x) + `(if ,x + ,(transform-c (caddr e) k) + ,(transform-c (cadddr e) k))))) + ,c)) + (transform-k (cadr e) + (lambda (x) + `(if ,x + ,(transform-c (caddr e) c) + ,(transform-c (cadddr e) c)))))) + (else + (transform-k (car e) + (lambda (f) + (transform*-k (cdr e) + (lambda (args) + `(,f ,c ,@args)))))))) + + (define (transform-v e) + (case (car e) + ((ref quote) e) + ((lambda) + (let ((k (uniq))) + `(lambda (,k ,@(cadr e)) ,(transform-c (caddr e) `(ref ,k))))))) + + (lambda (e) + (let ((k (uniq))) + `(lambda (,k) ,(transform-c e `(ref ,k))))))) + + + (define codegen + (let () + + ;; TODO: check range of index/depth/frame_size/irepc/objc + + (define (lookup var env) + (let up ((depth 0) (env env)) + (if (null? env) + `(global ,var) + (let loop ((index 1) (binding (car env))) + (if (symbol? binding) + (if (eq? var binding) + `(local ,depth ,index) + (up (+ depth 1) (cdr env))) + (if (null? binding) + (up (+ depth 1) (cdr env)) + (if (eq? var (car binding)) + `(local ,depth ,index) + (loop (+ index 1) (cdr binding))))))))) + + (define env (make-parameter '())) + (define code (make-parameter '())) + (define reps (make-parameter '())) + (define objs (make-parameter '())) + + (define (emit inst) + (code (cons inst (code)))) + + (define (emit-irep irep) + (let ((n (length (reps)))) + (reps (cons irep (reps))) + n)) + + (define (emit-objs obj) ; TODO remove duplicates + (let ((n (length (objs)))) + (objs (cons obj (objs))) + n)) + + (define make-label + (let ((n 0)) + (lambda () + (let ((m n)) + (set! n (+ n 1)) + m)))) + + (define (emit-label label) + (code (cons label (code)))) + + (define (codegen-e e) + (case (car e) + ((ref lambda quote undefined) (codegen-a e 0)) + ((set!) (begin + (codegen-a (caddr e) 0) + (let* ((x (lookup (cadr e) (env))) + (op (if (eq? 'global (car x)) 'GSET 'LSET))) + (emit `(,op 0 . ,(cdr x)))) + (codegen-e (cadddr e)))) + ((if) (begin + (codegen-a (cadr e) 0) + (let ((label (make-label))) + (emit `(COND 0 ,label)) + (codegen-e (caddr e)) + (emit-label label) + (codegen-e (cadddr e))))) + (else (begin + (let loop ((i 0) (e e)) + (unless (null? e) + (codegen-a (car e) i) + (loop (+ i 1) (cdr e)))) + (emit `(CALL ,(length e))))))) + + (define (codegen-a e i) + (case (car e) + ((ref) (let* ((x (lookup (cadr e) (env))) + (op (if (eq? 'global (car x)) 'GREF 'LREF))) + (emit `(,op ,i . ,(cdr x))))) + ((quote) (let ((obj (cadr e))) + (cond ((eq? #t obj) (emit `(LOADT ,i))) + ((eq? #f obj) (emit `(LOADF ,i))) + ((null? obj) (emit `(LOADN ,i))) + ((and (integer? obj) (<= -128 obj 127)) (emit `(LOADI ,i ,obj))) + (else (let ((n (emit-obj obj))) + (emit `(LOAD ,i ,n))))))) + ((undefined) (emit `(LOADU ,i))) + ((lambda) (let ((frame-size + (let loop ((e (caddr e))) + (case (car e) + ((ref lambda quote undefined) 1) + ((if) (max (loop (caddr e)) (loop (cadddr e)))) + ((set!) (loop (cadddr e))) + (else (+ 1 (length e)))))) + (argc-varg + (let loop ((args (cadr e)) (c 0)) + (if (symbol? args) + (cons (+ 1 c) #t) + (if (null? args) + (cons c #f) + (loop (cdr args) (+ 1 c))))))) + (let ((irep + (parameterize ((code '()) + (env (cons (cadr e) (env))) + (reps '()) + (objs '())) + (codegen-e (caddr e)) + (list (reverse (code)) (reverse (reps)) (reverse (objs)) argc-varg frame-size)))) + (let ((n (emit-irep irep))) + (emit `(PROC ,i ,n)))))))) + + (lambda (e) + (parameterize ((code '()) (env '()) (reps '()) (objs '())) + (codegen-e e) + (car (reps)))))) + + (lambda (e) + (codegen (transform (normalize e)))))) + + + ;; eval + + (define (eval expr . env) + (load (expand expr (if (null? env) default-environment (car env))))))