Home

Awesome

bfi

A Brainf*ck interpreter (not compiler!)

Most comprehensive collection of information: http://en.wikipedia.org/wiki/Brainfuck

Original author's site seems to be: http://www.muppetlabs.com/~breadbox/bf/

hello.b:

>+++++++++[<++++++++>-]<.>++++++[<+++++>-]<-.+++++++..+++.
>>+++++++[<++++++>-]<++.------------.<++++++++.--------.
+++.------.--------.>+.>++++++++++.

Excerpted from the author's website: ###The Language

A Brainfuck program has an implicit byte pointer, called "the pointer", which is free to move around within an array of 30000 bytes, initially all set to zero. The pointer itself is initialized to point to the beginning of this array.

The Brainfuck programming language consists of eight commands, each of which is represented as a single character.

> - Increment the pointer.
< - Decrement the pointer.
+ - Increment the byte at the pointer.
- - Decrement the byte at the pointer.
. - Output the byte at the pointer.
, - Input a byte and store it in the byte at the pointer.
[ - Jump forward past the matching ] if the byte at the pointer is zero.
] - Jump backward to the matching [ unless the byte at the pointer is zero.

[] loops can be nested

Taken directly from: http://www.muppetlabs.com/~breadbox/bf/standards.html

###The Unofficial Constraints on Portable Brainfuck Implementations

This interpreters conformance to the above guidelines:

  1. The cell array is fixed at 30000 cells
  2. The cell pointer will wrap around when moved past the ends
  3. Each cell is an 8 bit unsigned integer, range [0..255]
  4. Cell values wrap when incremented or decremented beyond that range
  5. Platform dependent; on Mac OS X, input is allowed until the program terminates. When a ^D is sent, a zero value is returned to the program, if a file is the source of input, additional reads will return zeros
  6. Yep, pretty much undefined. Good luck!