BRAINFUCK(1)

NAME
brainfuck - Brainfuck interpreter written in Perl

SYNOPSIS
brainfuck [file ...]

DESCRIPTION
The brainfuck utility interprets its standard input as a Brainfuck script. Processing will start after EOF. If you started brainfuck interactively, hit ^D (Ctrl-D) on a new line to start.

If optional arguments (file ...) are passed, these are run as if concatenated instead, and standard input processing starts immediately when utilised by the script.

THE LANGUAGE
Brainfuck is a simple enough language to include the entire official language describtion in this manual page. The following table is from the original Brainfuck distribution by its inventor Urban Mueller <umueller@amiga.physik.unizh.ch>:

The language Brainfuck knows the following commands:

    Cmd  Effect                                   Equivalent in C
    ---  ------                                   ---------------
    +    Increases element under pointer          array[p]++;
    -    Decrases element under pointer           array[p]--;
        Increases pointer                        p++;
        Decreases pointer                        p--;
    [    Starts loop, counter under pointer       while(array[p]) {
    ]    Indicates end of loop                    }
    .    Outputs ASCII code under pointer         putchar(array[p]);
    ,    Reads char and stores ASCII under ptr    array[p]=getchar();

All other characters are ignored.

The array elements and p are being initialized to zero at the beginning. Now while this seems to be a pretty useless language, it can be proven that it can compute every solvable mathematical problem (if we ignore the array size limit and the executable size limit).

This implementation reads and writes to stdio in bytes. Its cells are of the size of a standard Perl integral type, signed and with wrap-around behaviour. It uses LF as end of line and NUL as end of input indicator.

SEE ALSO
perl(1)

HISTORY
brainfuck first appeared in

AUTHORS

Urban Mueller designed the language.

Marko Nippula wrote this interpreter.

The Chaos Computer Club Cologne gave some hints for the man page.

Thorsten Glaser wrote this man page, put things together for and later corrected the interpreter.