I got tired of changing code to change my variations of my fractal flame renderer, and decided it was time I actually accept runtime configuration.
I realized I’ve never actually worked with lex/yacc before (flex, bison, whatever). I usually just build up my parsers by hand. I started learning lex and yacc. It seemed like overkill for what I wanted to do, though. I know the professionals are all sitting there thinking “lex and yacc overkill? are you mad?” You’re right. I admit it.
I still need to actually learn lex and yacc someday.
So, I figured YAML was appropriate for writing configuration files for something that exhibits a mild hierarchy, and wouldn’t have all the pain of XML to go with it — first, the configuration files wouldn’t deplete my will to live, and second I wouldn’t need to use some horrid XML parser.
Then I found out there is no good c++ YAML library. The current best recommendation for a library in terms of support and maintenance looks to be LibYAML. I have nothing against the implementation of this library. But it’s a C library. The example implementations are all switch cases and goto statements. Whatever, I can roll with that, right?
I realized, as my switch statement had grown to several hundred lines, that the whole of it was a huge ball of shit. It makes me sad. YAML was way more complicated than I needed. I started getting crazy ideas of writing a C++ parser for YAML.
There we go, much better. The internet is awesome.