Will 4 months ago
commit
8e5f0b2306
6 changed files with 382 additions and 0 deletions
  1. 25 0
      TTExample.csv
  2. BIN
      kjr/a
  3. 40 0
      kjr/a.c
  4. 127 0
      kjr/a.h
  5. 183 0
      ngncheat.txt
  6. 7 0
      transpiler.py

+ 25 - 0
TTExample.csv

@@ -0,0 +1,25 @@
+tempST,State Table,,,,,,
+States/Events,,E1,E2,E3,E4,E5,E6
+Off,S1,"4, S5","1, S2","2, S3","3, S4","5, S6","-, S1"
+FanLow,S2,"4, S5","-, S2","2, S3","3, S4","5, S6","6, S1"
+FanMedium,S3,"4, S5","1, S2","-, S3","3, S4","5, S6","6, S1"
+FanHigh,S4,"4, S5","1, S2","2, S3","-, S4","5, S6","6, S1"
+Heating,S5,"-, S5","1, S2","2, S3","3, S4","5, S6","6, S1"
+Cooling,S6,"4, S5","1, S2","2, S3","3, S4","-, S6","6, S1"
+Events,,E1,E2,E3,E4,E5,E6
+T < 18,C1,Y,N,N,N,N,N
+T >= 18 & T < 22,C2,N,Y,N,N,N,N
+T >= 22 & T < 26,C3,N,N,Y,N,N,N
+T >= 26 & T < 30,C4,N,N,N,Y,N,N
+T >= 30,C5,N,N,N,N,Y,N
+isOff,C6,N,N,N,N,N,Y
+Actions,,,,,,,
+setFan(low),A1,,,,,,
+setFan(medium),A2,,,,,,
+setFan(high),A3,,,,,,
+heaterOn(1),A4,,,,,,
+ACOn(1),A5,,,,,,
+setAll(0),A6,,,,,,
+next,A7,,,,,,
+exit,A8,,,,,,
+error,A9,,,,,,

BIN
kjr/a


+ 40 - 0
kjr/a.c

@@ -0,0 +1,40 @@
+#define R(t,n,z) r(t_(t,n),z) //:+-*%&|<>=~$.!@?#_^, '/\ 0bcieE
+#include"a.h"//ACDEMNOPS|FGIQRTUW (HJKL[XYZ]) At B Cut Equal Flipflop Less More Num Order Prd q Ret Sum t u Vcat Writework
+typedef float complex Float;float fabsf(float),sqrtf(float),expf(float),logf(float),log2f(float),cabsf(Float);Float csqrtf(Float),cexpf(Float),clogf(Float);Ze rf(ee){return 1/e;}ZE crf(EE){return 1/E;}
+double atof();void*malloc(),free(),*memcpy();long write(),read();int abs(),atoi(),stat(),open(),close(),sprintf(char*,const char*,...);G(mc,(u)memcpy((char*)f,sa,x))nu(vc,++T;sx[nx++]=n;x)
+G(w_,write(f,sa,x))G(_w,read(f,sa,x))f(_h,close(x))F(h,stat(sa,sx))F(h_,open(sa,x))f(W_,(u)malloc(x))f(_W,free(sx);0)f(w,127>x?w_(2,(u)&x,1):w_(2,x,sl(sx)))f(uz,5>ax?ix:_(EE=Ex;*(u*)&E))
+u(t_,ii=(u)n<<lt[t];T+=i;ux=W_(8+n3(i)*8+(2==t));*(u*)x=t<<24|(u)n<<32;x+8,it,in)f(_t,T-=Nx;_W(x-8);0)f(r_,pax?x:(++xr,x))f(_r,pax?0:(1<<24)-1&xr?(--xr,0):_(if(!tx)N(_r(xu))_t(x)))
+f(v,R(ax,1,*(u*)r=uz(x)))ns(kns,mc(t_(2,n),(u)s,n))us(ks,kns(sl(s),s))nu(nz,ua=uz(x);if(3>ax)(a|=a<<8,a|=a<<16);if(5>ax)a|=a<<32;R(ax,n,i(n3(Nr),ru=a)))
+f(wx,_x(w_(2,x,nx));0)F(err,w(a);w(58);w(x);w(10);Q)ns(prr,w((u)s);w(10);wx(vc(94,nz(n,tc(32))));w(10);Q)f(s_,in=0;N(n+=xc)n)f(m_,in=0;N(n=m(n,xi))n)
+Zu at(),es(),ws();f(qf,!ax&&!tx&&1==nx&&2==txx)us(def,r(v(ks(s)),sr[nr]=0))F(fa,U[23]=x;es(xx))f(foo,ws("a:2")) //U[0]=def("x");0) //ws("a"))
+u(tE,ua=*(u*)&E;a>>32?a:1l<<63|a,EE)u(_n,r3(n,i),in)G(c,mc(t_(tx,a),x+(f<<lx),a<<lx))iu(a_,tx?t(tx,ci,xe,xE):r_(xu))u(e1,T0(g(a_(i,x))),_ g,ux)u(e2,QZ,_ g,ua,ux)
+F(A,_ax(R(ta,nx,C4(la,i(nx,sr[i]=sa[xi]),,i(nx,re=((float*)a)[xi]),i(nx,rE=((Float*)a)[xi])))))
+F(V,_a(R(tx,na+nx,mc(r,a,Na);mc(r+Na,x,Nx))))F(cC,_x(R(2,0,N(r=vc(a,V(r,xu))))))nu(cv,V(v(tc(n)),x))us(i$,ti(atoi(s)))us(e$,te(atof(s)))ns(E$,tE((float)atof(s)+I*atof(s+n)))
+u($i,kns(sprintf(b,"%d",i),b),int i)u($e,kns(sprintf(b,"%g",e&&1e-6<fabsf(e)?e:0.),b),ee)f($E,ua=ix?$e(ex):0;x>>=32;x=x?$e(ex):0;a?x?V(vc(58,a),x):a:cv(46,x))
+f($,px?ks("?"):ax?4>ax?$i(x):5>ax?$e(ex):$E(x):2==tx?x:e1($,x))f($_,pax||!lx?$(x):tx?cC(32,e1($,x)):ks("."))f(w$,wx(vc(10,pax||tx?$_(x):cC(10,e1($_,x)))))f(wo,w$(r_(x));x)
+f(ind,_x(R(3,s_(x),unsigned*s=(unsigned*)sr;N(if(xc)*s++=i))))nu(ec,r1(nx,n==xc))F(C,_a(T0(c(xi,(i+1<nx?((unsigned*)x)[i+1]:na)-xi-1,a))))f(Cc,ua=ec(sx[nx-1],x);a=_a(c(-1,na,a));*sa=1;C(x,ind(a)))
+tu(Ua,t(t,ix,ix,4>ax?ix:ex))tu(Ut,T(t,xc,xc,xi,4>tx?xi:xe))f(q0,ax&&!uz(x))iu(set,u*a=U+i;_r(*a);*a=r_(x))
+#define a(g,t,a,v) f(g,ax?ue(t,a):tx?uE(t,v):e1(g,x))
+#define a4(f,c,d) a(f,4,5>ax?te(c(ex)):tE(d(Ex)),5>tx?R4(c(xe)):R5(d(xE)))
+a(_e,0,tb(!ix),R1(!ci))a(_s,2,t(ax,-ix,-ex,-Ex),T(tx,-xc,-xi,-xe,-xE))a(ab,0,3>ax?x:4>ax?ti(abs((int)ix)):te(5>ax?fabsf(ex):cabsf(Ex)),3>tx?x:4>tx?R3(abs((int)xi)):R5(5>tx?fabsf(xe):cabsf(xE)))
+a(_d,4,5>ax?tE(I*ex):4l<<51|x>>32,5>tx?R5(I*xe):R4(((float*)x)[2*i+1]))a4(_p,rf,crf)a4(_l,expf,cexpf)a4(q_,sqrtf,csqrtf)a4(l_,logf,clogf)f($q,1+ix?q_(x):tE(I))f($l,1+ix?l_(x):tE(I*pi))
+#define SP(g,o) F(g,ax?aa?uu(ue(2,t(ax,ia o ix,ea o ex,Ea o Ex))):g(x,a):(aa?:ta)&&tx?UU(uE(2,T(tx,ai o xc,ai o xi,ae o xe,aE o xE))):e2(g,a,x))
+#define LE(g,o) F(g,ax?aa?uu(tb((int)ia o(int)ix)):L_==g?g(_s(x),_s(a)):g(x,a):(aa?:ta)&&tx?UU(R1((int)ai o(int)ci)):e2(g,a,x))
+#define LM(g,o) F(g,Qt(1!=(aa?:ta)||1!=(ax?:tx))ax?tb(ia o ix):(aa?:ta)&&tx?R1(ai o xc):e2(g,a,x))
+SP(S$,+)SP(P_,*)LM(_M,&)LM(M_,|)LE(L_,<)LE(E_,==)F(S_,q0(a)?x:S$(a,x))F(_S,S_(_s(x),a))F(_P,P_(q0(a)?x:_p(x),a))F(_L,L_(x,a))F(_E,Qr(!ax)_e(E_(a,x)))
+F(A_,P(aa,P_(a,x))ax?_(Qd(ix>=na)a_(ix,a)):uE(3,Qt(3<tx)Qd(m_(x)>=na)A(a,x)))F(_A,P(aa,_P(a,x))Qr(aa)QZ)F(F_,QZ)f(f_,Qr(ax)A(x,r3(nx,nx-1-i)))f(n,Qr(ax)_x(ti(nx)))f(_v,Qr(ax)_x(a_(0,x)))f(x_,0)F(X_,_a(x))
+#define Qi(_) Qr(!a##_)Qt(3<a##_)Qd(i##_>>31)
+f(n$,Qi(x)_n(ix))f(p$,Qi(x)Qd(ix&ix-1)r5(ix,cexpf(i*pi/ix*I)))F(N$,Qi(a)QZ)F(_N,Qi(a)P(ax,nz(ia,x))P(2>nx,nz(ia,_v(x)))Qd(ia>nx)_x(c(0,ia,x)))F(N_,Qi(a)Qr(ax)Qd(ia>nx)_x(c(ia,nx-ia,x)))F(C_,Qi(a)QZ)
+F(V_,a=aa?v(a):a;x=ax?v(x):x;Qt(ta!=tx)_x(V(a,x)))f(_o,QZ)f(o_,_o(_e(x)))f(o,P(ax,p$(x))QZ)F(D_,QZ)F(_$,QZ)f(_z,QZ)f(z_,QZ)
+Z_// :  +  -  *  %  &  |  <  >  =   ~  $  . !  @  ?  #  _  ^  ,  *e %log &Flip |flop <asc >desc =group ?nub ^order [&|<>=@?#^]i   i[#_^]i  (#?) (#'=)
+f[]={x_,ab,_s,_l,$l,F_,f_,_o,o_,z_,_e, $,_d,n$,_v,_z,n ,$q,o ,v },F[]={X_,S_,_S,P_,_P,_M,M_,L_,_L,E_,_E,_$,D_,N$,at,_A,_N,N_,C_,V_};F(at,Qd(px)pa?f[a](x):qf(a)?fa(a,x):A_(a,x))
+Zs vm="+    - *  %    &and  |or   <    >     =      ~not $ . !index @at    ?find #take  _drop ^cut   ,\n+abs - *e %log &flip |flop <asc >desc =group ~not $ . !index @first ?nub  #count _sqrt ^order ,";
+Zs//!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  {"0a([.(while if :)
+B=" m_pkdet  casblu__________  gihon                           v rq __________________________ f j";us(ps,i(sl(s),P(58==si?26u<=s[i-1]-97:33>B[si-32],prr(i,s)))0)f(p,x=31&B[x-32];31>x?x:0)
+us(np,P(34==*s,is(34,s+1)+1)st=s;W(13u>*++t-46&&47-*t);t-s)ns(nq,P(34==*s,kns(n-2,s+1))mc((u)b,(u)s,n=l(21,n));b[n]=0;n=is(58,b);n?E$(n,s):is(46,b)?e$(s):i$(s))
+us(e,P(58==s[1],q(e(s+2))set(*s-97,x))ua=p(*s)?:26u>*s-97?r_(U[*s-97]):r(nq(a=np(s),s),s+=a-1);!*++s?a:32>a||!p(*s)?_(q(e(s))32>a?f[a](x):at(a,x)):_(q(e(s+1))F[p(*s)](a,x)))
+us(es,q(92-*s?e(s):ys(s+1))58==s[1]?_x(0):x)us(ws,if(92-*s)Q(ps(s))q(es(s))x?w$(x):0)us(ts,if(92-*s)Q(ps(s))in=1e6;uf=ut()+30*n;i(n,q(es(s))_r(x))ti((m(f,ut())-f)/(O?2.4e6:2.4e4)))
+us(f1,ux[18];in=!h((u)s,(u)x)&&1&((int*)x)[O?6:1]>>15?x[O?6:12]:0;Qs(!n,s)R(2,n,ii=h_((u)s,0);_w(i,r,n);_h(i)))us(f0,q(f1(s))Cc(x))
+us(ls,q(f0(s))ii=-1;W(++i<nx&&nxu)if(39!=*sxu)Q(ws(sxu))_x(0))us(ys,c4(is(*s,"ltw"),ks(vm),ls(s+2),ts(s+2),ti(T)))int main(int _,char**a){O=(u)a>>46;bu(ia32_ldmxcsr)(0x9fc0);
+foo(0);*++a?ls(*a):(w((u)"k/fun (c)atw "__DATE__),w(10));char b[64];W(1)w(32),b[_w(0,(u)b,64)-1]=0,*b?ws(b):0;}
+

+ 127 - 0
kjr/a.h

@@ -0,0 +1,127 @@
+#define Zi static unsigned
+#define Ze static float
+#define Zu static u // ubcieE [paieEtnNs][ax] [rax][ucieE] w[ucieE] //clang -Os -oa a.c -lm
+typedef unsigned long(*_)(),u;Zi lt[]={3,0,0,2,2,3,3},O,T;Zu Q=128,U[26],ys();Ze pi=3.1415927;
+static char b[64];Zu __attribute((naked))ut(){asm(".quad 0xd53be04031420aeb,0xc148310fd65f03c0,0xc3d0094820e2");}
+#define ty x(y,tx)
+#define xx *(u*)x
+#define txx y(xx,ty)
+#define q(z) ux=z;Q(x)
+#define T0(z)  _x(R(0,nx,i(nx,ru=z)))
+#define r1(n,z) R(1,n,i(n,sr[i]=z))
+#define r3(n,z) R(3,n,i(n,ri=z))
+#define r4(n,z) R(4,n,i(n,re=z))
+#define r5(n,z) R(5,n,i(n,rE=_(z)))
+#define T(t,c,h,e,E) _x(R(t,nx,C4(t-2,i(nx,sr[i]=c),i(nx,ri=h),i(nx,re=e),i(nx,rE=E))))
+#define t(t,i,e,E) c4(t-2,tc(i),ti(i),te(e),tE(E))
+#define ue(t,z) _(x=t>ax?Ua(t,x):x;z)
+#define uE(t,z) _(x=t>tx?Ut(t,x):x;z)
+#define uu(e) _(if(aa!=ax){if(aa<ax)a=Ua(ax,a);else x=Ua(aa,x);}e)
+#define UU(e) _a(it=aa?:ta;if(t!=tx){if(t<tx)a=aa?Ua(tx,a):Ut(tx,a);else x=Ut(t,x);}e)
+
+#define _(e) ({e;})
+#define f(g,e) u(g,e,ux)
+#define i(n,e) {unsigned $n=n;ii=0;for(;i<$n;++i){e;}}
+#define l(a,e) _(typeof(e)e_=e;(a)<e_?(a):e_)
+#define m(a,e) _(typeof(e)e_=e;(a)>e_?(a):e_)
+#define r(a,e) _(typeof(a)r=a;e;r)
+#define u(g,e,x...) Zu g(x){return _(e);}
+#define x(a,e) _(typeof(a)x=a;e)
+#define y(a,e) _(typeof(a)y=a;e)
+#define F(g,e) u(g,e,ua,ux)
+#define G(g,e) u(g,e,uf,ua,ux)
+#define Q(e) if(Q==(e))return Q;
+#define N(e) i(nx,e)
+#define P(b,e) if(b)return _(e);
+#define W(z) while(z)
+#define ii unsigned i
+#define in unsigned n
+#define ss char*s
+#define us(g,e) u(g,e,ss)
+#define ns(g,e) u(g,e,in,ss)
+#define _a(e) r(_(e),_r(a))
+#define _x(e) r(_(e),_r(x))
+#define _ax(e) _a(_x(e))
+#define n3(z) ((7+(z))>>3)
+#define ex (*(float*)&x)
+#define Ex (*(Float*)&x) 
+#define ax l(5,x>>51)
+#define pax (px||ax)
+#define xc sx[i]
+#define sx ((char*)x)
+#define px (31>x)
+#define xE ((Float*)x)[i]
+#define aE x(a,ax?Ex:xE)
+#define Ea x(a,Ex)
+#define ci (lx?xi:sx[i])
+#define ix (unsigned)x
+#define lx lt[tx]
+#define Nx (nx<<lx)
+#define tx sx[-5]
+#define xr ((unsigned*)x)[-2]
+#define nx ((unsigned*)x)[-1]
+#define xi ((unsigned*)x)[i]
+#define xe ((float*)x)[i]
+#define xu ((u*)x)[i]
+#define iu(g,e) u(g,e,ii,ux)
+#define nu(g,e) u(g,e,in,ux)
+#define tu(g,e) u(g,e,it,ux)
+#define Qs(e,s) if(e)return err((u)__func__,(u)s);
+#define Qz(e) Qs(e,"nyi")
+#define Qr(e) Qs(e,"rank")
+#define Qt(e) Qs(e,"type")
+#define Qd(e) Qs(e,"domain")
+#define QZ Qz(1)0
+#define oo w((u)"oo\n")
+#define uf u f
+#define ua u a
+#define ux u x
+#define st char*t
+#define it unsigned t
+#define EE Float E
+#define ee float e
+#define nxu ((unsigned*)xu)[-1]
+#define sxu ((char*)xu)
+#define si s[i]
+#define sr x(r,sx)
+#define nr x(r,nx)
+#define Nr x(r,Nx)
+#define ai x(a,ax?ix:xi)
+#define ae x(a,ax?ex:xe)
+#define ea x(a,ex)
+#define sa x(a,sx)
+#define la x(a,lx)
+#define pa x(a,px)
+#define aa x(a,ax)
+#define ia x(a,ix)
+#define na x(a,nx)
+#define ta x(a,tx)
+#define Na x(a,Nx)
+#define c4(z,a,b,c,d)   _(unsigned o=z;!o?a:1==o?b:2==o?c:_(d))
+#define C4(z,a,b,c,d)   unsigned o=z;if(!o)_(a);else if(1==o)_(b);else if(2==o)_(c);else _(d);
+#define Z_ static _
+#define Zs static char*
+#define ZE static Float
+#define l2(z) (64-bu(clzl)(z))
+#define R1(z) _x(r1(nx,z))
+#define R3(z) _x(r3(nx,z))
+#define R4(z) _x(r4(nx,z))
+#define R5(z) _x(r5(nx,z))
+#define tb(z) (1l<<51|(z))
+#define tc(z) (2l<<51|(char)(z))
+#define ti(z) (3l<<51|(unsigned)(z))
+#define te(z) (4l<<51|_(float _=z;*(unsigned*)&_))
+#define ru ((u*)r)[i]
+#define ri ((unsigned*)r)[i]
+#define re ((float*)r)[i]
+#define rE ((Float*)r)[i]
+#define wu(z) r((u)(z),nw(sprintf(b,"%lx\n",r),b))
+#define wi(z) r((int)(z),nw(sprintf(b,"%d\n",r),b))
+#define we(z) r((float)(z),nw(sprintf(b,"%g\n",r),b))
+#define wE(z) r((Float)(z),float*a=&r;nw(sprintf(b,"%g:%g\n",*a,a[1]),b))
+#define bu(o) __builtin_##o
+us(sl,ii=0;W(si)++i;i)ns(is,i(sl(s),P(n==si,i+1))0)
+#if __arm64 
+static void __builtin_ia32_ldmxcsr(int x){asm("msr fpcr,%0"::"r"(3l<<23));}
+#endif
+#include<complex.h>

+ 183 - 0
ngncheat.txt

@@ -0,0 +1,183 @@
+ngn/k, (c) 2019-2022 ngn, GNU AGPLv3. (codeberg.org/ngn/k)
+: SET      RETURN    '  each|slide|bin
++ add      flip      /  fold|join |dec|comment
+- subtract negate    \  scan|split|enc|trace
+* multiply first     ': eachprior
+% divide   sqrt      /: eachright
+! mod|dict enum|key  \: eachleft
+& min|and  where
+| max|or   reverse   /
+< less     ascend    multiline comment
+> more     descend   \
+= equal    group
+~ match    not       0: lines i/o
+, concat   enlist    1: bytes i/o
+^ without  null
+# reshape  length
+_ drop|cut floor
+$ cast     string    $[c;t;f]     COND
+? find|rnd uniq      ?[a;i;b]     splice
+@ apply(1) type      @[x;i;[f;]y] amend
+. apply(n) eval      .[x;i;[f;]y] drill
+grammar:  E:E;e|e e:nve|te| t:n|v v:tA|V n:t[E]|(E)|{E}|N
+limits: 8 locals/args, 256 bytecode
+--------------------------------------------------------------------------------
+Types:
+list atom
+ `A        generic list   ()   ,"ab"   (0;`1;"2";{3};%)
+ `I   `i   int            0N -9223372036854775807 01b
+ `D   `d   float          -0w -0.0 0.0 0w 1.2e308 0n
+ `C   `c   char           "a"   0x6263   "d\0\"\n\r\t"
+ `S   `s   symbol         `   `a   `"file.txt"   `b`cd`"ef"
+ `M   `m   table&dict     +`a`b!(0 1;"23")   (0#`)!()
+      `o   lambda         {1+x*y#z}  {[a;b]+/*/2#,a,b}
+      `p   projection     1+   {z}[0;1]   @[;i;;]
+      `q   composition    *|:   {1+x*y}@
+      `r   derived verb   +/   2\   {y,x}':
+      `u   monadic verb   +:   0::
+      `v   dyadic  verb   +   0:
+      `w   adverb         '   /:
+      `e   external func
+--------------------------------------------------------------------------------
+I/O verbs
+  0:x read  lines
+x 0:y write lines
+  1:x read  bytes
+x 1:y write bytes
+   <s open          fd:<`"file.txt"
+   >i close         >fd
+
+x can be a file descriptor (int) or symbol or string such as
+ "file.txt"
+ "/path/to/file"
+ "host:port"
+ ":port"         /host defaults to 127.0.0.1
+--------------------------------------------------------------------------------
+Verbs:    : + - * % ! & | < > = ~ , ^ # _ $ ? @ . 0: 1:
+notation: [c]har [i]nt [n]umber(int|float) [s]ymbol [a]tom [d]ict
+          [f]unc(monad) [F]unc(dyad) [xyz]any
+special:  var:y     set    a:1;a -> 1
+          (v;..):y  unpack (b;(c;d)):(2 3;4 5);c -> 4
+          :x        return {:x+1;2}[3] -> 4
+          $[x;y;..] cond   $[0;`a;"\0";`b;`;`c;();`d;`e] -> `e
+          o[..]     recur  {$[x<2;x;+/o'x-1 2]}9 -> 34
+          [..]      progn  [0;1;2;3] -> 3
+
+::  self      ::12 -> 12
+ :  right     1 :2 -> 2   "abc":'"d" -> "ddd"
+ +x flip      +("ab";"cd") -> ("ac";"bd")
+N+N add       1 2+3 -> 4 5
+ -N negate    - 1 2 -> -1 -2
+N-N subtract  1-2 3 -> -1 -2
+ *x first     *`a`b -> `a   *(0 1;"cd") -> 0 1
+N*N multiply  1 2*3 4 -> 3 8
+ %N sqrt      %25 -> 5.0   %-1 -> 0n
+N%N divide    2 3%4 -> 0.5 0.75
+ !i enum      !3 -> 0 1 2   !-3 -> -3 -2 -1
+ !I odometer  !2 3 -> (0 0 0 1 1 1;0 1 2 0 1 2)
+ !d keys      !`a`b!0 1 -> `a`b
+ !S ns keys   a.b.c:1;a.b.d:2;!`a`b -> ``c`d
+x!y dict      `a`b!1 2 -> `a`b!1 2
+i!I div       -10!1234 567 -> 123 56
+i!I mod       10!1234 567 -> 4 7
+ &I where     &3 -> 0 0 0   &1 0 1 4 2 -> 0 2 3 3 3 3 4 4
+ &x deepwhere &(0 1 0;1 0 0;1 1 1) -> (0 1 2 2 2;1 0 0 1 2)
+N&N min/and   2&-1 3 -> -1 2   0 0 1 1&0 1 0 1 -> 0 0 0 1
+ |x reverse   |"abc" -> "cba"   |12 -> 12
+N|N max/or    2|-1 3 -> 2 3   0 0 1 1|0 1 0 1 -> 0 1 1 1
+ <X ascend    <"abacus" -> 0 2 1 3 5 4
+ >X descend   >"abacus" -> 4 5 3 1 0 2
+ <s open      fd:<`"/path/to/file.txt"
+ >i close     >fd
+N<N less      0 2<1 -> 1 0
+N>N more      0 1>0 2 -> 0 0
+ =X group     ="abracadabra" -> "abrcd"!(0 3 5 7 10;1 8;2 9;,4;,6)
+ =i unitmat   =3 -> (1 0 0;0 1 0;0 0 1)
+N=N equal     0 1 2=0 1 3 -> 1 1 0
+ ~x not       ~(0 2;``a;"a \0";::;{}) -> (1 0;1 0;0 0 1;1;0)
+x~y match     2 3~2 3 -> 1   "4"~4 -> 0   0~0.0 -> 0
+ ,x enlist    ,0 -> ,0   ,0 1 -> ,0 1   ,`a!1 -> +(,`a)!,,1
+x,y concat    0,1 2 -> 0 1 2  "a",1 -> ("a";1)
+d,d merge     (`a`b!0 1),`b`c!2 3 -> `a`b`c!0 2 3
+ ^x null      ^(" a";0 1 0N;``a;0.0 0n) -> (1 0;0 0 1;1 0;0 1)
+a^y fill      1^0 0N 2 3 0N -> 0 1 2 3 1   "b"^" " -> "b"
+X^y without   "abracadabra"^"bc" -> "araadara"
+ #x length    #"abc" -> 3   #4 -> 1   #`a`b`c!0 1 0 -> 3
+i#y reshape   3#2 -> 2 2 2
+I#y reshape   2 3#` -> (```;```)
+f#y replicate (3>#:')#(0;2 1 3;5 4) -> (0;5 4)   {2}#"ab" -> "aabb"
+x#d take      `c`d`f#`a`b`c`d!1 2 3 4 -> `c`d`f!3 4 0N
+ _n floor     _12.34 -12.34 -> 12 -13
+ _c lowercase _"Ab" -> "ab"
+i_Y drop      2_"abcde" -> "cde"   `a`c_`a`b`c!0 1 2 -> (,`b)!,1
+I_Y cut       2 4 4_"abcde" -> ("cd";"";,"e")
+f_Y weed out  (3>#:')_(0;2 1 3;5 4) -> ,2 1 3
+X_i delete    "abcde"_2 -> "abde"
+ $x string    $(12;"ab";`cd;+) -> ("12";(,"a";,"b");"cd";,"+")
+i$C pad       5$"abc" -> "abc  "   -3$"a" -> "  a"
+s$y cast      `c$97 -> "a"   `i$-1.2 -> -1   `$"a" -> `a
+s$y int       `I$"-12" -> -12
+ ?X uniq      ?"abacus" -> "abcus"
+ ?i uniform   ?2 -> 0.6438163747387873 0.8852656305774402 /random
+X?y find      "abcde"?"bfe" -> 1 0N 4
+i?x roll      3?1000 -> 11 398 293   1?0 -> ,-8164324247243690787
+i?x deal      -3?1000 -> 11 398 293 /guaranteed distinct
+ @x type      @1 -> `b   @"ab" -> `C   @() -> `A   @(@) -> `v
+x@y apply(1)  {x+1}@2 -> 3   "abc"@1 -> "b"   (`a`b!0 1)@`b -> 1
+ .S get       a:1;.`a -> 1   b.c:2;.`b`c -> 2
+ .C eval      ."1+2" -> 3
+ .d values    .`a`b!0 1 -> 0 1
+x.y apply(n)  {x*y+1}. 2 3 -> 8   (`a`b`c;`d`e`f). 1 0 -> `d
+
+@[x;y;f]   amend  @["ABC";1;_:] -> "AbC"   @[2 3;1;{-x}] -> 2 -3
+@[x;y;F;z] amend  @["abc";1;:;"x"] -> "axc"   @[2 3;0;+;4] -> 6 3
+.[x;y;f]   drill  .[("AB";"CD");1 0;_:] -> ("AB";"cD")
+.[x;y;F;z] drill  .[("ab";"cd");1 0;:;"x"] -> ("ab";"xd")
+.[f;y;f]   try    .[+;1 2;"E:",] -> 3   .[+;1,`;"E:",] -> "E:'type\n"
+?[x;y;z]   splice ?["abcd";1 3;"xyz"] -> "axyzd"
+--------------------------------------------------------------------------------
+Special symbols:
+    `@x serialize    ` 7 8 9 -> 0x020300000000000000070809
+    `?C deserialize  `?0x020300000000000000070809 -> 7 8 9
+   `j?C parse json   `j?"{\"a\":1,\"b\":[true,\"c\"]}" -> `a`b!(1.0;(1;,"c"))
+   `k@x pretty-print `k("ab";2 3) -> "(\"ab\";2 3)"
+   `p@C parse k
+ `hex@C hexadecimal  `hex"ab" -> "6162"
+   `x@x fork-exec    `x(("/bin/wc";"-l");"a\nbc\nd\n") -> "3\n"
+   `t[] current time (microseconds)
+`argv[] list of cmd line args
+ `env[] dict of env variables
+`prng[] `prng@I get/set pseudo-random number generator internal state
+                     s:`prng[];r:9?0;`prng s;r~9?0 -> 1
+        `prng@0 use current time to set state
+ `err@C throw error
+Special symbols available only in an interpreter built with "make k-libc":
+ `sin@N trigonometry `sin 12.34 -> -0.22444212919135995
+ `exp@N exponential  `exp 1 -> 2.7182818284590455
+  `ln@N logarithm    `ln 2 -> 0.6931471805599453
+--------------------------------------------------------------------------------
+Adverbs:   ' / \ ': /: \:
+   f' each1     #'("abc";3 4 5 6) -> 3 4
+ x F' each2     2 3#'"ab" -> ("aa";"bbb")
+   X' binsearch 1 3 5 7 9'8 9 0 -> 3 4 -1
+   F/ fold      +/1 2 3 -> 6
+   F\ scan      +\1 2 3 -> 1 3 6
+ x F/ seeded /  10+/1 2 3 -> 16
+ x F\ seeded \  10+\1 2 3 -> 11 13 16
+ i f/ n-do      5(2*)/1 -> 32
+ i f\ n-dos     5(2*)\1 -> 1 2 4 8 16 32
+ f f/ while     (1<){$[2!x;1+3*x;-2!x]}/3 -> 1
+ f f\ whiles    (1<){$[2!x;1+3*x;-2!x]}\3 -> 3 10 5 16 8 4 2 1
+   f/ converge  {1+1.0%x}/1 -> 1.618033988749895
+   f\ converges (-2!)\100 -> 100 50 25 12 6 3 1 0
+   C/ join      "ra"/("ab";"cadab";"") -> "abracadabra"
+   C\ split     "ra"\"abracadabra" -> ("ab";"cadab";"")
+   I/ decode    24 60 60/1 2 3 -> 3723   2/1 1 0 1 -> 13
+   I\ encode    24 60 60\3723 -> 1 2 3   2\13 -> 1 1 0 1
+  i': window    3':"abcdef" -> ("abc";"bcd";"cde";"def")
+i f': stencil   3{x,"."}':"abcde" -> ("abc.";"bcd.";"cde.")
+  F': eachprior -':12 13 11 17 14 -> 12 1 -2 6 -3
+x F': seeded ': 10-':12 13 11 17 14 -> 2 1 -2 6 -3
+x F/: eachright 1 2*/:3 4 -> (3 6;4 8)
+x F\: eachleft  1 2*\:3 4 -> (3 4;6 8)
+--------------------------------------------------------------------------------

+ 7 - 0
transpiler.py

@@ -0,0 +1,7 @@
+import csv
+
+with open('TTExample.csv') as csvfile:
+    input = csv.reader(csvfile)
+
+    for row in input:
+        print(row)