
9 Nov
2010
9 Nov
'10
4:23 a.m.
I'd use a parser combinator library that has word8 word16, word32 combinators. The latter should really have big and little endian versions word16be, word16le, word32be, word32le. Data.Binary should provide this and Attoparsec I think. Usually I roll my own, but only because I had my own libraries before these two existed. The idiom of a tag byte telling you what comes next is very common in binary formats. It means parsers can avoid backtracking altogether.