@@ -9,9 +9,9 @@ js:{[o]opts::o
99 F[`neq`nop`not `orr`bor`xor`ret`shl`shr`stm`sub`swc`typ]:(jsneq;jsnop;jsnot;jsorr;jsbor;jsxor;jsret;jsshl;jsshr;jsstm;jssub;jsswc;jstyp)
1010
1111 jsren'`in`try`catch
12- i:i@&{(0N ~|/(T 1_c)?`swc`stm)&3=#c:&P=x}' i:&T=`cnd /keep ternary
12+ i:i@&{(2 ~|/(T 1_c)?`swc`stm)&3=#c:&P=x}' i:&T=`cnd /keep ternary
1313 rwcnd'|j@&~(j:&(~`=S)&(T=`cnd)|T=`swc)?\i /rewrite cnd/swc expressions
14- S[0]:$[0N ~i:o?`lib;S 0;o 1+i] /emit`lib`name (instead of main + remove func main)
14+ S[0]:$[(#o) ~i:o?`lib;S 0;o 1+i] /emit`lib`name (instead of main + remove func main)
1515 n:{x[y]+:1}/(,&#P),P;n[0]-:1; /number of children per node
1616 s:{c:(0,(#x)-z)^x /cut args from stack
1717 (c 0),,,/(F T y)[y;|c 1]}/[();|!#P;|n] /fold over the tree in reverse order
@@ -71,7 +71,7 @@ jsflts:(0x25fab843dda06440;0x2cde25af6a56113f;0x182d4454fb21e93f;0x485555555555c
7171jsflt:{x:C x+!8;$[#r:jsflts x;r;$*`f x]}
7272jslit:{hi:{*`i C 4+x+!4};lo:{*`i C x+!4}
7373 y;i:I x;jsty[t;$[`f~t:S x;jsflt i
74- `i~t;$[0N~i ;"-2147483648";$i]
74+ `i~t;$[i~|/!0 ;"-2147483648";$i]
7575 `u~t;$i,"n"
7676 `j~t;$[i~0;,"0n";(-1~h:hi i)&0>l:lo i;($l),"n";(h~0)&l>0;($l),"n";"J(BigInt(\"",(hx8 i),"\"))"]
7777 `k~t;$[i~0;,"0n";(0~h:hi i)&0<l:lo i;($l),"n";"BigInt(\"",(hx8 i),"\")"];"???"]]}
@@ -102,7 +102,8 @@ jsdrp:{y}
102102jscli:{n:I x;jsty[S x;"_F[",(*y),"](",(","/n#1_y),")"]}
103103jsasn:{r:(s:$S x),"=",(*|y),";\n";
104104 $[((n:6+2*#s)#r)~s,"=I(",s,"+I(";$["+=1"~-3#r:s,"+=",(n_-4_r);s,"++";r],";\n";r]}
105- jscnd:{$[S x; (jsnd@*y;"?(";y 1;"):(";y 2;")") ;"if",(jsnd y 0),(jsemb jssem y 1),$[3~#y;"else ",(jsemb jssem y 2);""]]}
105+ /jscnd:{$[S x; (jsnd@*y;"?(";y 1;"):(";y 2;")") ;"if",(jsnd y 0),(jsemb jssem y 1),$[3~#y;"else ",(jsemb jssem y 2);""]]}
106+ jscnd:{"if",(jsnd y 0),(jsemb jssem y 1),$[3~#y;"else ",(jsemb jssem y 2);""]}
106107jsnop:{y;""}
107108jsswc:{("switch(";*y;"){\n"),(1_(@[("case ",/$-1+!#y); (-1+#y)*I x; "default"] ,\":"),' (jssem'y),\"break;\n"),"}" }
108109
@@ -131,7 +132,7 @@ jsfmt:{
131132 x:@[x;1+find["};\n" ;x];" "]
132133 l:"\n"\x;
133134 l@:&~l~\"r=r;"
134- l@:&~(""~/l)|(,";")~/l;s:_32+&' (-"}" =*'l)+-1_0,+\+/' ("{" =l)-"}" =l
135+ l@:&~(""~/l)|(,";")~/l;s:_32+&' , ' (-"}"=*' l)+-1 _0,+\+/'("{"=l)-"}"=l
135136 ,/(s,' l),\"\n" }
136137
137138/ run time
0 commit comments