Crosscut

Daily Thought - 2025-01-23

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!

There's a second big problem caused by my choice of syntax and evaluation model in the previous prototype: Postfix syntax and the stack-based evaluation model are quite simple (maybe deceptively so), but also powerful. And that power came back to bite me.

This came as a surprise, because this model is so easy to get started with. Just parse from left to right. Tokens are separated by whitespace. (Throw in some more advanced tokenization, once ready.) Same with evaluation: Start on the left, execute what you encounter immediately, keep all values on a straight-forward stack.

Under this model, expressions consume and produce an arbitrary number of values. With prefix syntax, that's not the case. There, every expression is a tree. A sub-expression's output goes into one specific place. But with the stack-based model, an expression could produce values, which could get consumed by multiple expressions, which then might feed into a single expression. They form a graph.

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 every time I post a new one.