[wg-camlp4] Feedback to Leo's post from Jake

Anil Madhavapeddy anil at recoil.org
Fri Jan 25 18:07:50 GMT 2013


On 25 Jan 2013, at 17:26, Alain Frisch <alain at frisch.fr> wrote:

> This does not look very different from Sedlex ( http://www.lexifi.com/sedlex ), which encodes regular expressions as normal patterns. And adding quotations in pattern position would make it possible to use any concrete syntax.

That makes sense to me; I'll look at sedlex in more detail next week. Another 
extension which we've developed and depend on very heavily is a quick way to
map C structures to OCaml:

  https://github.com/mirage/ocaml-cstruct

cstruct pcap_header {
  uint32_t magic_number;   (* magic number *)
  uint16_t version_major;  (* major version number *)
  uint16_t version_minor;  (* minor version number *)
  uint32_t thiszone;       (* GMT to local correction *)
  uint32_t sigfigs;        (* accuracy of timestamps *)
  uint32_t snaplen;        (* max length of captured packets, in octets *)
  uint32_t network         (* data link type *)
} as little_endian


Will generate accessor functions for each field for a Bigarray.  This sounds 
like it'll just be a quotation in the ppx world, so slightly more syntactically
heavy (but I think that's an acceptable cost).

-anil


More information about the wg-camlp4 mailing list