|
Boost : |
From: Eric Niebler (eric_at_[hidden])
Date: 2003-11-17 16:21:50
James Curran wrote:
> Eric Niebler wrote:
>
>>// dynamically bound
>>rx = p.parse( "(hello )+world" );
>>
>>// statically bound
>>rx = +(_1 = "hello ") >> "world";
>>
>
>
> Would it be possible to have the dynamically bound syntax the same as
> the statically bound? (I'm assuming that the S-bound syntax in limited by
> externals -- notably which C++ operators can be overloaded -- but the
> D-bound syntax could be anything. I also assume that the difference was so
> at least one could match other RE syntaxes, but if I'm going to have to
> learn another syntax, it might as well be consistent throughout the domain.)
>
>
I had the same thought! Your assumptions are correct -- I want to
provide something familier and I don't want to constrain the dynamic
syntax by the limitations of the static syntax. But the nice thing
about the current design is that it imposes no constraints on the
dynamic parser. Look again at the example:
using namespace xpressive;
parser p;
regex rx;
rx = p.parse( "(hello )+world" );
Notice that the concept of "parser" is separate from the concept of
"regular expression". The parser is a regex factory -- anything that
creates a regex ISA parser. It is entirely possible to provide
multipile dynamic parsers that accept different syntax -- one for perl5,
one for perl6, one for xpressive static syntax, two for POSIX (basic and
extended) ...
For now I'm focusing on a perl5-like parser. Seems like a good place to
start. But an xpressive static syntax parser would be a fun project,
and it would give xpressive a unified feel and consistency it doesn't
currently have.
Thanks!
-- Eric Niebler Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk