From Esolang
Jump to navigation Jump to search

infinifuck is a brainfuck derivative created by User:Quelklef. It is exactly equivalent to brainfuck, except for the following differences and/or clarifications:

  1. Cells are unbounded nonnegative integers
  2. - has no effect if the target cell is 0
  3. The tape is unbounded both to the left and the right
  4. On EOF, , will zero out the target cell
  5. Output via . treats the target cell as modulo 128

infinifuck is designed to be like brainfuck, but be an easier target to compile to.

There is an infinifuck interpreter built-in to esoglot.


Infinifuck may be compiled to (certain implementations of) brainfuck via the replacements listed in the table below. PREAMBLE must be prepended to the resulting brainfuck code (this means that infinifuck is not quite a Trivial brainfuck substitution, though it wouldn't be hard to turn it into one).

The target brainfuck implementation is expected to have a doubly-unbounded tape with 7-or-more-bit wrapping cells and for , to, on eof, either zero out the current cell or have no effect.

Details of how this works can be found here.

infinifuck instruction equivalent brainfuck instructions
> [>>>]>>>[-]+
< <<<<<<<<<[<<<]>>>[-]+
+ >+[>+<-<->>[-<+<+>>]<[->+<]+<[>-<[-]]+>[->>>+<[>-<-]+>[<->->>[[>>>]>+>>]<<[-<<<<[>>[->>>+<<<]>+<<<-<<<]>]<+>]<->]<-[>+<[-]]+>]<[<<<]>>>
- [>>>]<<<[->>[-<+<+>>]<<[->>+<<]>[<+>[-]]<[->+<]+>>>>[-<<<+>>>]<<<<->[<+>[-]]<[->+<]+<<<]>>>>[-<->>[-<+<+>>]<<[->>+<<]+>>>>+<<<[[-]>>>-<<<]>->>]<<<<[<<<]>>>
[ [>>>]<<<[->>[-<+<+>>]<<[->>+<<]>[<+>[-]]<[->+<]+>>>>[-<<<+>>>]<<<<->[<+>[-]]<[->+<]+<<<]>>>>[-<
] [>>>]<<<[->>[-<+<+>>]<<[->>+<<]>[<+>[-]]<[->+<]+>>>>[-<<<+>>>]<<<<->[<+>[-]]<[->+<]+<<<]>>>>]<
, [>>[-]>]<<<[<<<]>>>>>,<<
. >>.<<