Daily Thought - 2024-11-24
Hey, I'm Hanno! These are my daily thoughts on Crosscut, the programming language I'm creating. If you have any questions, comments, or feedback, please get in touch!
This thought was published before Crosscut was called Crosscut! If it refers to "Caterpillar", that is the old name, just so you know.
So what about the efficiency of
using micro-instructions as undo instructions? Let's get
back to our example, the expression 1 2 +
which
translates to the instructions push 1
, push 2
, add
. We can undo the add
with pop
, push 1
, push 2
, the push 2
with a pop
, and the push 1
with
another pop
.
So pop
, push 1
, push 2
, pop
, pop
. Five micro-instructions to undo
three regular ones; pretty much the same as before. This
does not seem any more efficient. But remember, there are far fewer
micro-instructions than regular instructions. So their encoding can be more
compact. Those five wouldn't take up a lot of bytes.
Is this the best approach? I don't know. But it seems like the best bet for an initial attempt, for the implementation simplicity alone.
Hey, you! Want to subscribe to my daily thoughts? Just let me know (maybe include a nice message, if you're up for it), and I'll send you an email whenever I post a new one.