[antlr-interest] label for many alternatives?

Bryan Ewbank ewbank at gmail.com
Mon Feb 28 14:30:46 PST 2005


Can we use a syntactic predicate here?  It seems legit, but I have
trouble grokking the ANTLR gestalt.

     19 expr :
     20     atom (
     21         (PLUS | MULT) => ( .^ atom )
     22         | dummy
     23     )* EOF;
     24 
     25 atom    : ATOM;
     26
     27 // never produced - die if it's seen
     26 dummy   : DUMMY { diediedie("Dummy! Encountered DUMMY"); } ;

It looks like the generated code is correct, but I don't have time to
experiment further.

- Bryan


More information about the antlr-interest mailing list