← Back to context

Comment by epestr

17 hours ago

I’m happy to get such a constructive response from you.

This whole experiment was a way to experience some first-principles techniques rather than find the best way to compile to Brainfuck, so I agree with these limitations and will look into making it more efficient, where I can.

1. I’m not sure how far I could get rid of the layers of abstraction, since I would still need some abstractions, but they could perhaps be designed around Brainfuck’s tape and be more dynamic than addresses in a fixed layout.

2. Speaking of which, yes, I could use a better layout for scratch space, move values around while tracking where they currently are, and make more judicious use of dirty scratch cells instead of clearing them immediately.

3. And agreed, some form of lifetime tracking to zero at drop, or only when it was set earlier. The explicit zeroing was added because operations such as addition expected empty destination cells.

4. I hadn’t noticed that this made it a finite automaton, that’s interesting, I suppose removing the fixed-address restriction would let the same commands keep moving through the tape.

I might study more of your programs and try to apply some of the techniques used there.