3 ms·
I designed Nebula [0], a LLVM front end for Whitespace, written in Go. It's the first ahead-of-time compiler for Whitespace. It features its own bespoke interme
by aarchi 6y ago
I designed Nebula [0], a LLVM front end for Whitespace, written in Go. It's the first ahead-of-time compiler for Whitespace. It features its own bespoke intermediate representation in static single assignment form for simpler optimization. Whitespace instructions are stack-oriented like Forth, thus most instructions modify the stack. Nebula lowers these stack-oriented instructions to registers in SSA form such that the stack is modified only once per basic block. It was trivial to add support for Brainfuck, lowering to the same IR.
I have record of almost 100 Whitespace interpreters [1], so I am confident that Nebula is the first AOT compiler for Whitespace. Another project is CensoredUsername's Whitespace JIT compiler in Rust that assembles code on the fly and deoptimizes on error.
[0]: https://github.com/andrewarchi/nebula https://github.com/andrewarchi/nebula
[1]: https://github.com/andrewarchi/ws-collection https://github.com/andrewarchi/ws-collection