Daily Note - 2025-05-03
Hey, I'm Hanno! These are my daily notes on Crosscut, the programming language I'm creating. If you have any questions, comments, or feedback, please get in touch!
Some syntax nodes are only valid, if their children are of the correct type and
number. Take an fn
node for example, which is the parent node for a function
literal. It needs exactly two children, parameter and body. The parameter needs
to be a pattern, the body an expression. Anything else, and the fn
node is not
valid.
If you follow a free-form approach, that turns into a confusing mess pretty fast: You edit a node, you check its context (parent, and position among siblings), then you compile it depending on that context. Next, you compile its children, because compiling the original node could have changed their context. And so on, recursively.
At some point, you'll encounter a child that doesn't change as a result of the re-compilation. Then you're done with that part. But of course, for all the children that did change, you need to compile their parents again. Including the original node, but also its parents, up to the root. None of that is impossible to manage, but it's more complicated than I'd like.
Hey, you! Want to subscribe to my daily notes? 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.