|
Boost : |
From: Eric Niebler (eric_at_[hidden])
Date: 2003-11-18 11:50:10
Brock Peabody wrote:
>
> Maybe this is a silly question, but do we need Regular Expressions now that
> we have Spirit? I've never used regular expressions before so I may be
> missing something, but the syntax is frightening compared to EBNF. Could
> the dynamic syntax be EBNF too?
As a wise man once said, don't yuck my yum. :-) REs are used in dynamic
contexts: text editors, log file parsers, URL rewriters, etc., and there
needs to be some facility in C++ for supporting that syntax. But most
REs are statically hard-coded. Since all the RE machinery is there to
support dynamic REs, it should be possible to reuse it statically to
give the hard-coded REs more power and better performance.
As I mentioned earlier in the thread, in xpressive parsers are merely
regex factories. It would be possible to write a parser to convert
strings of EBNF into a regex at runtime and execute it. Then you have
the runtime equivalent of Spirit. Heck, you could write a parser to turn
your grocery list into a regex if you really want to. :-)
-- 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