The Caml Hump: Bitstring

Bitstring

The ocaml-bitstring project adds Erlang-style bitstrings and matching over bitstrings as a syntax extension and library for OCaml.
(This project was formerly known as "bitmatch").
You can use this module to both parse and generate binary formats, files and protocols.
Bitstring handling is added as primitives to the language, making it exceptionally simple to use and very powerful.