LoginLogin

Brainf*ck Compiler

Root / Submissions / [.]

computableeCreated:
Download:2KE3384V
Version:Size:4.2 KB
This is a Brainf*ck to SmileBasic compiler, meaning, it takes Brainf*ck code such as this Hello World program: ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++. and compiles it into a SmileBasic program and saves it as a PRG file, ready to run. The Brainf*ck:SmileBasic instruction ratio is about 1.8:1, which means that every 1.8 Brainf*ck commands are compiled into 1 SmileBasic command. This number is an approximation, so some programs might have a 5:1 ratio, while others could have a 1:1 ratio.

Instructions:

1. Run PRG:BRAINF 2. Input your program (max length 256) 3. Press enter and wait for the compilation process to complete 4. Enter your program's name when prompted 5. The program will automatically run from the compiler program, but you can also now run it as an individual program, meaning you can even publish it for others without the Brainf*ck compiler to use! Included in the BRAINF folder are a Hello World program and a Cat program, both coded and compiled using PRG:BRAINF. Feel free to look at their source codes!

Just from reading the instructions (I don't do BrainF***), I have a suggestion: Maybe be able to compile a program from a different slot? So that you can have many lines and have a larger max length. Plus you could easier edit the pre-compiled program.

Replying to:Mariominer
Just from reading the instructions (I don't do BrainF***), I have a suggestion: Maybe be able to compile a program from a different slot? So that you can have many lines and have a larger max length. Plus you could easier edit the pre-compiled program.
Very interesting suggestion, and I will definitely think on that! I can easily see that as a possibility.

You should port your SimpleC Program

I really need to port my befunge interpreter

Replying to:12Me21
I really need to port my befunge interpreter
Yes! Befunge on 3DS would be a beautiful thing. Could even have slowed-down, watchable execution, and debug mode could be to hold/drag/release the instruction pointer.

Amazing! Let's f*ck my brain with this!

Replying to:12Me21
I really need to port my befunge interpreter
yes, PUSH and POP will make it much easier

The way I thought this would work is convert PRG1 into the proper code, not input it :p

I know this program is old, but I found a solution for compiling a Brainf*ck program from a file. Replace the contents of DEF MAIN with the following:
DEF MAIN
 VAR L$
 VAR S$
 INPUT "Name of program to compile"; L$
 LOAD "PRG2:" + L$, 0
 PRGEDIT 2
 S$=PRGGET$()
 COMPILE S$
 RUNPRG
END
This basically (no pun intended) allows you to make Brainf*ck programs in the editor. You can also send Brainf*ck programs from your computer. Just make sure all Brainf*ck code is on one line (specifically, the first). By the way, entering an invalid file name will show an error, but still compile whatever’s in Slot 2, so you can do that if you would like to create Brainf*ck programs in the editor without saving. I would recommend saving the edited version of the compiler as a different program, so you can still use the original if you’re compiling a small program (I named the edited version BRAINFFROMFILE).