new denoted value: <library>

This commit is contained in:
ESL 2024-07-06 17:16:02 -04:00
parent ab334f4813
commit 13e0525c6c
2 changed files with 140 additions and 103 deletions

121
src/t.scm
View file

@ -189,6 +189,8 @@
; <core> -> (ref <id>) ; <core> -> (ref <id>)
; <core> -> (set! <id> <core>) ; <core> -> (set! <id> <core>)
; <core> -> (set& <id>) ; <core> -> (set& <id>)
; <core> -> (gref <global>)
; <core> -> (gset! <global> <core>)
; <core> -> (lambda <ids> <core>) where <ids> -> (<id> ...) | (<id> ... . <id>) | <id> ; <core> -> (lambda <ids> <core>) where <ids> -> (<id> ...) | (<id> ... . <id>) | <id>
; <core> -> (lambda* (<arity> <core>) ...) where <arity> -> (<cnt> <rest?>) ; <core> -> (lambda* (<arity> <core>) ...) where <arity> -> (<cnt> <rest?>)
; <core> -> (letcc <id> <core>) ; <core> -> (letcc <id> <core>)
@ -201,10 +203,12 @@
; <core> -> (once <gid> <core>) where gid is always resolved as global ; <core> -> (once <gid> <core>) where gid is always resolved as global
; NB: (begin) is legit, returns unspecified value ; NB: (begin) is legit, returns unspecified value
; on top level, these two extra core forms are legal: ; on top level, these four extra core forms are legal:
; <core> -> (define <id> <core>) ; <core> -> (define <id> <core>)
; <core> -> (define-syntax <id> <transformer>) ; <core> -> (define-syntax <id> <transformer>)
; <core> -> (define-library <listname> <library>)
; <core> -> (import <library>)
; These names are bound to specials never returned by xform: ; These names are bound to specials never returned by xform:
@ -261,27 +265,35 @@
; <denotation> -> <location> ; <denotation> -> <location>
; <location> -> #&<value> ; <location> -> #&<value>
; <value> -> <special> | <core> ; <value> -> <special> | <core>
; <special> -> <builtin> | <integrable> | <transformer> ; <special> -> <builtin> | <integrable> | <transformer> | <library>
; <builtin> -> syntax-quote | quote | set! | set& | if | lambda | lambda* | ; <builtin> -> syntax-quote | quote | set! | set& | if | lambda | lambda* |
; letcc | withcc | body | begin | define | define-syntax | ; letcc | withcc | body | begin | define | define-syntax |
; syntax-lambda | syntax-rules | syntax-length | syntax-error ; syntax-lambda | syntax-rules | syntax-length | syntax-error
; <integrable> -> <fixnum serving as index in internal integrables table> ; <integrable> -> <fixnum serving as index in internal integrables table>
; <transformer> -> <procedure of exp and env returning exp> ; <transformer> -> <procedure of exp and env returning exp>
; <library> -> <vector of init-code and export-alist>
(define-syntax val-core? pair?) (define-syntax val-core? pair?)
(define-syntax location? box?) (define-syntax location? box?)
(define-syntax make-location box) (define-syntax make-location box)
(define-syntax location-val unbox) (define-syntax location-val unbox)
(define-syntax location-set-val! set-box!) (define-syntax location-set-val! set-box!)
(define-syntax core? pair?)
(define-syntax transformer? procedure?)
(define-syntax library? vector?)
(define-syntax make-library vector)
(define-syntax library-code (syntax-rules () [(_ l) (vector-ref l 0)]))
(define-syntax library-exports (syntax-rules () [(_ l) (vector-ref l 1)]))
(define-syntax library-set-exports! (syntax-rules () [(_ l v) (vector-set! l 1 v)]))
(define (location-special? l) (not (pair? (unbox l)))) (define (location-special? l) (not (pair? (unbox l))))
(define (new-id sym den getlits) (define p (list sym den getlits)) (lambda () p)) (define (new-id sym den getlits) (define p (list sym den getlits)) (lambda () p))
(define (old-sym id) (car (id))) (define (old-sym id) (car (id)))
(define (old-den id) (cadr (id))) (define (old-den id) (cadr (id)))
(define (old-literals id) ((or (caddr (id)) (lambda () '())))) (define (old-literals id) ((or (caddr (id)) (lambda () '()))))
(define (id? x) (or (symbol? x) (procedure? x))) (define (id? x) (or (symbol? x) (procedure? x)))
(define (id->sym id) (if (symbol? id) id (old-sym id))) (define (id->sym id) (if (symbol? id) id (old-sym id)))
; take a possibly renamed target id, and find image for nid ; take a possibly renamed target id, and find image for nid
(define (id-rename-as id nid) (define (id-rename-as id nid)
@ -345,9 +357,9 @@
(cond [appos? hval] (cond [appos? hval]
[(integrable? hval) ; integrable id-syntax [(integrable? hval) ; integrable id-syntax
(list 'ref (integrable-global hval))] (list 'ref (integrable-global hval))]
[(procedure? hval) ; id-syntax [(transformer? hval) ; id-syntax
(xform appos? (hval sexp env) env)] (xform appos? (hval sexp env) env)]
[(not (pair? hval)) ; special used out of context [(not (core? hval)) ; other special used out of context
(x-error "improper use of syntax form" hval)] (x-error "improper use of syntax form" hval)]
[else hval]))] ; core [else hval]))] ; core
[(not (pair? sexp)) [(not (pair? sexp))
@ -374,11 +386,10 @@
[(syntax-error) (xform-syntax-error tail env)] [(syntax-error) (xform-syntax-error tail env)]
[(define-library) (xform-define-library head tail env appos?)] [(define-library) (xform-define-library head tail env appos?)]
[(import) (xform-import head tail env appos?)] [(import) (xform-import head tail env appos?)]
[else (if (integrable? hval) [else (cond [(integrable? hval) (xform-integrable hval tail env)]
(xform-integrable hval tail env) [(transformer? hval) (xform appos? (hval sexp env) env)]
(if (procedure? hval) [(library? hval) (x-error "improper use of library" hval sexp)]
(xform appos? (hval sexp env) env) [else (xform-call hval tail env)])]))]))
(xform-call hval tail env)))]))]))
(define (xform-quote tail env) (define (xform-quote tail env)
(if (list1? tail) (if (list1? tail)
@ -523,7 +534,7 @@
(loop env (cons id ids) (cons init inits) (cons #t nids) rest)) (loop env (cons id ids) (cons init inits) (cons #t nids) rest))
(x-error "improper define-syntax form" first))] (x-error "improper define-syntax form" first))]
[else [else
(if (procedure? hval) (if (transformer? hval)
(loop env ids inits nids (cons (hval first env) rest)) (loop env ids inits nids (cons (hval first env) rest))
(xform-labels (reverse ids) (reverse inits) (reverse nids) body env appos?))]))) (xform-labels (reverse ids) (reverse inits) (reverse nids) body env appos?))])))
(xform-labels (reverse ids) (reverse inits) (reverse nids) body env appos?)))])) (xform-labels (reverse ids) (reverse inits) (reverse nids) body env appos?)))]))
@ -867,12 +878,18 @@
[(and (list2+? s) (eq? (car s) is-library-id)) [(and (list2+? s) (eq? (car s) is-library-id))
(let ([ic&ex (preprocess-library s env)]) (let ([ic&ex (preprocess-library s env)])
(return (car ic&ex) (cdr ic&ex)))] (return (car ic&ex) (cdr ic&ex)))]
[(and (list1+? s) (andmap libpart? s)) #;[(and (list1+? s) (andmap libpart? s))
(let* ([lib (xform-sexp->datum s)] [sym (listname->symbol lib)] (let* ([lib (xform-sexp->datum s)] [sym (listname->symbol lib)]
[core (xform #f sym env)]) ; #f to run id-syntax (in mac-env?) [core (xform #f sym env)]) ; #f to run id-syntax (in mac-env?)
(check-syntax core '(quote ((<symbol> * ...) (<symbol> . *) ...)) (check-syntax core '(quote ((<symbol> * ...) (<symbol> . *) ...))
"library import set does not refer to a valid library") "library import set does not refer to a valid library")
(return (caadr core) (cdadr core)))] (return (caadr core) (cdadr core)))]
[(and (list1+? s) (andmap libpart? s))
; NB: this is 1/3 of listname->library interface
(let* ([listname (xform-sexp->datum s)] [sym (listname->symbol listname)]
[id (id-rename-as sid sym)] [val (xform-ref id env)]) ; or should id be just sym?
(unless (library? val) (x-error "invalid library" listname val))
(return (library-code val) (library-exports val)))]
[else [else
(x-error "invalid import set in import" s)])) (x-error "invalid import set in import" s)]))
(let loop ([isets (cdr sexp)] [code '(begin)] [eal '()]) (let loop ([isets (cdr sexp)] [code '(begin)] [eal '()])
@ -1011,11 +1028,11 @@
[(eq? hval 'import) [(eq? hval 'import)
(x-error "NYI: import inside library code" first)] (x-error "NYI: import inside library code" first)]
; TODO: check for built-in (export) and modify eal! ; TODO: check for built-in (export) and modify eal!
[(procedure? hval) ; transformer: apply and loop [(transformer? hval) ; apply transformer and loop
(scan (cons (hval first cenv) rest) code*)] (scan (cons (hval first cenv) rest) code*)]
[(integrable? hval) ; integrable application [(integrable? hval) ; integrable application
(scan rest (cons (xform-integrable hval tail cenv) code*))] (scan rest (cons (xform-integrable hval tail cenv) code*))]
[else ; other specials and calls [else ; other specials and calls (xform does not return libraries)
(scan rest (cons (xform #f first cenv) code*))])) (scan rest (cons (xform #f first cenv) code*))]))
(scan rest (cons (xform #f first cenv) code*)))))) (scan rest (cons (xform #f first cenv) code*))))))
(let* ([code* (scan forms '())] [forms-code (cons 'begin (reverse! code*))] (let* ([code* (scan forms '())] [forms-code (cons 'begin (reverse! code*))]
@ -1041,7 +1058,9 @@
(let* ([name (xform-sexp->datum (car tail))] [sym (if (symbol? name) name (listname->symbol name))] (let* ([name (xform-sexp->datum (car tail))] [sym (if (symbol? name) name (listname->symbol name))]
[libform (cons head (cons sym (cdr tail)))] ; head is used as seed id for renamings [libform (cons head (cons sym (cdr tail)))] ; head is used as seed id for renamings
[ic&ex (preprocess-library libform env)] [lid (id-rename-as head sym)]) [ic&ex (preprocess-library libform env)] [lid (id-rename-as head sym)])
(list 'define-library lid (list 'quote ic&ex))) ; NB: this is 1/3 of listname->library interface
;(list 'define-library lid (list 'quote ic&ex))
(list 'define-library lid (make-library (car ic&ex) (cdr ic&ex))))
(x-error "improper define-library form" (cons head tail)))) (x-error "improper define-library form" (cons head tail))))
; for now, we have no clear idea of how to process import in all possible contexts, so we will also ; for now, we have no clear idea of how to process import in all possible contexts, so we will also
@ -1050,7 +1069,8 @@
(define (xform-import head tail env appos?) ; non-internal (define (xform-import head tail env appos?) ; non-internal
(if (list? tail) (if (list? tail)
(let ([ic&ex (preprocess-import-sets (cons head tail) env)]) (let ([ic&ex (preprocess-import-sets (cons head tail) env)])
(list 'import (list 'quote ic&ex))) ; NB: this is 1/3 of listname->library interface
(list 'import (make-library (car ic&ex) (cdr ic&ex))))
(x-error "improper import form" (cons head tail)))) (x-error "improper import form" (cons head tail))))
@ -1886,18 +1906,18 @@
loc)])) loc)]))
; specialized version for libraries ; specialized version for libraries
(define (library-info listname alloc?) ;=> ic&ex | #f (define (library-info listname alloc?) ;=> <library> | #f
(let ([loc (listname-lookup listname alloc?)]) (let ([loc (listname-lookup listname alloc?)])
(and loc (and loc
(let* ([v (location-val loc)] [q? (and (pair? v) (eq? (car v) 'quote))]) (let ([v (location-val loc)])
(if q? (cadr v) (if (library? v) v
(let ([ic&ex (cons '(begin) '())]) (let ([v (make-library '(begin) '())])
(location-set-val! loc (list 'quote ic&ex)) (location-set-val! loc v)
ic&ex)))))) v))))))
(for-each (for-each
(lambda (r) (lambda (r)
(define (key->lib k) (define (key->listname k)
(case k (case k
[(w) '(scheme write)] [(t) '(scheme time)] [(p) '(scheme repl)] [(w) '(scheme write)] [(t) '(scheme time)] [(p) '(scheme repl)]
[(r) '(scheme read)] [(v) '(scheme r5rs)] [(u) '(scheme r5rs-null)] [(r) '(scheme read)] [(v) '(scheme r5rs)] [(u) '(scheme r5rs-null)]
@ -1905,16 +1925,17 @@
[(i) '(scheme inexact)] [(f) '(scheme file)] [(e) '(scheme eval)] [(i) '(scheme inexact)] [(f) '(scheme file)] [(e) '(scheme eval)]
[(o) '(scheme complex)] [(h) '(scheme char)] [(l) '(scheme case-lambda)] [(o) '(scheme complex)] [(h) '(scheme char)] [(l) '(scheme case-lambda)]
[(x) '(scheme cxr)] [(b) '(scheme base)])) [(x) '(scheme cxr)] [(b) '(scheme base)]))
(define (get-env! lib) ;=> ic&ex (define (get-library! listname) ;=> <library>
(library-info lib #t)) (library-info listname #t))
(define (put-loc! ic&ex k loc) (define (put-loc! library k loc)
(let ([p (assq k (cdr ic&ex))]) (let* ([eal (library-exports library)] [p (assq k eal)])
(cond [p (set-cdr! p loc)] [else (set-cdr! ic&ex (cons (cons k loc) (cdr ic&ex)))]))) (cond [p (set-cdr! p loc)]
[else (library-set-exports! library (cons (cons k loc) eal))])))
(let loop ([name (car r)] [keys (cdr r)]) (let loop ([name (car r)] [keys (cdr r)])
(cond [(null? keys) ; all go to (repl) (cond [(null? keys) ; all go to (repl)
(put-loc! (get-env! '(repl)) name (root-environment name 'ref))] (put-loc! (get-library! '(repl)) name (root-environment name 'ref))]
[else [else
(put-loc! (get-env! (key->lib (car keys))) name (root-environment name 'ref)) (put-loc! (get-library! (key->listname (car keys))) name (root-environment name 'ref))
(loop name (cdr keys))]))) (loop name (cdr keys))])))
'((* v b) (+ v b) (- v b) (... v u b) (/ v b) (< v b) (<= v b) (= v b) (=> v u b) (> v b) (>= v b) '((* v b) (+ v b) (- v b) (... v u b) (/ v b) (< v b) (<= v b) (= v b) (=> v u b) (> v b) (>= v b)
(_ b) (abs v b) (and v u b) (append v b) (apply v b) (assoc v b) (assq v b) (assv v b) (begin v u b) (_ b) (abs v b) (and v u b) (append v b) (apply v b) (assoc v b) (assq v b) (assv v b) (begin v u b)
@ -1984,10 +2005,11 @@
; NB: later, this will need to be done via auto-allocating denotations! ; NB: later, this will need to be done via auto-allocating denotations!
(for-each (for-each
(lambda (p) ; we can rely on the fact that p is (listname . #&(quote ic&ex)) (lambda (p) ; we can rely on the fact that p is (listname . #&(quote ic&ex))
(let* ([listname (car p)] [val (location-val (cdr p))]) (let ([listname (car p)] [val (location-val (cdr p))])
(define (libid-transformer sexp env) (list syntax-quote-id val)) ; NB: this is 1/3 of listname->library interface
(define-in-root-environment! (listname->symbol listname) ;(define (libid-transformer sexp env) (list syntax-quote-id val))
(make-location libid-transformer) #t))) ;(define-in-root-environment! (listname->symbol listname) (make-location libid-transformer) #t)
(define-in-root-environment! (listname->symbol listname) (make-location val) #t)))
*listname-registry*) *listname-registry*)
@ -2008,7 +2030,7 @@
(define (repl-compile-and-run-core-expr core) (define (repl-compile-and-run-core-expr core)
(when *verbose* (display "TRANSFORM =>") (newline) (write core) (newline)) (when *verbose* (display "TRANSFORM =>") (newline) (write core) (newline))
(unless (pair? core) (x-error "unexpected transformed output" core)) (unless (core? core) (x-error "unexpected transformed output" core))
(let ([code (compile-to-thunk-code core)] [start #f]) (let ([code (compile-to-thunk-code core)] [start #f])
(when *verbose* (when *verbose*
(display "COMPILE-TO-STRING =>") (newline) (display code) (newline) (display "COMPILE-TO-STRING =>") (newline) (display code) (newline)
@ -2022,7 +2044,7 @@
(define (repl-eval-top-form x env) (define (repl-eval-top-form x env)
(if (pair? x) (if (pair? x)
(let ([hval (xform #t (car x) env)]) (let ([hval (xform #t (car x) env)]) ; returns <core>
(cond (cond
[(eq? hval 'begin) ; splice [(eq? hval 'begin) ; splice
(let loop ([x* (cdr x)]) (let loop ([x* (cdr x)])
@ -2051,14 +2073,13 @@
(let* ([core (xform-define-library (car x) (cdr x) env #f)] (let* ([core (xform-define-library (car x) (cdr x) env #f)]
[loc (xenv-lookup env (cadr core) 'define-syntax)]) [loc (xenv-lookup env (cadr core) 'define-syntax)])
(if loc ; location or #f (if loc ; location or #f
(let* ([qie (caddr core)] [val (lambda (sexp env) (list syntax-quote-id qie))]) (let ([l (caddr core)]) (location-set-val! loc l))
(location-set-val! loc val)) ; wrapped in identifier-syntax transformer
(x-error "identifier cannot be (re)defined as syntax in env:" (x-error "identifier cannot be (re)defined as syntax in env:"
(cadr core) env)) (cadr core) env))
(when *verbose* (display "LIBRARY INSTALLED: ") (write (cadr core)) (newline)))] (when *verbose* (display "LIBRARY INSTALLED: ") (write (cadr core)) (newline)))]
[(eq? hval 'import) ; splice as definitions [(eq? hval 'import) ; splice as definitions
(let* ([core (xform-import (car x) (cdr x) env #f)] ; core is (import (quote ic&ex)) (let* ([core (xform-import (car x) (cdr x) env #f)] ; core is (import <library>)
[ic&ex (cadadr core)] [code (car ic&ex)] [eal (cdr ic&ex)]) [l (cadr core)] [code (library-code l)] [eal (library-exports l)])
(define (define-alias p) (define (define-alias p)
(repl-eval-top-form (repl-eval-top-form
(list define-syntax-id (car p) (list syntax-quote-id (location-val (cdr p)))) env)) (list define-syntax-id (car p) (list syntax-quote-id (location-val (cdr p)))) env))

122
t.c
View file

@ -138,6 +138,24 @@ char *t_code[] = {
"A", "location-set-val!", "set-box!", "A", "location-set-val!", "set-box!",
"A", "core?", "pair?",
"A", "transformer?", "procedure?",
"A", "library?", "vector?",
"A", "make-library", "vector",
"S", "library-code",
"l3:y12:syntax-rules;n;l2:l2:y1:_;y1:l;;l3:y10:vector-ref;y1:l;i0;;;",
"S", "library-exports",
"l3:y12:syntax-rules;n;l2:l2:y1:_;y1:l;;l3:y10:vector-ref;y1:l;i1;;;",
"S", "library-set-exports!",
"l3:y12:syntax-rules;n;l2:l3:y1:_;y1:l;y1:v;;l4:y11:vector-set!;y1:l;i1"
";y1:v;;;",
"P", "location-special?", "P", "location-special?",
"%1.0zp~]1", "%1.0zp~]1",
@ -227,7 +245,8 @@ char *t_code[] = {
"tax-error)[72}'(y14:define-library),.1v?{.4,.7,.4,.6,@(y20:xform-defin" "tax-error)[72}'(y14:define-library),.1v?{.4,.7,.4,.6,@(y20:xform-defin"
"e-library)[74}'(y6:import),.1v?{.4,.7,.4,.6,@(y12:xform-import)[74}.1U" "e-library)[74}'(y6:import),.1v?{.4,.7,.4,.6,@(y12:xform-import)[74}.1U"
"0?{.6,.3,.3,@(y16:xform-integrable)[73}.1K0?{.6,${.9,.9,.6[02},.6,@(y5" "0?{.6,.3,.3,@(y16:xform-integrable)[73}.1K0?{.6,${.9,.9,.6[02},.6,@(y5"
":xform)[73}.6,.3,.3,@(y10:xform-call)[73", ":xform)[73}.1V0?{.5,.2,'(s23:improper use of library),@(y7:x-error)[73"
"}.6,.3,.3,@(y10:xform-call)[73",
"P", "xform-quote", "P", "xform-quote",
"%2${.2,@(y6:list1?)[01}?{${.2a,@(y17:xform-sexp->datum)[01},'(y5:quote" "%2${.2,@(y6:list1?)[01}?{${.2a,@(y17:xform-sexp->datum)[01},'(y5:quote"
@ -473,30 +492,29 @@ char *t_code[] = {
"03}.2a,${'(y4:only),.3,@(y12:id-rename-as)[02},${'(y6:except),.4,@(y12" "03}.2a,${'(y4:only),.3,@(y12:id-rename-as)[02},${'(y6:except),.4,@(y12"
":id-rename-as)[02},${'(y6:rename),.5,@(y12:id-rename-as)[02},${'(y6:pr" ":id-rename-as)[02},${'(y6:rename),.5,@(y12:id-rename-as)[02},${'(y6:pr"
"efix),.6,@(y12:id-rename-as)[02},${'(y7:library),.7,@(y12:id-rename-as" "efix),.6,@(y12:id-rename-as)[02},${'(y7:library),.7,@(y12:id-rename-as"
")[02},,#0.(i10),.9,.3,.3,.(i11),.8,.8,.(i11),.(i13),&9{%2,#0${.3,@(y7:" ")[02},,#0.(i10),.7,.(i10),.4,.4,.(i12),.9,.9,.(i12),.(i14),&(i10){%2,#"
"list2+?)[01}?{.1dap}{f}.!0.0^?{:0,.2aq?{${.3dd,@(y3:id?),@(y6:andmap)[" "0${.3,@(y7:list2+?)[01}?{.1dap}{f}.!0.0^?{:0,.2aq?{${.3dd,@(y3:id?),@("
"02}}{f}}{f}?{.1,.3,&2{%2${${:1dd,@(y7:id->sym),@(y5:%25map1)[02},.4,,#" "y6:andmap)[02}}{f}}{f}?{.1,.3,&2{%2${${:1dd,@(y7:id->sym),@(y5:%25map1"
"0.0,&1{%2.0u?{.0]2}.1,.1aaA0?{${.3,.3d,:0^[02},.1ac]2}.1,.1d,:0^[22}.!" ")[02},.4,,#0.0,&1{%2.0u?{.0]2}.1,.1aaA0?{${.3,.3d,:0^[02},.1ac]2}.1,.1"
"0.0^_1[02},.1,:0[22},.2da,:5^[32}.0^?{:1,.2aq?{${.3dd,@(y3:id?),@(y6:a" "d,:0^[22}.!0.0^_1[02},.1,:0[22},.2da,:5^[32}.0^?{:1,.2aq?{${.3dd,@(y3:"
"ndmap)[02}}{f}}{f}?{.1,.3,&2{%2${${:1dd,@(y7:id->sym),@(y5:%25map1)[02" "id?),@(y6:andmap)[02}}{f}}{f}?{.1,.3,&2{%2${${:1dd,@(y7:id->sym),@(y5:"
"},.4,,#0.0,&1{%2.0u?{.0]2}.1,.1aaA0?{.1,.1d,:0^[22}${.3,.3d,:0^[02},.1" "%25map1)[02},.4,,#0.0,&1{%2.0u?{.0]2}.1,.1aaA0?{.1,.1d,:0^[22}${.3,.3d"
"ac]2}.!0.0^_1[02},.1,:0[22},.2da,:5^[32}.0^?{:2,.2aq?{${.3d,@(y6:list2" ",:0^[02},.1ac]2}.!0.0^_1[02},.1,:0[22},.2da,:5^[32}.0^?{:2,.2aq?{${.3d"
"?)[01}?{${.3dda,@(y3:id?)[01}}{f}}{f}}{f}?{.1,.3,&2{%2${${:1dda,@(y7:i" ",@(y6:list2?)[01}?{${.3dda,@(y3:id?)[01}}{f}}{f}}{f}?{.1,.3,&2{%2${${:"
"d->sym)[01},.4,,#0.0,&1{%2.0u?{.0]2}${.2aa,.4,@(y13:symbol-append)[02}" "1dda,@(y7:id->sym)[01},.4,,#0.0,&1{%2.0u?{.0]2}${.2aa,.4,@(y13:symbol-"
",${.4,.4d,:0^[02},.2ad,.2cc]3}.!0.0^_1[02},.1,:0[22},.2da,:5^[32}.0^?{" "append)[02},${.4,.4d,:0^[02},.2ad,.2cc]3}.!0.0^_1[02},.1,:0[22},.2da,:"
":3,.2aq?{${.3dd,:4^,@(y6:andmap)[02}}{f}}{f}?{.1,.3,&2{%2${${:1dd,@(y1" "5^[32}.0^?{:3,.2aq?{${.3dd,:4^,@(y6:andmap)[02}}{f}}{f}?{.1,.3,&2{%2${"
"7:xform-sexp->datum)[01},.4,,#0.0,&1{%2.0u?{.0]2}.1,.1aaA3,.0?{.0,${.5" "${:1dd,@(y17:xform-sexp->datum)[01},.4,,#0.0,&1{%2.0u?{.0]2}.1,.1aaA3,"
",.5d,:0^[02},.3ad,.2dacc]4}${.4,.4d,:0^[02},.2ac]3}.!0.0^_1[02},.1,:0[" ".0?{.0,${.5,.5d,:0^[02},.3ad,.2dacc]4}${.4,.4d,:0^[02},.2ac]3}.!0.0^_1"
"22},.2da,:5^[32}${.3,@(y7:list2+?)[01}?{:6,.2aq}{f}?{${:8,.4,@(y18:pre" "[02},.1,:0[22},.2da,:5^[32}${.3,@(y7:list2+?)[01}?{:6,.2aq}{f}?{${:9,."
"process-library)[02},.0d,.1a,.5[42}${.3,@(y7:list1+?)[01}?{${.3,:7^,@(" "4,@(y18:preprocess-library)[02},.0d,.1a,.5[42}${.3,@(y7:list1+?)[01}?{"
"y6:andmap)[02}}{f}?{${.3,@(y17:xform-sexp->datum)[01},${.2,@(y16:listn" "${.3,:7^,@(y6:andmap)[02}}{f}?{${.3,@(y17:xform-sexp->datum)[01},${.2,"
"ame->symbol)[01},${:8,.3,f,@(y5:xform)[03},${'(s52:library import set " "@(y16:listname->symbol)[01},${.2,:8,@(y12:id-rename-as)[02},${:9,.3,@("
"does not refer to a valid library),'(l2:y5:quote;l3:l3:y8:<symbol>;y1:" "y9:xform-ref)[02},.0V0~?{${.2,.6,'(s15:invalid library),@(y7:x-error)["
"*;y3:...;;py8:<symbol>;y1:*;;y3:...;;),.4,@(y12:check-syntax)[03}.0dad" "03}}'1,.1V4,'0,.2V4,.8[72}.1,'(s28:invalid import set in import),@(y7:"
",.1daa,.7[62}.1,'(s28:invalid import set in import),@(y7:x-error)[32}." "x-error)[32}.!0n,'(l1:y5:begin;),.(i11)d,,#0.0,.5,&2{%3.0u?{.2,.2c]3}."
"!0n,'(l1:y5:begin;),.(i11)d,,#0.0,.5,&2{%3.0u?{.2,.2c]3}.2,.2,.2,:1,&4" "2,.2,.2,:1,&4{%2${:3,.4,@(y11:adjoin-eals)[02},${.3,:2,@(y11:adjoin-co"
"{%2${:3,.4,@(y11:adjoin-eals)[02},${.3,:2,@(y11:adjoin-code)[02},:1d,:" "de)[02},:1d,:0^[23},.1a,:0^[32}.!0.0^_1[(i11)3",
"0^[23},.1a,:0^[32}.!0.0^_1[(i11)3",
"P", "preprocess-library-declarations", "P", "preprocess-library-declarations",
"%2${'(s35:invalid library declarations syntax),'(l3:y4:<id>;l3:y4:<id>" "%2${'(s35:invalid library declarations syntax),'(l3:y4:<id>;l3:y4:<id>"
@ -588,13 +606,12 @@ char *t_code[] = {
"%4${.3,@(y7:list2+?)[01}?{${.3a,@(y7:list1+?)[01}}{f}?{${.3a,@(y17:xfo" "%4${.3,@(y7:list2+?)[01}?{${.3a,@(y7:list1+?)[01}}{f}?{${.3a,@(y17:xfo"
"rm-sexp->datum)[01},.0Y0?{.0}{${.2,@(y16:listname->symbol)[01}},.3d,.1" "rm-sexp->datum)[01},.0Y0?{.0}{${.2,@(y16:listname->symbol)[01}},.3d,.1"
"c,.3c,${.7,.3,@(y18:preprocess-library)[02},${.4,.7,@(y12:id-rename-as" "c,.3c,${.7,.3,@(y18:preprocess-library)[02},${.4,.7,@(y12:id-rename-as"
")[02},.1,'(y5:quote),l2,.1,'(y14:define-library),l3]9}.1,.1c,'(s28:imp" ")[02},.1d,.2a,V12,.1,'(y14:define-library),l3]9}.1,.1c,'(s28:improper "
"roper define-library form),@(y7:x-error)[42", "define-library form),@(y7:x-error)[42",
"P", "xform-import", "P", "xform-import",
"%4.1L0?{${.4,.4,.4c,@(y22:preprocess-import-sets)[02},.0,'(y5:quote),l" "%4.1L0?{${.4,.4,.4c,@(y22:preprocess-import-sets)[02},.0d,.1a,V12,'(y6"
"2,'(y6:import),l2]5}.1,.1c,'(s20:improper import form),@(y7:x-error)[4" ":import),l2]5}.1,.1c,'(s20:improper import form),@(y7:x-error)[42",
"2",
"P", "write-serialized-char", "P", "write-serialized-char",
"%2'(c%25),.1C=,.0?{.0}{'(c%22),.2C=,.0?{.0}{'(c%5c),.3C=,.0?{.0}{'(c )" "%2'(c%25),.1C=,.0?{.0}{'(c%22),.2C=,.0?{.0}{'(c%5c),.3C=,.0?{.0}{'(c )"
@ -997,8 +1014,8 @@ char *t_code[] = {
";)b,@(y19:*listname-registry*),.1,.4cc@!(y19:*listname-registry*).0]4", ";)b,@(y19:*listname-registry*),.1,.4cc@!(y19:*listname-registry*).0]4",
"P", "library-info", "P", "library-info",
"%2${.3,.3,@(y15:listname-lookup)[02},.0?{.0z,.0p?{'(y5:quote),.1aq}{f}" "%2${.3,.3,@(y15:listname-lookup)[02},.0?{.0z,.0V0?{.0]4}n,'(l1:y5:begi"
",.0?{.1da]5}n,'(l1:y5:begin;)c,.0,'(y5:quote),l2,.4sz.0]6}f]3", "n;),V12,.0,.3sz.0]5}f]3",
"C", 0, "C", 0,
"${'(l343:l3:y1:*;y1:v;y1:b;;l3:y1:+;y1:v;y1:b;;l3:y1:-;y1:v;y1:b;;l4:y" "${'(l343:l3:y1:*;y1:v;y1:b;;l3:y1:+;y1:v;y1:b;;l3:y1:-;y1:v;y1:b;;l4:y"
@ -1142,16 +1159,16 @@ char *t_code[] = {
"lex;)]2}'(y1:h),.1v?{'(l2:y6:scheme;y4:char;)]2}'(y1:l),.1v?{'(l2:y6:s" "lex;)]2}'(y1:h),.1v?{'(l2:y6:scheme;y4:char;)]2}'(y1:l),.1v?{'(l2:y6:s"
"cheme;y11:case-lambda;)]2}'(y1:x),.1v?{'(l2:y6:scheme;y3:cxr;)]2}'(y1:" "cheme;y11:case-lambda;)]2}'(y1:x),.1v?{'(l2:y6:scheme;y3:cxr;)]2}'(y1:"
"b),.1v?{'(l2:y6:scheme;y4:base;)]2}]2}.!0&0{%1t,.1,@(y12:library-info)" "b),.1v?{'(l2:y6:scheme;y4:base;)]2}]2}.!0&0{%1t,.1,@(y12:library-info)"
"[12}.!1&0{%3.0d,.2A3,.0?{.3,.1sd]4}.1d,.4,.4cc,.2sd]4}.!2.3d,.4a,,#0.0" "[12}.!1&0{%3'1,.1V4,.0,.3A3,.0?{.4,.1sd]5}.1,.5,.5cc,'1,.4V5]5}.!2.3d,"
",.6,.5,.7,&4{%2.1u?{${'(y3:ref),.3,@(y16:root-environment)[02},.1,${'(" ".4a,,#0.0,.6,.5,.7,&4{%2.1u?{${'(y3:ref),.3,@(y16:root-environment)[02"
"l1:y4:repl;),:0^[01},:2^[23}${${'(y3:ref),.5,@(y16:root-environment)[0" "},.1,${'(l1:y4:repl;),:0^[01},:2^[23}${${'(y3:ref),.5,@(y16:root-envir"
"2},.3,${${.9a,:1^[01},:0^[01},:2^[03}.1d,.1,:3^[22}.!0.0^_1[42},@(y10:" "onment)[02},.3,${${.9a,:1^[01},:0^[01},:2^[03}.1d,.1,:3^[22}.!0.0^_1[4"
"%25for-each1)[02}", "2},@(y10:%25for-each1)[02}",
"C", 0, "C", 0,
"${@(y19:*listname-registry*),&0{%1.0a,.1dz,,#0.1,&1{%2:0,@(y15:syntax-" "${@(y19:*listname-registry*),&0{%1.0dz,.1a,t,.2b,${.4,@(y16:listname->"
"quote-id),l2]2}.!0t,.1^b,${.6,@(y16:listname->symbol)[01},@(y27:define" "symbol)[01},@(y27:define-in-root-environment!)[33},@(y10:%25for-each1)"
"-in-root-environment!)[43},@(y10:%25for-each1)[02}", "[02}",
"C", 0, "C", 0,
"f@!(y9:*verbose*)", "f@!(y9:*verbose*)",
@ -1181,19 +1198,18 @@ char *t_code[] = {
"yntax in env:),@(y7:x-error)[03}}@(y9:*verbose*)?{Po,'(s18:SYNTAX INST" "yntax in env:),@(y7:x-error)[03}}@(y9:*verbose*)?{Po,'(s18:SYNTAX INST"
"ALLED: )W4Po,.2daW5PoW6]5}]5}'(y14:define-library),.1q?{${f,.5,.5d,.6a" "ALLED: )W4Po,.2daW5PoW6]5}]5}'(y14:define-library),.1q?{${f,.5,.5d,.6a"
",@(y20:xform-define-library)[04},${'(y13:define-syntax),.3da,.7,@(y11:" ",@(y20:xform-define-library)[04},${'(y13:define-syntax),.3da,.7,@(y11:"
"xenv-lookup)[03},.0?{.1dda,.0,&1{%2:0,@(y15:syntax-quote-id),l2]2},.0," "xenv-lookup)[03},.0?{.1dda,.0,.2sz_1}{${.6,.4da,'(s50:identifier canno"
".3sz_1_1}{${.6,.4da,'(s50:identifier cannot be (re)defined as syntax i" "t be (re)defined as syntax in env:),@(y7:x-error)[03}}@(y9:*verbose*)?"
"n env:),@(y7:x-error)[03}}@(y9:*verbose*)?{Po,'(s19:LIBRARY INSTALLED:" "{Po,'(s19:LIBRARY INSTALLED: )W4Po,.2daW5PoW6]5}]5}'(y6:import),.1q?{$"
" )W4Po,.2daW5PoW6]5}]5}'(y6:import),.1q?{${f,.5,.5d,.6a,@(y12:xform-im" "{f,.5,.5d,.6a,@(y12:xform-import)[04},.0da,'0,.1V4,'1,.2V4,,#0.7,&1{%1"
"port)[04},.0dada,.0a,.1d,,#0.7,&1{%1:0,.1dz,@(y15:syntax-quote-id),l2," ":0,.1dz,@(y15:syntax-quote-id),l2,.2a,@(y16:define-syntax-id),l3,@(y18"
".2a,@(y16:define-syntax-id),l3,@(y18:repl-eval-top-form)[12}.!0${.4,@(" ":repl-eval-top-form)[12}.!0${.4,@(y30:repl-compile-and-run-core-expr)["
"y30:repl-compile-and-run-core-expr)[01}.1,.1^,@(y10:%25for-each1)[82}." "01}.1,.1^,@(y10:%25for-each1)[82}.0K0?{.2,${.5,.5,.5[02},@(y18:repl-ev"
"0K0?{.2,${.5,.5,.5[02},@(y18:repl-eval-top-form)[32}.0U0?{${.4,.4d,.4," "al-top-form)[32}.0U0?{${.4,.4d,.4,@(y16:xform-integrable)[03},@(y30:re"
"@(y16:xform-integrable)[03},@(y30:repl-compile-and-run-core-expr)[31}." "pl-compile-and-run-core-expr)[31}.0Y0?{${.4,.4,f,@(y5:xform)[03},@(y30"
"0Y0?{${.4,.4,f,@(y5:xform)[03},@(y30:repl-compile-and-run-core-expr)[3" ":repl-compile-and-run-core-expr)[31}${.4,.4d,.4,@(y10:xform-call)[03},"
"1}${.4,.4d,.4,@(y10:xform-call)[03},@(y30:repl-compile-and-run-core-ex" "@(y30:repl-compile-and-run-core-expr)[31}${.3,.3,f,@(y5:xform)[03},@(y"
"pr)[31}${.3,.3,f,@(y5:xform)[03},@(y30:repl-compile-and-run-core-expr)" "30:repl-compile-and-run-core-expr)[21",
"[21",
"P", "repl-read", "P", "repl-read",
"%2.1?{PoW6Po,.2W4Po,'(s1: )W4}.0,@(y14:read-code-sexp)[21", "%2.1?{PoW6Po,.2W4Po,'(s1: )W4}.0,@(y14:read-code-sexp)[21",