[antlr-interest] Nasty LHS expression
Bart Kiers
bkiers at gmail.com
Thu May 26 11:01:24 PDT 2011
Hi David,
Can an `expr` match something that starts with `ID OPENP` and/or `ID GETS`?
Perhaps you can post your entire grammar? Or at least the `expr` rule?
Regards,
Bart.
On Thu, May 26, 2011 at 7:02 PM, David Smith <david.smith at cc.gatech.edu>wrote:
> 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
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
More information about the antlr-interest
mailing list