Rust, C, and parsing
2024-05-01 18:52:36.980865+02 by Dan Lyke 0 comments
It's not in the current development path, but some features prototyped for work use a prefix notation math system, and that's bugged me, and wrote a little framework that let me use Objective-C to specify a parser in Backus–Naur form, and because that created an in-memory tree and had some good intermediate information that I could use for command completion.
I've done stuff with the peg/leg recursive descent parser generators in C, and realized that I want the ability to introspect the parse tree better, for things like command completion and better error messages.
I've been both thinking that this is a tool I'd like to have generally for implementing configuration and scripting kinds of things, and that this might be my opportunity to learn a new language. I've been thinking that I should learn Rust, although as I dig through a lot of it it (and Go) feel pretty prescriptive, on the other hand I've also looked at some of the side effects that sneak into Perl and Python and realize that whipupitude is not always great for long term maintenance of the code.
Anyway, I started thinking about what it might look like in C++, and that reminded me of how much the language informs my design thinking, even as I think that many of those ideas are portable across languages. Which got me back towards Rust, although...
LogLog Games: Leaving Rust gamedev after 3 years is a fascinating look at how Rust's proscription about memory management can make it difficult to build. Especially as we start to think about "data oriented design" as a response to Object-Oriented design, maybe that isn't a great idea.
On the other side, The Brain Dump — One year of C is some musings about C99 (vs C89) and thinking about design and memory in C vs C++, and it's making me think that maybe I even need to go back to my preprocessor abusing ways and implement this thing in C.