Parsing and optimizing a grammar with flex and bison