From: joel de guzman (joel_at_[hidden])
Date: 2001-05-22 19:03:45
----- Original Message -----
From: "David Abrahams":
> Only that sequencing is the most common operation, so it should have the
> simplest syntax. Since we can't get by with no syntax at all, I don't mind
> repeat<0>(a) meanting a*
> repeat<1>(a) meaning a+
> repeat<3,5>(a) meaning aaa | aaaa | aaaaa
I still want to keep the prefix +. EBNF and RegEX people are
already so a accustomed with the + for positive closure. One of
my goals was to mimic EBNF syntax as much as possible.
I guess c++ guys wouldn't be so bothered having prefix + for
the positive closure. We have the prefix * and infix * that does
different things already. We're used to that. So I'd say:
+(a + b); // repeat a b zero to zillion times
Still the iterator syntax is nice. I'd say:
loop<0,8>(a); // 0 ~ 8
loop<8>(a); // exactly 8 times (very useful for parsing files)
loop<0,_>(a); // zero to infinity (same as kleene star)
loop<1,_>(a); // one to infinity (same as positive closure)
loop<0,1>(a); // zero or one (same as optional closure)
** The single underscore means: to infinity and beyoooond....
I've been using a variant of this iterator in another parser generator.
I am rebuilding that right now on top of Spirit.
Joel de Guzman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk