[ 2023-10-02 ] Yak Shaving

I'm engaged in some yak shaving at the moment. The problem with projects in general is that they lead down interesting rabbit holes. Unfortunately, it's often the case that these rabbit holes are important to kick things along. I'm in good company when it comes to yak shaving; sometimes I just have to embrace it.

This particular yak shaving adventure involves a particular philosophical question: if I statically generate the content for this website using a content generator written in C, then shouldn't I also consider building content libraries in C? I decided to sort of run with this insane idea. Because, statically generating web content in C is insane, and I admit that. The particular feature I wanted was syntax highlighting for my documents. This led me down the path of considering lexical analysis for source files, which led me down the path of being somewhat curmudgeonly about existing C parser libraries. Fine... I'll write one "real quick"...

Well, that's sort of where I am. For years, I've wanted to build an extensible C lexer and parser library that I could use to enable some ideas I have regarding source level reflection, simple language extensions, importing C source files into a proof assistant, source code data mining, and of course, syntax highlighting. Each of these use cases represents a small snow flake of "it would be so nice if...", but when combined, these form an avalanche of development itch. So, I've been pouring over ISO/IEC9899:2017, and refining an API that properly captures these use cases. There are certainly some interesting problems to be found in a C parser, especially when different use cases care about different levels of abstraction. More on this later, but the important thing is that I am being productive, even if that productivity involves taking a pair of clippers to a yak. There is a method to my madness.