title Brainfuck Compiler in Tcl user strick ip 216.218.244.9 vol 1 lock ******** This translates BrainFuck to C, using the classical mapping. Try it on this program : http://www.muppetlabs.com/~breadbox/bf/factor.b.txt e.g. save the following code as "bfc.tcl"; then do /tt tclsh bfc.tcl factor.c ; gcc factor.c ; echo 111 | ./a.out /box( /pre( puts " #include unsigned char mem\[99999]; main() \{ unsigned char* p= mem+50000; \{ " while {[gets stdin b]>=0} { set b [string trim $b] regsub -all {[^]\055+<>,.[]} $b { } b puts [string map [ list < {--p;} > {++p;} + {++*p;} - {--*p;} . {putchar(*p);} , {*p=getchar();} \[ "while(*p)\{" \] "\}" ] $b] } puts " \}\} " /pre) /box) See also: http://www.muppetlabs.com/~breadbox/bf/ Warning: Unchecked buffer. Only use with brainfuck programs that don't move the pointer more than the maximum allowed 30000 positions. * /file facto