[Haskell-Cafe] Parsing bytestream
Stephen Tetley
stephen.tetley at gmail.com
Tue Nov 9 04:23:33 EST 2010
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.
More information about the Haskell-Cafe
mailing list