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

SEE ALSO

     perl(1)

HISTORY

     brainfuck first appeared in MirBSD #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 MirBSD, and
     later corrected the interpreter.

MirBSD #10-current            September 4, 2020                              1

Generated on 2022-12-24 01:00:14 by $MirOS: src/scripts/roff2htm,v 1.113 2022/12/21 23:14:31 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2022 MirBSD.

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

Kontakt / Impressum & Datenschutzerklärung