MirOS Manual: brainfuck(1)

BRAINFUCK(1)                 BSD Reference Manual                 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 in-
     teractively, hit ^D (Ctrl-D) on a new line to start.

     If optional arguments (file ...) are passed, these are run as if con-
     catenated 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 MirOS #1.

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 MirOS, and
     later corrected the interpreter.

MirOS BSD #10-current            July 1, 2010                                1

Generated on 2014-07-04 21:17:45 by $MirOS: src/scripts/roff2htm,v 1.79 2014/02/10 00:36:11 tg Exp $

These manual pages and other documentation are copyrighted by their respective writers; their source is available at our CVSweb, AnonCVS, and other mirrors. The rest is Copyright © 2002‒2014 The MirOS Project, Germany.
This product includes material provided by Thorsten Glaser.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.