Bison & flex are actually pretty cool once you get into them, though I still don’t profess to understand all the various subtleties. I’m sure the code I’ve ended up with can be improved. To get round one problem I resorted to using a global as my knowledge wasn’t great enough to see how to avoid it. Maybe someone can help one day 🙂

The rewrite goes well so far. The new code is a library and a small command line app in this version. This should allow IDE’s to intergrate far easier and makes maintenance easier. So far as much as possible of the old code has been reused, but some parts are being totally rewritten.

Work progresses well with the parser integrated tonight and commands now being run in response to a Recipes file being read. Need to figure out how to handle Templates and Rules next.

I’m hopeful that Rules will work as I envisage them. Basically you write a section in a recipes file that looks like

[ Extensions(c, o) CompleteIfOK() Command($COMPILER $CFLAGS $OPTIM $DEBUG $INCLUDES -o OUTPUT -c FILE) ]

The above tells butter how to take a .c file and turn it into a .o file, with work on that file being completed if all goes according to plan. The idea is that files will be passed through a loop as often as required, so a flex file might go through a rule that tells it how to turn the .l into a .c and then we’d run the above rule on the generated .c file.

Additionally I want to add another section that specifies how we check whether a file needs any actions. I’m presently planning to have a series of builtin functions that do such things as checking if the output file has a newer date/time than the source file, checking if any includes in a file are newer and so on. These would be checked in series and if they all say no action is needed we wouldn’t do anything. The rules would be selectable using a syntax yet to be decided.