/* * bdbf2c: braindead brainf**k to c compiler * * written 1:30am 10/16/2001 by joey richards * * this code is hereby released into the public domain * * the author makes no claims about the fitness of this code for * any purpose. for the love of god, it's a brainf**k compiler. * what the hell would it be fit for, anyway?! * * if you do anything with this code, it would be appreciated if * you left the above credit intact */ /* usage: bdbf2c */ /* outputs to bfout.c */ #include const int tablen = 2; const char *outfile="bfout.c"; const int arysz = 30000; void fatal_error( const char *s ) { printf( "%s\n", s ); exit( 1 ); } int main( int argc, char *argv[] ) { FILE *in, *out; int nest=1, c, i; if( in=fopen( argv[1], "r" ) ) { if( out=fopen( outfile, "w" ) ) { /* first put in header */ fprintf( out, "/* compiled from brainf**k source file %s */\n" "#include \n" "\n" "int main( void )\n" "{\n", argv[1] ); for(i=0;i': for(i=0;i