The language consists of an array of data cells, similar to brainfuck, with the addition of one "hold" cell, which is used to hold the value of the currently pointed cell. This makes it possible to add the value of one cell to another one easily.
This language consists of the 16 symbols:
!@#$%^&:;.?+-v<>, as well as the digits
0123456789. Their meaning is described by the following table.
||Outputs the content of the current cell.|
||Reads user input to the number.|
||Moves pointer to the next cell.|
||Moves pointer to the previous cell.|
||Adds the number to the current cell.|
||Subtracts the number from the current cell.|
||Copies the value of the current cell to the dedicated hold cell.|
||Adds the value of the hold cell to the current cell.|
||Sets a goto label referenced to as the number.|
||If the value of the current cell is non-zero, then the reader cursor goes to the label named as the number.|
||If the value of the current cell is zero, then the cursor goes to the label named as the number.|
||End of main program. Basically separates the part of the code which is read with the definitions of the subroutines.|
||Set a subroutine with the name of number. All subroutines must be defined after the |
||Use the subroutine of name number.|
||Erases the content of the current cell, i.e. makes it 0.|
To explain further, look at some examples below.
The adder is pretty simple:
But we'll take a more complicated example to understand more commands:
v+>: Asks for user input, then adds it to the cell (default value of the cells is 0), then moves pointer to the next cell.
v+: Asks for user input, then adds it to the cell.
#: Copies value of current cell.
<: Moves the pointer to the previous cell.
&: Adds the value of the hold cell to the current cell.
^: Outputs the value of the current cell.
.: End of program.
In case the adder is needed to be used multiple times, we can define it as a subroutine:
1@: The code cursor looks for the subroutine 1$, defined after the . in the list of subroutines. Then executes the code of the subroutine, then as soon as it reaches the ; it jumps back to the main program and executes the rest of the code till it reaches the . in this case, the rest of the code is just the ^ output operator.
1?: If the current cell is non-zero, goto label 1:
1:: Label 1:
So basically this is equivalent to the brainfuck adder:
You can figure it out =]
Jaune is yellow in French. And I like yellow, that's all =)