In that case you have to use syntactic predicate.

 

Cheers, Indhu

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Naveen Chawla
Sent: Wednesday, October 07, 2009 4:33 AM
To: [email protected]
Subject: Re: [antlr-interest] Help writing a particular semantic predicate

 

Ok, I've solved my particular problem using token lookaheads, but I was
wondering if there is a way of doing non-terminal symbol lookaheads in
semantic predicates?

2009/10/6 Naveen Chawla <[email protected]>

grammar x;

 

x:  a b;

 

     a: 'i' a? | c? 'j';     // Question, how would I write the semantic
predicates: if this "a" is followed by 'v1' choose the first alternative, if
not choose the second alternative

 

          c: 'i';

 

     b: 'v1' | 'v2';

 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to