Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Examples of attoparsec in parsing binary file formats? [closed]

Previously attoparsec was suggested to me for parsing complex binary file formats. While I can find examples of attoparsec parsing HTTP, which is essentially text based, I cannot find an example parsing actual binary, for example, a TCP packet, or image file, or mp3. Can someone post some code or pointer to some code which does this using attoparsec?

like image 671
me2 Avatar asked Mar 13 '10 05:03

me2


1 Answers

There are few or no examples of attoparsec for parsing binary formats, as parsec-style combinator parsing is mostly for text formats, not binary formats (though there's no good reason for this).

For straight binary parsing, see Data.Binary, examples include:

  • haskell-amqp
  • haskell-bencode
  • haskell-ieee
  • haskell-dbus
  • haskell-elf
  • haskell-uuid

and the examples in Real World Haskell.

The main example for attoparsec at the moment is an RFC2616 parser (HTTP).

  • http://bitbucket.org/bos/attoparsec/src/tip/examples/Parsec_RFC2616.hs
like image 59
Don Stewart Avatar answered Oct 01 '22 21:10

Don Stewart