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

Johannes Luber jaluber at gmx.de
Wed May 14 04:21:26 PDT 2008


Hamilton Link schrieb:
> 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.

Under <http://www.antlr.org/download/build/> you can get the latest 
daily builds. Unfortunately, the last one is a bit outdated as well. Ter 
should push a new one soon.

> 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).

The daily build includes a new library version.
> 
> 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?).

Correct. The appropriate sources are included in the daily build. 
ANTLRworks 1.2b2 doesn't support CSharp2 yet - it includes a too old 
version of ANTLR.
> 
> Q: Is there a practical way to contribute documentation for the .net 
> assembly so that Intellisense becomes useful?

What resources does Intellisense need actually? As I can use the source 
files I don't have difficulties with Intellisense myself, but that 
doesn't help you. In the case of still missing data, we can talk about 
further contributions.

> 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).

My guess is that the docs describe not 3.0.1, but an alpha version of 3.1.

> 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.

I've made it a bit more clear in one case that I refer to a new version 
of ANTLR. Otherwise you are simply using the wrong libraries and sources.

Johannes

>  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