FBP

From Esolang
Jump to: navigation, search

FBP (or Faster Brainfuck Programming), is a compiler that turns a higher level language to brainfuck language to make programming much easier and faster (hence the name), created by Hunar1997 under GPL license. Its still under development

git clone https://github.com/hunar1997/FasterBrainfuckProgramming/

You can test it by:

cmake .
make
./FBP

You need a c++ compiler, although this program is designed to be ported to other languages easily

Instruction and documentation is in the github page

This compiler looks more like an assembly code but it contains higher level concepts like if statements and loops (loops are not implemented yet) the plan is to complete this compiler then create another compiler that converts a higher level syntax and converts it to this syntax.

Most of the implementations were using Brainfuck algorithms so anyone populating that page will also help this project by inventing new algorithms

Example code, as found in the github page at the time of writing this page:

int age = newVariable(20);
int age1 = newVariable(12);
int age2 = newVariable(30);
printS("You are "); ifTrue(SMALLER_OR_EQUAL(age, age1)); printS("a child."); elseIf(); ifTrue(SMALLER_OR_EQUAL(age, age2)); printS("young."); elseIf(); printS("Old"); endIf(); endIf(); deleteVariable(age); deleteVariable(age1); deleteVariable(age2);

This outputs:

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

Notice the ```[-]```s at the end, that is because memory is being cleaned and reused as the program is running