[antlr-interest] A bug at C# DLLs?

Rodrigo C. L. tapetedepadaria at gmail.com
Mon Nov 17 12:08:13 PST 2008


Hello!

I'm new at ANTLR, and I'm using it to generate code for C# (.NET v3.5).

My grammar is:

tokens {
MODULE;
SPECIFICATION;
}
compilation : specification EOF! ;
specification : ( definition )* -> ^( SPECIFICATION definition* ) ;
definition : module ';' ;
module : 'module' ID '{' specification '}' -> ^(MODULE ID specification) ;
ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* ;

and I have this simple input for test:

module etal { };

And I got

Antlr.Runtime.Tree.RewriteEmptyStreamException{"token ID"},

which is odd, because ID should be 'etal'.

I changed the rule module using operators and got
NullReferenceException, for the same reason.

I am new at this, so I'm not sure how to handle. Is this a bug from
the DLLs that I should report or I am doing something wrong? Because I
tried the same grammar using ANTLRWorks and changing the language to
Java, and it worked like a charm, with no errors.

I don't know if this was already discussed, thought I searched for
this at the most recent Interest Archives. If it was, sorry.

Thank you all very much for any help.

 -- Rodrigo C. Lopes
 -- Also in r.cerqueira.lopes at gmail.com


More information about the antlr-interest mailing list