infinifuck
infinifuck is a brainfuck derivative created by User:Quelklef. It is exactly equivalent to brainfuck, except for the following differences and/or clarifications:
- Cells are unbounded nonnegative integers
-
has no effect if the target cell is 0- The tape is unbounded both to the left and the right
- On EOF,
,
will zero out the target cell - 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.
Compilation
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 |
---|---|
PREAMBLE | >>>+
|
> |
[>>>]>>>[-]+
|
< |
<<<<<<<<<[<<<]>>>[-]+
|
+ |
>+[>+<-<->>[-<+<+>>]<[->+<]+<[>-<[-]]+>[->>>+<[>-<-]+>[<->->>[[>>>]>+>>]<<[-<<<<[>>[->>>+<<<]>+<<<-<<<]>]<+>]<->]<-[>+<[-]]+>]<[<<<]>>>
|
- |
[>>>]<<<[->>[-<+<+>>]<<[->>+<<]>[<+>[-]]<[->+<]+>>>>[-<<<+>>>]<<<<->[<+>[-]]<[->+<]+<<<]>>>>[-<->>[-<+<+>>]<<[->>+<<]+>>>>+<<<[[-]>>>-<<<]>->>]<<<<[<<<]>>>
|
[ |
[>>>]<<<[->>[-<+<+>>]<<[->>+<<]>[<+>[-]]<[->+<]+>>>>[-<<<+>>>]<<<<->[<+>[-]]<[->+<]+<<<]>>>>[-<
|
] |
[>>>]<<<[->>[-<+<+>>]<<[->>+<<]>[<+>[-]]<[->+<]+>>>>[-<<<+>>>]<<<<->[<+>[-]]<[->+<]+<<<]>>>>]<
|
, |
[>>[-]>]<<<[<<<]>>>>>,<<
|
. |
>>.<<
|