caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Markus Mottl" <markus.mottl@gmail.com>
To: "Richard Jones" <rich@annexia.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] DSL for handling parsing binary memory structures?
Date: Fri, 18 May 2007 10:44:17 -0400	[thread overview]
Message-ID: <f8560b80705180744t6d7469d3n14318fb610ebd068@mail.gmail.com> (raw)
In-Reply-To: <20070517212157.GA20085@furbychan.cocan.org>

On 5/17/07, Richard Jones <rich@annexia.org> wrote:
> I wonder if anyone has thought about or developed a domain-specific
> language in OCaml for handling the processing of binary structures?
>
> I was thinking of writing something to make system calls into the Xen
> hypervisor.  The main problem is that the hypervisor takes & returns
> binary structures which have very precise size / alignment
> requirements, bitfields, etc. (and the requirements change with
> versions of the hypervisor).  It sounds like the ideal use for a DSL
> to describe the binary structure of each version of each call and
> automatically build accessors.

I'm currently developing a preprocessor that generates readers/writers
for binary protocols from OCaml type specifications.  It should be
very easy to add custom binary decoders by specifying an abstract type
for such values + custom readers/writer.  Or one can (ab)use the
existing ones to get the intended result (e.g. just use the int32 type
to read a 32bit integer from some memory loccation, etc.).

The protocol is very compact (even slightly more so than the
OCaml-marshal format), and performance is extremely high, usually even
higher than the standard marshal function, though it doesn't handle
shared/cyclic datastructures.  I also haven't looked into endianness
functionality yet (should be easy to add), but both 32bit and 64bit
platforms are supported.

In later stages there will also be a feature for a "protocol
handshake", which guarantees that e.g. the type specifications used by
two communicating machines are compatible.

We (Jane Street Capital) will eventually release this library as open
source so stay tuned...

Regards,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com


  parent reply	other threads:[~2007-05-18 14:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-17 21:21 Richard Jones
2007-05-17 21:30 ` [Caml-list] " Joel Reymont
2007-05-17 21:33 ` Gerd Stolpmann
2007-05-17 23:42 ` Jon Harrop
2007-05-18  7:41 ` Christian Lindig
2007-05-18 14:56   ` Mike Furr
2007-05-18 14:44 ` Markus Mottl [this message]
2007-06-14 11:51 ` Richard Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f8560b80705180744t6d7469d3n14318fb610ebd068@mail.gmail.com \
    --to=markus.mottl@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=rich@annexia.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).