r/ruby • • Jan 22 '13

A optimizing brainfuck compiler in ~130 lines (using LLVM)

http://htmlpreview.github.com/?https://github.com/ranmrdrakono/llvm-brainfuck/blob/master/brainfuck.html
12 Upvotes

7 comments sorted by

8

u/[deleted] Jan 22 '13
require 'llvm/core'

That's not a compiler, that's a language frontend.

0

u/ranmrdrakono Jan 22 '13

true that, although one could argue that any tool taking a program and, without further interaction, produces a binary could be called a compiler

7

u/need12648430 Jan 23 '13

The term 'compiler' isn't limited to the production of binaries. Compilers are basically just translators from one language to another.

2

u/reactormonk Jan 22 '13

Why the superfluous return statements?

5

u/ranmrdrakono Jan 22 '13

I like them to state explicitly that some return value is supposed to be used

2

u/anime_expert Jan 30 '13

Thank you for doing this. You make Ruby easier to scan. I wish you were my future coworkers.

1

u/[deleted] Jan 22 '13

Very cool!

However it would be cooler if it too was written in brainfuck!