RE: Conditional generation of Grammar rules

2006-05-03 Thread Ramaswamy R - TLS, Chennai.
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

RE: Conditional generation of Grammar rules

2006-05-02 Thread David Fang
> 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

Re: Conditional generation of Grammar rules

2006-05-02 Thread Hans Aberg
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,

RE: Conditional generation of Grammar rules

2006-05-02 Thread Jeganatan, Srividhya
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

Re: Conditional generation of Grammar rules

2006-05-02 Thread David Fang
> 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

Conditional generation of Grammar rules

2006-05-02 Thread Jeganatan, Srividhya
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