Every program is a sequence of tokens made up from two characters in the base64url alphabet.
The ordering of characters is: 0..9A..Za..z-_
The initial program can be passed in the URL after the '#'
The program must return either one value (grayscale) or 3 values (red, green, blue) on the stack when it is finished.
Tokens act on a stack, consuming the top 0, 1 or 2 values, and adding to the top 0 or 1 new values or objects.
Tokens:
- A2: atan2(x2, x1), Return atan2 of top two stack values
- Ab: abs(x1), Absolute value of top value on stack
- Ac: acos(x1), Return acos of top stack value
- Ad: x2+x1, Add top two values of stack
- As: asin(x1), Return asin of top stack value
- AT: atan(x1), Return atan of top stack value
- At: stack.push(time), Push time value to stack
- Ax: stack.push(x), Push x coordinate (aspect corrected -1..+1) to stack
- Ay: stack.push(y), Push y coordinate (aspect correcter -1..+1) to stack
- Ap: stack.push(vec2(x,y)), Push x & y coordinate as vec2 (still images)
- Am: stack.push(vec3(x,y,t)), Push x, y & time coordinateis as vec3 (moving image)
- Cs: cos(x1), Return cosine of top stack value
- Cr: cross product of top two vectors
- Dr: Drop, Remove top item on stack
- Dv: x2/x1, Divide second item on stack by first item on stack
- d[N]: stack.push(stack[-N]), duplicate item N from top of stack
- b[N]: stack.push((stack[-1]<<6)+N), Multiply stack value by 64 and add N
- e[N]: stack.push(stack[-1]*(2**N)), Multiply stack value by 2^N unsigned ('V'=+31,'_'..'W'=-1..-32 )
- Fl: floor(x1), Return integer part of top stack value
- Fn: stack[-1] = function(stack[-2]), create named function from list
- Fr: fract(x1), Return fractional part e.g. x1 - floor(x1) of top stack value. Range 0.0-1.0
- f[N]: stack.push(N/64), Push value N/64 to stack
- h[N]: stack.push(vec3((N>>4)/3.0,()(N>>2)&3)/3.0,(N&3)/3.0)), Split N to 3 x 2b numbers and push as vec3. Intended for colour hues.
- i[N]: stack.push(N), Push one integer in range 0..63 to stack
- I[N:high 3b][M:low 3b]: Iterate last N+1 instructions M+1 times
- Le: Length of vector
- Ln: log(x1), Return natural log of top stack value
- L2: log2(x1), Return log base 2 of top stack value
- l_: following tokens pushed to list
- Mn: min(x2, x1), Return lower of top two stack values
- Mu: x2*x1, Multiply top two stack values
- Mx: max(x2, x1), Return higher of top two stack values
- Ng: -x1, Negate top value on stack
- Nm: Normalise vector object - divide all elements by length
- Pw: pow(x2, x1), Return x2 raised to the power x1
- p[N]: Move stack item N to top of stack
- Pi: Push value of Pi to stack (3.1415926..)
- R[N]: Repeat previous token action N times
- r0: 1.0/x1, Calculate reciprocal of value of top of stack
- r[N>0]: Push value of 1/N to top of stack
- S2: Convert top vector of 2 values to two stack objects
- S3: Convert top vector of 3 values to three stack objects
- S4: Convert top vector of 4 values to four stack objects
- Sb: x2-x1, Subtract top value on stack from second value on stack
- Sn: sin(x1), Return sin of top stack value
- Sq: x1*x1, Square value of top of stack
- Sr: sqrt(x1), Square root of top value on stack
- St: step(x2, x1), 1 if x2 > x1 else 0
- Sx: Copy first element of top vector object to stack
- Sy: Copy second element of top vector object to stack
- Sz: Copy third element of top vector object to stack
- Sw: Copy fourth element of top vector object to stack
- Tn: tan(x1), Return tangent of top stack value
- Ta: Push value of Tau to stack (6.2831853..)
- V2: Pop top two values and combine to single vector object (max 4 elements)
- V3: Pop top three values and combine to single vector object (max 4 elements)
- V4: Pop top four values and combine to single vector object (max 4 elements)
- _j: end of list definition, list pushed to top of stack