C to brainfuck compiler?

MyNameIsKhan picture MyNameIsKhan · Jul 10, 2012 · Viewed 14.2k times · Source

I have a basic program in C that I wish to convert to the language brainfsck but cannot find anything on the subject. I find many "brainfuck to C" converters but not the other way around. I found C2BF but do not understand how to use it or if that's what I need.

Answer

Alexander Oh picture Alexander Oh · Jul 11, 2012

C2BF is a C program that is distributed as C source code.

To build the C2BF you need svn, Gnu Make and yacc and flex to be installed. After you have compiled C2BF yourself it should do exactly what you expect it to.

If you are using some kind of Linux flavour:

cd ${HOME}
svn co https://c2bf.svn.sourceforge.net/svnroot/brainfuck/c2bf/trunk c2bf
cd c2bf
sudo apt-get install bison flex # or yum install bison flex
YACC=bison make

should give you the compiler in ${HOME}/c2bf/cc/c2bf-cc.

If you are using Windows you have to install something like MinGW or cygwin to compile the stuff.