I'm writing a parser for a document format which has a couple of version out. The document format basically consists of a header field, where the document format version is specified and whose format is the same across all format versions, followed by multiple fields which differ between versions.
Having that case in mind, what is the best strategy to write a bison parser that is capable of parsing multiple versions of a document format? It would be possible to write a single bison parser that support all document version, which has the potential of ending up an ungodly, unmanageable pile of grammar definitions. It would also be possible to rely on a parser to process only the header field and, when finishing parsing it, check the version number and start parsing the document from that point on with a different parser which is specific to the version number. Yet, this seems to be a bit of a hack. So, according to your experience, what's the best strategy to parse multiple versions of a document format? Thanks in advance, Rui Maciel _______________________________________________ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison