Brainfuck$

Brainfuck$ (sometimes called Brainfuck with Buffer, although it doesn't really have a buffer at all) is an esoteric programming language derived from Brainfuck, which features only the addition of a stack - which is used to ensure that there will be no data corruption when performing certain operations that require loops - and two new commands for I/O that deal with absolute numbers (meaning an input of '3' will not refer to the ASCII value of '3', but to the number itself).

Brainfuck$ introduces six new "one char" commands:

It should be noticed that Brainfuck$ merely extends on the original language, so it still has the primary eight commands.

The most obvious difference between Brainfuck and Brainfuck$ is the classic example of cell copying. It is impossible to make a Brainfuck program which copies the content of a cell without eventually destroying the contents of another cell. For example, if we were to copy the content of cell 1 to cell 2, we'd have to use cell 3 as the loop index, and it's previous contents would be lost. The actual code would be performed this way:


 * 1) Clear the contents of both cells 2 and 3
 * 2) Copy the content of 1 to both 2 and 3. This will erase cell 1.
 * 3) Copy the content of cell 3 to cell 1, therefore erasing cell 3.

This compiles as the following brainfuck program:

>[-]>[-]<<[->+>+<<]>>[-<<+>>]<<

However, Brainfuck$ allows the programmer to not only save the contents of all cells, but to also do so with a much cleaner code, which is:



In the above three-character-example, the value of cell 1 is copied to the end of the list, the pointer is moved to the following cell, and then the copied value is blit back into cell 2.

External resources

 * Currently, there is no compiler for Brainfuck$, but there is a language interpreter (requires java).