5 ms·
Show HN: A Brainfuck to C transcompiler in Ruby
- tomsmeding 11y agoNice work; how about optimising the C output? Ten plusses in a row can be shortened to *p+=10 for example.
- cpro 11y agoThanks-- that's a good idea. I didn't think of optimization at all but that sounds like a fun step to take next.
- killercup 11y agoInteresting! I just read [1] this morning, which describes an optimizing BF compiler (written in Rust) that compiles to LLVM IR. The article also gives a good overview of optimization techniques used. [1]: http://www.wilfred.me.uk/blog/2015/08/29/an-optimising-bf-compiler/ http://www.wilfred.me.uk/blog/2015/08/29/an-optimising-bf-co... Edit: Just saw this was also discussed on HN: https://news.ycombinator.com/item?id=10141604 https://news.ycombinator.com/item?id=10141604
- cpro 11y agoThanks! It's an interesting article, it really takes the compiling to the next level.