[antlr-interest] Help writing a particular semantic predicate

Naveen Chawla naveen.chwl at googlemail.com
Tue Oct 6 16:03:11 PDT 2009


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 <naveen.chwl at googlemail.com>

> 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';
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091007/e0dfd765/attachment.html 


More information about the antlr-interest mailing list