*      __________________    __  *
                 *      | ___ \  ___/ __  \   | |  *
		 *	| |_/ / |_  `' / /' __| |   *
		 *	| ___ \  _|   / /  / _` |    *   
		 *	| |_/ / |   ./ /__| (_| |     *
		 *	\____/\_|   \_____/\__,_|      *
		 *	© by Natok                      *
(c) 2002 Du-Ne @ www.gcf.de
         oCaS @ www.legacy-project.de
 
Logo by  Natok @ www.legacy-project.de

News

16.04.02- Brainfuck2D release (first sources, language, compiler - everything!) :)

specification
-----------------

2dbf is to compare with with a cord. that you lay out like a specific pattern. The direction of that cord causes the command that is used. The 8 different directions comply with the 8 commands of the programming language Brainf*ck. To repeat a command you'll have to use numbers, which you can compare with nodes. The length of a part of that cord doesn't affect the repetition of a command. Only the cross sum of the numbers in a direction does matter. If there aren't any numbers at the beginning of a direction, the command will exactly be executed once (if you write a number later in that direction, it will be added to that 1). If you begin a shift of direction with a 0 (zero), this change will be ignored - which is very important for longer code.

Besides, the language only 'knows' 3 types of chars: Spaces, numbers and 'the rest'. Spaces are used to isolate the 'rest' from themself. 

2dbf is not a linear language, which means that the code is not interpreted line-by-line. The instructions depend on the shifts of direction. Remember the cord: The interpreter follows the pattern of the cord (and begins at the left upper corner, line 1 char 1). If the cord overlaps, the way the cord is 'layed' is important: It will follow the cord into the direction that has been used before (if that is possible): The cord starts at the upper left, it goes along to the lower right. Thus, the interpreter tries to keep the direction. If this is not possible, the program will be terminated. Because of this, branches like 

            *
           *
***********
           *
       *

are not possible, because the shift of direction is not clearly defined. This will cause an abort of the program. Sections like these

*
 *
*******
   *
    *

are clearly defined. 

The end (and the start) of a program is an absolutely isolated 'end of the cord', for example:

 
 * <- start    *
  *           *  <- end
   *5555552***
 

If you want a program to begin with a command that runs to the left, you'll have to use the 0: For example a simple echo program (char is typed, char is written ; ',.' ) could look like this:

*0********
         0 
 . ->  * *
      *  *
 , ->  * *
        **
         *  

The cord can be composed of all chars except for spaces. It has to begin in line 1 @ char 1. Numbers are used as 'repetition-operators', so they repeat the command subject to their value. A number placed on position 1,1 will be ignored.

Comments can be used everywhere, as long as there is no connection to the cord. If that is the case, comments will be interpreted as part of the cord, which often causes errors (in the form of a program abort). 

The maximum size of the source code depends on the interpreter: With 2DBFI you can use at least 10.000 lines with 200 chars per line.

2dbf is "turing-complete", which means that you can compute everything that you can compute with 'normal' programming languages.

The commands, which are defined by the direction, comply with the following commands used in Brainf*ck (the '.' shows where the cord begins, which is useful to see if you run from the left to the right or from the right to the left for example):

|----------------------------------|
|direction    | Brainf*ck-command  |
|----------------------------------|
|----------------------------------|
|.*****       |        +           |
|             |                    |
|to the right |     increment      |
|----------------------------------|
|*****.       |        -           |
|             |                    |
|to the left  |     decrement      |
|----------------------------------|
|.            |        >           |
| *           |                    |
|lower right  |  ArrInd-forward    |
|----------------------------------|
|  .          |        <           |
| *           |                    |
|lower left   |  ArrInd-backward   |
|----------------------------------|
| .           |        [           |
| *           |                    |
|downward     |  begin of loop     |
|----------------------------------|
| *           |        ]           |
| .           |                    |
|upward       |   end of loop      |
|----------------------------------|
|  *          |        .           |
| .           |                    |
|upper right  |     output         |
|----------------------------------|
| *           |        ,           |
|  .          |                    |
|upper left   |     input          |
|__________________________________|
 
In Brainf*ck, the language on that 2dbf builds up, you can navigate (with < and >) in an array of the size 30.000. At the beginning, every array element will be initialized with 0 and the pointer points on 0, too. With > the pointer can be moved to the next element, with < it can be moved backwards, but never into the negative array. + increases the actual array element (+1), - will decrease it. (size: 0-255). With , you can catch the ascii-value of the char pressed on your keyboard, the . is used to put the value out in ascii form (65 = A, for example. [ and ] are loop-operators. Their function is a bit too complicated to explain it exactly, but there are Brainf*ck tutorials which explain this pretty good.
 
2dbf is a development made by oCaS and Du-Ne and is supported by www.legacy-project.de and www.gcf.de
 
Have fun and good nerves with 2dbf!

 

[addition: I hope the translation is readable for english users ;-)]

Files
-----------
 
2DBFI.cpp    - C++ interpreter     
               source
2DBFI.exe    - Windows executable
hello.b2d    - "Hello World!"
               source
prime.adv.b2d- conversion of
               primes.b source
               (long + comments)
invert.b2d   - text inverter
               source
brainfuck2d.b2d - "brainfuck2d" 
               text source
specification.txt - the text on
               the left ;-)
Links
-----------
 
http://www.catseye.mb.ca/esoteric/bf/   
    - Brainf*ck official site
 
http://esoteric.sange.fi/brainfuck/   
    - Brainf*ck resources page