GBrainFuck

Welcome to the GBrainFuck Project home page.

Português

The BrainFuck language

BrainFuck is a very simple, concise language. In fact, it is so simple that it has only 8 keywords:

The keyword "+" increments the content of the current cell by one; the keyword "-" decrements the content of the current cell by one; the keyword ">" makes the controller advance to the next cell (thus advancing the tape), making it the current cell; the keyword "<" makes the controller retreat to the previous cell, making it the new current cell; the keyword "." outputs the content of the current cell as an ASCII character (e.g., if the cell contains the value 33, the interpreter outputs the character "!"); the keyword "," reads from the standard input a character and stores its value into the current cell.

Loops are performed using the keywords "[" and "]". "[" verifies that the current cell's value is not 0. If it is, the control goes to the first instruction after the matching "]", otherwise the control goes to the next instruction. All other characters found in the source program are considered to be comments, and are ignored.

The GBrainFuck Interpreter

The GBrainFuck interpreter (gbf for short) is an interpreter for this language. It is more memory-effective than processor-effective, and it has room for optimization (especially on the code dealing with "[" and "]").

The interpreter is very like a Turing machine: it has an infinite tape, divided in cells that contain the value 0, which can move forward and backward; also, it has a controller unit, that reads, writes and moves the tape. Data in the cells are the size an int in the host machine (usually 32- or 64-bit)

Along with the interpreter, I put various BrainFuck sample programs, of which one of the most intersting is the BrainFuck interpreter in BrainFuck. I hope you enjoy.

Files are released at SourceForge in source code form.

About the author

José de Paula is a Brazilian Computer Science student, still making his way into programming, but already a GNU, FreeBSD and Vim zealot.

You can mail him for any bug reports, feature requests, rants, suggestions, patches or flames. Thank you.

Motivation

Why would anyone make a program in BrainFuck? First, because a BrainFuck environment simulates quite well a Turing Machine, the concept upon which all modern computers are built. Secondly, because you can.

Links

Daniel B. Cristofani, an amazing BrainFuck programmer, the author of a BrainFuck interpreter written in BrainFuck. Lots of brilliant BrainFuck programs here.

Mr. Rock's Brainfuck Pages, contains a good BrainFuck tutorial.

Brian Raiter's Brainfuck Programming Language, some hints to Brainfuck implementators (sp?)

SourceForge.net Logo    Valid XHTML 1.0! Valid CSS!

The Esoteric Programming Languages Ring
<<Previous | Ring Hub | Next>>