[antlr-interest] Newbie: Is it an ANTLRWorks bug or a feature?

孟岩 myan at csdn.net
Wed Oct 22 06:35:48 PDT 2008


Hi all,

I am learning ANTLR and just joined this mailing list. I don’t know where
to submit bugs, is here the right place?

 

Anyway, I found something unusual in ANTLRWorks. Consider this grammar:

 

/////////////////////////////////////////

grammar G;

 

expr :        INT (('+' INT {System.out.println("matched +");})

                       |('-' INT {System.out.println("matched -");})


                       |('*' INT {System.out.println("matched *");})

                       )* NEWLINE;

INT   :        '0'..'9'+;

NEWLINE :        '\r'? '\n';

///////////////////////////////////////

 

In ANTLRWorks 1.2, put this grammar text in the main editor, switch to the
“Interpreter” tab view, input “3+2<Enter>” or “3*2<Enter>” and click
the triangle button, it will show the right tree diagram. Nevertheless, the
“3-2<Enter>” expression will encounter a wrong diagram. I tried several
times, and it turns out that the whatever the second sub-expression will
fail to generate correct tree diagram. 

 

Is it a bug or a feature?

 

Regards,

 

Mike Meng

October 22, 2008

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081022/04329768/attachment.html 


More information about the antlr-interest mailing list