From: George A. Heintzelman (georgeh_at_[hidden])
Date: 2001-05-22 07:51:13
> > // Generates the parser from the grammar expression
> > Parser parser = re
> > | '(' + re + ')'
> > | '(' + re + ',' + im + ')'
> > ;
> Consider it done. I'll add that capability or a variation
> into the framework. The open-ended nature of
> spirit makes that trivial to do:
> Something like:
> FloatVar re, im;
> Rule<> r = re | '(' >> re >> ')' | '(' >> re >> ',' >> im >> ')';
Careful with your choice of operators for defining rules. First, I
don't find the '>>' operator as intuitively appealing as the use of '+'
in the example above. Second, operator precedence rules here would
group this expression as:
Rule<> r = ( re | '(' )
>> ( ')' | '(' )
>> ( ','
And ')' | '(' is unlikely to give the results you want...
That said, I would love to see something which could robustly handle
this kind of stuff...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk