[antlr-interest] Syntactic predicates and ()+ rules

Joan Pujol joanpujol at gmail.com
Sat Aug 21 01:51:12 PDT 2004


Hi,

After a lot of time I have found my problems with indeterminism and
syntactic predicates ;)
But I have a question:

I have a grammar like

inst: instx (NL|SPC);
instX:  ... expr OP;

expr: exp1
        (
           (OP ~(NL|SPC)) =>  OP exp1
           |
         )

And it works well and it has no indeterminism. I'm lucky because the
OP can't be associated in form      exp1 OP exp1 OP exp1 OP (is a
comparison operator)

But my question is If I suppose that exp1 OP exp1 OP exp1 is valid
and then  I need to do:
 
expr: exp1
        (
           (OP ~(NL|SPC)) =>  (OP exp1)+
           |
         )

This doesn't work, because the syntactic predicate is only evaluated
once and when I enter in the ()+ block I don't solve the
indeterminism.
My question how can I manage this If sometimes i need a grammar like
this. I tried to refactor, but with no exit.

A lot of thanks,


-- 
Joan Jesús Pujol Espinar


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list