Reversible Brainfuck

From Esolang

Jump to: navigation, search

Reversible Brainfuck is a brainfuck derivative created by User:ais523 at the end of 2006. It uses the same right-infinite tape starting with zeros as brainfuck does, and most of the same commands.

[edit] Commands

Six of the commands are identical to brainfuck:

 + Increment the current cell.
 - Decrement the current cell.
 > The cell to the right of the current cell becomes current.
 < The cell to the left of the current cell becomes current.
 . Output a character whose ASCII code is that of the current cell.
 ] If the current cell is nonzero, jump backwards to the matching [.

Two of the commands are changed:

 , Input a character and store its ASCII code in the current cell, if it contains a 0.
   If the current cell doesn't contain a 0, end the program.
   EOF is treated as if a 0 were read.
 [ If the current cell is nonzero, jump forwards to the matching ].

(In brainfuck, [ jumps forwards if the current cell is zero, but Reversible Brainfuck jumps forwards if the current cell is non-zero).

[edit] Compatibility

Reversible Brainfuck uses a right-infinite tape. Each cell on the tape must be able to be decremented 255 times from zero and incremented 255 times from zero without giving a zero result on any increment. (However, it's legal to use a wrapping system where, for instance, -128 and 128 are the same number.)

[edit] See also

Personal tools