February 8, 2006

The brain**ck programming language

Great article at Wikipedia about the brainfuck programming language complete with code samples and links to brainfuck interpreters. About the language:
Urban Müller created brainfuck in 1993 with the intention of designing a language which could be implemented with the smallest possible compiler [1], inspired by the 1024 byte compiler for the FALSE programming language. Several brainfuck compilers have been made smaller than 200 bytes. The classic distribution is Müller's version 2, containing a compiler for the Amiga, an interpreter, example programs, and a readme document.

The language consists of eight commands, listed below. A brainfuck program is a sequence of these commands, possibly interspersed with other characters (which are ignored). The commands are executed sequentially, except as noted below.

The brainfuck language uses a simple machine model consisting, besides the program, of an array of 30,000 byte cells initialized to zero, a movable pointer into the array (initialized to point to the leftmost byte of the array), and two streams of bytes for input and output (most often connected to a keyboard and a monitor respectively, and using the ASCII character encoding).
Here is the code to multiply two numbers input from the keyboard and print the results:
,>,>++++++++[<------<------>>-] <<[>[>+>+<<-]>>[<<+>>-]<<<-] >>>++++++[<++++++++>-],<.>.
Computer Science geeks with too much time on their hands. Heh... Posted by DaveH at February 8, 2006 5:39 PM
Comments

Crikey, I thought obfuscated Perl was impenetrable.

Posted by: Don McArthur at February 8, 2006 6:24 PM
Post a comment









Remember personal info?