[antlr-interest] Conditional grammar

Jose Juan Tapia jjtapia at gmail.com
Tue Oct 18 16:09:34 PDT 2011


Thank you. That was it. I had tried this option but I hadn't realized you
explicitly have to provide the alternative grammar when your condition is
not satisfied.


On Tue, Oct 18, 2011 at 7:07 PM, Jim Idle <jimi at temporal-wave.com> wrote:

> Gated semantic predicates.
>
> Jim
>
> > -----Original Message-----
> > From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> > bounces at antlr.org] On Behalf Of Jose Juan Tapia
> > Sent: Tuesday, October 18, 2011 4:06 PM
> > To: antlr-interest at antlr.org
> > Subject: [antlr-interest] Conditional grammar
> >
> > How can make it so that certain parts of my grammar are only executed
> > when a certain condition is met. For example,
> >
> > method1:
> > (myCondtion? INT) STRING;
> >
> >
> > method1 would require that INT STRING if myCondition evaluates to true.
> > And only STRING otherwise. I know I've seen this somewhere in the ANTLR
> > reference but for the life of me I can't find it again. And all my
> > google searches through the newsgroup leads to conditional tree rewrite
> > or something similar.
> >
> >
> > --
> > José Juan Tapia Valenzuela
> > Research Associate
> > University of Pittsburgh
> > 3076.1 Biological Sciences Tower 3
> > Pittsburgh, Pa 15260
> >
> > List: http://www.antlr.org/mailman/listinfo/antlr-interest
> > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> > email-address
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>



-- 
José Juan Tapia Valenzuela
Research Associate
University of Pittsburgh
3076.1 Biological Sciences Tower 3
Pittsburgh, Pa 15260


More information about the antlr-interest mailing list