[antlr-interest] What's wrong with this grammar? (2.7.6)

Robert Baruch autophile at zoominternet.net
Fri Oct 20 18:42:05 PDT 2006


Here is a test grammar I was putting together and running through  
ANTLR 2.7.6:

header { package generated; }
class TestParser extends Parser;
options { k=2; }

r0 : . * ;

class TestLexer extends Lexer;

N : 'n';
V : 'v';


Really, all it says is that a valid sentence is any token, any number  
of times. Without the *, it works fine, but with the *, the output is:

ANTLR Parser Generator   Version 2.7.6 (2005-12-22)   1989-2005
generated.g:5:6: rule classDef trapped:
generated.g:5:6: unexpected token: .
error: aborting grammar 'TestParser' due to errors
Exiting due to errors.

So what is wrong with . *?

Thanks,

--Rob




More information about the antlr-interest mailing list