Boost logo

Boost :

From: joel de guzman (isis-tech_at_[hidden])
Date: 2001-05-30 13:55:29


From: "Douglas Gregor" :

> On Wednesday 30 May 2001 02:08 pm, you wrote:
> > From: "joel de guzman"
> >
> > > Rule<> a, c;
> > > Rule<> b = c | a;
> > > a = ...
> > > b = ...
> >
> > Sorry this is wrong, cannot redefine b once
> > defined. Well in fact I could have allowed that.
> > Example:
> >
> > a = b;
> > a = c;
> > a = d;
> >
> > Equivalent to:
> >
> > a = b | c | d;
> >
> > But there's a runtime penalty.
> >
> > Have a nice day,
> > Joel de Guzman
>
> How significant would this runtime penalty be? It would be _extremely_
useful
> to be able to, for instance, turn on/off extensions to a language at the
> parser level, e.g.,
>
> if (allow_typeof) {
> typespec = TYPEOF '(' expr ')' | TYPEOF '(' type_id ')';
> }
>
> if (allow_template_typedefs) {
> type_decl = template_header typedef;
> }
>
> That way one could have a very pure grammar for strict conformance to a
> language and not worry so much about having extensions break the grammar
> while running in a mode that does not allow the extensions at all. Why
bother
> to flag an error on use of extensions in the semantic actions if they
> shouldn't be in the grammar at all?
>
> Doug
>

Pardon my limited imagination but how does this relate to
the redefinition of rules as exemplified?

Nevertheless, I wasn't quite accurate. There's no runtime
penalty. But there sure is code-size penalty even if you
don't use the feature.

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