Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] [ann] Regexp library supporting binding for * and +'s
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-09-19 (20:41)
From: Yutaka OIWA <oiwa@y...>
Subject: [Caml-list] [ann] Regexp library supporting binding for * and +'s
Hi everyone at caml-list,

From the computer room at ICFP2004 in Snowbird Resort,
I announce a beta version of my combinator-based
regular-expression match library which supports
list (Kleene-*) binding.

This library provide a set of typed "combinators" which can be
used to construct "regular expression matcher", which tests strings
against regexps and capture the matched substring in various ways.
Especially, powerful "repeat" combinator, which corresponds
to * and + operators in conventional regular expression notation,
returns all values captured inside as a list value.

For example, the small code below

  open Regexp_pp_ng
  let s = "1 2 3 4 5" in
  match_string s (repeat ~sep:spacesA int_decimal) (fun x -> x)

returns [1; 2; 3; 4; 5]: int list.

All combinators are given static types and any mismatch of
value types and matcher types are statically rejected.

The implementation is available from a subversion repository.
Using subversion, you can checkout the URL

to get the up-to-date implementation, or you can directly
access the above address by web browsers to see the latest revision.
There is also a ViewCVS interface at the following address.

See regexp_pp_ng.mli for interfaces, and for
some example of the use of this library.

It may work partially on some older OCaml, but for real use
it requires a newer version (3.07 or later) which supports
the relaxed value restriction.

I plan to construct a neat syntax sugar over this library 
and build a next-generation version of Regexp/OCaml library.
Any comments are welcome.

Yutaka Oiwa              Yonezawa Lab., Dept. of Computer Science,
      Graduate School of Information Sci. & Tech., Univ. of Tokyo.
                    <>, <>
PGP fingerprint = C9 8D 5C B8 86 ED D8 07  EA 59 34 D8 F4 65 53 61

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: