On Monday, 10 August 2015 at 12:29:43 UTC, wobbles wrote:
While doing this I had the idea of implementing a more general
approach to this, using CTFE to build a struct / parserFunction
(Similar to Pegged [1] ).
You describe at compile time how this binary file looks, and
then the parser handles everything else.
Does anyone know of a good Binary Description Grammar out in
the wild? I'd rather not re-invent the wheel on that front, and
just use something standard. My Googling didn't come up with
something that could be considered "standard" however.
Any ideas?
You should look into Construct (Python) -
https://github.com/construct/construct
If you are not afraid of Haskell, also take a look at
https://github.com/bos/attoparsec