From cf01f4d46e4922d2dc45d0e97b229be154011ff5 Mon Sep 17 00:00:00 2001 From: ESL Date: Wed, 24 Jul 2024 01:05:05 -0400 Subject: [PATCH] prelim work on newtop --- pre/t.scm | 131 ++++++++++++++++++++++++++---------------- t.c | 166 ++++++++++++++++++++++++++++++------------------------ 2 files changed, 173 insertions(+), 124 deletions(-) diff --git a/pre/t.scm b/pre/t.scm index d32a868..7b9ee4b 100644 --- a/pre/t.scm +++ b/pre/t.scm @@ -5,6 +5,7 @@ (load "s.scm") + ;-------------------------------------------------------------------------------------------------- ; Utils ;-------------------------------------------------------------------------------------------------- @@ -157,7 +158,7 @@ ;-------------------------------------------------------------------------------------------------- -; Syntax of the Scheme Core language +; Syntax of the 'Scheme Core' language ;-------------------------------------------------------------------------------------------------- ; -> (quote ) @@ -229,6 +230,11 @@ ; Macro transformer (from Scheme to Scheme Core) derived from Al Petrofsky's EIOD 1.17 ;-------------------------------------------------------------------------------------------------- +; EIOD Copyright notice (amended with the author's permission): +; Copyright 2002, 2004, 2005 Al Petrofsky +; LICENSING (3-clause BSD or GNU GPL 2 and up) +; + ; An environment is a procedure that accepts any identifier and access type and returns a ; denotation. Access type is one of these symbols: ref, set!, define, define-syntax. ; The denotation of an identifier is its macro location, which is a cell storing the @@ -292,13 +298,32 @@ (unless peek (x-error "env peek failed!" id env (id->sym id) (and (new-id? id) (new-id-lookup id 'peek)))) (new-id (id->sym id) peek getlits)) +; common code for consistency between two procedures below +; precondition: peek part of spg is a name registry; it is replaced by location +; containing (ref gs) value, where gs is a gensym derived from spg name part +(define (gensym-ref-value-helper def? spg) + ; on top level, make sure the def? calling path should reach this procedure first! + (name-lookup (cadr spg) (car spg) (lambda (n) (list 'ref (if def? (gensym n) n))))) + ; look up denotation of renamed identifier, trying to delay allocation up to the moment ; when actual location is needed -- peeks don't have to go all the way (see ) (define (new-id-lookup id at) (let* ([spg (id)] [peek (cadr spg)]) (if (or (eq? at 'peek) (location? peek)) peek ; delay binding allocation until absolutely necessary - (name-lookup peek (car spg) (lambda (n) (list 'ref n)))))) + (gensym-ref-value-helper #f spg)))) + +; this operation should be consistent with new-id-lookup, but comes with a twist: if it is +; called with new-id and at=define/define-syntax, (env id at) is guaranteed to fail because +; renamed ids cannot be interned into name registries. +(define (top-defined-id-lookup env id at) ;=> loc | #f + (and (memq at '(define define-syntax)) + (if (symbol? id) (xenv-lookup env id at) + (let* ([spg (id)] [peek (cadr spg)]) + (if (location? peek) + peek ; loc is already there, use it + (gensym-ref-value-helper #t spg)))))) + ; Expand-time environments map names (identifiers or listnames) to denotations, i.e. locations ; containing either a or a value. In normal case, value is (ref ), @@ -374,7 +399,7 @@ [else hval]))] [(not (pair? sexp)) (xform-quote (list sexp) env)] - [else + [else ; note: these transformations are made in 'expression' context (let* ([head (car sexp)] [tail (cdr sexp)] [hval (xform #t head env)]) (case hval [(quote) (xform-quote tail env)] @@ -508,6 +533,19 @@ (xform-body (cdr tail) env) #f) (x-error "improper withcc form" (cons 'withcc tail)))) +(define (preprocess-define head tail) ;=> (id sexp) or (sexp) for idless + (cond [(and (list2? tail) (null? (car tail))) (cdr tail)] ; idless + [(and (list2? tail) (id? (car tail))) tail] ; simple + [(and (list2+? tail) (pair? (car tail)) (id? (caar tail)) (idslist? (cdar tail))) + (list (caar tail) (cons lambda-id (cons (cdar tail) (cdr tail))))] + ; TODO? here we can do full MIT-style define (arbitrarily nested) + [else (x-error "improper define form" (cons head tail))])) + +(define (preprocess-define-syntax head tail) ;=> (id sexp) + (cond [(and (list2? tail) (id? (car tail))) tail] ; simple + ; TODO? here we can do some fancy shortcuts or extensions + [else (x-error "improper define-syntax form" (cons head tail))])) + (define (xform-body tail env appos?) (cond [(null? tail) @@ -527,24 +565,19 @@ (loop env ids inits nids (append tail rest)) (x-error "improper begin form" first))] [(define) ; internal - (cond [(and (list2? tail) (null? (car tail))) ; idless - (let ([init (cadr tail)]) - (loop env (cons #f ids) (cons init inits) (cons #f nids) rest))] - [(and (list2? tail) (id? (car tail))) - (let* ([id (car tail)] [init (cadr tail)] - [nid (gensym (id->sym id))] [env (add-local-var id nid env)]) - (loop env (cons id ids) (cons init inits) (cons nid nids) rest))] - [(and (list2+? tail) (pair? (car tail)) (id? (caar tail)) (idslist? (cdar tail))) - (let* ([id (caar tail)] [init (cons lambda-id (cons (cdar tail) (cdr tail)))] - [nid (gensym (id->sym id))] [env (add-local-var id nid env)]) - (loop env (cons id ids) (cons init inits) (cons nid nids) rest))] - [else (x-error "improper define form" first)])] + (let ([tail (preprocess-define head tail)]) + (cond [(list1? tail) ; idless + (let ([init (car tail)]) + (loop env (cons #f ids) (cons init inits) (cons #f nids) rest))] + [else ; (id sexp) + (let* ([id (car tail)] [init (cadr tail)] + [nid (gensym (id->sym id))] [env (add-local-var id nid env)]) + (loop env (cons id ids) (cons init inits) (cons nid nids) rest))]))] [(define-syntax) ; internal - (if (and (list2? tail) (id? (car tail))) - (let* ([id (car tail)] [init (cadr tail)] - [env (extend-xenv-local id '(undefined) env)]) ; placeholder val - (loop env (cons id ids) (cons init inits) (cons #t nids) rest)) - (x-error "improper define-syntax form" first))] + (let ([tail (preprocess-define-syntax head tail)]) + (let* ([id (car tail)] [init (cadr tail)] + [env (extend-xenv-local id '(undefined) env)]) ; placeholder val + (loop env (cons id ids) (cons init inits) (cons #t nids) rest)))] [(define-library) ; internal (if (and (list2+? tail) (listname? (car tail))) ; note: library is fully expanded in incomplete env, to make it @@ -615,8 +648,7 @@ [(and (list2+? tail) (pair? (car tail)) (id? (caar tail)) (idslist? (cdar tail))) (list 'define (id->sym (caar tail)) (xform-lambda (cons (cdar tail) (cdr tail)) env))] - [else - (x-error "improper define form" (cons 'define tail))])) + [else (x-error "improper define form" (cons 'define tail))])) (define (xform-define-syntax tail env) ; non-internal (if (and (list2? tail) (id? (car tail))) @@ -1037,20 +1069,22 @@ (cond [(eq? hval 'begin) (unless (list? tail) (x-error "improper begin form" first)) - (scan (append tail rest) code*)] - [(and (eq? hval 'define) (list2? tail) (null? (car tail))) ; special idless define - (scan (append (cadr tail) rest) code*)] + (scan (append tail rest) code*)] ; splice [(eq? hval 'define) - (let* ([core (xform-define tail cenv)] - [loc (xenv-lookup cenv (cadr core) 'define)]) - (unless (location? loc) (x-error "unexpected define for id" (cadr core) first)) - (scan rest (cons (list 'set! (cadr (location-val loc)) (caddr core)) code*)))] + (let ([tail (preprocess-define head tail)]) + (if (list1? tail) ; tail is either (sexp) or (id sexp) + (scan (append tail rest) code*) ; idless, splice + (let ([loc (top-defined-id-lookup cenv (car tail) 'define)]) + (unless (and (location? loc) (sexp-match? '(ref *) (location-val loc))) + (x-error "unexpected define for id" (car tail) first)) + (let ([g (cadr (location-val loc))] [core (xform #f (cadr tail) cenv)]) + (scan rest (cons (list 'set! g core) code*))))))] [(eq? hval 'define-syntax) - (let* ([core (xform-define-syntax tail cenv)] - [loc (xenv-lookup cenv (cadr core) 'define-syntax)]) + (let* ([tail (preprocess-define-syntax head tail)] + [loc (top-defined-id-lookup cenv (car tail) 'define-syntax)]) (unless (location? loc) - (x-error "unexpected define-syntax for id" (cadr core) first)) - (location-set-val! loc (caddr core)) + (x-error "unexpected define-syntax for id" (car tail) first)) + (location-set-val! loc (xform #t (cadr tail) cenv)) (scan rest code*))] [(eq? hval 'define-library) (let* ([core (xform-define-library head tail env #f)] @@ -2249,28 +2283,27 @@ (cond [(eq? hval 'begin) ; splice (let loop ([x* (cdr x)]) - (cond [(null? x*) (void)] ; nothing valuable leaks + (cond [(null? x*) (void)] [(not (pair? x*)) (x-error "invalid begin form:" x)] [(null? (cdr x*)) (evaluate-top-form (car x*) env)] ; tail call [else (evaluate-top-form (car x*) env) (loop (cdr x*))]))] - [(and (eq? hval 'define) (null? (cadr x))) ; special idless define - (evaluate-top-form (caddr x) env) (void)] ; nothing valuable leaks [(eq? hval 'define) ; use new protocol for top-level envs - (let* ([core (xform-define (cdr x) env)] - [loc (xenv-lookup env (cadr core) 'define)]) - (if (and loc (sexp-match? '(ref *) (location-val loc))) - (compile-and-run-core-expr ; tail - (list 'set! (cadr (location-val loc)) (caddr core))) - (x-error "identifier cannot be (re)defined as variable in env:" - (cadr core) env)))] + (let ([tail (preprocess-define (car x) (cdr x))]) + (if (list1? tail) ; tail is either (sexp) or (id sexp) + (begin (evaluate-top-form (car tail) env) (void)) + (let ([loc (top-defined-id-lookup env (car tail) 'define)]) + (unless (and (location? loc) (sexp-match? '(ref *) (location-val loc))) + (x-error "identifier cannot be (re)defined as variable" (car tail) x)) + (let ([g (cadr (location-val loc))] [core (xform #f (cadr tail) env)]) + (compile-and-run-core-expr (list 'set! g core)) (void)))))] [(eq? hval 'define-syntax) ; use new protocol for top-level envs - (let* ([core (xform-define-syntax (cdr x) env)] - ; core is (define-syntax ) - [loc (xenv-lookup env (cadr core) 'define-syntax)]) + (let* ([tail (preprocess-define-syntax (car x) (cdr x))] + [loc (top-defined-id-lookup env (car tail) 'define-syntax)]) (unless (location? loc) - (x-error "unexpected define-syntax for id" (cadr core) x)) - (location-set-val! loc (caddr core)) - (when *verbose* (display "SYNTAX INSTALLED: ") (write (cadr core)) (newline)))] + (x-error "unexpected define-syntax for id" (car tail) x)) + (location-set-val! loc (xform #t (cadr tail) env)) + (when *verbose* (display "SYNTAX INSTALLED: ") (write (car tail)) (newline)) + (void))] [(eq? hval 'define-library) ; use new protocol for top-level envs (let* ([core (xform-define-library (car x) (cdr x) env #t)] ; core is (define-library ) diff --git a/t.c b/t.c index 69cf13a..7fe6a35 100644 --- a/t.c +++ b/t.c @@ -186,9 +186,18 @@ char *t_code[] = { "id-lookup)[02}}{f},${.6,@(y7:id->sym)[01},.6,.6,'(s16:env peek failed!" "),@(y7:x-error)[05}}.3,.1^,${.5,@(y7:id->sym)[01},@(y6:new-id)[43", + "P", "gensym-ref-value-helper", + "%2.0,&1{%1:0?{${.2,@(y6:gensym)[01}}{.0},'(y3:ref),l2]1},.2a,.3da,@(y1" + "1:name-lookup)[23", + "P", "new-id-lookup", - "%2${.2[00},.0da,'(y4:peek),.4q,.0?{.0}{.1Y2}_1?{.0]4}&0{%1.0,'(y3:ref)" - ",l2]1},.2a,.2,@(y11:name-lookup)[43", + "%2${.2[00},.0da,'(y4:peek),.4q,.0?{.0}{.1Y2}_1?{.0]4}.1,f,@(y23:gensym" + "-ref-value-helper)[42", + + "P", "top-defined-id-lookup", + "%3'(l2:y6:define;y13:define-syntax;),.3A0?{.1Y0?{.2,.2,.2,@(y11:xenv-l" + "ookup)[33}${.3[00},.0da,.0Y2?{.0]5}.1,t,@(y23:gensym-ref-value-helper)" + "[52}f]3", "P", "extend-xenv-local", "%3.1b,.1p?{.3,.1,.3,&3{%2.0,:0e?{.1,'(l3:y3:ref;y4:set!;y4:peek;),.1A1" @@ -339,37 +348,42 @@ char *t_code[] = { "@(y5:xform)[03},'(y6:withcc),l4]2}.0,'(y6:withcc)c,'(s20:improper with" "cc form),@(y7:x-error)[22", + "P", "preprocess-define", + "%2${.3,@(y6:list2?)[01}?{.1au}{f}?{.1d]2}${.3,@(y6:list2?)[01}?{${.3a," + "@(y3:id?)[01}}{f}?{.1]2}${.3,@(y7:list2+?)[01}?{.1ap?{${.3aa,@(y3:id?)" + "[01}?{${.3ad,@(y8:idslist?)[01}}{f}}{f}}{f}?{.1d,.2adc,@(y9:lambda-id)" + "c,.2aa,l2]2}.1,.1c,'(s20:improper define form),@(y7:x-error)[22", + + "P", "preprocess-define-syntax", + "%2${.3,@(y6:list2?)[01}?{${.3a,@(y3:id?)[01}}{f}?{.1]2}.1,.1c,'(s27:im" + "proper define-syntax form),@(y7:x-error)[22", + "P", "xform-body", "%3.0u?{'(y5:begin),l1]3}${.2,@(y6:list1?)[01}?{.1,.1a,.4,@(y5:xform)[3" "3}.0L0~?{.0,'(y4:body)c,'(s18:improper body form),@(y7:x-error)[32}.0," "n,n,n,.5,,#0.8,.1,&2{%5.4p?{.4ap}{f}?{.4d,.5a,.0a,.1d,${.6,.4,t,@(y5:x" "form)[03},.0,'(y5:begin),.1v?{.2L0?{.5,.3L6,.(i10),.(i10),.(i10),.(i10" "),:0^[(i11)5}.4,'(s19:improper begin form),@(y7:x-error)[(i11)2}'(y6:d" - "efine),.1v?{${.4,@(y6:list2?)[01}?{.2au}{f}?{.2da,.6,.(i11),fc,.(i11)," - ".3c,.(i11),fc,.(i11),:0^[(i12)5}${.4,@(y6:list2?)[01}?{${.4a,@(y3:id?)" - "[01}}{f}?{.2a,.3da,${${.5,@(y7:id->sym)[01},@(y6:gensym)[01},${.(i11)," - ".3,.6,@(y13:add-local-var)[03},.9,.(i14),.3c,.(i14),.5c,.(i14),.7c,.4," - ":0^[(i15)5}${.4,@(y7:list2+?)[01}?{.2ap?{${.4aa,@(y3:id?)[01}?{${.4ad," - "@(y8:idslist?)[01}}{f}}{f}}{f}?{.2aa,.3d,.4adc,@(y9:lambda-id)c,${${.5" - ",@(y7:id->sym)[01},@(y6:gensym)[01},${.(i11),.3,.6,@(y13:add-local-var" - ")[03},.9,.(i14),.3c,.(i14),.5c,.(i14),.7c,.4,:0^[(i15)5}.4,'(s20:impro" - "per define form),@(y7:x-error)[(i11)2}'(y13:define-syntax),.1v?{${.4,@" - "(y6:list2?)[01}?{${.4a,@(y3:id?)[01}}{f}?{.2a,.3da,${.(i10),'(l1:y9:un" - "defined;),.5,@(y17:extend-xenv-local)[03},.8,.(i13),tc,.(i13),.4c,.(i1" - "3),.6c,.4,:0^[(i14)5}.4,'(s27:improper define-syntax form),@(y7:x-erro" - "r)[(i11)2}'(y14:define-library),.1v?{${.4,@(y7:list2+?)[01}?{${.4a,@(y" - "9:listname?)[01}}{f}?{${f,.9,.6,.8,@(y20:xform-define-library)[04},.0d" - "a,.1dda,${.(i11),.3,.5,@(y17:extend-xenv-local)[03},.9,.(i14),.(i14),." - "(i14),.4,:0^[(i15)5}.4,'(s28:improper define-library form),@(y7:x-erro" - "r)[(i11)2}'(y6:import),.1v?{.2L0?{${f,.9,.6,.8,@(y12:xform-import)[04}" - ",.0da,'0,.1V4,'1,.2V4,.(i10),.1,,#0.(i10),.1,.(i14),.(i19),.(i19),.(i1" - "9),:0,.(i11),&8{%2.0u?{:0,@(y15:syntax-quote-id),l2,:5,:4,fc,:3,.3c,:2" - ",fc,.6,:1^[35}.0ad,${.3aa,:7,@(y12:id-rename-as)[02},.3,.2,.2,&3{%2:0," - ".1q?{'(l2:y3:ref;y4:peek;),.2A0?{:1]2}f]2}.1,.1,:2[22},.3d,:6^[42}.!0." - "0^_1[(i15)2}.4,'(s20:improper import form),@(y7:x-error)[(i11)2}.1K0?{" - ".5,${.9,.8,.6[02}c,.(i10),.(i10),.(i10),.(i10),:0^[(i11)5}:1,.7,.(i12)" - ",.(i12)A8,.(i12)A8,.(i12)A8,@(y12:xform-labels)[(i11)6}:1,.1,.6,.6A8,." - "6A8,.6A8,@(y12:xform-labels)[56}.!0.0^_1[35", + "efine),.1v?{${.4,.6,@(y17:preprocess-define)[02},${.2,@(y6:list1?)[01}" + "?{.0a,.7,.(i12),fc,.(i12),.3c,.(i12),fc,.(i12),:0^[(i13)5}.0a,.1da,${$" + "{.5,@(y7:id->sym)[01},@(y6:gensym)[01},${.(i12),.3,.6,@(y13:add-local-" + "var)[03},.(i10),.(i15),.3c,.(i15),.5c,.(i15),.7c,.4,:0^[(i16)5}'(y13:d" + "efine-syntax),.1v?{${.4,.6,@(y24:preprocess-define-syntax)[02},.0a,.1d" + "a,${.(i11),'(l1:y9:undefined;),.5,@(y17:extend-xenv-local)[03},.9,.(i1" + "4),tc,.(i14),.4c,.(i14),.6c,.4,:0^[(i15)5}'(y14:define-library),.1v?{$" + "{.4,@(y7:list2+?)[01}?{${.4a,@(y9:listname?)[01}}{f}?{${f,.9,.6,.8,@(y" + "20:xform-define-library)[04},.0da,.1dda,${.(i11),.3,.5,@(y17:extend-xe" + "nv-local)[03},.9,.(i14),.(i14),.(i14),.4,:0^[(i15)5}.4,'(s28:improper " + "define-library form),@(y7:x-error)[(i11)2}'(y6:import),.1v?{.2L0?{${f," + ".9,.6,.8,@(y12:xform-import)[04},.0da,'0,.1V4,'1,.2V4,.(i10),.1,,#0.(i" + "10),.1,.(i14),.(i19),.(i19),.(i19),:0,.(i11),&8{%2.0u?{:0,@(y15:syntax" + "-quote-id),l2,:5,:4,fc,:3,.3c,:2,fc,.6,:1^[35}.0ad,${.3aa,:7,@(y12:id-" + "rename-as)[02},.3,.2,.2,&3{%2:0,.1q?{'(l2:y3:ref;y4:peek;),.2A0?{:1]2}" + "f]2}.1,.1,:2[22},.3d,:6^[42}.!0.0^_1[(i15)2}.4,'(s20:improper import f" + "orm),@(y7:x-error)[(i11)2}.1K0?{.5,${.9,.8,.6[02}c,.(i10),.(i10),.(i10" + "),.(i10),:0^[(i11)5}:1,.7,.(i12),.(i12)A8,.(i12)A8,.(i12)A8,@(y12:xfor" + "m-labels)[(i11)6}:1,.1,.6,.6A8,.6A8,.6A8,@(y12:xform-labels)[56}.!0.0^" + "_1[35", "P", "xform-labels", "%6,#0${.5,&0{%1t,.1q]1},@(y6:andmap)[02}.!0n,n,.5,.5,.5,,#0.0,.(i12),." @@ -610,28 +624,29 @@ char *t_code[] = { "rolled-environment)[03},n,,#0.(i12),.1,.4,&3{%2.0u?{.1]2}.0d,.1a,.0p?{" ".0a,.1d,${:0,.4,t,@(y5:xform)[03},'(y5:begin),.1q?{.1L0~?{${.5,'(s19:i" "mproper begin form),@(y7:x-error)[02}}.6,.5,.3L6,:1^[72}'(y6:define),." - "1q?{${.3,@(y6:list2?)[01}?{.1au}{f}}{f}?{.6,.5,.3daL6,:1^[72}'(y6:defi" - "ne),.1q?{${:0,.4,@(y12:xform-define)[02},${'(y6:define),.3da,:0,@(y11:" - "xenv-lookup)[03},.0Y2~?{${.7,.4da,'(s24:unexpected define for id),@(y7" - ":x-error)[03}}.8,.2dda,.2zda,'(y4:set!),l3c,.7,:1^[92}'(y13:define-syn" - "tax),.1q?{${:0,.4,@(y19:xform-define-syntax)[02},${'(y13:define-syntax" - "),.3da,:0,@(y11:xenv-lookup)[03},.0Y2~?{${.7,.4da,'(s31:unexpected def" - "ine-syntax for id),@(y7:x-error)[03}}.1dda,.1sz.8,.7,:1^[92}'(y14:defi" - "ne-library),.1q?{${f,:2,.5,.7,@(y20:xform-define-library)[04},${'(y13:" - "define-syntax),.3da,:2,@(y11:xenv-lookup)[03},.0Y2~?{${.7,.4da,'(s32:u" - "nexpected define-library for id),@(y7:x-error)[03}}.1dda,.1sz.8,.7,:1^" - "[92}'(y6:import),.1q?{${f,:0,.5,.7,@(y12:xform-import)[04},.0da,'0,.1V" - "4,'1,.2V4,${'(y6:import),.3,:0[02}~?{${.9,'(s33:broken import inside l" - "ibrary code),@(y7:x-error)[02}}.(i10),.2c,.9,:1^[(i11)2}.0K0?{.6,.5,${" - ":0,.8,.6[02}c,:1^[72}.0U0?{.6,${:0,.5,.5,@(y16:xform-integrable)[03}c," - ".5,:1^[72}.6,${:0,.7,f,@(y5:xform)[03}c,.5,:1^[72}.3,${:0,.4,f,@(y5:xf" - "orm)[03}c,.2,:1^[42}.!0${n,.6,.4^[02},.0A9,'(y5:begin)c,${.(i13)?{.2,." - "(i14),'(y4:once),l3}{.2},.(i11),@(y11:adjoin-code)[02},.4,.8,,#0.8,.1," - ".5,&3{%2.0u?{.1A9,:0c]2}.0aa,.1ad,${'(y3:ref),.4,:2[02},.0~?{.2,'(s16:" - "cannot export id),@(y7:x-error)[52}${.2,@(y17:location-special?)[01}?{" - ".4,.1,.3cc,.4d,:1^[52}.0z,.0p~,.0?{.0}{'(l2:y3:ref;y5:const;),.2aA0}_1" - "?{.5,.2,.4cc,.5d,:1^[62}.0,.4,'(s27:cannot export code alias id),@(y7:" - "x-error)[63}.!0.0^_1[(i16)2", + "1q?{${.3,.5,@(y17:preprocess-define)[02},${.2,@(y6:list1?)[01}?{.7,.6," + ".2L6,:1^[82}${'(y6:define),.3a,:0,@(y21:top-defined-id-lookup)[03},.0Y" + "2?{${.2z,'(l2:y3:ref;y1:*;),@(y11:sexp-match?)[02}}{f}~?{${.7,.4a,'(s2" + "4:unexpected define for id),@(y7:x-error)[03}}${:0,.4da,f,@(y5:xform)[" + "03},.1zda,.(i10),.2,.2,'(y4:set!),l3c,.9,:1^[(i11)2}'(y13:define-synta" + "x),.1q?{${.3,.5,@(y24:preprocess-define-syntax)[02},${'(y13:define-syn" + "tax),.3a,:0,@(y21:top-defined-id-lookup)[03},.0Y2~?{${.7,.4a,'(s31:une" + "xpected define-syntax for id),@(y7:x-error)[03}}${:0,.4da,t,@(y5:xform" + ")[03},.1sz.8,.7,:1^[92}'(y14:define-library),.1q?{${f,:2,.5,.7,@(y20:x" + "form-define-library)[04},${'(y13:define-syntax),.3da,:2,@(y11:xenv-loo" + "kup)[03},.0Y2~?{${.7,.4da,'(s32:unexpected define-library for id),@(y7" + ":x-error)[03}}.1dda,.1sz.8,.7,:1^[92}'(y6:import),.1q?{${f,:0,.5,.7,@(" + "y12:xform-import)[04},.0da,'0,.1V4,'1,.2V4,${'(y6:import),.3,:0[02}~?{" + "${.9,'(s33:broken import inside library code),@(y7:x-error)[02}}.(i10)" + ",.2c,.9,:1^[(i11)2}.0K0?{.6,.5,${:0,.8,.6[02}c,:1^[72}.0U0?{.6,${:0,.5" + ",.5,@(y16:xform-integrable)[03}c,.5,:1^[72}.6,${:0,.7,f,@(y5:xform)[03" + "}c,.5,:1^[72}.3,${:0,.4,f,@(y5:xform)[03}c,.2,:1^[42}.!0${n,.6,.4^[02}" + ",.0A9,'(y5:begin)c,${.(i13)?{.2,.(i14),'(y4:once),l3}{.2},.(i11),@(y11" + ":adjoin-code)[02},.4,.8,,#0.8,.1,.5,&3{%2.0u?{.1A9,:0c]2}.0aa,.1ad,${'" + "(y3:ref),.4,:2[02},.0~?{.2,'(s16:cannot export id),@(y7:x-error)[52}${" + ".2,@(y17:location-special?)[01}?{.4,.1,.3cc,.4d,:1^[52}.0z,.0p~,.0?{.0" + "}{'(l2:y3:ref;y5:const;),.2aA0}_1?{.5,.2,.4cc,.5d,:1^[62}.0,.4,'(s27:c" + "annot export code alias id),@(y7:x-error)[63}.!0.0^_1[(i16)2", "P", "xform-define-library", "%4${.3,@(y7:list2+?)[01}?{${.3a,@(y9:listname?)[01}}{f}?{${.3a,@(y17:x" @@ -1429,32 +1444,33 @@ char *t_code[] = { "%2.0p?{${.3,.3a,t,@(y5:xform)[03},'(y5:begin),.1q?{.1d,,#0.0,.5,.5,&3{" "%1.0u?{Y9]1}.0p~?{:0,'(s19:invalid begin form:),@(y7:x-error)[12}.0du?" "{:1,.1a,@(y17:evaluate-top-form)[12}${:1,.3a,@(y17:evaluate-top-form)[" - "02}.0d,:2^[11}.!0.0^_1[31}'(y6:define),.1q?{.1dau}{f}?{${.4,.4dda,@(y1" - "7:evaluate-top-form)[02}Y9]3}'(y6:define),.1q?{${.4,.4d,@(y12:xform-de" - "fine)[02},${'(y6:define),.3da,.7,@(y11:xenv-lookup)[03},.0?{${.2z,'(l2" - ":y3:ref;y1:*;),@(y11:sexp-match?)[02}}{f}?{.1dda,.1zda,'(y4:set!),l3,@" - "(y25:compile-and-run-core-expr)[51}.4,.2da,'(s52:identifier cannot be " - "(re)defined as variable in env:),@(y7:x-error)[53}'(y13:define-syntax)" - ",.1q?{${.4,.4d,@(y19:xform-define-syntax)[02},${'(y13:define-syntax),." - "3da,.7,@(y11:xenv-lookup)[03},.0Y2~?{${.5,.4da,'(s31:unexpected define" - "-syntax for id),@(y7:x-error)[03}}.1dda,.1sz@(y9:*verbose*)?{Po,'(s18:" - "SYNTAX INSTALLED: )W4Po,.2daW5PoW6]5}]5}'(y14:define-library),.1q?{${t" - ",.5,.5d,.6a,@(y20:xform-define-library)[04},${'(y13:define-syntax),.3d" - "a,.7,@(y11:xenv-lookup)[03},.0Y2~?{${.5,.4da,'(s32:unexpected define-l" - "ibrary for id),@(y7:x-error)[03}}.1dda,.1sz@(y9:*verbose*)?{Po,'(s19:L" - "IBRARY INSTALLED: )W4Po,.2daW5PoW6]5}]5}'(y6:import),.1q?{${t,.5,.5d,." - "6a,@(y12:xform-import)[04},.0da,'0,.1V4,'1,.2V4,${'(y6:import),.3,.(i1" - "0)[02},.0~?{${.3,.(i10),'(s49:failed to import to env, import is not s" - "upported:),@(y7:x-error)[03}}@(y7:*quiet*)~,.0?{.0}{@(y9:*verbose*)}_1" - "?{${.2,'(l3:y8:;y8:;y8:;),@(y11:sexp-match?)[0" - "2}}{f}?{@(y9:*verbose*)?{Po,'(s8:IMPORT: )W4}{Po,'(s10:; import: )W4}P" - "o,.1aW5Po,'(s24: bindings are the same, )W4Po,.1daW5Po,'(s11: modified" - ", )W4Po,.1ddaW5Po,'(s7: added%0a)W4}_1.1,@(y25:compile-and-run-core-ex" - "pr)[71}.0K0?{.2,${.5,.5,.5[02},@(y17:evaluate-top-form)[32}.0U0?{${.4," - ".4d,.4,@(y16:xform-integrable)[03},@(y25:compile-and-run-core-expr)[31" - "}.0Y0?{${.4,.4,f,@(y5:xform)[03},@(y25:compile-and-run-core-expr)[31}$" - "{.4,.4d,.4,@(y10:xform-call)[03},@(y25:compile-and-run-core-expr)[31}$" - "{.3,.3,f,@(y5:xform)[03},@(y25:compile-and-run-core-expr)[21", + "02}.0d,:2^[11}.!0.0^_1[31}'(y6:define),.1q?{${.3d,.4a,@(y17:preprocess" + "-define)[02},${.2,@(y6:list1?)[01}?{${.5,.3a,@(y17:evaluate-top-form)[" + "02}Y9]4}${'(y6:define),.3a,.7,@(y21:top-defined-id-lookup)[03},.0Y2?{$" + "{.2z,'(l2:y3:ref;y1:*;),@(y11:sexp-match?)[02}}{f}~?{${.5,.4a,'(s44:id" + "entifier cannot be (re)defined as variable),@(y7:x-error)[03}}${.6,.4d" + "a,f,@(y5:xform)[03},.1zda,${.3,.3,'(y4:set!),l3,@(y25:compile-and-run-" + "core-expr)[01}Y9]7}'(y13:define-syntax),.1q?{${.3d,.4a,@(y24:preproces" + "s-define-syntax)[02},${'(y13:define-syntax),.3a,.7,@(y21:top-defined-i" + "d-lookup)[03},.0Y2~?{${.5,.4a,'(s31:unexpected define-syntax for id),@" + "(y7:x-error)[03}}${.6,.4da,t,@(y5:xform)[03},.1sz@(y9:*verbose*)?{Po,'" + "(s18:SYNTAX INSTALLED: )W4Po,.2aW5PoW6}Y9]5}'(y14:define-library),.1q?" + "{${t,.5,.5d,.6a,@(y20:xform-define-library)[04},${'(y13:define-syntax)" + ",.3da,.7,@(y11:xenv-lookup)[03},.0Y2~?{${.5,.4da,'(s32:unexpected defi" + "ne-library for id),@(y7:x-error)[03}}.1dda,.1sz@(y9:*verbose*)?{Po,'(s" + "19:LIBRARY INSTALLED: )W4Po,.2daW5PoW6]5}]5}'(y6:import),.1q?{${t,.5,." + "5d,.6a,@(y12:xform-import)[04},.0da,'0,.1V4,'1,.2V4,${'(y6:import),.3," + ".(i10)[02},.0~?{${.3,.(i10),'(s49:failed to import to env, import is n" + "ot supported:),@(y7:x-error)[03}}@(y7:*quiet*)~,.0?{.0}{@(y9:*verbose*" + ")}_1?{${.2,'(l3:y8:;y8:;y8:;),@(y11:sexp-match" + "?)[02}}{f}?{@(y9:*verbose*)?{Po,'(s8:IMPORT: )W4}{Po,'(s10:; import: )" + "W4}Po,.1aW5Po,'(s24: bindings are the same, )W4Po,.1daW5Po,'(s11: modi" + "fied, )W4Po,.1ddaW5Po,'(s7: added%0a)W4}_1.1,@(y25:compile-and-run-cor" + "e-expr)[71}.0K0?{.2,${.5,.5,.5[02},@(y17:evaluate-top-form)[32}.0U0?{$" + "{.4,.4d,.4,@(y16:xform-integrable)[03},@(y25:compile-and-run-core-expr" + ")[31}.0Y0?{${.4,.4,f,@(y5:xform)[03},@(y25:compile-and-run-core-expr)[" + "31}${.4,.4d,.4,@(y10:xform-call)[03},@(y25:compile-and-run-core-expr)[" + "31}${.3,.3,f,@(y5:xform)[03},@(y25:compile-and-run-core-expr)[21", "P", "eval", "%!1,#0.1p?{.1a}{${@(y23:interaction-environment)[00}}.!0.0^,.3,@(y17:e"