[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Parse multiple versions of a document format?
From: |
Rui Maciel |
Subject: |
Parse multiple versions of a document format? |
Date: |
Thu, 8 Oct 2009 08:55:29 +0100 |
User-agent: |
KMail/1.12.1 (Linux/2.6.28-15-generic; KDE/4.3.2; x86_64; ; ) |
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
- Parse multiple versions of a document format?,
Rui Maciel <=