[antlr-interest] What does empty subrule mean?
Arto Viitanen
arto.viitanen at pp4.inet.fi
Thu Sep 27 12:12:35 PDT 2007
I had following in my antlr 3 .g file:
statement
:
| (ID '(' argumentList ')' ';' )=> procedureCall
| ('break' ) => 'break' ';' -> ^(STAT 'break')
| ('continue' ) => 'continue' ';' -> ^(STAT 'continue')
....
I had had procedure calls that needed at least one argument. Then I
noticed that it should be possible to have
procedure calls without any arguments. So I tried both
(ID ';') => procedureCall
and making argumentList something like argument* (ok, with commas). So I
removed the first line, but left
the | mark. This made the antlr tool generate lots of warnings, but no
error. Of course, it took sometime, before
I noticed the extra | ...
So, why is
rule : | subrule | subrule ...
allowed and what does it mean?
--
Arto Viitanen
More information about the antlr-interest
mailing list