From 302ddec77092fd3cd32b21a026bc907f0b402264 Mon Sep 17 00:00:00 2001 From: JeffBezanson Date: Sat, 8 Aug 2009 21:44:14 +0000 Subject: [PATCH] adding read and print support for named characters, e.g. #\space printing infs and nans in R6RS format making closure print syntax more compact; fn instead of function adding more c[ad]+r functions --- femtolisp/aliases.scm | 24 +++++++++++++-- femtolisp/flisp.boot | 2 +- femtolisp/flisp.c | 69 +++++++++++++++++++++---------------------- femtolisp/flisp.h | 3 +- femtolisp/print.c | 29 +++++++++++++----- femtolisp/read.c | 22 ++++++++++++++ femtolisp/system.lsp | 21 +++++++++++-- femtolisp/todo | 4 ++- 8 files changed, 124 insertions(+), 50 deletions(-) diff --git a/femtolisp/aliases.scm b/femtolisp/aliases.scm index fbaa34b..0001b26 100644 --- a/femtolisp/aliases.scm +++ b/femtolisp/aliases.scm @@ -7,6 +7,11 @@ (define vector-set! aset!) (define vector-length length) (define make-vector vector.alloc) +(define (vector-fill! v f) + (for 0 (- (length v) 1) + (lambda (i) (aset! v i f))) + #t) +(define (vector-map f v) (vector.map f v)) (define array-ref! aref) (define (array-set! a obj i0 . idxs) @@ -23,18 +28,25 @@ (define (exact? x) (integer? x)) (define (inexact? x) (not (exact? x))) (define quotient div0) +(define (inexact x) x) +(define (exact x) + (if (exact? x) x + (error "exact real numbers not supported"))) +(define (finite? x) (and (< x +inf.0) (> x -inf.0))) +(define (infinite? x) (or (equal? x +inf.0) (equal? x -inf.0))) +(define (nan? x) (or (equal? x +nan.0) (equal? x -nan.0))) (define (char->integer c) (fixnum c)) (define (integer->char i) (wchar i)) (define char-upcase char.upcase) (define char-downcase char.downcase) -(define char=? =) +(define char=? eqv?) (define char? >) (define char<=? <=) (define char>=? >=) -(define string=? =) +(define string=? eqv?) (define string? >) (define string<=? <=) @@ -44,6 +56,14 @@ (define string-length string.count) (define string->symbol symbol) (define (symbol->string s) (string s)) +(define symbol=? eq?) +(define (make-string k (fill #\space)) + (string.rep fill k)) (define (string-ref s i) (string.char s (string.inc s 0 i))) + +(define (input-port? x) (iostream? x)) +(define (output-port? x) (iostream? x)) + +(define (eval-core x) (eval x)) diff --git a/femtolisp/flisp.boot b/femtolisp/flisp.boot index db1bf8d..bc88371 100644 --- a/femtolisp/flisp.boot +++ b/femtolisp/flisp.boot @@ -1 +1 @@ -(*banner* "; _\n; |_ _ _ |_ _ | . _ _\n; | (-||||_(_)|__|_)|_)\n;-------------------|----------------------------------------------------------\n\n" *syntax-environment* #table(with-bindings #function(">000s1c0qe1c2|32e1e3|32e1c4|3243;" [#function("B000r3e0c1L1e2c3g2|33L1e4e2c5|}3331c6e0c7L1e4\x7f3132e0c7L1e4e2c8|g2333132L3L144;" [nconc let map #.list copy-list #function("8000r2c0|}L3;" [set!]) unwind-protect begin #function("8000r2c0|}L3;" [set!])]) map #.car cadr #function("6000r1e040;" [gensym])]) letrec #function("?000s1e0e0c1L1e2c3|32L1e2c4|32e5}3134L1e2c6|3242;" [nconc lambda map #.car #function("9000r1e0c1L1e2|3142;" [nconc set! copy-list]) copy-list #function("6000r1^;" [])]) backquote #function("7000r1e0|41;" [bq-process]) assert #function("<000r1c0|]c1c2c3|L2L2L2L4;" [if raise quote assert-failed]) label #function(":000r2c0|L1c1|}L3L3^L2;" [lambda set!]) do #function("A000s2c0qe130}Me2c3|32e2e4|32e2c5|3245;" [#function("B000r5c0|c1g2c2}e3c4L1e5\x7fN3132e3c4L1e5i0231e3|L1g432L133L4L3L2L1e3|L1g332L3;" [letrec lambda if nconc begin copy-list]) gensym map #.car cadr #function("7000r1e0|31F680e1|41;|M;" [cddr caddr])]) when #function("<000s1c0|c1}K^L4;" [if begin]) dotimes #function(";000s1c0q|M|\x8442;" [#function("=000r2c0`c1}aL3e2c3L1|L1L1e4\x7f3133L4;" [for - nconc lambda copy-list])]) unwind-protect #function("8000r2c0qe130e13042;" [#function("@000r2c0}c1_\x7fL3L2L1c2c3~c1|L1c4}L1c5|L2L3L3L3}L1L3L3;" [let lambda prog1 trycatch begin raise]) gensym]) define-macro #function("?000s1c0c1|ML2e2c3L1|NL1e4}3133L3;" [set-syntax! quote nconc lambda copy-list]) receive #function("@000s2c0c1_}L3e2c1L1|L1e3g23133L3;" [call-with-values lambda nconc copy-list]) unless #function("=000s1c0|^c1}KL4;" [if begin]) let #function(":000s1c0q^41;" [#function("<000r1~C6D0~m02\x7fMo002\x7fNo01530^2c0qe1c2L1e3c4~32L1e5\x7f3133e3c6~3242;" [#function("8000r2~6;0c0~|L3530|}K;" [label]) nconc lambda map #function("6000r1|F650|M;|;" []) copy-list #function("6000r1|F650|\x84;^;" [])])]) cond #function("9000s0c0q^41;" [#function("7000r1c0qm02|~41;" [#function("7000r1|?640^;c0q|M41;" [#function(";000r1|Mc0<17702|M]<6@0|N\x8550|M;c1|NK;|N\x85@0c2|Mi10~N31L3;c3|Mc1|NKi10~N31L4;" [else begin or if])] cond-clauses->if)])]) throw #function(":000r2c0c1c2c3L2|}L4L2;" [raise list quote thrown-value]) time #function("7000r1c0qe13041;" [#function(">000r1c0|c1L1L2L1c2~c3c4c5c1L1|L3c6L4L3L3;" [let time.now prog1 princ "Elapsed time: " - " seconds\n"]) gensym]) let* #function("A000s1|?6E0e0c1L1_L1e2}3133L1;e0c1L1e3|31L1L1e2|NF6H0e0c4L1|NL1e2}3133L1530}3133e5|31L2;" [nconc lambda copy-list caar let* cadar]) case #function(":000s1c0q^41;" [#function("7000r1c0m02c1qe23041;" [#function(";000r2}c0\x8250c0;}\x8540^;}C6=0c1|e2}31L3;}?6=0c3|e2}31L3;}N\x85>0c3|e2}M31L3;e4c5}326=0c6|c7}L2L3;c8|c7}L2L3;" [else eq? quote-value eqv? every #.symbol? memq quote memv] vals->cond) #function("<000r1c0|i10L2L1e1c2L1e3c4qi113232L3;" [let nconc cond map #function("8000r1i10~|M32|NK;" [])]) gensym])]) with-output-to #function("=000s1e0c1L1c2|L2L1L1e3}3143;" [nconc with-bindings *output-stream* copy-list]) catch #function("7000r2c0qe13041;" [#function("@000r1c0\x7fc1|L1c2c3c4|L2c5c6|L2c7c8L2L3c5c9|L2~L3L4c:|L2c;|L2L4L3L3;" [trycatch lambda if and pair? eq car quote thrown-value cadr caddr raise]) gensym])) *whitespace* "\t\n\v\f\r \u0085  ᠎           \u2028\u2029   " /= #function("7000r2|}W@;" [] /=) 1+ #function("7000r1|aw;" [] 1+) 1- #function("7000r1|ax;" [] 1-) 1arg-lambda? #function("8000r1|F16T02|Mc0<16J02|NF16B02|\x84F16:02e1|\x84a42;" [lambda length=] 1arg-lambda?) <= #function("7000r2|}X17602|}W;" [] <=) > #function("7000r2}|X;" [] >) >= #function("7000r2}|X17602|}W;" [] >=) Instructions #table(not 16 vargc 67 load1 49 = 39 setc.l 64 sub2 72 brne.l 83 largc 74 brnn 85 loadc.l 58 loadi8 50 < 40 nop 0 set-cdr! 32 loada 55 bound? 21 / 37 neg 73 brn.l 88 lvargc 75 brt 7 trycatch 68 null? 17 load0 48 jmp.l 8 loadv 51 seta 61 keyargs 91 * 36 function? 26 builtin? 23 aref 43 optargs 89 vector? 24 loadt 45 brf 6 symbol? 19 cdr 30 for 69 loadc00 78 pop 2 pair? 22 cadr 84 closure 65 loadf 46 compare 41 loadv.l 52 setg.l 60 brn 87 eqv? 13 aset! 44 eq? 12 atom? 15 boolean? 18 brt.l 10 tapply 70 dummy_nil 94 loada0 76 brbound 90 list 28 dup 1 apply 33 loadc 57 loadc01 79 dummy_t 92 setg 59 loada1 77 tcall.l 81 jmp 5 fixnum? 25 cons 27 loadg.l 54 tcall 4 call 3 - 35 brf.l 9 + 34 dummy_f 93 add2 71 seta.l 62 loadnil 47 brnn.l 86 setc 63 set-car! 31 vector 42 loadg 53 loada.l 56 argc 66 div0 38 ret 11 number? 20 equal? 14 car 29 call.l 80 brne 82) __init_globals #function("7000r0c0c1<17B02c0c2<17802c0c3<6>0c4k52c6k75;0c8k52c9k72e:k;2ek?;" [linux win32 win64 windows "\\" *directory-separator* "\r\n" *linefeed* "/" "\n" *stdout* *output-stream* *stdin* *input-stream* *stderr* *error-stream*] __init_globals) __script #function("7000r1c0qc1t;" [#function("7000r0e0~41;" [load]) #function("7000r1e0|312e1a41;" [top-level-exception-handler exit])] __script) __start #function("8000r1e0302|NF6@0|Nk12e2|\x84315A0|k12e3e4312e5302e6`41;" [__init_globals *argv* __script princ *banner* repl exit] __start) abs #function("7000r1|`X650|y;|;" [] abs) any #function("8000r2}F16D02|}M3117:02e0|}N42;" [any] any) arg-counts #table(#.not 1 #.atom? 1 #.number? 1 #.cons 2 #.set-cdr! 2 #.equal? 2 #.fixnum? 1 #.bound? 1 #.eq? 2 #.symbol? 1 #.builtin? 1 #.< 2 #.aset! 3 #.div0 2 #.cdr 1 #.null? 1 #.eqv? 2 #.compare 2 #.aref 2 #.car 1 #.set-car! 2 #.pair? 1 #.= 2 #.vector? 1 #.boolean? 1) argc-error #function("<000r2e0c1|c2}}aW670c3540c445;" [error "compile error: " " expects " " argument." " arguments."] argc-error) array? #function("8000r1|H17<02c0e1|3141;" [#function("7000r1|F16802|Mc0<;" [array]) typeof] array?) assoc #function("8000r2}?640^;e0}31|>650}M;e1|}N42;" [caar assoc] assoc) assv #function("8000r2}?640^;e0}31|=650}M;e1|}N42;" [caar assv] assv) bcode:cdepth #function(":000r2|b3e0|b3[}32\\;" [min] bcode:cdepth) bcode:code #function("7000r1|`[;" [] bcode:code) bcode:ctable #function("7000r1|a[;" [] bcode:ctable) bcode:indexfor #function("9000r2c0qe1|31e2|3142;" [#function(":000r2e0|\x7f32690e1|\x7f42;e2|\x7f}332}~b2}aw\\2;" [has? get put!]) bcode:ctable bcode:nconst] bcode:indexfor) bcode:nconst #function("7000r1|b2[;" [] bcode:nconst) bq-bracket #function("8000r1|?6<0c0e1|31L2;|Mc2\x8290c0|\x84L2;|Mc3\x8290c4|\x84L2;|Mc5\x8250|\x84;c0e1|31L2;" [#.list bq-process *comma* *comma-at* copy-list *comma-dot*] bq-bracket) bq-process #function("8000r1c0q^^42;" [#function("<000r2c0m02c1m12e2~316G0~H6@0c3e4e5~313141;~;~?680c6~L2;~Mc7\x82=0e4e4~\x843141;~Mc8\x8250~\x84;e9|~327B0c:e;~31e<}~3242;c=~_42;" [#function("7000r1|F16B02|Mc0<17802|Mc1<17702|c2<;" [*comma-at* *comma-dot* *comma*] splice-form?) #function("7000r1|F16802|Mc0<650|\x84;e1|41;" [*comma* bq-process] bq-bracket1) self-evaluating? #function("8000r1|Mc0\x8280c1|NK;c2c1|L3;" [list #.vector #.apply]) bq-process vector->list quote backquote *comma* any #function("8000r2|\x8570c0}K;e1c2}Ke3|31L142;" [list nconc list* bq-process]) lastcdr map #function(":000r2^|F16902|Mc0<@6E02e1|M31}Km12|Nm05\x0f/2c2|F6>0e3}|\x84L1325J0|\x85:0e4}315>0e3}e5|31L13241;" [*comma* bq-bracket #function("7000r1|N\x8550|M;c0|K;" [nconc]) nreconc reverse! bq-process])])] bq-process) builtin->instruction #function("9000r1e0~|^43;" [get] [#table(#.number? number? #.cons cons #.fixnum? fixnum? #.equal? equal? #.eq? eq? #.symbol? symbol? #.div0 div0 #.builtin? builtin? #.aset! aset! #.- - #.boolean? boolean? #.not not #.apply apply #.atom? atom? #.set-cdr! set-cdr! #./ / #.function? function? #.vector vector #.list list #.bound? bound? #.< < #.* * #.cdr cdr #.null? null? #.+ + #.eqv? eqv? #.compare compare #.aref aref #.set-car! set-car! #.car car #.pair? pair? #.= = #.vector? vector?) ()]) caaar #function("6000r1|MMM;" [] caaar) caadr #function("6000r1|\x84M;" [] caadr) caar #function("6000r1|MM;" [] caar) cadar #function("6000r1|M\x84;" [] cadar) cadddr #function("6000r1|NN\x84;" [] cadddr) caddr #function("6000r1|N\x84;" [] caddr) cadr #function("6000r1|\x84;" [] cadr) call-with-values #function("7000r2c0q|3041;" [#function("7000r1|F16902i10|M<680\x7f|Nv2;\x7f|41;" [])] #4=[(*values*) ()]) cdaar #function("6000r1|MMN;" [] cdaar) cdadr #function("6000r1|\x84N;" [] cdadr) cdar #function("6000r1|MN;" [] cdar) cddar #function("6000r1|MNN;" [] cddar) cdddr #function("6000r1|NNN;" [] cdddr) cddr #function("6000r1|NN;" [] cddr) char? #function("7000r1e0|31c1<;" [typeof wchar] char?) closure? #function("7000r1|J16602|G@;" [] closure?) compile #function("8000r1e0_|42;" [compile-f] compile) compile-and #function("<000r4e0|}g2g3]c146;" [compile-short-circuit brf] compile-and) compile-app #function("7000r4c0qg3M41;" [#function("9000r1c0q|C16V02e1|\x7f32@16J02|E16C02e2|3116902e3|31G6:0e3|31530|41;" [#function(":000r1e0i13Nc1326S0e2i10i11^|342c3qe4i10i11i13N3341;c5q|G16802e6|3141;" [length> 255 compile-in #function(":000r1e0i20i22670c1540c2|43;" [emit tcall.l call.l]) compile-arglist #function(";000r1~c0<16X02e1~i2132@16J02e2c031e0>16<02e3i23b2326L0e4i20i21^i23\x84342e5i20c042;|7A0e4i20i21^~34530^2c6qe7i20i21i23N3341;" [cadr in-env? top-level-value length= compile-in emit #function("=000r1~6H0e0i30i31i32i33i10~|47;e1i30i32670c2540c3|43;" [compile-builtin-call emit tcall call]) compile-arglist]) builtin->instruction]) in-env? constant? top-level-value])] compile-app) compile-arglist #function("8000r3e0c1qg2322e2g241;" [for-each #function(":000r1e0~\x7f^|44;" [compile-in]) length] compile-arglist) compile-begin #function(":000r4g3?6<0e0|}g2^44;g3N?6>0e0|}g2g3M44;e0|}^g3M342e1|c2322e3|}g2g3N44;" [compile-in emit pop compile-begin] compile-begin) compile-builtin-call #function(":000r7c0qe1e2g5^3341;" [#function("8000r1|16=02e0i03N|32@6=0e1i04|32530^2c2qi0541;" [length= argc-error #function("O000r1|c0\x82R0i16`W6<0e1i10c242;e1i10i15i1643;|c3\x82e0i16`W6<0e1i10c442;i16b2W6<0e1i10c542;e1i10i15i1643;|c6\x82v0i16`W6;0e7i14a42;i16aW6<0e1i10c842;i16b2W6<0e1i10c942;e1i10i15i1643;|c:\x82R0i16`W6<0e1i10c;42;e1i10i15i1643;|c<\x82Q0i16`W6;0e7i14a42;e1i10i15i1643;|c=\x82T0i16`W6>0e1i10c>c?43;e1i10i15i1643;|c@\x82]0i16b2X6<0e7i14b242;e1i10i12670cA540c@i1643;e1i10i1542;" [list emit loadnil + load0 add2 - argc-error neg sub2 * load1 / vector loadv [] apply tapply])]) get arg-counts] compile-builtin-call) compile-f #function("8000r2e0c1qc242;" [call-with-values #function("8000r0e0~\x7f42;" [compile-f-]) #function("6000r2|;" [])] compile-f) compile-f- #function("7000r2c0q^41;" [#function("=000r1c0qm02c1qe230\x7f\x84e3\x7f\x8431e4\x7f\x8431e5c6\x7f\x8432e3\x7f31i10\x8270c7570e3\x7f3146;" [#function("9000r1c0qe1|31F6N0e2|31F6=0c3e1|31K570e4|31530^41;" [#function("8000r1c0qe1|3141;" [#function(";000r1|\x8540~;e0c1|~i4034e2c3|32K;" [list* lambda map #function("6000r1^;" [])]) get-defined-vars]) cddr cdddr begin caddr] lambda-body) #function("9000r6c0q}?660`570e1}3141;" [#function("9000r1c0q|e1i0431x41;" [#function("9000r1c0qe1e2i143241;" [#function("F000r1i24\x87\xa90|\x85O0e0i20c1~i22\x8580i10560i10y345s0e2i20e3e4c5e4c6|32e7e8|31313331322e0i20c9~e8|31i22\x8580i10560i10y352e:i20i40i24i23~35530^2e;i10c<326L0e0i20i22\x8570c=540c>i10335]0i22\x87A0e0i20c?i10335H0i24\x85A0e0i20c@i1033530^2eAi20i23i40K]eBi4131i50\x82<0eCi41315:0i30i4131342e0i20cD322eEeFeGeHi203131eIi2031i2533i20b3[42;" [emit optargs bcode:indexfor make-perfect-hash-table map #.cons #.car iota length keyargs emit-optional-arg-inits > 255 largc lvargc vargc argc compile-in lastcdr caddr ret values function encode-byte-code bcode:code const-to-idx-vec]) filter keyword-arg?]) length]) length]) make-code-emitter lastcdr lambda-vars filter #.pair? lambda])] #0=[#:g621 ()]) compile-for #function(":000r5e0g4316X0e1|}^g2342e1|}^g3342e1|}^g4342e2|c342;e4c541;" [1arg-lambda? compile-in emit for error "for: third form must be a 1-argument lambda"] compile-for) compile-if #function("<000r4c0qe1|31e1|31g3\x84e2g331e3g331F6;0e4g331530^45;" [#function("=000r5g2]\x82>0e0~\x7fi02g344;g2^\x82>0e0~\x7fi02g444;e0~\x7f^g2342e1~c2|332e0~\x7fi02g3342i026<0e1~c3325:0e1~c4}332e5~|322e0~\x7fi02g4342e5~}42;" [compile-in emit brf ret jmp mark-label]) make-label caddr cdddr cadddr] compile-if) compile-in #function(":000r4g3C6=0e0|}g3c144;g3?6\x950g3`\x82:0e2|c342;g3a\x82:0e2|c442;g3]\x82:0e2|c542;g3^\x82:0e2|c642;g3_\x82:0e2|c742;e8g3316<0e2|c9g343;e2|c:g343;c;qg3M41;" [compile-sym [loada loadc loadg] emit load0 load1 loadt loadf loadnil fits-i8 loadi8 loadv #function("S000r1|c0\x82>0e1~c2i03\x8443;|c3\x82?0e4~\x7fi02i0344;|c5\x82@0e6~\x7fi02i03N44;|c7\x82<0e8~\x7fi0343;|c9\x82=0e:c;qc~\x7fi02i03N44;|c?\x82@0e@~\x7fi02i03N44;|cA\x82G0eB~\x7fi03\x84c5eCi0331K44;|cD\x82K0eE~\x7fi03\x84eFi0331eGi033145;|cH\x82F0eI~\x7f]i03\x84342e1~cJ42;|cK\x82N0eI~\x7f^eFi0331342eL~\x7fi03\x84cM44;|cN\x82K0eI~\x7fi02eOi03\x84eCi03313244;|cP\x82s0eI~\x7f^c9_i03\x84L3342eQeFi033131660^580eRcS312eI~\x7f^eFi0331342e1~cP42;eT~\x7fi02i0344;" [quote emit loadv if compile-if begin compile-begin prog1 compile-prog1 lambda call-with-values #function("8000r0e0i11i1342;" [compile-f-]) #function("9000r2e0i10c1|332e2i10}322}e3i1131X6<0e0i10c442;^;" [emit loadv bcode:cdepth nnn closure]) and compile-and or compile-or while compile-while cddr for compile-for caddr cadddr return compile-in ret set! compile-sym [seta setc setg] define expand-define trycatch 1arg-lambda? error "trycatch: second form must be a 1-argument lambda" compile-app])] compile-in) compile-or #function("<000r4e0|}g2g3^c146;" [compile-short-circuit brt] compile-or) compile-prog1 #function(";000r3e0|}^g2\x84342e1g231F6H0e2|}^e1g231342e3|c442;^;" [compile-in cddr compile-begin emit pop] compile-prog1) compile-short-circuit #function(":000r6g3?6=0e0|}g2g444;g3N?6>0e0|}g2g3M44;c1qe2|3141;" [compile-in #function("<000r1e0~\x7f^i03M342e1~c2322e1~i05|332e1~c3322e4~\x7fi02i03Ni04i05362e5~|42;" [compile-in emit dup pop compile-short-circuit mark-label]) make-label] compile-short-circuit) compile-sym #function(";000r4c0qe1g2}`]3441;" [#function("7000r1c0q|M41;" [#function(">000r1|c0\x82A0e1i10i13`[~\x8443;|c2\x82[0e1i10i13a[~\x84e3~31342e4i10e5i11N31a~\x84S342;e6i123116>02e7e8i1231316C0e1i10c9e8i123143;e1i10i13b2[i1243;" [arg emit closed caddr bcode:cdepth nnn constant? printable? top-level-value loadv])]) lookup-sym] compile-sym) compile-thunk #function(";000r1e0e1c2L1_L1|L1~3441;" [compile nconc lambda] #0#) compile-while #function("9000r4c0qe1|31e1|3142;" [#function(":000r2e0~\x7f^^342e1~|322e0~\x7f^i02342e2~c3}332e2~c4322e0~\x7f^i03342e2~c5|332e1~}42;" [compile-in mark-label emit brf pop jmp]) make-label] compile-while) const-to-idx-vec #function("9000r1c0qe1e2|313141;" [#function("9000r1e0c1qe2~31322|;" [table.foreach #function("8000r2~}|\\;" []) bcode:ctable]) vector.alloc bcode:nconst] const-to-idx-vec) copy-tree #function("8000r1|?640|;e0|M31e0|N31K;" [copy-tree] copy-tree) count #function("7000r2c0q^41;" [#function("9000r1c0qm02|~\x7f`43;" [#function("9000r3}\x8550g2;~|}N|}M31690g2aw540g243;" [] count-)])] count) delete-duplicates #function("8000r1|?640|;c0|M|N42;" [#function("8000r2e0|}32680e1}41;|e1}31K;" [member delete-duplicates])] delete-duplicates) disassemble #function(">000s1}\x85C0e0|`322e1302];530^2c2}Me3|31e4|3143;" [disassemble newline #function("7000r3c0q^41;" [#function(":000r1c0qm02`~axc1u2e2c3e4\x7f`32c5332c6qb4e7\x7f3142;" [#function("9000r1|J16602|G@6D0e0c1312e2|i10aw42;e3|41;" [princ "\n" disassemble print] print-val) #function("7000r1e0c141;" [princ "\t"]) princ "maxstack " ref-int32-LE "\n" #function(":000r2^|}X6E02c0qe1c2q^e333315\x19/;" [#function(";000r1e0~b432690e130530^2`i20axc2u2e3e4~b4x31c5e6|31c7342~awo002c8q|41;" [> newline #function("7000r1e0c141;" [princ "\t"]) princ hex5 ": " string "\t" #function(">000r1e0|c1326P0i20i32e2i31i1032[312i10b4wo10;e0|c3326L0i20i32i31i10[[312i10awo10;e0|c4326K0e5e6i31i10[31312i10awo10;e0|c7326O0e5e6e2i31i103231312i10b4wo10;e0|c8326f0e5e6i31i10[31c9322i10awo102e5e6i31i10[31312i10awo10;e0|c:326\x9c0e5e6e2i31i103231c9322i10b4wo102e5e6e2i31i103231312i10b4wo102~c;\x82X0e5c9312e5e6e2i31i103231c9322i10b4wo10;^;|c<=6w0e5e6e2i31i103231c9322i10b4wo102e5c=e>i10b,e2i31i1032R331322i10b4wo10;e0|c?326X0e5c=e>i10b,e@i31i1032R331322i10b2wo10;e0|cA326X0e5c=e>i10b,e2i31i1032R331322i10b4wo10;^;" [memq (loadv.l loadg.l setg.l) ref-int32-LE (loadv loadg setg) (loada seta call tcall list + - * / vector argc vargc loadi8 apply tapply) princ number->string (loada.l seta.l largc lvargc call.l tcall.l) (loadc setc) " " (loadc.l setc.l optargs keyargs) keyargs brbound "@" hex5 (jmp brf brt brne brnn brn) ref-int16-LE (jmp.l brf.l brt.l brne.l brnn.l brn.l)])]) table.foldl #function("8000r3g217@02}i21~[<16402|;" []) Instructions]) length])]) function:code function:vals] disassemble) display #function("7000r1e0|312];" [princ] display) div #function("8000r2|}V|`X16C02}`X16402a17502b/17402`w;" [] div) emit #function("I000s2g2\x85b0}c0<16C02|`[F16:02|`[Mc1<6;0|`[c2O5:0|`}|`[K\\5\xe20e3}c4326A0e5|g2M32L1m2530^2c6qe7}c832312c9qe7}c:32312}c;\x82\\0g2c<>6=0c=m12_m25F0g2c>>6=0c?m12_m2530^530^2}c@\x82\\0g2cA>6=0cBm12_m25F0g2cC>6=0cDm12_m2530^530^2cEq|`[F690|`[M530_|`[322|;" [car cdr cadr memq (loadv loadg setg) bcode:indexfor #function("8000r1|16=02e0i02Mc132680|\x84o01;^;" [> 255]) assq ((loadv loadv.l) (loadg loadg.l) (setg setg.l) (loada loada.l) (seta seta.l)) #function("8000r1|16L02e0i02Mc13217=02e0i02\x84c132680|\x84o01;^;" [> 255]) ((loadc loadc.l) (setc setc.l)) loada (0) loada0 (1) loada1 loadc (0 0) loadc00 (0 1) loadc01 #function("D000r2\x7fc0<16\x9a02|c1<16802}\x84c2<6E0~`i02Mc3e4}31KK\\5u0|c1\x82B0~`i02Mc5}NKK\\5_0|c6\x82B0~`i02Mc7}NKK\\5I0|c2\x82B0~`i02Mc8}NKK\\530^17^02\x7fc5<16702|c2<6@0~`i02Mc3}NKK\\;~`e9\x7fi02K}32\\;" [brf not null? brn cddr brt eq? brne brnn nreconc])] emit) emit-optional-arg-inits #function("8000r5g2F6=0c0qe1|3141;^;" [#function("<000r1e0~c1i04|342e2~e3i03i0432\x7fK^e4i0231342e0~c5i04332e0~c6322e7~|322e8~\x7fi02Ni03i04aw45;" [emit brbound compile-in list-head cadar seta pop mark-label emit-optional-arg-inits]) make-label] emit-optional-arg-inits) encode-byte-code #function("8000r1c0e1|3141;" [#function("8000r1c0e1|3141;" [#function(";000r1c0qe1e2|31b3e2|31b2VT2wc33241;" [#function("=000r1c0qe1~31`e230e230e330^^47;" [#function("B000r7e0g4c1322^}|X6#02i10}[m52g5c2\x82O0e3g2i10}aw[e4g431332}b2wm15\xf30e0g4e5e6e7~6<0c8qg531540g53231322}awm12}|X6:0i10}[530^m62e9g5c:326^0e3g3e4g431g6332e0g4~670e;540e<`31322}awm15\x830g5c=\x82k0e0g4e;g631322}awm12e3g3e4g431i10}[332e0g4e;`31322}awm15C0g6D6<0c>qg531530^5;/2e?c@qg3322eAg441;" [io.write #int32(0) label put! sizeof byte get Instructions #function("9000r1|c0\x8250c1;|c2\x8250c3;|c4\x8250c5;|c6\x8250c7;|c8\x8250c9;|c:\x8250c;;i05;" [jmp jmp.l brt brt.l brf brf.l brne brne.l brnn brnn.l brn brn.l]) memq (jmp brf brt brne brnn brn) int32 int16 brbound #function("<000r1e0|c1326H0e2i04e3i0631322\x7fawo01;e0|c4326`0e2i04e5i0631322\x7fawo012e2i04e5i20\x7f[31322\x7fawo01;e0|c6326\x820e2i04e3i0631322\x7fawo012e2i04e3i20\x7f[31322\x7fawo012i05c7\x82J0e2i04e3i20\x7f[31322\x7fawo01;^;e2i04e5i0631322\x7fawo01;" [memq (loadv.l loadg.l setg.l loada.l seta.l largc lvargc call.l tcall.l) io.write int32 (loadc setc) uint8 (loadc.l setc.l optargs keyargs) keyargs]) table.foreach #function("<000r2e0i04|322e1i04i10670e2540e3e4i02}32|x3142;" [io.seek io.write int32 int16 get]) io.tostring!]) length table buffer]) >= length 65536]) list->vector]) reverse!] encode-byte-code) error #function(":000s0e0c1|K41;" [raise error] error) eval #function("8000r1e0e1|313140;" [compile-thunk expand] eval) even? #function("8000r1e0|a32`W;" [logand] even?) every #function("8000r2}?17D02|}M3116:02e0|}N42;" [every] every) expand #function("7000r1e0|41;" [macroexpand] expand) expand-define #function("<000r2|C6:0c0|}ML3;c0|Me1c2L1|NL1e3}31|M34L3;" [set! nconc lambda copy-list] expand-define) filter #function("7000r2c0q^41;" [#function("9000r1c0qm02|~\x7f_L143;" [#function("9000r3g2^}F6S02i10}M316?0g2}M_KPNm2530^2}Nm15\f/2N;" [] filter-)])] filter) fits-i8 #function("8000r1|I16F02e0|b\xb03216:02e1|b\xaf42;" [>= <=] fits-i8) foldl #function(";000r3g2\x8540};e0||g2M}32g2N43;" [foldl] foldl) foldr #function("<000r3g2\x8540};|g2Me0|}g2N3342;" [foldr] foldr) for-each #function("8000r2}F6@0|}M312e0|}N42;];" [for-each] for-each) get-defined-vars #function("8000r1e0~|3141;" [delete-duplicates] #1=[#function(":000r1|?640_;|Mc0<16602|NF6d0|\x84C16702|\x84L117S02|\x84F16E02e1|31C16:02e1|31L117402_;|Mc2\x82>0e3e4~|N32v2;_;" [define caadr begin append map] #1#) ()]) hex5 #function("9000r1e0e1|b@32b5c243;" [string.lpad number->string #\0] hex5) identity #function("6000r1|;" [] identity) in-env? #function("8000r2e0c1q}42;" [any #function("8000r1e0~|42;" [memq])] in-env?) index-of #function(";000r3}\x8540^;|}M\x8250g2;e0|}Ng2aw43;" [index-of] index-of) io.readline #function("8000r1e0|c142;" [io.readuntil #\x000a] io.readline) io.readlines #function("8000r1e0e1|42;" [read-all-of io.readline] io.readlines) iota #function("8000r1e0e1|42;" [map-int identity] iota) keyword->symbol #function("9000r1e0|316@0e1c2e3|313141;|;" [keyword? symbol #function("<000r1e0|`e1|e2|313243;" [string.sub string.dec length]) string] keyword->symbol) keyword-arg? #function("7000r1|F16902e0|M41;" [keyword?] keyword-arg?) lambda-vars #function("7000r1c0q^41;" [#function(":000r1c0qm02|~~^^342e1c2e3~3142;" [#function(";000r4|A17502|C640];|F16602|MC6S0g217502g36<0e0c1}c243;~|N}g2g344;|F16602|MF6\x870e3|Mb23216902e4|31C660^5=0e0c5|Mc6}342e7e4|31316<0~|N}g2]44;g36<0e0c1}c843;~|N}]g344;|F6>0e0c9|Mc6}44;|}\x82:0e0c1}42;e0c9|c6}44;" [error "compile error: invalid argument list " ". optional arguments must come after required." length= caar "compile error: invalid optional argument " " in list " keyword? ". keyword arguments must come last." "compile error: invalid formal argument "] check-formals) map! #function("7000r1|F690e0|M41;|;" [keyword->symbol]) to-proper])] lambda-vars) last-pair #function("7000r1|N?640|;e0|N41;" [last-pair] last-pair) lastcdr #function("7000r1|?640|;e0|31N;" [last-pair] lastcdr) length= #function("9000r2}`X640^;}`W650|?;|?660}`W;e0|N}ax42;" [length=] length=) length> #function("9000r2}`X640|;}`W6;0|F16402|;|?660}`X;e0|N}ax42;" [length>] length>) list->vector #function("7000r1c0|v2;" [#.vector] list->vector) list-head #function(":000r2e0}`32640_;|Me1|N}ax32K;" [<= list-head] list-head) list-ref #function("8000r2e0|}32M;" [list-tail] list-ref) list-tail #function("9000r2e0}`32640|;e1|N}ax42;" [<= list-tail] list-tail) list? #function("7000r1|A17@02|F16902e0|N41;" [list?] list?) load #function("9000r1c0qe1|c23241;" [#function("7000r1c0qc1qt;" [#function("9000r0c0q^31^^^43;" [#function("6000r1c0qm0;" [#function(":000r3e0i10317C0~e1i1031|e2}3143;e3i10312e2}41;" [io.eof? read load-process io.close])])]) #function("9000r1e0~312e1c2i10|L341;" [io.close raise load-error])]) file :read] load) load-process #function("7000r1e0|41;" [eval] load-process) lookup-sym #function("7000r4}\x8550c0;c1q}M41;" [(global) #function(":000r1c0qe1~|`3341;" [#function(";000r1|6G0i13680c0|L2;c1i12|L3;e2i10i11Ni1317502~A680i12570i12aw^44;" [arg closed lookup-sym]) index-of])] lookup-sym) macrocall? #function("9000r1|MC16<02e0e1|M^43;" [get *syntax-environment*] macrocall?) macroexpand #function("7000r1c0q^41;" [#function("8000r1c0qm02|~_42;" [#function("9000r2|?640|;c0qe1|M}3241;" [#function("9000r1|6C0i10|\x84~NQ2e0|3142;c1qe2~3141;" [caddr #function("C000r1|6B0i20|i10NQ2i1142;i10Mc0\x8260i10;i10Mc1\x82V0e2c1L1i10\x84L1e3c4qe5i103132e6i103144;i10Mc7\x82O0e2c7L1i10\x84L1e3c8qe5i10313243;i10Mc9\x82T0c:qi10\x84e2c1L1_L1e;e5i10313133L142;e3c@16K02e3|i2132@16=02e4e1|3131@;" [constant? top-level-value string memq iostream?]) simple-sort environment io.close]) #function("7000r1~302e0|41;" [raise])]) #function("6000r0~k02\x7fk1;" [*print-pretty* *print-readably*])]) *print-pretty* *print-readably*]) file :write :create :truncate (*linefeed* *directory-separator* *argv* that *print-pretty* *print-width* *print-readably*)] make-system-image) map #function("<000s2c0q^^42;" [#function("9000r2c0m02c1qm12i02\x85;0|~\x7f_L143;}~\x7fi02K42;" [#function("9000r3g2^}F6H02g2|}M31_KPNm22}Nm15\x17/2N;" [] map1) #function("=000r2}M\x8540_;|~c0}_L133Q2\x7f|~c1}_L13332K;" [#.car #.cdr] mapn)])] map) map! #function("9000r2}^}F6B02}|}M31O2}Nm15\x1d/2;" [] map!) map-int #function("8000r2e0}`32640_;c1q|`31_K_42;" [<= #function(":000r2|m12a\x7faxc0qu2|;" [#function("8000r1\x7fi10|31_KP2\x7fNo01;" [])])] map-int) mark-label #function("9000r2e0|c1}43;" [emit label] mark-label) max #function("=000s1}\x8540|;e0c1|}43;" [foldl #function("7000r2|}X640};|;" [])] max) member #function("8000r2}?640^;}M|>640};e0|}N42;" [member] member) memv #function("8000r2}?640^;}M|=640};e0|}N42;" [memv] memv) min #function("=000s1}\x8540|;e0c1|}43;" [foldl #function("7000r2|}X640|;};" [])] min) mod #function("9000r2|e0|}32}T2x;" [div] mod) mod0 #2=#function("8000r2||}V}T2x;" [] mod0) negative? #function("7000r1|`X;" [] negative?) nestlist #function(";000r3e0g2`32640_;}e1||}31g2ax33K;" [<= nestlist] nestlist) newline #function("7000r0e0e1312];" [princ *linefeed*] newline) nnn #function("8000r1e0c1|42;" [count #function("6000r1|A@;" [])] nnn) nreconc #function("8000r2e0e1|31}42;" [nconc reverse!] nreconc) odd? #function("7000r1e0|31@;" [even?] odd?) positive? #function("8000r1e0|`42;" [>] positive?) princ #function("9000s0c0qe141;" [#function("7000r1^k02c1qc2q41;" [*print-readably* #function("7000r1c0qc1qt|302;" [#function("8000r0e0e1i2042;" [for-each write]) #function("7000r1~302e0|41;" [raise])]) #function("6000r0~k0;" [*print-readably*])]) *print-readably*] princ) print #function(":000s0e0e1|42;" [for-each write] print) print-exception #function("=000r1|F16D02|Mc0<16:02e1|b4326P0e2c3|\x84c4e5|31c6352e7e8|31315\x070|F16D02|Mc9<16:02e1|b4326N0e2|\x84c:e8|31c;342e7e5|31315\xd00|F16@02|Mc<<16602|NF6?0e2c=|\x84c>335\xac0|F16802|Mc?<6B0e2c@312e2|NQ25\x8d0|F16802|McA<6G0eBe5|31312e2cC|\x84325i0eD|3116:02e1|b2326I0e7|M312e2cE312cF|\x84315>0e2cG312e7|312e2eH41;" [type-error length= princ "type error: " ": expected " caddr ", got " print cadddr bounds-error ": index " " out of bounds for " unbound-error "eval: variable " " has no value" error "error: " load-error print-exception "in file " list? ": " #function("8000r1e0|3117502|C670e1540e2|41;" [string? princ print]) "*** Unhandled exception: " *linefeed*] print-exception) print-stack-trace #function("8000r1c0q^^42;" [#function("<000r2c0qm02c1qm12c2qe3e4~b53231e5e6e7c8e9303232`43;" [#function("8000r3c0qe1|31g2K41;" [#function(":000r1e0~31e0\x7f31\x82>0e1c2c3|L341;c4qe5~3141;" [function:code raise thrown-value ffound #function(":000r1`e0e1|3131c2qu;" [1- length #function("9000r1e0~|[316A0i30~|[i21i1043;^;" [closure?])]) function:vals]) function:name] find-in-f) #function("8000r2c0c1qc2t41;" [#function(";000r1|6H0e0e1e2e3e4|3132c53241;c6;" [symbol string.join map string reverse! "/" lambda]) #function("8000r0e0c1q\x7f322^;" [for-each #function("9000r1i10|~_43;" [])]) #function("7000r1|F16B02|Mc0<16802|\x84c1<680e2|41;e3|41;" [thrown-value ffound caddr raise])] fn-name) #function("8000r3e0c1q|42;" [for-each #function("9000r1e0c1i02c2332e3i11|`[\x7f32e4|31NK312e5302i02awo02;" [princ "#" " " print vector->list newline])]) reverse! list-tail filter closure? map #function("7000r1|E16802e0|41;" [top-level-value]) environment])] print-stack-trace) print-to-string #function("7000r1c0qe13041;" [#function("8000r1e0~|322e1|41;" [write io.tostring!]) buffer] print-to-string) printable? #function("7000r1e0|31@;" [iostream?] printable?) println #function("9000s0e0|Q2e1302;" [print newline] println) quote-value #function("7000r1e0|31640|;c1|L2;" [self-evaluating? quote] quote-value) quotient #.div0 random #function("8000r1e0|316<0e1e230|42;e330|T2;" [integer? mod rand rand.double] random) read-all #function("8000r1e0e1|42;" [read-all-of read] read-all) read-all-of #function("9000r2c0q^31_|}3142;" [#function("6000r1c0qm0;" [#function("9000r2e0i1131680e1|41;~}|Ki10i113142;" [io.eof? reverse!])])] read-all-of) ref-int16-LE #function(";000r2e0e1|}`w[`32e1|}aw[b832w41;" [int16 ash] ref-int16-LE) ref-int32-LE #function("=000r2e0e1|}`w[`32e1|}aw[b832e1|}b2w[b@32e1|}b3w[bH32R441;" [int32 ash] ref-int32-LE) remainder #2# repl #function("8000r0c0^^42;" [#function("6000r2c0m02c1qm12}302e240;" [#function("8000r0e0c1312e2e3312c4c5c6t41;" [princ "> " io.flush *output-stream* #function("8000r1e0e131@16<02c2e3|3141;" [io.eof? *input-stream* #function("7000r1e0|312|k12];" [print that]) load-process]) #function("6000r0e040;" [read]) #function("7000r1e0e1312e2|41;" [io.discardbuffer *input-stream* raise])] prompt) #function("7000r0c0qc1t6;0e2302\x7f40;^;" [#function("7000r0~3016702e040;" [newline]) #function("7000r1e0|312];" [top-level-exception-handler]) newline] reploop) newline])] repl) revappend #function("8000r2e0e1|31}42;" [nconc reverse] revappend) reverse #function("9000r1e0c1_|43;" [foldl #.cons] reverse) reverse! #function("7000r1c0q_41;" [#function("9000r1^~F6C02~N~|~m02P2o005\x1c/2|;" [])] reverse!) self-evaluating? #function("8000r1|?16602|C@17K02e0|3116A02|C16:02|e1|31<;" [constant? top-level-value] self-evaluating?) separate #function(":000r2~|}__44;" [] #3=[#function("6000r4}\x8580g2g3K;|}M316@0~|}N}Mg2Kg344;~|}Ng2}Mg3K44;" [] #3#) ()]) set-syntax! #function("9000r2e0e1|}43;" [put! *syntax-environment*] set-syntax!) simple-sort #function("7000r1|A17602|NA640|;c0q|M41;" [#function("9000r1c0qe1c2q~N3241;" [#function(":000r1e0e1|M31~L1e1|N3143;" [nconc simple-sort]) separate #function("7000r1|~X;" [])])] simple-sort) string.join #function("7000r2|\x8550c0;c1qe23041;" ["" #function("8000r1e0|~M322e1c2q~N322e3|41;" [io.write for-each #function("8000r1e0~i11322e0~|42;" [io.write]) io.tostring!]) buffer] string.join) string.lpad #function(";000r3e0e1g2}e2|31x32|42;" [string string.rep string.count] string.lpad) string.map #function("9000r2c0qe130e2}3142;" [#function("7000r2c0q`312e1|41;" [#function(";000r1^|\x7fX6S02e0~i10e1i11|3231322e2i11|32m05\v/;" [io.putc string.char string.inc]) io.tostring!]) buffer length] string.map) string.rep #function(";000r2}b4X6`0e0}`32650c1;}aW680e2|41;}b2W690e2||42;e2|||43;e3}316@0e2|e4|}ax3242;e4e2||32}b2U242;" [<= "" string odd? string.rep] string.rep) string.rpad #function("<000r3e0|e1g2}e2|31x3242;" [string string.rep string.count] string.rpad) string.tail #function(";000r2e0|e1|`}3342;" [string.sub string.inc] string.tail) string.trim #function("8000r3c0q^^42;" [#function("8000r2c0qm02c1qm12c2qe3~3141;" [#function(";000r4g2g3X16?02e0}e1|g232326A0~|}e2|g232g344;g2;" [string.find string.char string.inc] trim-start) #function("<000r3e0g2`3216D02e1}e2|e3|g23232326?0\x7f|}e3|g23243;g2;" [> string.find string.char string.dec] trim-end) #function("<000r1e0i10~i10i11`|34\x7fi10i12|3343;" [string.sub]) length])] string.trim) symbol-syntax #function("9000r1e0e1|^43;" [get *syntax-environment*] symbol-syntax) table.clone #function("7000r1c0qe13041;" [#function("9000r1e0c1q_~332|;" [table.foldl #function("9000r3e0~|}43;" [put!])]) table] table.clone) table.foreach #function("9000r2e0c1q_}43;" [table.foldl #function("8000r3~|}322];" [])] table.foreach) table.invert #function("7000r1c0qe13041;" [#function("9000r1e0c1q_~332|;" [table.foldl #function("9000r3e0~}|43;" [put!])]) table] table.invert) table.keys #function("9000r1e0c1_|43;" [table.foldl #function("7000r3|g2K;" [])] table.keys) table.pairs #function("9000r1e0c1_|43;" [table.foldl #function("7000r3|}Kg2K;" [])] table.pairs) table.values #function("9000r1e0c1_|43;" [table.foldl #function("7000r3}g2K;" [])] table.values) to-proper #function("9000r1|\x8540|;|?660|L1;|Me0|N31K;" [to-proper] to-proper) top-level-exception-handler #function("7000r1c0qe141;" [#function("7000r1e0k12c2qc3q41;" [*stderr* *output-stream* #function("7000r1c0qc1qt|302;" [#function("7000r0e0i20312e1e23041;" [print-exception print-stack-trace stacktrace]) #function("7000r1~302e0|41;" [raise])]) #function("6000r0~k0;" [*output-stream*])]) *output-stream*] top-level-exception-handler) trace #function("8000r1c0qe1|31312c2;" [#function("7000r1c0qe13041;" [#function("?000r1e0~317a0e1i10e2c3|c4c5c6c7i10L2|L3L2c8c7~L2|L3L3L33142;^;" [traced? set-top-level-value! eval lambda begin println cons quote apply]) gensym]) top-level-value ok] trace) traced? #function("8000r1e0|31e0~31>;" [function:code] [#function(":000s0e0c1|K312c2|v2;" [println x #.apply]) ()]) untrace #function("8000r1c0qe1|3141;" [#function("9000r1e0|316@0e1~e2|31b2[42;^;" [traced? set-top-level-value! function:vals]) top-level-value] untrace) values #function("9000s0|F16602|NA650|M;~|K;" [] #4#) vector->list #function("8000r1c0qe1|31_42;" [#function(":000r2a|c0qu2};" [#function("8000r1i10~|x[\x7fKo01;" [])]) length] vector->list) vector.map #function("8000r2c0qe1}3141;" [#function("8000r1c0qe1|3141;" [#function(":000r1`~axc0qu2|;" [#function(":000r1~|i20i21|[31\\;" [])]) vector.alloc]) length] vector.map) zero? #function("7000r1|`W;" [] zero?)) +(*banner* "; _\n; |_ _ _ |_ _ | . _ _\n; | (-||||_(_)|__|_)|_)\n;-------------------|----------------------------------------------------------\n\n" *syntax-environment* #table(with-bindings #fn(">000s1c0qe1c2|32e1e3|32e1c4|3243;" [#fn("B000r3e0c1L1e2c3g2|33L1e4e2c5|}3331c6e0c7L1e4\x7f3132e0c7L1e4e2c8|g2333132L3L144;" [nconc let map #.list copy-list #fn("8000r2c0|}L3;" [set!]) unwind-protect begin #fn("8000r2c0|}L3;" [set!])]) map #.car cadr #fn("6000r1e040;" [gensym])]) letrec #fn("?000s1e0e0c1L1e2c3|32L1e2c4|32e5}3134L1e2c6|3242;" [nconc lambda map #.car #fn("9000r1e0c1L1e2|3142;" [nconc set! copy-list]) copy-list #fn("6000r1^;" [])]) backquote #fn("7000r1e0|41;" [bq-process]) assert #fn("<000r1c0|]c1c2c3|L2L2L2L4;" [if raise quote assert-failed]) label #fn(":000r2c0|L1c1|}L3L3^L2;" [lambda set!]) do #fn("A000s2c0qe130}Me2c3|32e2e4|32e2c5|3245;" [#fn("B000r5c0|c1g2c2}e3c4L1e5\x7fN3132e3c4L1e5i0231e3|L1g432L133L4L3L2L1e3|L1g332L3;" [letrec lambda if nconc begin copy-list]) gensym map #.car cadr #fn("7000r1e0|31F680e1|41;|M;" [cddr caddr])]) when #fn("<000s1c0|c1}K^L4;" [if begin]) dotimes #fn(";000s1c0q|M|\x8442;" [#fn("=000r2c0`c1}aL3e2c3L1|L1L1e4\x7f3133L4;" [for - nconc lambda copy-list])]) unwind-protect #fn("8000r2c0qe130e13042;" [#fn("@000r2c0}c1_\x7fL3L2L1c2c3~c1|L1c4}L1c5|L2L3L3L3}L1L3L3;" [let lambda prog1 trycatch begin raise]) gensym]) define-macro #fn("?000s1c0c1|ML2e2c3L1|NL1e4}3133L3;" [set-syntax! quote nconc lambda copy-list]) receive #fn("@000s2c0c1_}L3e2c1L1|L1e3g23133L3;" [call-with-values lambda nconc copy-list]) unless #fn("=000s1c0|^c1}KL4;" [if begin]) let #fn(":000s1c0q^41;" [#fn("<000r1~C6D0~m02\x7fMo002\x7fNo01530^2c0qe1c2L1e3c4~32L1e5\x7f3133e3c6~3242;" [#fn("8000r2~6;0c0~|L3530|}K;" [label]) nconc lambda map #fn("6000r1|F650|M;|;" []) copy-list #fn("6000r1|F650|\x84;^;" [])])]) cond #fn("9000s0c0q^41;" [#fn("7000r1c0qm02|~41;" [#fn("7000r1|?640^;c0q|M41;" [#fn(";000r1|Mc0<17702|M]<6@0|N\x8550|M;c1|NK;|N\x85@0c2|Mi10~N31L3;c3|Mc1|NKi10~N31L4;" [else begin or if])] cond-clauses->if)])]) throw #fn(":000r2c0c1c2c3L2|}L4L2;" [raise list quote thrown-value]) time #fn("7000r1c0qe13041;" [#fn(">000r1c0|c1L1L2L1c2~c3c4c5c1L1|L3c6L4L3L3;" [let time.now prog1 princ "Elapsed time: " - " seconds\n"]) gensym]) let* #fn("A000s1|?6E0e0c1L1_L1e2}3133L1;e0c1L1e3|31L1L1e2|NF6H0e0c4L1|NL1e2}3133L1530}3133e5|31L2;" [nconc lambda copy-list caar let* cadar]) case #fn(":000s1c0q^41;" [#fn("7000r1c0m02c1qe23041;" [#fn(";000r2}c0\x8250c0;}\x8540^;}C6=0c1|e2}31L3;}?6=0c3|e2}31L3;}N\x85>0c3|e2}M31L3;e4c5}326=0c6|c7}L2L3;c8|c7}L2L3;" [else eq? quote-value eqv? every #.symbol? memq quote memv] vals->cond) #fn("<000r1c0|i10L2L1e1c2L1e3c4qi113232L3;" [let nconc cond map #fn("8000r1i10~|M32|NK;" [])]) gensym])]) with-output-to #fn("=000s1e0c1L1c2|L2L1L1e3}3143;" [nconc with-bindings *output-stream* copy-list]) catch #fn("7000r2c0qe13041;" [#fn("@000r1c0\x7fc1|L1c2c3c4|L2c5c6|L2c7c8L2L3c5c9|L2~L3L4c:|L2c;|L2L4L3L3;" [trycatch lambda if and pair? eq car quote thrown-value cadr caddr raise]) gensym])) *whitespace* "\t\n\v\f\r \u0085  ᠎           \u2028\u2029   " /= #fn("7000r2|}W@;" [] /=) 1+ #fn("7000r1|aw;" [] 1+) 1- #fn("7000r1|ax;" [] 1-) 1arg-lambda? #fn("8000r1|F16T02|Mc0<16J02|NF16B02|\x84F16:02e1|\x84a42;" [lambda length=] 1arg-lambda?) <= #fn("7000r2|}X17602|}W;" [] <=) > #fn("7000r2}|X;" [] >) >= #fn("7000r2}|X17602|}W;" [] >=) Instructions #table(not 16 vargc 67 load1 49 = 39 setc.l 64 sub2 72 brne.l 83 largc 74 brnn 85 loadc.l 58 loadi8 50 < 40 nop 0 set-cdr! 32 loada 55 bound? 21 / 37 neg 73 brn.l 88 lvargc 75 brt 7 trycatch 68 null? 17 load0 48 jmp.l 8 loadv 51 seta 61 keyargs 91 * 36 function? 26 builtin? 23 aref 43 optargs 89 vector? 24 loadt 45 brf 6 symbol? 19 cdr 30 for 69 loadc00 78 pop 2 pair? 22 cadr 84 closure 65 loadf 46 compare 41 loadv.l 52 setg.l 60 brn 87 eqv? 13 aset! 44 eq? 12 atom? 15 boolean? 18 brt.l 10 tapply 70 dummy_nil 94 loada0 76 brbound 90 list 28 dup 1 apply 33 loadc 57 loadc01 79 dummy_t 92 setg 59 loada1 77 tcall.l 81 jmp 5 fixnum? 25 cons 27 loadg.l 54 tcall 4 call 3 - 35 brf.l 9 + 34 dummy_f 93 add2 71 seta.l 62 loadnil 47 brnn.l 86 setc 63 set-car! 31 vector 42 loadg 53 loada.l 56 argc 66 div0 38 ret 11 number? 20 equal? 14 car 29 call.l 80 brne 82) __init_globals #fn("7000r0c0c1<17B02c0c2<17802c0c3<6>0c4k52c6k75;0c8k52c9k72e:k;2ek?;" [linux win32 win64 windows "\\" *directory-separator* "\r\n" *linefeed* "/" "\n" *stdout* *output-stream* *stdin* *input-stream* *stderr* *error-stream*] __init_globals) __script #fn("7000r1c0qc1t;" [#fn("7000r0e0~41;" [load]) #fn("7000r1e0|312e1a41;" [top-level-exception-handler exit])] __script) __start #fn("8000r1e0302|NF6@0|Nk12e2|\x84315A0|k12e3e4312e5302e6`41;" [__init_globals *argv* __script princ *banner* repl exit] __start) abs #fn("7000r1|`X650|y;|;" [] abs) any #fn("8000r2}F16D02|}M3117:02e0|}N42;" [any] any) arg-counts #table(#.not 1 #.atom? 1 #.number? 1 #.cons 2 #.set-cdr! 2 #.equal? 2 #.fixnum? 1 #.bound? 1 #.eq? 2 #.symbol? 1 #.builtin? 1 #.< 2 #.aset! 3 #.div0 2 #.cdr 1 #.null? 1 #.eqv? 2 #.compare 2 #.aref 2 #.car 1 #.set-car! 2 #.pair? 1 #.= 2 #.vector? 1 #.boolean? 1) argc-error #fn("<000r2e0c1|c2}}aW670c3540c445;" [error "compile error: " " expects " " argument." " arguments."] argc-error) array? #fn("8000r1|H17<02c0e1|3141;" [#fn("7000r1|F16802|Mc0<;" [array]) typeof] array?) assoc #fn("8000r2}?640^;e0}31|>650}M;e1|}N42;" [caar assoc] assoc) assv #fn("8000r2}?640^;e0}31|=650}M;e1|}N42;" [caar assv] assv) bcode:cdepth #fn(":000r2|b3e0|b3[}32\\;" [min] bcode:cdepth) bcode:code #fn("7000r1|`[;" [] bcode:code) bcode:ctable #fn("7000r1|a[;" [] bcode:ctable) bcode:indexfor #fn("9000r2c0qe1|31e2|3142;" [#fn(":000r2e0|\x7f32690e1|\x7f42;e2|\x7f}332}~b2}aw\\2;" [has? get put!]) bcode:ctable bcode:nconst] bcode:indexfor) bcode:nconst #fn("7000r1|b2[;" [] bcode:nconst) bq-bracket #fn("8000r1|?6<0c0e1|31L2;|Mc2\x8290c0|\x84L2;|Mc3\x8290c4|\x84L2;|Mc5\x8250|\x84;c0e1|31L2;" [#.list bq-process *comma* *comma-at* copy-list *comma-dot*] bq-bracket) bq-process #fn("8000r1c0q^^42;" [#fn("<000r2c0m02c1m12e2~316G0~H6@0c3e4e5~313141;~;~?680c6~L2;~Mc7\x82=0e4e4~\x843141;~Mc8\x8250~\x84;e9|~327B0c:e;~31e<}~3242;c=~_42;" [#fn("7000r1|F16B02|Mc0<17802|Mc1<17702|c2<;" [*comma-at* *comma-dot* *comma*] splice-form?) #fn("7000r1|F16802|Mc0<650|\x84;e1|41;" [*comma* bq-process] bq-bracket1) self-evaluating? #fn("8000r1|Mc0\x8280c1|NK;c2c1|L3;" [list #.vector #.apply]) bq-process vector->list quote backquote *comma* any #fn("8000r2|\x8570c0}K;e1c2}Ke3|31L142;" [list nconc list* bq-process]) lastcdr map #fn(":000r2^|F16902|Mc0<@6E02e1|M31}Km12|Nm05\x0f/2c2|F6>0e3}|\x84L1325J0|\x85:0e4}315>0e3}e5|31L13241;" [*comma* bq-bracket #fn("7000r1|N\x8550|M;c0|K;" [nconc]) nreconc reverse! bq-process])])] bq-process) builtin->instruction #fn("9000r1e0~|^43;" [get] [#table(#.number? number? #.cons cons #.fixnum? fixnum? #.equal? equal? #.eq? eq? #.symbol? symbol? #.div0 div0 #.builtin? builtin? #.aset! aset! #.- - #.boolean? boolean? #.not not #.apply apply #.atom? atom? #.set-cdr! set-cdr! #./ / #.function? function? #.vector vector #.list list #.bound? bound? #.< < #.* * #.cdr cdr #.null? null? #.+ + #.eqv? eqv? #.compare compare #.aref aref #.set-car! set-car! #.car car #.pair? pair? #.= = #.vector? vector?) ()]) caaaar #fn("6000r1|MMMM;" [] caaaar) caaadr #fn("6000r1|\x84MM;" [] caaadr) caaar #fn("6000r1|MMM;" [] caaar) caadar #fn("6000r1|M\x84M;" [] caadar) caaddr #fn("6000r1|N\x84M;" [] caaddr) caadr #fn("6000r1|\x84M;" [] caadr) caar #fn("6000r1|MM;" [] caar) cadaar #fn("6000r1|MM\x84;" [] cadaar) cadadr #fn("6000r1|\x84\x84;" [] cadadr) cadar #fn("6000r1|M\x84;" [] cadar) caddar #fn("6000r1|MN\x84;" [] caddar) cadddr #fn("6000r1|NN\x84;" [] cadddr) caddr #fn("6000r1|N\x84;" [] caddr) cadr #fn("6000r1|\x84;" [] cadr) call-with-values #fn("7000r2c0q|3041;" [#fn("7000r1|F16902i10|M<680\x7f|Nv2;\x7f|41;" [])] #4=[(*values*) ()]) cdaaar #fn("6000r1|MMMN;" [] cdaaar) cdaadr #fn("6000r1|\x84MN;" [] cdaadr) cdaar #fn("6000r1|MMN;" [] cdaar) cdadar #fn("6000r1|M\x84N;" [] cdadar) cdaddr #fn("6000r1|N\x84N;" [] cdaddr) cdadr #fn("6000r1|\x84N;" [] cdadr) cdar #fn("6000r1|MN;" [] cdar) cddaar #fn("6000r1|MMNN;" [] cddaar) cddadr #fn("6000r1|\x84NN;" [] cddadr) cddar #fn("6000r1|MNN;" [] cddar) cdddar #fn("6000r1|MNNN;" [] cdddar) cddddr #fn("6000r1|NNNN;" [] cddddr) cdddr #fn("6000r1|NNN;" [] cdddr) cddr #fn("6000r1|NN;" [] cddr) char? #fn("7000r1e0|31c1<;" [typeof wchar] char?) closure? #fn("7000r1|J16602|G@;" [] closure?) compile #fn("8000r1e0_|42;" [compile-f] compile) compile-and #fn("<000r4e0|}g2g3]c146;" [compile-short-circuit brf] compile-and) compile-app #fn("7000r4c0qg3M41;" [#fn("9000r1c0q|C16V02e1|\x7f32@16J02|E16C02e2|3116902e3|31G6:0e3|31530|41;" [#fn(":000r1e0i13Nc1326S0e2i10i11^|342c3qe4i10i11i13N3341;c5q|G16802e6|3141;" [length> 255 compile-in #fn(":000r1e0i20i22670c1540c2|43;" [emit tcall.l call.l]) compile-arglist #fn(";000r1~c0<16X02e1~i2132@16J02e2c031e0>16<02e3i23b2326L0e4i20i21^i23\x84342e5i20c042;|7A0e4i20i21^~34530^2c6qe7i20i21i23N3341;" [cadr in-env? top-level-value length= compile-in emit #fn("=000r1~6H0e0i30i31i32i33i10~|47;e1i30i32670c2540c3|43;" [compile-builtin-call emit tcall call]) compile-arglist]) builtin->instruction]) in-env? constant? top-level-value])] compile-app) compile-arglist #fn("8000r3e0c1qg2322e2g241;" [for-each #fn(":000r1e0~\x7f^|44;" [compile-in]) length] compile-arglist) compile-begin #fn(":000r4g3?6<0e0|}g2^44;g3N?6>0e0|}g2g3M44;e0|}^g3M342e1|c2322e3|}g2g3N44;" [compile-in emit pop compile-begin] compile-begin) compile-builtin-call #fn(":000r7c0qe1e2g5^3341;" [#fn("8000r1|16=02e0i03N|32@6=0e1i04|32530^2c2qi0541;" [length= argc-error #fn("O000r1|c0\x82R0i16`W6<0e1i10c242;e1i10i15i1643;|c3\x82e0i16`W6<0e1i10c442;i16b2W6<0e1i10c542;e1i10i15i1643;|c6\x82v0i16`W6;0e7i14a42;i16aW6<0e1i10c842;i16b2W6<0e1i10c942;e1i10i15i1643;|c:\x82R0i16`W6<0e1i10c;42;e1i10i15i1643;|c<\x82Q0i16`W6;0e7i14a42;e1i10i15i1643;|c=\x82T0i16`W6>0e1i10c>c?43;e1i10i15i1643;|c@\x82]0i16b2X6<0e7i14b242;e1i10i12670cA540c@i1643;e1i10i1542;" [list emit loadnil + load0 add2 - argc-error neg sub2 * load1 / vector loadv [] apply tapply])]) get arg-counts] compile-builtin-call) compile-f #fn("8000r2e0c1qc242;" [call-with-values #fn("8000r0e0~\x7f42;" [compile-f-]) #fn("6000r2|;" [])] compile-f) compile-f- #fn("7000r2c0q^41;" [#fn("=000r1c0qm02c1qe230\x7f\x84e3\x7f\x8431e4\x7f\x8431e5c6\x7f\x8432e3\x7f31i10\x8270c7570e3\x7f3146;" [#fn("9000r1c0qe1|31F6N0e2|31F6=0c3e1|31K570e4|31530^41;" [#fn("8000r1c0qe1|3141;" [#fn(";000r1|\x8540~;e0c1|~i4034e2c3|32K;" [list* lambda map #fn("6000r1^;" [])]) get-defined-vars]) cddr cdddr begin caddr] lambda-body) #fn("9000r6c0q}?660`570e1}3141;" [#fn("9000r1c0q|e1i0431x41;" [#fn("9000r1c0qe1e2i143241;" [#fn("F000r1i24\x87\xa90|\x85O0e0i20c1~i22\x8580i10560i10y345s0e2i20e3e4c5e4c6|32e7e8|31313331322e0i20c9~e8|31i22\x8580i10560i10y352e:i20i40i24i23~35530^2e;i10c<326L0e0i20i22\x8570c=540c>i10335]0i22\x87A0e0i20c?i10335H0i24\x85A0e0i20c@i1033530^2eAi20i23i40K]eBi4131i50\x82<0eCi41315:0i30i4131342e0i20cD322eEeFeGeHi203131eIi2031i2533i20b3[42;" [emit optargs bcode:indexfor make-perfect-hash-table map #.cons #.car iota length keyargs emit-optional-arg-inits > 255 largc lvargc vargc argc compile-in lastcdr caddr ret values function encode-byte-code bcode:code const-to-idx-vec]) filter keyword-arg?]) length]) length]) make-code-emitter lastcdr lambda-vars filter #.pair? lambda])] #0=[#:g630 ()]) compile-for #fn(":000r5e0g4316X0e1|}^g2342e1|}^g3342e1|}^g4342e2|c342;e4c541;" [1arg-lambda? compile-in emit for error "for: third form must be a 1-argument lambda"] compile-for) compile-if #fn("<000r4c0qe1|31e1|31g3\x84e2g331e3g331F6;0e4g331530^45;" [#fn("=000r5g2]\x82>0e0~\x7fi02g344;g2^\x82>0e0~\x7fi02g444;e0~\x7f^g2342e1~c2|332e0~\x7fi02g3342i026<0e1~c3325:0e1~c4}332e5~|322e0~\x7fi02g4342e5~}42;" [compile-in emit brf ret jmp mark-label]) make-label caddr cdddr cadddr] compile-if) compile-in #fn(":000r4g3C6=0e0|}g3c144;g3?6\x950g3`\x82:0e2|c342;g3a\x82:0e2|c442;g3]\x82:0e2|c542;g3^\x82:0e2|c642;g3_\x82:0e2|c742;e8g3316<0e2|c9g343;e2|c:g343;c;qg3M41;" [compile-sym [loada loadc loadg] emit load0 load1 loadt loadf loadnil fits-i8 loadi8 loadv #fn("S000r1|c0\x82>0e1~c2i03\x8443;|c3\x82?0e4~\x7fi02i0344;|c5\x82@0e6~\x7fi02i03N44;|c7\x82<0e8~\x7fi0343;|c9\x82=0e:c;qc~\x7fi02i03N44;|c?\x82@0e@~\x7fi02i03N44;|cA\x82G0eB~\x7fi03\x84c5eCi0331K44;|cD\x82K0eE~\x7fi03\x84eFi0331eGi033145;|cH\x82F0eI~\x7f]i03\x84342e1~cJ42;|cK\x82N0eI~\x7f^eFi0331342eL~\x7fi03\x84cM44;|cN\x82K0eI~\x7fi02eOi03\x84eCi03313244;|cP\x82s0eI~\x7f^c9_i03\x84L3342eQeFi033131660^580eRcS312eI~\x7f^eFi0331342e1~cP42;eT~\x7fi02i0344;" [quote emit loadv if compile-if begin compile-begin prog1 compile-prog1 lambda call-with-values #fn("8000r0e0i11i1342;" [compile-f-]) #fn("9000r2e0i10c1|332e2i10}322}e3i1131X6<0e0i10c442;^;" [emit loadv bcode:cdepth nnn closure]) and compile-and or compile-or while compile-while cddr for compile-for caddr cadddr return compile-in ret set! compile-sym [seta setc setg] define expand-define trycatch 1arg-lambda? error "trycatch: second form must be a 1-argument lambda" compile-app])] compile-in) compile-or #fn("<000r4e0|}g2g3^c146;" [compile-short-circuit brt] compile-or) compile-prog1 #fn(";000r3e0|}^g2\x84342e1g231F6H0e2|}^e1g231342e3|c442;^;" [compile-in cddr compile-begin emit pop] compile-prog1) compile-short-circuit #fn(":000r6g3?6=0e0|}g2g444;g3N?6>0e0|}g2g3M44;c1qe2|3141;" [compile-in #fn("<000r1e0~\x7f^i03M342e1~c2322e1~i05|332e1~c3322e4~\x7fi02i03Ni04i05362e5~|42;" [compile-in emit dup pop compile-short-circuit mark-label]) make-label] compile-short-circuit) compile-sym #fn(";000r4c0qe1g2}`]3441;" [#fn("7000r1c0q|M41;" [#fn(">000r1|c0\x82A0e1i10i13`[~\x8443;|c2\x82[0e1i10i13a[~\x84e3~31342e4i10e5i11N31a~\x84S342;e6i123116>02e7e8i1231316C0e1i10c9e8i123143;e1i10i13b2[i1243;" [arg emit closed caddr bcode:cdepth nnn constant? printable? top-level-value loadv])]) lookup-sym] compile-sym) compile-thunk #fn(";000r1e0e1c2L1_L1|L1~3441;" [compile nconc lambda] #0#) compile-while #fn("9000r4c0qe1|31e1|3142;" [#fn(":000r2e0~\x7f^^342e1~|322e0~\x7f^i02342e2~c3}332e2~c4322e0~\x7f^i03342e2~c5|332e1~}42;" [compile-in mark-label emit brf pop jmp]) make-label] compile-while) const-to-idx-vec #fn("9000r1c0qe1e2|313141;" [#fn("9000r1e0c1qe2~31322|;" [table.foreach #fn("8000r2~}|\\;" []) bcode:ctable]) vector.alloc bcode:nconst] const-to-idx-vec) copy-tree #fn("8000r1|?640|;e0|M31e0|N31K;" [copy-tree] copy-tree) count #fn("7000r2c0q^41;" [#fn("9000r1c0qm02|~\x7f`43;" [#fn("9000r3}\x8550g2;~|}N|}M31690g2aw540g243;" [] count-)])] count) delete-duplicates #fn("8000r1|?640|;c0|M|N42;" [#fn("8000r2e0|}32680e1}41;|e1}31K;" [member delete-duplicates])] delete-duplicates) disassemble #fn(">000s1}\x85C0e0|`322e1302];530^2c2}Me3|31e4|3143;" [disassemble newline #fn("7000r3c0q^41;" [#fn(":000r1c0qm02`~axc1u2e2c3e4\x7f`32c5332c6qb4e7\x7f3142;" [#fn("9000r1|J16602|G@6D0e0c1312e2|i10aw42;e3|41;" [princ "\n" disassemble print] print-val) #fn("7000r1e0c141;" [princ "\t"]) princ "maxstack " ref-int32-LE "\n" #fn(":000r2^|}X6E02c0qe1c2q^e333315\x19/;" [#fn(";000r1e0~b432690e130530^2`i20axc2u2e3e4~b4x31c5e6|31c7342~awo002c8q|41;" [> newline #fn("7000r1e0c141;" [princ "\t"]) princ hex5 ": " string "\t" #fn(">000r1e0|c1326P0i20i32e2i31i1032[312i10b4wo10;e0|c3326L0i20i32i31i10[[312i10awo10;e0|c4326K0e5e6i31i10[31312i10awo10;e0|c7326O0e5e6e2i31i103231312i10b4wo10;e0|c8326f0e5e6i31i10[31c9322i10awo102e5e6i31i10[31312i10awo10;e0|c:326\x9c0e5e6e2i31i103231c9322i10b4wo102e5e6e2i31i103231312i10b4wo102~c;\x82X0e5c9312e5e6e2i31i103231c9322i10b4wo10;^;|c<=6w0e5e6e2i31i103231c9322i10b4wo102e5c=e>i10b,e2i31i1032R331322i10b4wo10;e0|c?326X0e5c=e>i10b,e@i31i1032R331322i10b2wo10;e0|cA326X0e5c=e>i10b,e2i31i1032R331322i10b4wo10;^;" [memq (loadv.l loadg.l setg.l) ref-int32-LE (loadv loadg setg) (loada seta call tcall list + - * / vector argc vargc loadi8 apply tapply) princ number->string (loada.l seta.l largc lvargc call.l tcall.l) (loadc setc) " " (loadc.l setc.l optargs keyargs) keyargs brbound "@" hex5 (jmp brf brt brne brnn brn) ref-int16-LE (jmp.l brf.l brt.l brne.l brnn.l brn.l)])]) table.foldl #fn("8000r3g217@02}i21~[<16402|;" []) Instructions]) length])]) function:code function:vals] disassemble) display #fn("8000\x8910002000\x8a10009000e0m12c1qe0312];" [*output-stream* #fn("7000r1\x7fk02c1qc2q41;" [*output-stream* #fn("7000r1c0qc1qt|302;" [#fn("7000r0e0i2041;" [princ]) #fn("7000r1~302e0|41;" [raise])]) #fn("6000r0~k0;" [*output-stream*])])] display) div #fn("8000r2|}V|`X16C02}`X16402a17502b/17402`w;" [] div) emit #fn("I000s2g2\x85b0}c0<16C02|`[F16:02|`[Mc1<6;0|`[c2O5:0|`}|`[K\\5\xe20e3}c4326A0e5|g2M32L1m2530^2c6qe7}c832312c9qe7}c:32312}c;\x82\\0g2c<>6=0c=m12_m25F0g2c>>6=0c?m12_m2530^530^2}c@\x82\\0g2cA>6=0cBm12_m25F0g2cC>6=0cDm12_m2530^530^2cEq|`[F690|`[M530_|`[322|;" [car cdr cadr memq (loadv loadg setg) bcode:indexfor #fn("8000r1|16=02e0i02Mc132680|\x84o01;^;" [> 255]) assq ((loadv loadv.l) (loadg loadg.l) (setg setg.l) (loada loada.l) (seta seta.l)) #fn("8000r1|16L02e0i02Mc13217=02e0i02\x84c132680|\x84o01;^;" [> 255]) ((loadc loadc.l) (setc setc.l)) loada (0) loada0 (1) loada1 loadc (0 0) loadc00 (0 1) loadc01 #fn("D000r2\x7fc0<16\x9a02|c1<16802}\x84c2<6E0~`i02Mc3e4}31KK\\5u0|c1\x82B0~`i02Mc5}NKK\\5_0|c6\x82B0~`i02Mc7}NKK\\5I0|c2\x82B0~`i02Mc8}NKK\\530^17^02\x7fc5<16702|c2<6@0~`i02Mc3}NKK\\;~`e9\x7fi02K}32\\;" [brf not null? brn cddr brt eq? brne brnn nreconc])] emit) emit-optional-arg-inits #fn("8000r5g2F6=0c0qe1|3141;^;" [#fn("<000r1e0~c1i04|342e2~e3i03i0432\x7fK^e4i0231342e0~c5i04332e0~c6322e7~|322e8~\x7fi02Ni03i04aw45;" [emit brbound compile-in list-head cadar seta pop mark-label emit-optional-arg-inits]) make-label] emit-optional-arg-inits) encode-byte-code #fn("8000r1c0e1|3141;" [#fn("8000r1c0e1|3141;" [#fn(";000r1c0qe1e2|31b3e2|31b2VT2wc33241;" [#fn("=000r1c0qe1~31`e230e230e330^^47;" [#fn("B000r7e0g4c1322^}|X6#02i10}[m52g5c2\x82O0e3g2i10}aw[e4g431332}b2wm15\xf30e0g4e5e6e7~6<0c8qg531540g53231322}awm12}|X6:0i10}[530^m62e9g5c:326^0e3g3e4g431g6332e0g4~670e;540e<`31322}awm15\x830g5c=\x82k0e0g4e;g631322}awm12e3g3e4g431i10}[332e0g4e;`31322}awm15C0g6D6<0c>qg531530^5;/2e?c@qg3322eAg441;" [io.write #int32(0) label put! sizeof byte get Instructions #fn("9000r1|c0\x8250c1;|c2\x8250c3;|c4\x8250c5;|c6\x8250c7;|c8\x8250c9;|c:\x8250c;;i05;" [jmp jmp.l brt brt.l brf brf.l brne brne.l brnn brnn.l brn brn.l]) memq (jmp brf brt brne brnn brn) int32 int16 brbound #fn("<000r1e0|c1326H0e2i04e3i0631322\x7fawo01;e0|c4326`0e2i04e5i0631322\x7fawo012e2i04e5i20\x7f[31322\x7fawo01;e0|c6326\x820e2i04e3i0631322\x7fawo012e2i04e3i20\x7f[31322\x7fawo012i05c7\x82J0e2i04e3i20\x7f[31322\x7fawo01;^;e2i04e5i0631322\x7fawo01;" [memq (loadv.l loadg.l setg.l loada.l seta.l largc lvargc call.l tcall.l) io.write int32 (loadc setc) uint8 (loadc.l setc.l optargs keyargs) keyargs]) table.foreach #fn("<000r2e0i04|322e1i04i10670e2540e3e4i02}32|x3142;" [io.seek io.write int32 int16 get]) io.tostring!]) length table buffer]) >= length 65536]) list->vector]) reverse!] encode-byte-code) error #fn(":000s0e0c1|K41;" [raise error] error) eval #fn("8000r1e0e1|313140;" [compile-thunk expand] eval) even? #fn("8000r1e0|a32`W;" [logand] even?) every #fn("8000r2}?17D02|}M3116:02e0|}N42;" [every] every) expand #fn("7000r1e0|41;" [macroexpand] expand) expand-define #fn("<000r2|C6:0c0|}ML3;c0|Me1c2L1|NL1e3}31|M34L3;" [set! nconc lambda copy-list] expand-define) filter #fn("7000r2c0q^41;" [#fn("9000r1c0qm02|~\x7f_L143;" [#fn("9000r3g2^}F6S02i10}M316?0g2}M_KPNm2530^2}Nm15\f/2N;" [] filter-)])] filter) fits-i8 #fn("8000r1|I16F02e0|b\xb03216:02e1|b\xaf42;" [>= <=] fits-i8) foldl #fn(";000r3g2\x8540};e0||g2M}32g2N43;" [foldl] foldl) foldr #fn("<000r3g2\x8540};|g2Me0|}g2N3342;" [foldr] foldr) for-each #fn("8000r2}F6@0|}M312e0|}N42;];" [for-each] for-each) get-defined-vars #fn("8000r1e0~|3141;" [delete-duplicates] #1=[#fn(":000r1|?640_;|Mc0<16602|NF6d0|\x84C16702|\x84L117S02|\x84F16E02e1|31C16:02e1|31L117402_;|Mc2\x82>0e3e4~|N32v2;_;" [define caadr begin append map] #1#) ()]) hex5 #fn("9000r1e0e1|b@32b5c243;" [string.lpad number->string #\0] hex5) identity #fn("6000r1|;" [] identity) in-env? #fn("8000r2e0c1q}42;" [any #fn("8000r1e0~|42;" [memq])] in-env?) index-of #fn(";000r3}\x8540^;|}M\x8250g2;e0|}Ng2aw43;" [index-of] index-of) io.readline #fn("8000r1e0|c142;" [io.readuntil #\linefeed] io.readline) io.readlines #fn("8000r1e0e1|42;" [read-all-of io.readline] io.readlines) iota #fn("8000r1e0e1|42;" [map-int identity] iota) keyword->symbol #fn("9000r1e0|316@0e1c2e3|313141;|;" [keyword? symbol #fn("<000r1e0|`e1|e2|313243;" [string.sub string.dec length]) string] keyword->symbol) keyword-arg? #fn("7000r1|F16902e0|M41;" [keyword?] keyword-arg?) lambda-vars #fn("7000r1c0q^41;" [#fn(":000r1c0qm02|~~^^342e1c2e3~3142;" [#fn(";000r4|A17502|C640];|F16602|MC6S0g217502g36<0e0c1}c243;~|N}g2g344;|F16602|MF6\x870e3|Mb23216902e4|31C660^5=0e0c5|Mc6}342e7e4|31316<0~|N}g2]44;g36<0e0c1}c843;~|N}]g344;|F6>0e0c9|Mc6}44;|}\x82:0e0c1}42;e0c9|c6}44;" [error "compile error: invalid argument list " ". optional arguments must come after required." length= caar "compile error: invalid optional argument " " in list " keyword? ". keyword arguments must come last." "compile error: invalid formal argument "] check-formals) map! #fn("7000r1|F690e0|M41;|;" [keyword->symbol]) to-proper])] lambda-vars) last-pair #fn("7000r1|N?640|;e0|N41;" [last-pair] last-pair) lastcdr #fn("7000r1|?640|;e0|31N;" [last-pair] lastcdr) length= #fn("9000r2}`X640^;}`W650|?;|?660}`W;e0|N}ax42;" [length=] length=) length> #fn("9000r2}`X640|;}`W6;0|F16402|;|?660}`X;e0|N}ax42;" [length>] length>) list->vector #fn("7000r1c0|v2;" [#.vector] list->vector) list-head #fn(":000r2e0}`32640_;|Me1|N}ax32K;" [<= list-head] list-head) list-ref #fn("8000r2e0|}32M;" [list-tail] list-ref) list-tail #fn("9000r2e0}`32640|;e1|N}ax42;" [<= list-tail] list-tail) list? #fn("7000r1|A17@02|F16902e0|N41;" [list?] list?) load #fn("9000r1c0qe1|c23241;" [#fn("7000r1c0qc1qt;" [#fn("9000r0c0q^31^^^43;" [#fn("6000r1c0qm0;" [#fn(":000r3e0i10317C0~e1i1031|e2}3143;e3i10312e2}41;" [io.eof? read load-process io.close])])]) #fn("9000r1e0~312e1c2i10|L341;" [io.close raise load-error])]) file :read] load) load-process #fn("7000r1e0|41;" [eval] load-process) lookup-sym #fn("7000r4}\x8550c0;c1q}M41;" [(global) #fn(":000r1c0qe1~|`3341;" [#fn(";000r1|6G0i13680c0|L2;c1i12|L3;e2i10i11Ni1317502~A680i12570i12aw^44;" [arg closed lookup-sym]) index-of])] lookup-sym) macrocall? #fn("9000r1|MC16<02e0e1|M^43;" [get *syntax-environment*] macrocall?) macroexpand #fn("7000r1c0q^41;" [#fn("8000r1c0qm02|~_42;" [#fn("9000r2|?640|;c0qe1|M}3241;" [#fn("9000r1|6C0i10|\x84~NQ2e0|3142;c1qe2~3141;" [caddr #fn("C000r1|6B0i20|i10NQ2i1142;i10Mc0\x8260i10;i10Mc1\x82V0e2c1L1i10\x84L1e3c4qe5i103132e6i103144;i10Mc7\x82O0e2c7L1i10\x84L1e3c8qe5i10313243;i10Mc9\x82T0c:qi10\x84e2c1L1_L1e;e5i10313133L142;e3c@16K02e3|i2132@16=02e4e1|3131@;" [constant? top-level-value string memq iostream?]) simple-sort environment io.close]) #fn("7000r1~302e0|41;" [raise])]) #fn("6000r0~k02\x7fk1;" [*print-pretty* *print-readably*])]) *print-pretty* *print-readably*]) file :write :create :truncate (*linefeed* *directory-separator* *argv* that *print-pretty* *print-width* *print-readably*)] make-system-image) map #fn("<000s2c0q^^42;" [#fn("9000r2c0m02c1qm12i02\x85;0|~\x7f_L143;}~\x7fi02K42;" [#fn("9000r3g2^}F6H02g2|}M31_KPNm22}Nm15\x17/2N;" [] map1) #fn("=000r2}M\x8540_;|~c0}_L133Q2\x7f|~c1}_L13332K;" [#.car #.cdr] mapn)])] map) map! #fn("9000r2}^}F6B02}|}M31O2}Nm15\x1d/2;" [] map!) map-int #fn("8000r2e0}`32640_;c1q|`31_K_42;" [<= #fn(":000r2|m12a\x7faxc0qu2|;" [#fn("8000r1\x7fi10|31_KP2\x7fNo01;" [])])] map-int) mark-label #fn("9000r2e0|c1}43;" [emit label] mark-label) max #fn("=000s1}\x8540|;e0c1|}43;" [foldl #fn("7000r2|}X640};|;" [])] max) member #fn("8000r2}?640^;}M|>640};e0|}N42;" [member] member) memv #fn("8000r2}?640^;}M|=640};e0|}N42;" [memv] memv) min #fn("=000s1}\x8540|;e0c1|}43;" [foldl #fn("7000r2|}X640|;};" [])] min) mod #fn("9000r2|e0|}32}T2x;" [div] mod) mod0 #2=#fn("8000r2||}V}T2x;" [] mod0) negative? #fn("7000r1|`X;" [] negative?) nestlist #fn(";000r3e0g2`32640_;}e1||}31g2ax33K;" [<= nestlist] nestlist) newline #fn("7000r0e0e1312];" [princ *linefeed*] newline) nnn #fn("8000r1e0c1|42;" [count #fn("6000r1|A@;" [])] nnn) nreconc #fn("8000r2e0e1|31}42;" [nconc reverse!] nreconc) odd? #fn("7000r1e0|31@;" [even?] odd?) positive? #fn("8000r1e0|`42;" [>] positive?) princ #fn("9000s0c0qe141;" [#fn("7000r1^k02c1qc2q41;" [*print-readably* #fn("7000r1c0qc1qt|302;" [#fn("8000r0e0e1i2042;" [for-each write]) #fn("7000r1~302e0|41;" [raise])]) #fn("6000r0~k0;" [*print-readably*])]) *print-readably*] princ) print #fn(":000s0e0e1|42;" [for-each write] print) print-exception #fn("=000r1|F16D02|Mc0<16:02e1|b4326P0e2c3|\x84c4e5|31c6352e7e8|31315\x070|F16D02|Mc9<16:02e1|b4326N0e2|\x84c:e8|31c;342e7e5|31315\xd00|F16@02|Mc<<16602|NF6?0e2c=|\x84c>335\xac0|F16802|Mc?<6B0e2c@312e2|NQ25\x8d0|F16802|McA<6G0eBe5|31312e2cC|\x84325i0eD|3116:02e1|b2326I0e7|M312e2cE312cF|\x84315>0e2cG312e7|312e2eH41;" [type-error length= princ "type error: " ": expected " caddr ", got " print cadddr bounds-error ": index " " out of bounds for " unbound-error "eval: variable " " has no value" error "error: " load-error print-exception "in file " list? ": " #fn("8000r1e0|3117502|C670e1540e2|41;" [string? princ print]) "*** Unhandled exception: " *linefeed*] print-exception) print-stack-trace #fn("8000r1c0q^^42;" [#fn("<000r2c0qm02c1qm12c2qe3e4~b53231e5e6e7c8e9303232`43;" [#fn("8000r3c0qe1|31g2K41;" [#fn(":000r1e0~31e0\x7f31\x82>0e1c2c3|L341;c4qe5~3141;" [function:code raise thrown-value ffound #fn(":000r1`e0e1|3131c2qu;" [1- length #fn("9000r1e0~|[316A0i30~|[i21i1043;^;" [closure?])]) function:vals]) function:name] find-in-f) #fn("8000r2c0c1qc2t41;" [#fn(";000r1|6H0e0e1e2e3e4|3132c53241;c6;" [symbol string.join map string reverse! "/" lambda]) #fn("8000r0e0c1q\x7f322^;" [for-each #fn("9000r1i10|~_43;" [])]) #fn("7000r1|F16B02|Mc0<16802|\x84c1<680e2|41;e3|41;" [thrown-value ffound caddr raise])] fn-name) #fn("8000r3e0c1q|42;" [for-each #fn("9000r1e0c1i02c2332e3i11|`[\x7f32e4|31NK312e5302i02awo02;" [princ "#" " " print vector->list newline])]) reverse! list-tail filter closure? map #fn("7000r1|E16802e0|41;" [top-level-value]) environment])] print-stack-trace) print-to-string #fn("7000r1c0qe13041;" [#fn("8000r1e0~|322e1|41;" [write io.tostring!]) buffer] print-to-string) printable? #fn("7000r1e0|31@;" [iostream?] printable?) println #fn("9000s0e0|Q2e1302;" [print newline] println) quote-value #fn("7000r1e0|31640|;c1|L2;" [self-evaluating? quote] quote-value) quotient #.div0 random #fn("8000r1e0|316<0e1e230|42;e330|T2;" [integer? mod rand rand.double] random) read-all #fn("8000r1e0e1|42;" [read-all-of read] read-all) read-all-of #fn("9000r2c0q^31_|}3142;" [#fn("6000r1c0qm0;" [#fn("9000r2e0i1131680e1|41;~}|Ki10i113142;" [io.eof? reverse!])])] read-all-of) ref-int16-LE #fn(";000r2e0e1|}`w[`32e1|}aw[b832w41;" [int16 ash] ref-int16-LE) ref-int32-LE #fn("=000r2e0e1|}`w[`32e1|}aw[b832e1|}b2w[b@32e1|}b3w[bH32R441;" [int32 ash] ref-int32-LE) remainder #2# repl #fn("8000r0c0^^42;" [#fn("6000r2c0m02c1qm12}302e240;" [#fn("8000r0e0c1312e2e3312c4c5c6t41;" [princ "> " io.flush *output-stream* #fn("8000r1e0e131@16<02c2e3|3141;" [io.eof? *input-stream* #fn("7000r1e0|312|k12];" [print that]) load-process]) #fn("6000r0e040;" [read]) #fn("7000r1e0e1312e2|41;" [io.discardbuffer *input-stream* raise])] prompt) #fn("7000r0c0qc1t6;0e2302\x7f40;^;" [#fn("7000r0~3016702e040;" [newline]) #fn("7000r1e0|312];" [top-level-exception-handler]) newline] reploop) newline])] repl) revappend #fn("8000r2e0e1|31}42;" [nconc reverse] revappend) reverse #fn("9000r1e0c1_|43;" [foldl #.cons] reverse) reverse! #fn("7000r1c0q_41;" [#fn("9000r1^~F6C02~N~|~m02P2o005\x1c/2|;" [])] reverse!) self-evaluating? #fn("8000r1|?16602|C@17K02e0|3116A02|C16:02|e1|31<;" [constant? top-level-value] self-evaluating?) separate #fn(":000r2~|}__44;" [] #3=[#fn("6000r4}\x8580g2g3K;|}M316@0~|}N}Mg2Kg344;~|}Ng2}Mg3K44;" [] #3#) ()]) set-syntax! #fn("9000r2e0e1|}43;" [put! *syntax-environment*] set-syntax!) simple-sort #fn("7000r1|A17602|NA640|;c0q|M41;" [#fn("9000r1c0qe1c2q~N3241;" [#fn(":000r1e0e1|M31~L1e1|N3143;" [nconc simple-sort]) separate #fn("7000r1|~X;" [])])] simple-sort) string.join #fn("7000r2|\x8550c0;c1qe23041;" ["" #fn("8000r1e0|~M322e1c2q~N322e3|41;" [io.write for-each #fn("8000r1e0~i11322e0~|42;" [io.write]) io.tostring!]) buffer] string.join) string.lpad #fn(";000r3e0e1g2}e2|31x32|42;" [string string.rep string.count] string.lpad) string.map #fn("9000r2c0qe130e2}3142;" [#fn("7000r2c0q`312e1|41;" [#fn(";000r1^|\x7fX6S02e0~i10e1i11|3231322e2i11|32m05\v/;" [io.putc string.char string.inc]) io.tostring!]) buffer length] string.map) string.rep #fn(";000r2}b4X6`0e0}`32650c1;}aW680e2|41;}b2W690e2||42;e2|||43;e3}316@0e2|e4|}ax3242;e4e2||32}b2U242;" [<= "" string odd? string.rep] string.rep) string.rpad #fn("<000r3e0|e1g2}e2|31x3242;" [string string.rep string.count] string.rpad) string.tail #fn(";000r2e0|e1|`}3342;" [string.sub string.inc] string.tail) string.trim #fn("8000r3c0q^^42;" [#fn("8000r2c0qm02c1qm12c2qe3~3141;" [#fn(";000r4g2g3X16?02e0}e1|g232326A0~|}e2|g232g344;g2;" [string.find string.char string.inc] trim-start) #fn("<000r3e0g2`3216D02e1}e2|e3|g23232326?0\x7f|}e3|g23243;g2;" [> string.find string.char string.dec] trim-end) #fn("<000r1e0i10~i10i11`|34\x7fi10i12|3343;" [string.sub]) length])] string.trim) symbol-syntax #fn("9000r1e0e1|^43;" [get *syntax-environment*] symbol-syntax) table.clone #fn("7000r1c0qe13041;" [#fn("9000r1e0c1q_~332|;" [table.foldl #fn("9000r3e0~|}43;" [put!])]) table] table.clone) table.foreach #fn("9000r2e0c1q_}43;" [table.foldl #fn("8000r3~|}322];" [])] table.foreach) table.invert #fn("7000r1c0qe13041;" [#fn("9000r1e0c1q_~332|;" [table.foldl #fn("9000r3e0~}|43;" [put!])]) table] table.invert) table.keys #fn("9000r1e0c1_|43;" [table.foldl #fn("7000r3|g2K;" [])] table.keys) table.pairs #fn("9000r1e0c1_|43;" [table.foldl #fn("7000r3|}Kg2K;" [])] table.pairs) table.values #fn("9000r1e0c1_|43;" [table.foldl #fn("7000r3}g2K;" [])] table.values) to-proper #fn("9000r1|\x8540|;|?660|L1;|Me0|N31K;" [to-proper] to-proper) top-level-exception-handler #fn("7000r1c0qe141;" [#fn("7000r1e0k12c2qc3q41;" [*stderr* *output-stream* #fn("7000r1c0qc1qt|302;" [#fn("7000r0e0i20312e1e23041;" [print-exception print-stack-trace stacktrace]) #fn("7000r1~302e0|41;" [raise])]) #fn("6000r0~k0;" [*output-stream*])]) *output-stream*] top-level-exception-handler) trace #fn("8000r1c0qe1|31312c2;" [#fn("7000r1c0qe13041;" [#fn("?000r1e0~317a0e1i10e2c3|c4c5c6c7i10L2|L3L2c8c7~L2|L3L3L33142;^;" [traced? set-top-level-value! eval lambda begin println cons quote apply]) gensym]) top-level-value ok] trace) traced? #fn("8000r1e0|31e0~31>;" [function:code] [#fn(":000s0e0c1|K312c2|v2;" [println x #.apply]) ()]) untrace #fn("8000r1c0qe1|3141;" [#fn("9000r1e0|316@0e1~e2|31b2[42;^;" [traced? set-top-level-value! function:vals]) top-level-value] untrace) values #fn("9000s0|F16602|NA650|M;~|K;" [] #4#) vector->list #fn("8000r1c0qe1|31_42;" [#fn(":000r2a|c0qu2};" [#fn("8000r1i10~|x[\x7fKo01;" [])]) length] vector->list) vector.map #fn("8000r2c0qe1}3141;" [#fn("8000r1c0qe1|3141;" [#fn(":000r1`~axc0qu2|;" [#fn(":000r1~|i20i21|[31\\;" [])]) vector.alloc]) length] vector.map) with-output-to-file #fn(";000r2c0qe1|c2c3c43441;" [#fn("7000r1c0qc1q41;" [#fn("7000r1c0qc1qt|302;" [#fn("7000r0c0qe141;" [#fn("7000r1i10k02c1qc2q41;" [*output-stream* #fn("7000r1c0qc1qt|302;" [#fn("6000r0i4140;" []) #fn("7000r1~302e0|41;" [raise])]) #fn("6000r0~k0;" [*output-stream*])]) *output-stream*]) #fn("7000r1~302e0|41;" [raise])]) #fn("7000r0e0~41;" [io.close])]) file :write :create :truncate] with-output-to-file) zero? #fn("7000r1|`W;" [] zero?)) diff --git a/femtolisp/flisp.c b/femtolisp/flisp.c index cd9ef97..f5a1902 100644 --- a/femtolisp/flisp.c +++ b/femtolisp/flisp.c @@ -89,14 +89,21 @@ static uint32_t curr_frame = 0; static value_t *GCHandleStack[N_GC_HANDLES]; static uint32_t N_GCHND = 0; -value_t NIL, FL_T, FL_F, LAMBDA, QUOTE, IF, TRYCATCH; -value_t BACKQUOTE, COMMA, COMMAAT, COMMADOT, FUNCTION; +value_t NIL, FL_T, FL_F; value_t IOError, ParseError, TypeError, ArgError, UnboundError, MemoryError; value_t DivideError, BoundsError, Error, KeyError, EnumerationError; -value_t pairsym, symbolsym, fixnumsym, vectorsym, builtinsym, vu8sym; -value_t definesym, defmacrosym, forsym, labelsym, printprettysym, setqsym; -value_t printwidthsym, printreadablysym; -value_t tsym, Tsym, fsym, Fsym, booleansym, nullsym, evalsym; +value_t printwidthsym, printreadablysym, printprettysym; + +value_t QUOTE; +static value_t LAMBDA, IF, TRYCATCH; +static value_t BACKQUOTE, COMMA, COMMAAT, COMMADOT, FUNCTION; + +static value_t pairsym, symbolsym, fixnumsym, vectorsym, builtinsym, vu8sym; +static value_t definesym, defmacrosym, forsym, labelsym, setqsym; +static value_t tsym, Tsym, fsym, Fsym, booleansym, nullsym, evalsym, fnsym; +// for reading characters +static value_t nulsym, alarmsym, backspacesym, tabsym, linefeedsym, newlinesym; +static value_t vtabsym, pagesym, returnsym, escsym, spacesym, deletesym; static value_t apply_cl(uint32_t nargs); static value_t *alloc_words(int n); @@ -2089,39 +2096,31 @@ static void lisp_init(void) NIL = builtin(OP_THE_EMPTY_LIST); FL_T = builtin(OP_BOOL_CONST_T); FL_F = builtin(OP_BOOL_CONST_F); - LAMBDA = symbol("lambda"); - FUNCTION = symbol("function"); - QUOTE = symbol("quote"); - TRYCATCH = symbol("trycatch"); - BACKQUOTE = symbol("backquote"); - COMMA = symbol("*comma*"); - COMMAAT = symbol("*comma-at*"); - COMMADOT = symbol("*comma-dot*"); - IOError = symbol("io-error"); - ParseError = symbol("parse-error"); - TypeError = symbol("type-error"); - ArgError = symbol("arg-error"); + LAMBDA = symbol("lambda"); FUNCTION = symbol("function"); + QUOTE = symbol("quote"); TRYCATCH = symbol("trycatch"); + BACKQUOTE = symbol("backquote"); COMMA = symbol("*comma*"); + COMMAAT = symbol("*comma-at*"); COMMADOT = symbol("*comma-dot*"); + IOError = symbol("io-error"); ParseError = symbol("parse-error"); + TypeError = symbol("type-error"); ArgError = symbol("arg-error"); UnboundError = symbol("unbound-error"); - KeyError = symbol("key-error"); - MemoryError = symbol("memory-error"); + KeyError = symbol("key-error"); MemoryError = symbol("memory-error"); BoundsError = symbol("bounds-error"); DivideError = symbol("divide-error"); EnumerationError = symbol("enumeration-error"); - Error = symbol("error"); - pairsym = symbol("pair"); - symbolsym = symbol("symbol"); - fixnumsym = symbol("fixnum"); - vectorsym = symbol("vector"); - builtinsym = symbol("builtin"); - booleansym = symbol("boolean"); - nullsym = symbol("null"); - definesym = symbol("define"); - defmacrosym = symbol("define-macro"); - forsym = symbol("for"); - labelsym = symbol("label"); - setqsym = symbol("set!"); - evalsym = symbol("eval"); - vu8sym = symbol("vu8"); + Error = symbol("error"); pairsym = symbol("pair"); + symbolsym = symbol("symbol"); fixnumsym = symbol("fixnum"); + vectorsym = symbol("vector"); builtinsym = symbol("builtin"); + booleansym = symbol("boolean"); nullsym = symbol("null"); + definesym = symbol("define"); defmacrosym = symbol("define-macro"); + forsym = symbol("for"); labelsym = symbol("label"); + setqsym = symbol("set!"); evalsym = symbol("eval"); + vu8sym = symbol("vu8"); fnsym = symbol("fn"); + nulsym = symbol("nul"); alarmsym = symbol("alarm"); + backspacesym = symbol("backspace"); tabsym = symbol("tab"); + linefeedsym = symbol("linefeed"); vtabsym = symbol("vtab"); + pagesym = symbol("page"); returnsym = symbol("return"); + escsym = symbol("esc"); spacesym = symbol("space"); + deletesym = symbol("delete"); newlinesym = symbol("newline"); tsym = symbol("t"); Tsym = symbol("T"); fsym = symbol("f"); Fsym = symbol("F"); set(printprettysym=symbol("*print-pretty*"), FL_T); diff --git a/femtolisp/flisp.h b/femtolisp/flisp.h index 1e6ea78..2db16a9 100644 --- a/femtolisp/flisp.h +++ b/femtolisp/flisp.h @@ -253,12 +253,13 @@ typedef float float_t; typedef value_t (*builtin_t)(value_t*, uint32_t); +extern value_t QUOTE; extern value_t int8sym, uint8sym, int16sym, uint16sym, int32sym, uint32sym; extern value_t int64sym, uint64sym; extern value_t longsym, ulongsym, bytesym, wcharsym; extern value_t structsym, arraysym, enumsym, cfunctionsym, voidsym, pointersym; extern value_t stringtypesym, wcstringtypesym, emptystringsym; -extern value_t unionsym, floatsym, doublesym, builtinsym; +extern value_t unionsym, floatsym, doublesym; extern fltype_t *bytetype, *wchartype; extern fltype_t *stringtype, *wcstringtype; extern fltype_t *builtintype; diff --git a/femtolisp/print.c b/femtolisp/print.c index ecae3bb..41a773a 100644 --- a/femtolisp/print.c +++ b/femtolisp/print.c @@ -399,7 +399,7 @@ void fl_print_child(ios_t *f, value_t v) if (!print_princ) { if (print_circle_prefix(f, v)) return; function_t *fn = (function_t*)ptr(v); - outs("#function(", f); + outs("#fn(", f); char *data = cvalue_data(fn->bcode); size_t i, sz = cvalue_len(fn->bcode); for(i=0; i < sz; i++) data[i] += 48; @@ -515,15 +515,28 @@ static void cvalue_printdata(ios_t *f, void *data, size_t len, value_t type, else if (type == wcharsym) { uint32_t wc = *(uint32_t*)data; char seq[8]; - if (print_princ || iswprint(wc)) { - size_t nb = u8_toutf8(seq, sizeof(seq), &wc, 1); - seq[nb] = '\0'; + size_t nb = u8_toutf8(seq, sizeof(seq), &wc, 1); + seq[nb] = '\0'; + if (print_princ) { // TODO: better multibyte handling - if (!print_princ) outsn("#\\", f, 2); outs(seq, f); } else { - HPOS+=ios_printf(f, "#\\x%04x", (int)wc); + outsn("#\\", f, 2); + if (wc == 0x00) outsn("nul", f, 3); + else if (wc == 0x07) outsn("alarm", f, 5); + else if (wc == 0x08) outsn("backspace", f, 9); + else if (wc == 0x09) outsn("tab", f, 3); + else if (wc == 0x0A) outsn("linefeed", f, 8); + //else if (wc == 0x0A) outsn("newline", f, 7); + else if (wc == 0x0B) outsn("vtab", f, 4); + else if (wc == 0x0C) outsn("page", f, 4); + else if (wc == 0x0D) outsn("return", f, 6); + else if (wc == 0x1B) outsn("esc", f, 3); + else if (wc == 0x20) outsn("space", f, 5); + else if (wc == 0x7F) outsn("delete", f, 6); + else if (iswprint(wc)) outs(seq, f); + else HPOS+=ios_printf(f, "x%04x", (int)wc); } } else if (type == int64sym @@ -569,9 +582,9 @@ static void cvalue_printdata(ios_t *f, void *data, size_t len, value_t type, if (!DFINITE(d)) { char *rep; if (isnan(d)) - rep = sign_bit(d) ? "-NaN" : "+NaN"; + rep = sign_bit(d) ? "-nan.0" : "+nan.0"; else - rep = sign_bit(d) ? "-Inf" : "+Inf"; + rep = sign_bit(d) ? "-inf.0" : "+inf.0"; if (type == floatsym && !print_princ && !weak) HPOS+=ios_printf(f, "#%s(%s)", symbol_name(type), rep); else diff --git a/femtolisp/read.c b/femtolisp/read.c index 8ec2c94..636fffb 100644 --- a/femtolisp/read.c +++ b/femtolisp/read.c @@ -216,6 +216,25 @@ static u_int32_t peek() cval = numval(tokval); } } + else if (cval >= 'a' && cval <= 'z') { + read_token((char)cval, 0); + tokval = symbol(buf); + if (buf[1] == '\0') /* one character */; + else if (tokval == nulsym) cval = 0x00; + else if (tokval == alarmsym) cval = 0x07; + else if (tokval == backspacesym) cval = 0x08; + else if (tokval == tabsym) cval = 0x09; + else if (tokval == linefeedsym) cval = 0x0A; + else if (tokval == newlinesym) cval = 0x0A; + else if (tokval == vtabsym) cval = 0x0B; + else if (tokval == pagesym) cval = 0x0C; + else if (tokval == returnsym) cval = 0x0D; + else if (tokval == escsym) cval = 0x1B; + else if (tokval == spacesym) cval = 0x20; + else if (tokval == deletesym) cval = 0x7F; + else + lerrorf(ParseError, "read: unknown character #\\%s", buf); + } toktype = TOK_NUM; tokval = mk_wchar(cval); } @@ -580,6 +599,9 @@ static value_t do_read_sexpr(value_t label) sym = arraysym; Stack[SP-1] = fl_cons(uint8sym, Stack[SP-1]); } + else if (sym == fnsym) { + sym = FUNCTION; + } v = symbol_value(sym); if (v == UNBOUND) raise(list2(UnboundError, sym)); diff --git a/femtolisp/system.lsp b/femtolisp/system.lsp index f6c9a2f..ea1022a 100644 --- a/femtolisp/system.lsp +++ b/femtolisp/system.lsp @@ -147,7 +147,22 @@ (define (cdadr x) (cdr (car (cdr x)))) (define (cddar x) (cdr (cdr (car x)))) (define (cdddr x) (cdr (cdr (cdr x)))) +(define (caaaar x) (car (car (car (car x))))) +(define (caaadr x) (car (car (car (cdr x))))) +(define (caadar x) (car (car (cdr (car x))))) +(define (caaddr x) (car (car (cdr (cdr x))))) +(define (cadaar x) (car (cdr (car (car x))))) +(define (cadadr x) (car (cdr (car (cdr x))))) +(define (caddar x) (car (cdr (cdr (car x))))) (define (cadddr x) (car (cdr (cdr (cdr x))))) +(define (cdaaar x) (cdr (car (car (car x))))) +(define (cdaadr x) (cdr (car (car (cdr x))))) +(define (cdadar x) (cdr (car (cdr (car x))))) +(define (cdaddr x) (cdr (car (cdr (cdr x))))) +(define (cddaar x) (cdr (cdr (car (car x))))) +(define (cddadr x) (cdr (cdr (car (cdr x))))) +(define (cdddar x) (cdr (cdr (cdr (car x))))) +(define (cddddr x) (cdr (cdr (cdr (cdr x))))) (let ((*values* (list '*values*))) (set! values @@ -511,10 +526,12 @@ (for-each write args))) (define (newline) (princ *linefeed*) #t) -(define (display x) (princ x) #t) +(define (display x (port *output-stream*)) + (with-output-to port (princ x)) + #t) (define (println . args) (prog1 (apply print args) (newline))) -(define (io.readline s) (io.readuntil s #\x0a)) +(define (io.readline s) (io.readuntil s #\linefeed)) ; call f on a stream until the stream runs out of data (define (read-all-of f s) diff --git a/femtolisp/todo b/femtolisp/todo index 6fa44c6..f220e35 100644 --- a/femtolisp/todo +++ b/femtolisp/todo @@ -643,6 +643,7 @@ low-level functions: - (eltype type field [field ...]) - (memcpy dest-cv src-cv) - (memcpy dest doffs src soffs nbytes) +- (bswap cvalue) - (c2lisp cvalue) ; convert to sexpr form * (typeof cvalue) * (sizeof cvalue|type) @@ -968,7 +969,7 @@ consolidated todo list as of 7/8: - evaluator improvements, perf & debugging (below) * fix make-system-image to save aliases of builtins -- reading named characters, e.g. #\newline etc. +* reading named characters, e.g. #\newline etc. - #+, #- reader macros - printing improvements: *print-big*, keep track of horiz. position per-stream so indenting works across print calls @@ -978,6 +979,7 @@ consolidated todo list as of 7/8: * optional arguments * keyword arguments - some kind of record, struct, or object system +- improve test coverage - special efficient reader for #array - reimplement vectors as (array lispvalue)