[antlr-interest] Nasty LHS expression

David Smith david.smith at cc.gatech.edu
Thu May 26 10:02:50 PDT 2011


I am having a difficult time distinguishing two legal lines of code:
   ID = expression
and
   ID(exp1, exp2, ...) = expression
I tried this rule:
stat:   expr NEWLINE        -> expr
     |   (ID OPENP .* CLOSEP GETS)
          => ID OPENP actualParameters CLOSEP GETS expr NEWLINE
          -> ^(INDEX ID OPENP actualParameters CLOSEP expr)
     |   ID GETS expr NEWLINE -> ^(GETS ID expr)
     |   NEWLINE             ->
     ;
But it says that alternatives 2 and 3 can never be matched.  How do I 
"reactivate" 2 and 3?

                                 DMS


David M. Smith http://www.cc.gatech.edu/fac/David.Smith
Georgia Institute of Technology, College of Computing
Sent from my ASR-33 Teletype 



More information about the antlr-interest mailing list