ginal Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Jeganatan, Srividhya
Sent: Tuesday, May 02, 2006 10:08 PM
To: 'help-bison@gnu.org'
Subject: Conditional generation of Grammar rules
All,
Is there a way to conditionally generate grammar rules?
For exampl
> Thanks for the response.
> But I'm not sure I understood what you have mentioned.
> Could you please give an example or a bit more detail?
Sure, (at the risk of being slightly off-topic)...
> > nonterminal X:
> > #ifdef FEATURE
> > { rule 1 }
> > #else
> > { rule 1; rule 2 }
> > #endif
Place
One way of handling this is to merge the two grammars, and making
them selectable by a special token, which is then used at runtime.
The .y grammar is entirely static, and is even thrown away by the LALR
(1) algorithm that Bison uses, so the generated parser does not know
anything about it,
idhya
Cc: 'help-bison@gnu.org'
Subject: Re: Conditional generation of Grammar rules
> Is there a way to conditionally generate grammar rules?
> For example, I need to do something like
>
> nonterminal X:
> #ifdef FEATURE
> { rule 1 }
> #else
> { rule 1; rule 2
> Is there a way to conditionally generate grammar rules?
> For example, I need to do something like
>
> nonterminal X:
> #ifdef FEATURE
> { rule 1 }
> #else
> { rule 1; rule 2 }
> #endif
>
> I know that ifdefs dont work with the grammar but is there anything
> else that can be done? Or is it pos
All,
Is there a way to conditionally generate grammar rules?
For example, I need to do something like
nonterminal X:
#ifdef FEATURE
{ rule 1 }
#else
{ rule 1; rule 2 }
#endif
I know that ifdefs dont work with the grammar but is there anything else
that can be done?
Or is it possible to make bi