Cubix

Cubix is a stack-based 2-dimensional language where the code is wrapped around a cube.

Overview
Cubix was inspired by Labyrinth and Hexagony, both stack-based 2D languages with their own quirks.

Cubix utilizes a stack which can be populated with integers. At the beginning of the program, the stack contains infinite zeroes.

Running the code
The first thing the interpreter does is remove whitespace, then figure out the smallest cube that the code will fit onto. The code is then padded with no-ops until all six sides are filled. That means that this "Hello, World!" program:

./v.o;@?/"!dlroW"S',u/"Hello"

is exactly the same as this one:

. / v       . o ; @ ? / " ! d l r o W " S ', u  / " H e l l o ". . . . . . . . . . . . . . . .        . . .        . . .        . ..

Then the code is run like a regular 2-dimensional language, except that the IP (instruction pointer) wraps around like the code is on a cube.

Operators
Unless specified otherwise (with "pop" or "in place"), operators do not remove their operands from the stack.

I/O

 * - Push a single charcode from the input. If there is no more input, pushes.
 * - Consume all input until a match of  is found, and push that integer. If no integers are found, pushes.
 * - Push a -1, then push all remaining charcodes in the input in reverse order.
 * - Output the top item as a charcode.
 * - Output the top item as a number.

Arithmetic

 * - Decrement the top item in place.
 * - Increment the top item in place.
 * - Add the top two items.
 * - Subtract the top two items.
 * - Multiply the top two items.
 * - Integer-divide the top two items, rounding toward 0.
 * - Pop the top two items, concatenate their digits, and push the result.
 * - Negate the top item in place.
 * - Take bitwise NOT of the top item in place.
 * - Take bitwise AND of the top two items.
 * - Take bitwise OR of the top two items.
 * - Take bitwise XOR of the top two items.

Stack manipulation

 * - Duplicate the top item.
 * - Pop the top item.
 * - Push the length of the stack.
 * - Swap the top two items.
 * - Rotate the top three items (push the top one down two spots).
 * - Send the top item to the bottom.
 * - Pop X and bring the Xth item to the top.

Literals

 * - Push that digit.
 * - Push the charcode of the next char.
 * - Start/end a string literal, performing  on each item until the next.
 * - Push a newline, or 10.
 * - Push a space, or 32.
 * - Push a, or 34.

Control flow

 * - No-op.
 * - Flip the IP diagonally.
 * - Flip the IP horizontally. No-op if the IP is traveling N or S.
 * - Flip the IP vertically. No-op if the IP is traveling W or E.
 * - Flip the IP diagonally.
 * - Point the IP in a specific direction.
 * - point the IP in a random direction.
 * - Turn the IP left (90° counter-clockwise).
 * - Turn the IP right (90° clockwise).
 * - "U-turn" the IP to the left (90° counter-clockwise twice).
 * - "U-turn" the IP to the right (90° clockwise twice).
 * - "Sidestep" the IP to the left (90° counter-clockwise) before continuing in the original direction.
 * - "Sidestep" the IP to the right (90° clockwise) before continuing in the original direction.
 * - Skip the next instruction.
 * - If the top item is non-zero, skip the next instruction.
 * - If the top item is negative, turn left; if it's positive, turn right; otherwise, continue straight.
 * - End the program.

Example programs
Example programs can be found in the online interpreter.

Links

 * GitHub repository
 * Online interpreter