What's new

Brainfuck programming language

blight

New member
Hi!

Checkout this programming language which consists only of 8 operators, the compiler is 171 bytes (runs on linux, dunno about windows) and my first hello-world program is 967 bytes ;P

http://www.muppetlabs.com/~breadbox/bf/

Here's the hello-world which I just wrote:
Code:
>+++++++
[<++++++++++>-]
<++>

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

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

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

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

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

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

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

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

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

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

++++++++++

 < < < < < < < < < < <
.>.>.>.>.>.>.>.>.>.>.>.

:w00t: :blink: :teehee: :crazy: :)
 
OP
blight

blight

New member
matching C code for the program above:

Code:
#include <stdio.h> // putchar()
#include <string.h> // memset()

char data[30000];

int main(void) {
char *p = data;
memset( data, 0, 30000 );

p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;
while (*p) {p--;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;p++;*p--;}
p--;*p++;*p++;p++;

p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;
while (*p) {p--;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;p++;*p--;}
p--;*p++;p++;

p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;
while (*p) {p--;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;p++;*p--;}
p--;*p--;*p--;p++;

p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;
while (*p) {p--;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;p++;*p--;}
p--;*p--;*p--;p++;

p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;
while (*p) {p--;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;p++;*p--;}
p--;*p++;p++;

p++;*p++;*p++;*p++;
while (*p) {p--;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;p++;*p--;}
p--;*p++;*p++;p++;

p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;
while (*p) {p--;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;p++;*p--;}
p--;*p--;*p--;*p--;p++;

p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;
while (*p) {p--;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;p++;*p--;}
p--;*p++;p++;

p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;
while (*p) {p--;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;p++;*p--;}
p--;*p++;*p++;*p++;*p++;p++;

p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;
while (*p) {p--;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;p++;*p--;}
p--;*p--;*p--;p++;

p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;
while (*p) {p--;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;p++;*p--;}

*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;*p++;

 p--; p--; p--; p--; p--; p--; p--; p--; p--; p--; p--;
putchar(*p);p++;putchar(*p);p++;putchar(*p);p++;putchar(*p);p++;putchar(*p);p++;putchar(*p);p++;putchar(*p);p++;putchar(*p);p++;putchar(*p);p++;putchar(*p);p++;putchar(*p);p++;putchar(*p);

}
 
OP
blight

blight

New member
it's not very readable and i think there is no way of creating/using functions so i'd say it's uselsee :p
 

BlueYoshi

New member
Hi

I have made BrainFuck intepreter for windows. It can run the code right from the editor and allows using also numeric I/O (no need to convert values into ASCII) for making easily calculation programs... though I'm not sure whether BF is best language for lenghty mathematical operatings ;)

It's available here (Delphi sources included).
 

Top