Skip to content

Commit b792c9f

Browse files
committed
as
1 parent 3dbae6a commit b792c9f

1 file changed

Lines changed: 12 additions & 19 deletions

File tree

x/as.k

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
F:(0#`)!()
21
hx8:{[i]"0x",`x@|C i+!8}
3-
delta:{x-(*x),-1_x}
42

53
prg:{
64
c:1_&P=0
@@ -19,7 +17,7 @@ mem:{y;""}
1917
con:{"(global $",($S x)," ",(type S 1+x)," (",(*y),"))"}
2018
var:{"(global $",($S x)," (mut ",(type S 1+x),") (",(*y),"))"}
2119
tab:{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]}
2321
fun:{s:$S x
2422
args:" "/y@&`arg=T c:&x=P
2523
rets:" "/y@&`res=T c
@@ -73,16 +71,16 @@ swc:{
7371
cnd:{"\n"/(*y;$[#t:type S x;"if (result ",t,")";"if"];y 1;$[3~#y;"else\n",(y 2);""],"\nend")}
7472
typ:{y;S x} /keep as symbol
7573
76-
wa2: {"\n"/(z 0;z 1;(type S y),x)}
77-
wa2s:{"\n"/(z 0;z 1;(type t ),x,sign@t:S y)}
78-
add:wa2".add";sub:wa2".sub"
79-
mul:wa2".mul";div:wa2s".div";mod:wa2s".rem"
80-
and:wa2".and";bnd:wa2".and"
81-
neq:wa2".ne"
82-
mor:wa2s".gt";gte:wa2s".ge";les:wa2s".lt";lte:wa2s".le";
83-
orr:wa2".or";bor:orr;xor:wa2".xor"
84-
eql:wa2".eq"
85-
shl:wa2".shl";shr:wa2s".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
8785
type:`i`u`j`k`f!("i32";"i32";"i64";"i64";"f64")
8886
sign:`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-
10699
n:{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

Comments
 (0)