Flexible binary data format in OCaml