News for hackers. Stuff that matters.
Re:Brainfuck Optimization Strategies by primaryobjects on Wednesday January 07, 2015 @12:17PM (#8851739)
Is there an implementation of this that converts any BF code into C/C# code? Might make a handy web-based tool.

It would be interesting to apply this to AI generated programs (http://www.primaryobjects.com/CMS/Article163)

Re:Brainfuck Optimization Strategies by matslina on Wednesday January 07, 2015 @12:25PM (#8851788)
Implementations are available in the repository linked to from the article. Not quite "ready for production", but hopefully a useful starting point. https://github.com/matslina/bfoptimization
Re:Brainfuck Optimization Strategies by primaryobjects on Wednesday January 07, 2015 @12:52PM (#8851979)
Thanks, I see it. The translation code is inside ir.py. So you can call ir_to_c(bf_to_ir("+++.")) to do the conversion.

Here is the code to convert BF to C, in case anyone else is interested https://gist.github.com/primaryobjects/0ba06f1f6f0d3e984d89

Here it is running the converted C code https://ideone.com/z16KPJ

Very cool.

Re:Brainfuck Optimization Strategies by rdc12 on Wednesday January 07, 2015 @09:01PM (#8854636)
It is pretty trival to write a BF compiler to C, each instruction has a clear C equivilant and the parser is dead simple to write as well. It is less then an hours work to write a naive BF->C compiler
Re:Brainfuck Optimization Strategies by shultays on Thursday January 08, 2015 @03:06AM (#8855462)
BF operators can be matched C code easily.

http://en.wikipedia.org/wiki/Brainfuck#Commands