Persistent brainfuck

From Esolang
Jump to navigation Jump to search

Persistent brainfuck is an esolang invented by User:None1, inspired by brainfuck.

Tape and pointer

It's tape and pointer are like that of brainfuck, but they're persistent. In other words, they can be rolled back to history versions. Each time before a non-rollback command is executed, a new history version is created. They're rolled back together when a rollback command is executed.

Rollback command

!a, where a is a nonnegative integer, rolls back a versions. The first version will be rolled back if a is greater than or equal to the number of versions.

Examples

Rollback demo (XKCD Random Number)

++++++!2>>++++++++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>>[-]>>>++++++++++<[->-[>+>>]>[+[-

<+>]>+>>]<<<<<]>[-]>>[>++++++[-<++++++++>]<.<<+>+>[-]]<[<[->-<]++++++[->++++++++ <]>.[-]]<<++++++[-<++++++++>]<.[-]<<[-<+>]< This example increments the current cell 6 times, and then rolls back 2 versions, causing the current cell to be decreased by 2. Then it prints current cell as an integer with brainfuck algorithms.