I would like to parse the grammar definition from a Bison/YACC .y
file. The syntax of the rules is very simple (and I can ignore everything outside the grammar rules section), and I don't need information about the semantic actions. However, even to skip the actions seems to require parsing the arbitrary C code fragments to determine where the {...}
block ends (since you can have nested blocks etc.).
Is there a shortcut to this that doesn't require parsing C?
I guess one workaround would be to ask Bison itself to strip out all callbacks and just leave the grammar rules in the file which would then be trivial to parse.