Extended Brainfuck

(Please note that this is a single variant, not the Brainfuck extensions page which lists many more extra command classes.)

Extended Brainfuck is a variant of brainfuck with unknown authorship. It has an extended vocabulary to allow smaller source sizes and improved speed of execution. A correct implementation dynamically lengthens the size of the internal array as needed, the arrays length increasing by half. This is the first release of the Extended Brainfuck.

The goal of extended brainfuck is to make the normally hard to program in brainfuck, fairly easy and be completely impossible to actually compile.

Basic Commands
Extended Brainfuck has the basic 8 commands.

The eight Basic language commands, each consisting of a single character:

Extended Type I
An extended set of 9 commands which can be accessed by designating -x on the interpreters commandline.

The nine Extended Type I language commands, each consisting of a single character:


 * 1) Storage &mdash; The number in storage can only be changed by using a $ command, operations take place in the cell, not in storage.

Extended Type II
The second extended set of 8 commands which can be accessed by designating -x2 on the interpreters commandline. This set also adds the code itself to the cells, such as Self-modifying Brainfuck does and allows the code to modify itself. This set automatically inherits the commands from Extended Type I.

In Type II, if a loop brackets partner cannot be found before the @ ignore that bracket.

Data after the @ is added into the data cells as cell initializer data. Otherwise as normal all cells starts with at zero. Appended data can also be added to the program using the -d commandline switch.

Extended Type II Topography

The storage byte takes up the leftmost cell. Followed by the source code, then directly by the normal memory cells.

The eight Extended Type II language commands, each consisting of a single character:
 * 1) Goto &mdash; The new position will execute immediately after the ?, there is no restrictions on the goto, meaning it is possible to jump into the middle of a loop.
 * 2) Insertion &mdash; After this operation resolves the pointer is pointing at the newly created cell.
 * 3) Deletion &mdash; After this operation resolves the pointer is pointing at the cell that was originally to the right of the deleted cell.
 * 4) Mathematical Operators &mdash; Adding or Multiplying a number only stores the first 8 bits of the result. Dividing by zero causes the interpreter to crash or causes undefined behavior. Subtracting a larger number from a smaller number may produce unpredictable results.

Extended Type III
This is an extended set to speed the execution and self modifying ability of Extended Brainfuck. This unlike previous versions may cause problems with text within its code body (but ignores all unknown characters). So a comment command has been added. These can be accessed by designating -x3 on the interpreters command line.

The Extended Type III language commands, each consisting of a single character:
 * 1) Cell &mdash; If the cell was deleted somehow, it returns to the cell immediately to the right of the that was deleted cell. (or if that one was deleted to the right of that, and so on).

Type II
Code with appended initializer data.

Type III
Using fast cell initializer commands to compress the code. This example was created using Brainfuck code generation with a genetic algorithm.