3 ms·
Brainfuck is simple enough that you could just write out the machine code directly in memory. I think that would make a really good exercise. I made one based
by csl 9y ago
Brainfuck is simple enough that you could just write out the machine code directly in memory. I think that would make a really good exercise.
I made one based on GNU Lightning to JIT. Even that can be considered a pretty huge dependency:
https://github.com/cslarsen/brainfuck-jit https://github.com/cslarsen/brainfuck-jit
The interesting part is how slow a one-to-one translation of Brainfuck code to machine code will run without any optimizations. That's where the speed comes from, entirely based on those sweet optimizations. So writing one yourself is a rite of passage, like writing a Mandelbrot renderer.
The above project, from the looks of it, looks quite mature, and therefore interesting in its own right.
- shakna 9y agoNothing there I don't agree with. I was more hoping someone might be able to shed light on why LLVM would be a good fit for something that it looks like it might be overkill for. Might just be it's what the authour/s are familiar with.