What's on my mind

Hacking Rust and other awesomeness.

17 April 2023

dwarf and ChaCha

by Keith Star

I mentioned in the last update that I was working on modeling the AST for my DSL (called dwarf). For the last few days I’ve been iterating on updating the model to support what I need, and then updating my code to reflect those changes. I’ve got two pieces of code that use the model.

The first takes the parser output, walks it’s AST and creates instances in the model. At this point the model instances are essentially an AST. The second chunk of code is an interpreter. It reads the instances from the populated model and executes the instructions.

The entire point of this is to enable me to write language agnostic code that can extrude instances. That’s to say, read instances from a source model, “do stuff”, and create instances in a target model.

I got a little side tracked, and to be honest, having a REPL to debug against is probably worth the time spent. Having the REPL will also be invaluable in helping me interrogate instances when I’m debugging the compiler. I think that there may also be a “model debugger” and maybe “simulator” hiding in there as well.

asciicast

tags: parser, - rust, - modeling