mirror of
https://github.com/false-schemers/skint.git
synced 2024-12-25 21:58:54 +01:00
some instructions re-coded
This commit is contained in:
parent
01561c7243
commit
af543d10a6
3 changed files with 85 additions and 62 deletions
84
i.h
84
i.h
|
@ -256,13 +256,18 @@ declare_instruction(ineg, "I-!", 0, "fxneg", '1',
|
|||
declare_instruction(iabs, "Ia", 0, "fxabs", '1', AUTOGL)
|
||||
declare_instruction(itoj, "Ij", 0, "fixnum->flonum", '1', AUTOGL)
|
||||
declare_instruction(fixp, "I0", 0, "fixnum?", '1', AUTOGL)
|
||||
declare_instruction(imqu, "I3", 0, "fxmodquo", '2', AUTOGL)
|
||||
declare_instruction(imlo, "I4", 0, "fxmodulo", '2', AUTOGL)
|
||||
declare_instruction(imqu, "Il", 0, "fxmodquo", '2', AUTOGL)
|
||||
//declare_instrshadow(imqu, "I3", 0, NULL, 0, NULL)
|
||||
declare_instruction(imlo, "Im", 0, "fxmodulo", '2', AUTOGL)
|
||||
//declare_instrshadow(imlo, "I4", 0, NULL, 0, NULL)
|
||||
declare_instruction(ieuq, "I5", 0, "fxeucquo", '2', AUTOGL)
|
||||
declare_instruction(ieur, "I6", 0, "fxeucrem", '2', AUTOGL)
|
||||
declare_instruction(igcd, "I7", 0, "fxgcd", '2', AUTOGL)
|
||||
declare_instruction(ipow, "I8", 0, "fxexpt", '2', AUTOGL)
|
||||
declare_instruction(isqrt, "I9", 0, "fxsqrt", '1', AUTOGL)
|
||||
declare_instruction(igcd, "Ig", 0, "fxgcd", '2', AUTOGL)
|
||||
//declare_instrshadow(igcd, "I7", 0, NULL, 0, NULL)
|
||||
declare_instruction(ipow, "Ip", 0, "fxexpt", '2', AUTOGL)
|
||||
//declare_instrshadow(ipow, "I8", 0, NULL, 0, NULL)
|
||||
declare_instruction(isqrt, "It", 0, "fxsqrt", '1', AUTOGL)
|
||||
//declare_instrshadow(isqrt, "I9", 0, NULL, 0, NULL)
|
||||
declare_instruction(inot, "D0", 0, "fxnot", '1', AUTOGL)
|
||||
declare_instruction(iand, "D1\0'(i-1)", 0, "fxand", 'p', AUTOGL)
|
||||
declare_instruction(iior, "D2\0'0", 0, "fxior", 'p', AUTOGL)
|
||||
|
@ -296,12 +301,18 @@ declare_instruction(jneg, "J-!", 0, "flneg", '1',
|
|||
declare_instruction(jabs, "Ja", 0, "flabs", '1', AUTOGL)
|
||||
declare_instruction(jtoi, "Ji", 0, "flonum->fixnum", '1', AUTOGL)
|
||||
declare_instruction(flop, "J0", 0, "flonum?", '1', AUTOGL)
|
||||
declare_instruction(jmqu, "J3", 0, "flmodquo", '2', AUTOGL)
|
||||
declare_instruction(jmlo, "J4", 0, "flmodulo", '2', AUTOGL)
|
||||
declare_instruction(jfloor, "H0", 0, "flfloor", '1', AUTOGL)
|
||||
declare_instruction(jceil, "H1", 0, "flceiling", '1', AUTOGL)
|
||||
declare_instruction(jtrunc, "H2", 0, "fltruncate", '1', AUTOGL)
|
||||
declare_instruction(jround, "H3", 0, "flround", '1', AUTOGL)
|
||||
declare_instruction(jmqu, "Jl", 0, "flmodquo", '2', AUTOGL)
|
||||
//declare_instrshadow(jmqu, "J3", 0, NULL, 0, NULL)
|
||||
declare_instruction(jmlo, "Jm", 0, "flmodulo", '2', AUTOGL)
|
||||
//declare_instrshadow(jmlo, "J4", 0, NULL, 0, NULL)
|
||||
declare_instruction(jfloor, "Jb", 0, "flfloor", '1', AUTOGL)
|
||||
//declare_instrshadow(jfloor, "H0", 0, NULL, 0, NULL)
|
||||
declare_instruction(jceil, "Jc", 0, "flceiling", '1', AUTOGL)
|
||||
//declare_instrshadow(jceil, "H1", 0, NULL, 0, NULL)
|
||||
declare_instruction(jtrunc, "Jk", 0, "fltruncate", '1', AUTOGL)
|
||||
//declare_instrshadow(jtrunc, "H2", 0, NULL, 0, NULL)
|
||||
declare_instruction(jround, "Jd", 0, "flround", '1', AUTOGL)
|
||||
//declare_instrshadow(jround, "H3", 0, NULL, 0, NULL)
|
||||
declare_instruction(zerop, "=0", 0, "zero?", '1', AUTOGL)
|
||||
declare_instruction(posp, ">0", 0, "positive?", '1', AUTOGL)
|
||||
declare_instruction(negp, "<0", 0, "negative?", '1', AUTOGL)
|
||||
|
@ -316,22 +327,37 @@ declare_instruction(ge, "<!", 0, ">=", 'c',
|
|||
declare_instruction(eq, "=", 0, "=", 'c', AUTOGL)
|
||||
declare_instruction(ne, "=!", 0, "!=", '2', AUTOGL)
|
||||
declare_instruction(neg, "-!", 0, "neg", '1', AUTOGL)
|
||||
declare_instruction(abs, "G0", 0, "abs", '1', AUTOGL)
|
||||
declare_instruction(mqu, "G3", 0, "floor-quotient", '2', AUTOGL)
|
||||
declare_instruction(mlo, "G4", 0, "floor-remainder", '2', AUTOGL)
|
||||
declare_instruction(quo, "G5", 0, "truncate-quotient", '2', AUTOGL)
|
||||
declare_instruction(rem, "G6", 0, "truncate-remainder", '2', AUTOGL)
|
||||
declare_instruction(abs, "Ga", 0, "abs", '1', AUTOGL)
|
||||
//declare_instrshadow(abs, "G0", 0, NULL, 0, NULL)
|
||||
declare_instruction(mqu, "Gl", 0, "floor-quotient", '2', AUTOGL)
|
||||
//declare_instrshadow(mqu, "G3", 0, NULL, 0, NULL)
|
||||
declare_instruction(mlo, "Gm", 0, "floor-remainder", '2', AUTOGL)
|
||||
//declare_instrshadow(mlo, "G4", 0, NULL, 0, NULL)
|
||||
declare_instruction(quo, "Gq", 0, "truncate-quotient", '2', AUTOGL)
|
||||
//declare_instrshadow(quo, "G5", 0, NULL, 0, NULL)
|
||||
declare_instruction(rem, "Gr", 0, "truncate-remainder", '2', AUTOGL)
|
||||
//declare_instrshadow(rem, "G6", 0, NULL, 0, NULL)
|
||||
declare_instruction(nump, "N0", 0, "number?", '1', AUTOGL)
|
||||
declare_instruction(intp, "N4", 0, "integer?", '1', AUTOGL)
|
||||
declare_instruction(nanp, "N5", 0, "nan?", '1', AUTOGL)
|
||||
declare_instruction(finp, "N6", 0, "finite?", '1', AUTOGL)
|
||||
declare_instruction(infp, "N7", 0, "infinite?", '1', AUTOGL)
|
||||
declare_instruction(evnp, "N8", 0, "even?", '1', AUTOGL)
|
||||
declare_instruction(oddp, "N9", 0, "odd?", '1', AUTOGL)
|
||||
declare_instruction(ntoi, "M0", 0, "exact", '1', AUTOGL)
|
||||
declare_instruction(ntoj, "M1", 0, "inexact", '1', AUTOGL)
|
||||
declare_instruction(min, "M2", 0, "min", 'x', AUTOGL)
|
||||
declare_instruction(max, "M3", 0, "max", 'x', AUTOGL)
|
||||
declare_instruction(intp, "Gw", 0, "integer?", '1', AUTOGL)
|
||||
//declare_instrshadow(intp, "N4", 0, NULL, 0, NULL)
|
||||
declare_instruction(nanp, "Gu", 0, "nan?", '1', AUTOGL)
|
||||
//declare_instrshadow(nanp, "N5", 0, NULL, 0, NULL)
|
||||
declare_instruction(finp, "Gf", 0, "finite?", '1', AUTOGL)
|
||||
//declare_instrshadow(finp, "N6", 0, NULL, 0, NULL)
|
||||
declare_instruction(infp, "Gh", 0, "infinite?", '1', AUTOGL)
|
||||
//declare_instrshadow(infp, "N7", 0, NULL, 0, NULL)
|
||||
declare_instruction(evnp, "Ge", 0, "even?", '1', AUTOGL)
|
||||
//declare_instrshadow(evnp, "N8", 0, NULL, 0, NULL)
|
||||
declare_instruction(oddp, "Go", 0, "odd?", '1', AUTOGL)
|
||||
//declare_instrshadow(oddp, "N9", 0, NULL, 0, NULL)
|
||||
declare_instruction(ntoi, "Gi", 0, "exact", '1', AUTOGL)
|
||||
//declare_instrshadow(ntoi, "M0", 0, NULL, 0, NULL)
|
||||
declare_instruction(ntoj, "Gj", 0, "inexact", '1', AUTOGL)
|
||||
//declare_instrshadow(ntoj, "M1", 0, NULL, 0, NULL)
|
||||
declare_instruction(min, "Gn", 0, "min", 'x', AUTOGL)
|
||||
//declare_instrshadow(min, "M2", 0, NULL, 0, NULL)
|
||||
declare_instruction(max, "Gx", 0, "max", 'x', AUTOGL)
|
||||
//declare_instrshadow(max, "M3", 0, NULL, 0, NULL)
|
||||
declare_instruction(listp, "L0", 0, "list?", '1', AUTOGL)
|
||||
declare_instruction(list, "l", 1, "list", '#', "%!0_!]0")
|
||||
declare_instruction(lmk, "L2\0f", 0, "make-list", 'b', AUTOGL)
|
||||
|
@ -457,9 +483,9 @@ declare_integrable(NULL, "N0", 0, "rational?", '1',
|
|||
declare_integrable(NULL, "I0", 0, "exact-integer?", '1', AUTOGL)
|
||||
declare_integrable(NULL, "%nI0", 0, "exact?", '1', AUTOGL)
|
||||
declare_integrable(NULL, "%nJ0", 0, "inexact?", '1', AUTOGL)
|
||||
declare_integrable(NULL, "G4", 0, "modulo", '2', AUTOGL)
|
||||
declare_integrable(NULL, "G5", 0, "quotient", '2', AUTOGL)
|
||||
declare_integrable(NULL, "G6", 0, "remainder", '2', AUTOGL)
|
||||
declare_integrable(NULL, "Gm", 0, "modulo", '2', AUTOGL)
|
||||
declare_integrable(NULL, "Gq", 0, "quotient", '2', AUTOGL)
|
||||
declare_integrable(NULL, "Gr", 0, "remainder", '2', AUTOGL)
|
||||
declare_integrable(NULL, "Ij", 0, "exact->inexact", '1', AUTOGL)
|
||||
declare_integrable(NULL, "Ji", 0, "inexact->exact", '1', AUTOGL)
|
||||
declare_integrable(NULL, "aaa", 0, "caaar", '1', AUTOGL)
|
||||
|
|
4
s.c
4
s.c
|
@ -151,10 +151,10 @@ char *s_code[] = {
|
|||
"da*;l2:y4:args;py6:lambda;py4:args;y5:forms;;;;y3:...;;;",
|
||||
|
||||
"P", "floor/",
|
||||
"%2.1,.1G4,.2,.2G3,@(y6:values)[22",
|
||||
"%2.1,.1Gm,.2,.2Gl,@(y6:values)[22",
|
||||
|
||||
"P", "truncate/",
|
||||
"%2.1,.1G6,.2,.2G5,@(y6:values)[22",
|
||||
"%2.1,.1Gr,.2,.2Gq,@(y6:values)[22",
|
||||
|
||||
"P", "%append",
|
||||
"%!0.0,,#0.0,&1{%1.0u?{n]1}.0du?{.0a]1}${.2d,:0^[01},.1aL6]1}.!0.0^_1[1"
|
||||
|
|
59
t.c
59
t.c
|
@ -135,19 +135,18 @@ char *t_code[] = {
|
|||
"%3${.3,@(y3:id?)[01}?{${.4,.4,@(y9:xform-ref)[02},.1?{.0]4}.0U0?{.0U7,"
|
||||
"'(y3:ref),l2]4}.0K0?{.3,${.6,.6,.5[02},.3,@(y5:xform)[43}.0p~?{.0,'(s2"
|
||||
"7:improper use of syntax form),@(y7:x-error)[42}.0]4}.1p~?{.2,.2,l1,@("
|
||||
"y11:xform-quote)[32}.1a,.2d,${.6,.4,t,@(y5:xform)[03},.0,'(l1:y6:synta"
|
||||
"x;),.1A1?{.2a]7}'(l1:y5:quote;),.1A1?{.6,.3,@(y11:xform-quote)[72}'(l1"
|
||||
":y4:set!;),.1A1?{.6,.3,@(y10:xform-set!)[72}'(l1:y4:set&;),.1A1?{.6,.3"
|
||||
",@(y10:xform-set&)[72}'(l1:y5:begin;),.1A1?{.6,.3,@(y11:xform-begin)[7"
|
||||
"2}'(l1:y2:if;),.1A1?{.6,.3,@(y8:xform-if)[72}'(l1:y6:lambda;),.1A1?{.6"
|
||||
",.3,@(y12:xform-lambda)[72}'(l1:y7:lambda*;),.1A1?{.6,.3,@(y13:xform-l"
|
||||
"ambda*)[72}'(l1:y13:syntax-lambda;),.1A1?{.6,.3,@(y19:xform-syntax-lam"
|
||||
"bda)[72}'(l1:y5:letcc;),.1A1?{.6,.3,@(y11:xform-letcc)[72}'(l1:y6:with"
|
||||
"cc;),.1A1?{.6,.3,@(y12:xform-withcc)[72}'(l1:y4:body;),.1A1?{.6,.3,@(y"
|
||||
"10:xform-body)[72}'(l1:y6:define;),.1A1?{.6,.3,@(y12:xform-define)[72}"
|
||||
"'(l1:y13:define-syntax;),.1A1?{.6,.3,@(y19:xform-define-syntax)[72}t?{"
|
||||
".1U0?{.6,.3,.3,@(y16:xform-integrable)[73}.1K0?{.6,${.9,.9,.6[02},.6,@"
|
||||
"(y5:xform)[73}.6,.3,.3,@(y10:xform-call)[73}f]7",
|
||||
"y11:xform-quote)[32}.1a,.2d,${.6,.4,t,@(y5:xform)[03},.0,'(y6:syntax),"
|
||||
".1v?{.2a]7}'(y5:quote),.1v?{.6,.3,@(y11:xform-quote)[72}'(y4:set!),.1v"
|
||||
"?{.6,.3,@(y10:xform-set!)[72}'(y4:set&),.1v?{.6,.3,@(y10:xform-set&)[7"
|
||||
"2}'(y5:begin),.1v?{.6,.3,@(y11:xform-begin)[72}'(y2:if),.1v?{.6,.3,@(y"
|
||||
"8:xform-if)[72}'(y6:lambda),.1v?{.6,.3,@(y12:xform-lambda)[72}'(y7:lam"
|
||||
"bda*),.1v?{.6,.3,@(y13:xform-lambda*)[72}'(y13:syntax-lambda),.1v?{.6,"
|
||||
".3,@(y19:xform-syntax-lambda)[72}'(y5:letcc),.1v?{.6,.3,@(y11:xform-le"
|
||||
"tcc)[72}'(y6:withcc),.1v?{.6,.3,@(y12:xform-withcc)[72}'(y4:body),.1v?"
|
||||
"{.6,.3,@(y10:xform-body)[72}'(y6:define),.1v?{.6,.3,@(y12:xform-define"
|
||||
")[72}'(y13:define-syntax),.1v?{.6,.3,@(y19:xform-define-syntax)[72}.1U"
|
||||
"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",
|
||||
|
||||
"P", "xform-ref",
|
||||
"%2${.2,.4[01},.0Y0?{.0,'(y3:ref),l2]3}.0d]3",
|
||||
|
@ -178,10 +177,10 @@ char *t_code[] = {
|
|||
"form),@(y7:x-error)[22",
|
||||
|
||||
"P", "xform-if",
|
||||
"%2.0L0?{${.2,.4,&1{%1:0,.1,f,@(y5:xform)[13},@(y5:%25map1)[02},.0g,'(l"
|
||||
"1:i2;),.1A1?{'(l1:l1:y5:begin;;),.2L6,'(y2:if)c]4}'(l1:i3;),.1A1?{.1,'"
|
||||
"(y2:if)c]4}t?{.2,'(y2:if)c,'(s17:malformed if form),@(y7:x-error)[42}f"
|
||||
"]4}.0,'(y2:if)c,'(s16:improper if form),@(y7:x-error)[22",
|
||||
"%2.0L0?{${.2,.4,&1{%1:0,.1,f,@(y5:xform)[13},@(y5:%25map1)[02},.0g,'2,"
|
||||
".1v?{'(l1:l1:y5:begin;;),.2L6,'(y2:if)c]4}'3,.1v?{.1,'(y2:if)c]4}.2,'("
|
||||
"y2:if)c,'(s17:malformed if form),@(y7:x-error)[42}.0,'(y2:if)c,'(s16:i"
|
||||
"mproper if form),@(y7:x-error)[22",
|
||||
|
||||
"P", "xform-call",
|
||||
"%3.1L0?{${.3,.5,&1{%1:0,.1,f,@(y5:xform)[13},@(y5:%25map1)[02},.0u?{'("
|
||||
|
@ -189,11 +188,10 @@ char *t_code[] = {
|
|||
"3}.1,.1c,'(s20:improper application),@(y7:x-error)[32",
|
||||
|
||||
"P", "integrable-argc-match?",
|
||||
"%2.0,'(l1:c0;),.1A1?{'0,.3=]3}'(l1:c1;),.1A1?{'1,.3=]3}'(l1:c2;),.1A1?"
|
||||
"{'2,.3=]3}'(l1:c3;),.1A1?{'3,.3=]3}'(l1:cp;),.1A1?{'0,.3<!]3}'(l1:cm;)"
|
||||
",.1A1?{'1,.3<!]3}'(l1:cc;),.1A1?{'2,.3<!]3}'(l1:cx;),.1A1?{'1,.3<!]3}'"
|
||||
"(l1:cu;),.1A1?{'1,.3,,'0>!;>!]3}'(l1:cb;),.1A1?{'2,.3,,'1>!;>!]3}'(l1:"
|
||||
"c#;),.1A1?{'0,.3<!]3}'(l1:c@;),.1A1?{f]3}t?{f]3}f]3",
|
||||
"%2.0,'(c0),.1v?{'0,.3=]3}'(c1),.1v?{'1,.3=]3}'(c2),.1v?{'2,.3=]3}'(c3)"
|
||||
",.1v?{'3,.3=]3}'(cp),.1v?{'0,.3<!]3}'(cm),.1v?{'1,.3<!]3}'(cc),.1v?{'2"
|
||||
",.3<!]3}'(cx),.1v?{'1,.3<!]3}'(cu),.1v?{'1,.3,,'0>!;>!]3}'(cb),.1v?{'2"
|
||||
",.3,,'1>!;>!]3}'(c#),.1v?{'0,.3<!]3}'(c@),.1v?{f]3}f]3",
|
||||
|
||||
"P", "xform-integrable",
|
||||
"%3${.3g,.3U6,@(y22:integrable-argc-match?)[02}?{${.3,.5,&1{%1:0,.1,f,@"
|
||||
|
@ -238,15 +236,14 @@ char *t_code[] = {
|
|||
|
||||
"P", "xform-body",
|
||||
"%2.0u?{'(y5:begin),l1]2}.0,n,n,n,.5,,#0.0,&1{%5.4p?{.4ap}{f}?{.4d,.5a,"
|
||||
".0a,${.5,.3,t,@(y5:xform)[03},.0,'(l1:y5:begin;),.1A1?{.4,.4dL6,.9,.9,"
|
||||
".9,.9,:0^[(i10)5}'(l1:y6:define;),.1A1?{.3da,.4dda,${${.5,@(y7:id->sym"
|
||||
")[01},@(y6:gensym)[01},${.(i10),.3,.6,@(y7:add-var)[03},.8,.(i13),.3c,"
|
||||
".(i13),.5c,.(i13),.7c,.4,:0^[(i14)5}'(l1:y13:define-syntax;),.1A1?{.3d"
|
||||
"a,.4dda,${.9,'(l1:y9:undefined;),.5,@(y11:add-binding)[03},.7,.(i12),t"
|
||||
"c,.(i12),.4c,.(i12),.6c,.4,:0^[(i13)5}t?{.1K0?{.4,${.8,.7,.6[02}c,.9,."
|
||||
"9,.9,.9,:0^[(i10)5}.5,.(i10),.(i10)A8,.(i10)A8,.(i10)A8,@(y12:xform-la"
|
||||
"bels)[(i10)5}f](i10)}.0,.5,.5A8,.5A8,.5A8,@(y12:xform-labels)[55}.!0.0"
|
||||
"^_1[25",
|
||||
".0a,${.5,.3,t,@(y5:xform)[03},.0,'(y5:begin),.1v?{.4,.4dL6,.9,.9,.9,.9"
|
||||
",:0^[(i10)5}'(y6:define),.1v?{.3da,.4dda,${${.5,@(y7:id->sym)[01},@(y6"
|
||||
":gensym)[01},${.(i10),.3,.6,@(y7:add-var)[03},.8,.(i13),.3c,.(i13),.5c"
|
||||
",.(i13),.7c,.4,:0^[(i14)5}'(y13:define-syntax),.1v?{.3da,.4dda,${.9,'("
|
||||
"l1:y9:undefined;),.5,@(y11:add-binding)[03},.7,.(i12),tc,.(i12),.4c,.("
|
||||
"i12),.6c,.4,:0^[(i13)5}.1K0?{.4,${.8,.7,.6[02}c,.9,.9,.9,.9,:0^[(i10)5"
|
||||
"}.5,.(i10),.(i10)A8,.(i10)A8,.(i10)A8,@(y12:xform-labels)[(i10)5}.0,.5"
|
||||
",.5A8,.5A8,.5A8,@(y12:xform-labels)[55}.!0.0^_1[25",
|
||||
|
||||
"P", "xform-labels",
|
||||
"%5n,n,.4,.4,.4,,#0.0,.(i11),.(i11),&3{%5.0u?{${:0,:1,&1{%1:0,.1,f,@(y5"
|
||||
|
|
Loading…
Reference in a new issue