January 2008
I used flex and bisonc++ to create a rudimentary parser for syslinux config files. I realize that a parser is overkill to extract the location of the image-to-boot and the boot parameters from such a simple file, but I also needed a way to distinguish these config files from others, and I just longed to have a go at creating a parser. These are the guidelines I set myself for the next time:
Finish the scanner before starting work on the parser.
Don't do in the parser what can be done in the scanner (like e.g. joining newlines and whitespace into a single token).
Character classes in the scanner go within range brackets, like this: "[[:blank:]]".
When trying to create a parse tree while using non-pointer semantic values, one shouldn't use a list of pointers in the node, as the location they point to will be overwritten by subsequent parsing actions.