In addition to the other's suggestions, change HIDDEN to Hidden.  The C# target 
attempts to use standard C# conventions when possible. It can be frustrating 
when working from the books and Java-focused documentation, but once you get 
past the few differences and gain some momentum, you should not have too many 
other compatibility issues.

Kevin Carroll

-----Original Message-----
[] On Behalf Of Voelkel, Andy
Sent: Wednesday, October 19, 2011 1:26 PM
To: Sam Harwell; 'pragmaik';
Subject: Re: [antlr-interest] How viable is the Csharp3 target? (more specific 


First, thanks for the encouragement. Knowing there are active users out there 
makes all the difference.

I've now taken the first example from "the definitive ANTLR reference" and 
tried to get it to work, first using the Visual Studio Extensions and 
templates, and then also manually running the ANTLR3.exe file at the command 
line, just to verify that my problems are in the generated code and are not 
errors generated during the generation of code (since the Visual Studio 
Extensions and associated instructions seem to produce projects that both 
generate code and then build it).

So my grammar is this simple:

grammar Lexer1;

options {



/** Match things like "call foo;" */

r : 'call' ID ';' {System.out.println("invoke "+$ID.text);} ;

ID: 'a'..'z'+ ;

WS: (' '|'\n'|'\r')+   {$channel=HIDDEN;} ; // ignore whitespace

When I compile the code generated by ANTLR3, I get these errors:

Sandbox\AntlrTest\AntlrTest\obj\x86\Debug\Lexer1Parser.cs(28,2): warning 
CS3021: 'Lexer1Parser' does not need a CLSCompliant attribute because the 
assembly does not have a CLSCompliant attribute K:\Plantronics\Development 
Sandbox\AntlrTest\AntlrTest\obj\x86\Debug\Lexer1Parser.cs(86,11): error CS1041: 
Identifier expected; 'out' is a keyword K:\Plantronics\Development 
Sandbox\AntlrTest\AntlrTest\obj\x86\Debug\Lexer1Parser.cs(86,11): error CS1525: 
Invalid expression term 'out'
Sandbox\AntlrTest\AntlrTest\obj\x86\Debug\Lexer1Lexer.cs(28,2): warning CS3021: 
'Lexer1Lexer' does not need a CLSCompliant attribute because the assembly does 
not have a CLSCompliant attribute K:\Plantronics\Development 
Sandbox\AntlrTest\AntlrTest\obj\x86\Debug\Lexer1Lexer.cs(276,13): error CS0103: 
The name 'HIDDEN' does not exist in the current context

The errors regarding "System.out" make sense, that seems like a call to a Java 
function that does not exist in C#. However the error with HIDDEN is confusing 
to me, and it is the result of sub a basic construct ({$channel=HIDDEN:};). I 
can't imagine what I am doing wrong to cause this, and since it is the first 
example pulled out of the book, you would think it would work!

Can someone help me here? I'm gaining confidence, but I'm having trouble even 
walking before I can run!

Oh, also: What are the files Antlr3.Targets.CSharp2.dll and 
Antlr3.Targets.CSharp3.dll for?

-          Andy

-----Original Message-----
[] On Behalf Of Sam Harwell
Sent: Wednesday, October 19, 2011 7:59 AM
To: 'pragmaik';
Subject: Re: [antlr-interest] How viable is the Csharp3 target?

Hi Andy & Maik,

I agree that the C# target documentation is lacking in many ways. I try to keep 
enough documentation at the following page to get you started on the right path:

I've been using the CSharp3 target in a commercial product for 3 years now.

At this point, most of the remaining the issues I have with it are 
basic/technical limitations of ANTLR 3 that will hopefully be resolved in later 


-----Original Message-----


 On Behalf Of pragmaik

Sent: Wednesday, October 19, 2011 9:36 AM


Subject: Re: [antlr-interest] How viable is the Csharp3 target?

Hi Andy!

I am using ANTLR's C# target for a couple of weeks now to create a domain 
specific language that is a subset of the C programming language.

My experience is similar to yours, but I can assure you that the C# target 
works and that it is actively maintained. It differs from the Java target in a 
few places, but it works.

The biggest problem is finding documentation. I've both of Terence Parr's books 
on my desk and the folks on this mailing list are very friendly and competent.




View this message in context:


Sent from the ANTLR mailing list archive at






CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files or 
previous e-mail messages attached to it, may contain information that is 
confidential and/or legally privileged. If you are not the intended recipient, 
or a person responsible for delivering it to the intended recipient, please DO 
NOT disclose the contents to another person, store or copy the information in 
any medium, or use any of the information contained in or attached to this 
transmission for any purpose. If you have received this transmission in error, 
please immediately notify the sender by reply email or at, and destroy the original transmission and its 
attachments without reading or saving in any manner.

For further information about Plantronics - the Company, its products, brands, 
partners, please visit our website



You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to