BrainRelax Introduction
BrainRelax (BR) is a translator from the BF (BrainFuck) programming language (a Turing-complete language) to other programming languages (such as C, TCL, PHP, Pascal, Basic, Python, etc.).

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 to the matching ] if the byte at the pointer is zero.
] Jump to the matching [.

When i first came into BrainF**k, i realized why it is called so: A simple 'HelloWorld' program looks like this:

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

When i started to decode the above simple statemement, i realized that writing in BrainFuck has the two contrary meanings the word f**k has, depending on the context: intense suffering and pleasure. These, -for some bizzare reason- are also the characteristics of writting low level obscure source code.
What is nice about BF, is that it's something like a very simple assembly language, and it's very easy to write an interpreter for it. This also meant that it's very easy to write a translator from BF to other (known) programming languages.
This is the target of this project, and this is why i called it BrainRelax. The idea behind BF was that if we have a piece of memory and we can move up and down on this memory, increase and decrease the data of the memory and have a simple loop and i/o functionality, we can do almost anything. The above functionality is something that -more or less- all the known programming languages support. So, writting a translator from BF to any programming language needs only to define the syntax that the target language uses to perform those actions. Simple, huh? So all you have to do is to write a general purpose translator, that reads from a configuration file the rules to use and that's it.

Of course, my first translator was to the C language, (by far the best programming language in this universe, and maybe to other universes too). For more details about the development and the syntax of the tl (target language) configuration files, you can have a look at the Development page.

      BrainRelax Sourceforge


   Last Updated: 23 July 2001.