Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-05-25 10:00:30


From: joel de guzman <joel_at_[hidden]>
> From: "Greg Colvin":
>
> > I wonder if Rule could be given an operator() or operator[] to let you
> > specify a postfix repetition count, e.g.
> >
> > identifier = letter(1,MORE) + (letter | digit)(0,MORE)
> >
> > or
> >
> > identifier = letter[1,MORE] + (letter | digit)[0,MORE]
> >
>
> That's very cool! Of course we can do that, these are all
> expression objects that can have the [] overloaded. But I still
> have the passion for the prefix + and * in addition to this.
> See the post of andy.elvey_at_[hidden] for a 'newbie'
> perspective.

I don't care that much about prefix + and *, but it
seems people who don't like them don't have to use
them, so long as they have an alternative they do
like.

> BTW, is MORE a macro? A constant? Nice touch.

A constant, probably -1.

> Isn't there an inf constant somewhere in the floating point
> math libs? we can definitely reuse that.

Sure, if you want to use float instead of int.

> > I also wonder if the need for these isn't strongest in the "lexer"
> > part of most grammars, in which case integrating regex may be the
> > best solution anyway,
>
> I always intended to subsume the lexer. I, for one, am not a
> fan of posix style regular expressions. Reading one gives me
> a headache. Here's a sample from boost::regex:
>
> "<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)\"
>
> Arghh, give me an aspirin!

Me too. But what does the above look like in Spirit?

> I'd like Spirit to be usable as a preprocessor, and a lexer
> as well.

It can remain a lexer for those who wnat to use it that
way, but since Boost has a regex, and since regex is an
efficient and popular way to write lexers, it seems a
shame not to integerate it.

> Have a nice day,
> Joel de Guzman
>
> PS> May I post this conversation on to boost?

Of course. Done.


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