MirOS Manual: brainfuck(1)

BRAINFUCK(1)                 BSD Reference Manual                 BRAINFUCK(1)


     brainfuck - Brainfuck interpreter written in Perl


     brainfuck [file ...]


     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.


     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 -1 as end of input indicator.




     brainfuck first appeared in MirOS #1.


     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         February 11, 2016                              1

Generated on 2017-04-03 16:26:17 by $MirOS: src/scripts/roff2htm,v 1.88 2017/01/29 00:51:06 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–2017 The MirOS Project, Germany.
This product includes material provided by mirabilos.

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