The language described is a 3D Esolang, similar to ARGH. Its execution space is a 3D grid where instructions are executed based on the current direction of the instruction pointer and its location within the grid. This language interacts with a stack, and the grid can be thought of as both the program and memory.
- State (3D grid): The execution space.
- Instruction Pointer (IP): Points to the current cell in the state that is being executed. The IP moves in a specific direction.
- Instruction Direction: Defines the direction in which the IP should move after executing an instruction.
- Stack: A Last-In-First-Out (LIFO) data structure used to store and manipulate values.
A: Add the value of the cell above the current cell to the value on top of the stack.a: Add the value of the cell below the current cell to the value on top of the stack.D: Delete (pop) the top value off the stack.d: Duplicate the top value on the stack.F: Fetch (pop) the value from the top of the stack and store it in the cell above.f: Fetch (pop) the value from the top of the stack and store it in the cell below.G: Get one byte from stdin and store it in the cell above the IP.g: Get one byte from stdin and store it in the cell below the IP.R: Reduce the value on top of the stack by the value of the cell above.r: Reduce the value on top of the stack by the value of the cell below.S: Store (push) the value of the cell above the current cell onto the stack.s: Store (push) the value of the cell below the current cell onto the stack.
P: Send the value in the cell above the current cell to stdout.p: Send the value in the cell below the current cell to stdout.
H: Jump (move IP) left to the next cell whose value matches the value on top of the stack and set the execution direction to left.h: Set the execution direction to left.J: Jump down to the next cell whose value matches the value on top of the stack and set the execution direction to down.j: Set the execution direction to down.K: Jump up to the next cell whose value matches the value on top of the stack and set the execution direction to up.k: Set the execution direction to up.L: Jump right to the next cell whose value matches the value on top of the stack and set the execution direction to right.l: Set the execution direction to right.W: Jump in the positive z-direction to the next cell whose value matches the value on top of the stack and set the execution direction to positive z.w: Set the execution direction to positive z.E: Jump in the negative z-direction to the next cell whose value matches the value on top of the stack and set the execution direction to negative z.e: Set the execution direction to negative z.X: If the value on top of the stack is negative, turn the execution direction 90 degrees to the left.x: If the value on top of the stack is positive, turn the execution direction 90 degrees to the right.q: Quit/end program execution.
#: Behaves likejbut only if its position in the code/data array is (0,0) and only if there's a!in the cell on its right side.
- Install raylib
- Open
3d-programming-language/d3argh/rayLibArgh /rayLibArghin Visual Studio and runrayLibArgh.cpp
- Initialization:
Size()
<dimensions>
This specifies the size of the grid. In the provided example, it's 4,4,4.
- Program Body: The program body consists of a series of layers (in this example, four layers). Each layer consists of rows and each row consists of cells, similar to a 3D matrix or tensor.
- Each cell contains either a command, a number, or a space (interpreted as a null operation).
- Commands are executed based on the current cell's position and contents.
- Delimiter:
-----
This separates each layer. It’s essential for distinguishing between the layers of the 3D matrix.
-
Dimension Declaration: Start the program with the
Size()function, followed by the grid's dimensions. -
Layered Structure: Always ensure the program is structured in layers, separated by the delimiter
-----. -
Consistent Dimensions: Ensure that the number of rows and cells in each row is consistent with the declared dimensions.
-
Commands and Numbers: Use commands and numbers within cells to carry out operations. The exact semantics of each command would need further clarification.
-
Whitespace: Utilize spaces for null operations or placeholders. This helps maintain the grid's shape when not all cells in a row have operations.
-
End of File: The program concludes when all layers are defined, and no additional delimiters are required after the last layer.
Size()
4,4,4
sdre,
1 0j,
j,
llle,
-----
e,
f,
,
w A,
-----
j,
w,
,
w d,
-----
jhhh,
jlpk,
jk,
wkFh,
-----