From: Larry Evans (jcampbell3_at_[hidden])
Date: 2001-05-31 12:44:06
Douglas Gregor wrote:
> On Thursday 31 May 2001 11:45 am, you wrote:
> > --- In boost_at_y..., "joel de guzman" <isis-tech_at_m...> wrote:
> > > From: "Douglas Gregor"
> > ...skipping
> > > > Doug
> > >
> > > If we did it George Heintzelman's way, |= instead of = for new
> > productions,
> > > we don't have to pay for the feature if we don't use it. The penalty
> > is the
> > > added code to the = operator. If we let that as is (no redefines)
> > and
> > > use the |= for new productions (alternatives), then we have a
> > win-win
> > > situation: no penalty if the feature is not used and clarity in the
> > > imperative
> > > perspective.
> > >
> > > a = b;
> > > a |= c;
> > > a |= d;
> > > if (flag) a |= e;
> > Someone seeing |= might think >>= is also defined. Should
> > this also be provided? Then what about &=?
> >>= and &= don't make sense in the context of a (E)BNF grammar. For instance:
> Rule<> A = B >> C
> | B >> D;
> A &= F;
> This would be equivalent to:
> Rule<> A = B >> C >> F
> | B >> D >> F;
> With |=, it merely adds another alternative production, instead of modifying
> each of the productions that already exist.
OK. But now I'm wondering whether |= is a good idea. For example:
Rule<> As_b = b;
As_b |= a>>A;
Does the final value of As_b represent the following BNF:
As_b ::= 'a' As_b | 'b'
Or the following:
As_b ::= 'a' 'b' | 'b'
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk