1- F:(0#`)!()
21hx8 :{[i]"0x" ,`x@|C i+!8 }
3- delta:{x-(*x),-1 _x}
42
53prg:{
64 c:1 _&P=0
@@ -19,7 +17,7 @@ mem:{y;""}
1917con:{"(global $" ,($S x)," " ,(type S 1 +x)," (" ,(*y),"))" }
2018var:{"(global $" ,($S x)," (mut " ,(type S 1 +x),") (" ,(*y),"))" }
2119tab:{y;(I x;S x)}
22- watbl:{"\n" /{"(elem (i32.const " ,($x),") func " ,y,")" }'[(*x)i;" "/' "$" ,'' $(i:&~1 =delta@ *x)^(x:+x)1 ]}
20+ watbl:{"\n" /{"(elem (i32.const " ,($x),") func " ,y,")" }'[(*x)i;" "/' "$" ,'' $(i:&~1 =- ' *x)^(x:+x)1]}
2321fun:{s:$S x
2422 args:" "/y@&`arg=T c:&x=P
2523 rets:" "/y@&`res=T c
@@ -73,16 +71,16 @@ swc:{
7371cnd:{"\n"/(*y;$[#t:type S x;"if (result ",t,")";"if"];y 1;$[3~#y;"else\n",(y 2);""],"\nend")}
7472typ:{y;S x} /keep as symbol
7573
76- wa 2 : {"\n" /(z 0;z 1 ;(type S y),x)}
77- wa 2 s :{"\n" /(z 0;z 1 ;(type t ),x,sign@t:S y)}
78- add:wa 2 ".add" ;sub:wa 2 ".sub"
79- mul:wa 2 ".mul" ;div:wa 2 s ".div" ;mod:wa 2 s ".rem"
80- and :wa 2 ".and" ;bnd:wa 2 ".and"
81- neq:wa 2 ".ne"
82- mor:wa 2 s ".gt" ;gte:wa 2 s ".ge" ;les:wa 2 s ".lt" ;lte:wa 2 s ".le" ;
83- orr:wa 2 ".or" ;bor:orr;xor:wa 2 ".xor"
84- eql:wa 2 ".eq"
85- shl:wa 2 ".shl" ;shr:wa 2 s ".shr"
74+ f2 : {"\n"/(z 0;z 1;(type S y),x)}
75+ f2s :{"\n"/(z 0;z 1;(type t ),x,sign@t:S y)}
76+ add:f2 ".add";sub:f2 ".sub"
77+ mul:f2 ".mul";div:f2s ".div";mod:f2s ".rem"
78+ and:f2 ".and";bnd:f2 ".and"
79+ neq:f2 ".ne"
80+ mor:f2s ".gt";gte:f2s ".ge";les:f2s ".lt";lte:f2s ".le";
81+ orr:f2 ".or";bor:orr;xor:f2 ".xor"
82+ eql:f2 ".eq"
83+ shl:f2 ".shl";shr:f2s ".shr"
8684
8785type:`i`u`j`k`f!("i32";"i32";"i64";"i64";"f64")
8886sign:`i`u`j`k`f!("_s"; "_u"; "_s"; "_u"; "")
@@ -98,11 +96,6 @@ cast:("" ;"" ;"i32.wrap_i64" ;"i32.wrap_i64"
9896 "f64.convert_i32_s" ;"f64.convert_i32_u" ;"f64.convert_i64_s" ;"f64.convert_i64_u" ;"" ) /f
9997
10098
101- F[`prg`mem`con`var`tab`fun`arg`sym`res`loc`ast`lod`sto]:(prg;mem;con;var;tab;fun;arg;sym;res;loc;ast;lod;sto)
102- F[`add`and `bnd`ant`asn`cal`cli`cnd`dfr`div`drp`eql`cst]:(add;and ;bnd;ant;asn;cal;cli;cnd;dfr;div;drp;eql;cst)
103- F[`for `get`Get`gte`jmp`les`lit`lte`mod`mor`mul`neg ]:(for ;get;Get;gte;jmp;les;lit;lte;mod;mor;mul;neg)
104- F[`neq`nop`not `orr`bor`xor`ret`shl`shr`stm`sub`swc`typ]:(neq;nop;not ;orr;bor;xor;ret;shl;shr;stm;sub;swc;typ)
105-
10699n:{x[y]+:1 }/(,&#P),P;n[0]-:1
107- s:{c:(0,(#x)-z)^x;(c 0),,,/(F T y)[y;|c 1]}/[();|!#P;|n]
100+ s:{c:(0,(#x)-z)^x;(c 0),,,/(. T y)[y;|c 1]}/[();|!#P;|n]
108101`<*s
0 commit comments