Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] ANNOUNCE: pa_bitmatch 0.5

5 views
Skip to first unread message

Richard Jones

unread,
Apr 25, 2008, 9:11:36 AM4/25/08
to caml...@inria.fr
I'm pleased to announce the (experimental) version 0.5 of pa_bitmatch,
the syntax extension that adds Erlang-style bit strings and bit string
matching to OCaml.

http://et.redhat.com/~rjones/bitmatch/

In this release:

- The "bitmatch" operator has been rewritten to use patterns
properly (before it was using a hack involving expressions).
One consequence of this is that you can now use all the
features of OCaml patterns, eg:

bitmatch packet with
| { ((4|6) as ip_version) : 4 } ->
printf "I understand IPv4 or v6, this is version %d\n" ip_version

- You can now match and construct using plain strings:

bitmatch file with
| { "MAGIC" : 40 : string } -> ...

- Error messages are now localized all the way down to individual
fields in the pattern, which makes it a lot easier to chase
errors.

- You need to put { ... } around all fields. Sorry, this breaks
the syntax, but (a) it makes it much easier to use the extension
with common editors, and (b) it's a very simple mechanical change
to existing code. I'll try not to change the syntax again if
I can avoid it.

Rich.

--
Richard Jones
Red Hat

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

0 new messages