20 ms·
Ask HN: Compile to BF
I'm looking for a compiler that takes a more high-level language, and compiles to BF (I think HN will censor the name).
Background:
My Fun side project this year, is taking a bunch of Arduinos and hooking them together to create something similar to a computer.
To make it extensible, so I can keep adding and building it out into something nicer, I created a sort of extended BF, to be on the "central" Arduino, which all the others communicate via.
It has all the usual functions, except:
,
Read from selected pin
.
Output to selected pin
(
Move pin selection to the left
)
Move pin selection to the right
0
Reset the stack and pin selection.
This means that I can add and remove components as I like, so long as the core interpreter stays the same. Programs can even be bigger than the interpreter can read at once, so long as 0 doesn't appear.
But BF sucks almost as much as ASM for hand-writing programs.
I don't have a lot of experience with compilers, interpreters are more my thing because they're so easy.
I was hoping something out there, that I haven't managed to find, will be simple enough for me to adapt to the core interpreter for my device.
- jetti 10y agoI'm not sure if anything exists like that but it would be an interesting project to create a brainf*ck backend to LLVM, which would allow any language to compile to BF