Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2003-11-16 21:52:11

I have begun work on a new library. It is beginning life as a regular
expression pattern matcher, though I plan to morph it into something
more powerful and general. I am hoping spark the interest of some
developers, Spirit developers in particular, to make sure that the new
library plays well with the rest of Boost. The working title for the
project is "xpressive".

xpressive will have the following features:

- rules (aka, regular expressions) can be written as strings
- rules can also be written as expression templates
- when written as a string, the rule is bound dynamically
- when written as an expression template, the rule is bound statically
   for full inlining and optimzation.
- both statically and dynamically bound rules will be built from the
   same core components.
- rules will be able to nest and call each other recursively.
- it will be possible to bind an action to a rule and have that action
   execute when the rule succeeds (a-la Spirit)

Here is a sample usage:
using namespace xpressive;
parser p;
regex rx;

// dynamically bound
rx = p.parse( "(hello )+world" );

// statically bound
rx = +(_1 = "hello ") >> "world";

The two rules above are equivalent; they both match "hello " repeatedly,
storing the result in capture number 1, and then match "world".

The inspiration for xpressive comes from Spirit, Boost.Regex, GRETA and
the Perl 6 regular expression redesign, described by Larry Wall in
Apocalypse 5 ( IMO, the
Apocalypse is excellent reading for anyone who wants to expand their
mind about what regular expressions can and should be good for.

xpressive will differ from Spirit in that it will have backtracking
semantics. (Spirit has greedy semantics, and does not do backtracking.)
Also, it will allow rules to be defined at runtime via a string,
accepted from a user or read from a file.

The project is still quite small. I have checked the source code into
the boost sandbox at boost-sandbox/boost/xpressive for anybody who is
interested. Joel de Guzman has already expressed interest, and we plan
to collaborate once he finds some free time.

Is anybody else interested?

Eric Niebler
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at