Boost logo

Boost :

From: Andreas Pokorny (andreas.pokorny_at_[hidden])
Date: 2007-08-29 07:08:32


Hi,

Eric Niebler wrote:
> I made that syntax up and I'm not attached to it. I don't know of any
> prior art in this area, except that design work for Perl 6. I don't
> recall not what they're using or why I didn't go with it. :-P Can you
> suggest a better syntax?

The stuff in the nested_dynamc_regex branch delays the compilation to a call
to compile() which has to happen after the last addition of a
(name,regex) tuple.
Hence one can refer to regular expressions using plain literals.

compiler.add_start("somename","^bar(baz)$")
compiler.add("baz","\\d+ \\d+")

This restricts the regex grammar because one cannot parse the literal "baz"
because baz will always be the regular expression "\\d+ \\d", but as a user
you know which words have to be parsed, and which can be used as
name expressions.

There is of course another disadvantage, because you have to separate bar
from baz in the example above.

I just look at quickbooks C++ grammar and I have to notice that it gets really
hard to write as a dynamic. If you have to write bigger things a C++ embedded
DSL really has advantages.

Regards
Andreas


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk