[antlr-interest] beta6, alternation produces non compiling code.
Dr. Kocher, Hartmut
h.kocher at pharmatechnik.de
Wed Feb 28 03:11:59 PST 2007
The problem is with lexer vs. parser rules: Lexer rules are upper case. Parser rules are lower case. ELEM must be a lexer rule. Therefore, it must be named starting with an upper case letter. List is a parser rule. Therefore it must be lower case. That's why your first approach doesn't work.
Hope this helps
Dr. Hartmut Kocher
Cortex Brainware
-----Ursprüngliche Nachricht-----
Von: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] Im Auftrag von Johannes Luber
Gesendet: Mittwoch, 28. Februar 2007 12:06
An: antlr-interest at antlr.org
Betreff: Re: [antlr-interest] beta6, alternation produces non compiling code.
Hello!
I'm wondering myself, if I miss something, but
> Grammar list;
>
> list : ELEM (COMMA ELEM)* ;
>
> COMMA : ',' ;
> ELEM : 'a'..'z' | 'A'..'Z' ;
doesn't look different to me than
> list.g:
> ------
> grammar list;
> list : elem (',' elem)* ;
> elem : 'a'..'z'|'A'..'Z' ;
> ------
(unless you count the COMMA). Why doesn't work the latter?
Best regards,
Johannes Luber
--------------------------------------------------------------------
Pharmatechnik GmbH & Co. KG
Münchner Straße 15
D-82319 Starnberg
Sitz der Gesellschaft: Starnberg
HRA: 64434, HRB: 66369, Amtsgericht München
Geschäftsführer: Dr. Detlef Graessner, Werner Torns, Stephan Jörgens
More information about the antlr-interest
mailing list