Braindash is an esoteric programming language based on brainfuck.
All brainfuck commands work as normal, but Braindash has more functions.
All characters not defined as a function or a command are treated as comments.
command | operation |
---|---|
+ | Add one to the current cell. Wrap from 255 to 0. |
- | Subtract one from the current cell. Wrap from 0 to 255. |
. | Prints the current cell as an ASCII character. |
, | Reads a character from the input and overwrites the current cell with it. After the input is empty it writes zeros. |
< | Shifts the pointer to the left. There are 2048 cells, and they wrap from 0 to 2047. |
> | Shifts the pointer to the right. There are 2048 cells, and they wrap from 2047 to 0. |
[ | Jumps to the corresponding ] if the current cell is 0 |
] | Jumps to the corresponding ] if the current cell isn't 0 |
command | operation |
---|---|
% | Wipes the tape. All cells are zeros. |
^ | Set the pointer to the initial position. |
~ | Prints the current cell as a base 10 number with a space after. |
( | Jumps to the corresponding ) if the current cell is not 0. |
) | Jumps to the corresponding ( if the current cell is 0. |
| | Breaks out of the current loop. Useful for making if statements. |
: | Begin declaring a function. More detail on this below. |
; | End declaring a function. More detail on this below. |
@ | Set a variable from the tape. More detail on this below. |
# | Write a variable on the tape. More detail on this below. |
Functions are declared like so:
When the letter after the colon is reached in the program, the code before the semicolon and after the letter is called.
In this example, whenever the character 'd' is reached in the code 10 is added to the current cell.
When an '@' or a '#' is reached in the code, the character after is the variable dealt with.
If an '@' is reached, the value of the current cell is placed in the variable.
If a '#' is reached, the value of the variable is placed in the current cell, overwriting it. The variable keeps it data.
The following is a quick cloning sequence:
The variable 'a' is set to the value of the current cell, the pointer is moved to the right, then contents of the cell are replaced with 'a'.
The end result is two cells side by side with the same content.