[antlr-interest] Fwd: How viable is the Csharp3 target? (more specific questions)

Eric researcher0x00 at gmail.com
Wed Oct 19 12:26:37 PDT 2011


---------- Forwarded message ----------
From: Eric <researcher0x00 at gmail.com>
Date: Wed, Oct 19, 2011 at 3:25 PM
Subject: Re: [antlr-interest] How viable is the Csharp3 target? (more
specific questions)
To: "Voelkel, Andy" <andy.voelkel at plantronics.com>




On Wed, Oct 19, 2011 at 3:16 PM, Voelkel, Andy <andy.voelkel at plantronics.com
> wrote:

> Hi Kevin,
>
>
>
> That's the ticket (change HIDDEN to Hidden)! But doesn't that make the
> grammar non-portable, and aren't portable grammars a goal of ANTLR?
>
Depends upon your definition of portable. The grammar will be portable, but
the embedded code will be specific to the target language. Depending upon
the grammar, you may not even need to embed target source code. Most
grammars have little to none embedded target code, which is usually just
snippets of several lines or less that can be converted in an hour our so by
someone experienced in both target languages.


>
>
>
> Also, it verifies my suspicion that the example code I got (for Csharp) was
> wrong. All the examples I downloaded are wrong, I just checked. So I went
> back and tried to retrace where I got them from, but found the same examples
> on the Antlr site with the same folder organization, but without the errors.
> Frustrating. I sure haven't figured my way around the ANTLR site properly
> yet, I guess! And there are stale examples out there, since I got them only
> yesterday!
>

Anyhow, I think I'm unstuck for the moment. Thanks to all of you!



Now I can go see if I can figure out how to use AntlrWorks, since everyone
seems to rave about it, even though it seems that I need to use grammars
that are a little different (unfortunately), because it's all Java

Wise choice.

If you are using ANTLRWorks, don't trust the Interpreter, the debugger is
OK.


>
>
>
> -          Andy
>
>
>
>
>
> -----Original Message-----
> From: Kevin Carroll [mailto:kcarroll at signmgmt.com]
> Sent: Wednesday, October 19, 2011 11:35 AM
> To: Voelkel, Andy; antlr-interest at antlr.org
> Subject: RE: [antlr-interest] How viable is the Csharp3 target? (more
> specific questions)
>
>
>
> Andy,
>
>
>
> 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-----
>
> From: antlr-interest-bounces at antlr.org<mailto:
> antlr-interest-bounces at antlr.org> [mailto:antlr-interest-bounces at antlr.org
> ]<mailto:[mailto:antlr-interest-bounces at antlr.org]> On Behalf Of Voelkel,
> Andy
>
> Sent: Wednesday, October 19, 2011 1:26 PM
>
> To: Sam Harwell; 'pragmaik'; antlr-interest at antlr.org<mailto:
> antlr-interest at antlr.org>
>
> Subject: Re: [antlr-interest] How viable is the Csharp3 target? (more
> specific questions)
>
>
>
> Hi,
>
>
>
>
>
>
>
> 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 {
>
>
>
>    language=CSharp3;
>
>
>
> }
>
>
>
>
>
>
>
> /** 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:
>
>
>
>
>
> K:\Plantronics\Development
> 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'
>
> K:\Plantronics\Development
> 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-----
>
> From: antlr-interest-bounces at antlr.org<mailto:
> antlr-interest-bounces at antlr.org> [mailto:antlr-interest-bounces at antlr.org
> ]<mailto:[mailto:antlr-interest-bounces at antlr.org]> On Behalf Of Sam
> Harwell
>
> Sent: Wednesday, October 19, 2011 7:59 AM
>
> To: 'pragmaik'; antlr-interest at antlr.org<mailto:antlr-interest at antlr.org>
>
> 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:
>
>
>
> http://www.antlr.org/wiki/display/ANTLR3/Antlr3CSharpReleases
>
>
>
>
>
>
>
> 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 versions.
>
>
>
>
>
>
>
> Sam
>
>
>
>
>
>
>
> -----Original Message-----
>
>
>
> From: antlr-interest-bounces at antlr.org<mailto:
> antlr-interest-bounces at antlr.org<mailto:antlr-interest-bounces at antlr.org%
> 3cmailto:antlr-interest-bounces at antlr.org>>
>
>
>
> [mailto:antlr-interest-bounces at antlr.org]<mailto:[mailto:
> antlr-interest-bounces at antlr.org]><mailto:[mailto:
> antlr-interest-bounces at antlr.org]> On Behalf Of pragmaik
>
>
>
> Sent: Wednesday, October 19, 2011 9:36 AM
>
>
>
> To: antlr-interest at antlr.org<mailto:antlr-interest at antlr.org<mailto:
> antlr-interest at antlr.org%3cmailto:antlr-interest at antlr.org>>
>
>
>
> 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.
>
>
>
>
>
>
>
> Cheers,
>
>
>
> Maik
>
>
>
>
>
>
>
>
>
>
>
> --
>
>
>
> View this message in context:
>
>
>
>
> http://antlr.1301665.n2.nabble.com/How-viable-is-the-Csharp3-target-tp690889
>
>
>
> 0p6908949.html
>
>
>
> Sent from the ANTLR mailing list archive at Nabble.com.
>
>
>
>
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>
>
>
> Unsubscribe:
>
>
>
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
>
>
>
>
>
>
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>
>
>
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
>
>
>
>
>
> ________________________________
>
>
>
> 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 privacy at plantronics.com<mailto:privacy at plantronics.com>, 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 www.plantronics.com<
> http://www.plantronics.com>.
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
>
> ________________________________
>
> 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 privacy at plantronics.com, 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 www.plantronics.com.
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list