s=>I=>eval([..."8;@CDEJKLMNQTUWYZ^_bkqw"]"@CDEJKLMNQTUWYZ^_bkmqw"].reduce((s,c)=>(a=s.split(c)).join(a.pop()),"(R=X=>(H={},o=P=[],S=[],z=x=p=i=0,gWs[p]gUs[p]?~(j=` \n`.indexOf(s[pDYs[p++]N?j:gLgK:3,hWgL<2hUgK<2?Tn*2+jMn*2+j):V=n,GWx=zGUx=z--&&S.pop(y=xJFWgy=x),FUg(`qb$qS[z+~x=`mbQQ$mS[z+~(b]KS;ceb])TSCce((z-=V=b-1,VKqkJqxKMqyJqxKk$MH[x]=y$qH@KR[T1V)$mkJLmyJkTTLH[x]=y$mHD)qR[M1)]=_?R[P8pJV]R[P@p),V]:_Z_&_Y_&!kZ_&k<0Zp$CkY_&k<0Yp$E?P.popLpopK:p$w+NwpT$^QQQQQqW+yw-Nw*Nwyw*yw/y|0Yy|0w%yN:w%NUo+=Buffer(@Ko+=k^.codePointAtL^`;t`$`.some(c=>^QTTo+=Buffer(v-=~[47E47EEQ,9Q10QEQ,3,597QEQ26Q2][yDD)$o+=k$Z.codePointAtKZ`Ct`$`[n-n?0:x=c9],y=v=0)&&evalx&&eval(x,n=3Y<3&&Fn=1N<3&&F(n*4+jYn*3+jN(3Y1N(0)||R(1)||owUz>1?(Mqxqz=S8kGLbgL||owN:^$WqTT$mz=S@kGKbgK?-T0M0):T0Y_p$T1JC^$H@=I[iDZM0N_p$M1),E^E?g:pZ$HD=I[i++]Y?R[V]:YWz>1?(LmxU=n=>T$$QqqN))W=n=>UC?g:p$ThMh(Q,,NyY:MkLk,k,L()K()$JJ),E,1D++]Cp=X@[k];mx)$Ep=XD[k]C.spli8spli@.pusT"pusM"))
Try it online!Try it online! (all test cases without comments)
Try it online!Try it online! (an example with a commented source code as input)
The sequences of spaces, tabs and linefeeds are converted to an integer in base-4 (with 3 with a leading \$3\$ for EOT)\$1\$ until they match a known value:
seq. | base 43 | decimal
------+--------+---------
SS | 300 100 | 48 9
STS | 3010 1010 | 196 30
STN | 3012 1012 | 198 32
SNS | 3020 1020 | 200 33
SNT | 3021 1021 | 201 34
SNN | 3022 1022 | 202 35
TTS | 3110 1110 | 212 39
TTT | 3111 1111 | 213 40
NSS | 3200 1200 | 224 45
NST | 3201 1201 | 225 46
NSN | 3202 1202 | 226 47
NTS | 3210 1210 | 228 48
NTT | 3211 1211 | 229 49
NTN | 3212 1212 | 230 50
NNN | 3222 1222 | 234 53
TSSS | 3100011000 | 832108
TSST | 3100111001 | 833109
TSSN | 3100211002 | 834110
TSTS | 3101011010 | 836111
TSTT | 3101111011 | 837112
TNSS | 3120011200 | 864126
TNST | 3120111201 | 865127
TNTS | 3121011210 | 868129
TNTT | 3121111211 | 869130
We store the delta values minus \$1\$, leading to:
[47, 147, 1, 1,,, 9,, 10,,, 1,,, 3, 597,,, 1,, 26,, 2]
Once the command has been identified, we pick the code fromThe commands are simply stored in a lookup table and invokeexecuted with eval()
.
###Unpacked and formatted
s => I => (
R = X => (
H = {},
o = P = [],
S = [],
z = x = p = i = 0,
g = n => s[p] ? ~(j = ` \t\n`.indexOf(s[p++])) ? j : g() : 3,
h = n => g() < 2 ? h(n * 2 + j) : V = n,
G = n => x = z-- && S.pop(y = x),
F = n => g(
x = [
"z=S.push(g()?-h(0):h(0))",,,,,,,,,,,,,,,,,,,,,
"z=S.push(S[z+~(g()?-h(0):h(0))])",,
"S.splice((z-=V=g()?-h(0):h(0))-1,V)",
"z=S.push(G()),z=S.push(x)",
"G(),G(),z=S.push(y),z=S.push(x)",
"G()",,,,
"G(),G(),H[x]=y",
"z=S.push(H[G()])",,,,,
"R[h(1)]=p",
"h(1),p=X?R[P.push(p),V]:p",
"h(1),p=X?R[V]:p",
"h(1),p=X&!G()?R[V]:p",
"h(1),p=X&G()<0?R[V]:p",
"p=X?P.pop():p",,,
"p=X?g:p",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
"z>1?(G(),G(),z=S.push(x+y)):p=X?g:p",
"z>1?(G(),G(),z=S.push(x-y)):p=X?g:p",
"z>1?(G(),G(),z=S.push(x*y)):p=X?g:p",
"z>1?(G(),G(),z=S.push(x/y|0)):p=X?g:p",
"z>1?(G(),G(),z=S.push(x%y)):p=X?g:p",,,,,,,,,,,,,,
"o+=Buffer([G()])",
"o+=G()",,
"H[G()]=I[i++].codePointAt()",
"H[G()]=I[i++]"
]
.some(c =>
(v][n -= ~[47, 147, 1, 1,,, 9,, 10,,, 1,,, 3, 597,,, 1,, 26,9], 2][y++]) - n ?
0
:
x = c,
y = v = 0
) && eval(x, n = 31)
) < 3 && F(n * 43 + j)
)(31)
)(0) || R(1) || o