[antlr-interest] a few C# questions, plus ANTLR version questions

Hamilton Link helink at sandia.gov
Tue May 13 18:13:32 PDT 2008


Hello, I started poking a bit at ANTLR today after crawling all over the 
web site and wiki.  I am generating a C# lexer and parser and had a 
couple of comments and questions.  Mostly I think my problems are 
version confusion.  FYI I'm using VSPro 2008 but it doesn't seem to be 
causing any problem.

I quickly noticed that the CSharp target doesn't quite work the same 
between ANTLR 3.0.1 and 3.1b2 (which I believe are the versions that 
I've tried, using ANTLRWorks 1.1.7 and 1.2b2).  I am referencing 
Antlr3.Runtime.dll from the source download (that being the only runtime 
I could find), I think it's a 3.0.1 runtime.

Using the Antlr3.Runtime.dll and AntlrWorks 1.1.7, I am able to tokenize 
and parse in a little command line C# app.  I can't do the parse tree 
example and I am not generating AST nodes so it's not super useful yet 
but it runs.

Q: Is a .net runtime of ANTLR 3.1 available yet, and if not when 
approximately will it appear?  Am I correct in assuming the runtimes 
provided in the 3.0.1 source distribution are the older 3.0.1 and 2.7.7 
runtimes?

I'd rather go CSharp2 for everything, for one thing, and for another 
thing it appears that in the 3.0.1 runtime there's no such thing as 
Antlr.Runtime.RecognizerSharedState --- so I can't generate a parse tree 
based on the wiki's example (I am guessing this is C. Mundi's problem as 
well).

Q: Is the following fixable and am I even understanding the problem 
properly?

Using options{language=CSharp2} doesn't work, I believe I'm at least 
missing the CSharp2.stg file and I am getting an error to this effect.  
This seems contrary to the documentation which suggests it should work 
under ANTLRWorks 1.2b2/ANTLR 3.1b2.  It doesn't seem to be provided in 
the downloadable sources, but that makes sense because the sources 
appear to be for ANTLR 3.0.1 (and CSharp2 is new as of ANTLR 3.1, right?).

Q: Is there a practical way to contribute documentation for the .net 
assembly so that Intellisense becomes useful?

Not having any intellisense documentation is kind of a bummer.  I notice 
that the online Java documentation is close but not quite in line with 
the CSharp target (for one thing, in the 3.0.1 Java target, 
RecognizerSharedState exists).

Finally, one comment: It is hugely confusing for the documentation to 
reference ANTLR 3.1 as if it exists when various features don't yet 
exist as far as I can tell.  Is this a problem with the documentation or 
do I simply not have the right versions of things yet?

Any help on these matters would be greatly appreciated.

thanks,
hamilton






More information about the antlr-interest mailing list