[antlr-interest] CSharp Targets
Ramon Verbruggen
Ramon.Verbruggen at quintiq.com
Mon Nov 2 06:32:27 PST 2009
I have never used the C# target(s) myself, but in the C target, you need to specify the type of the AST nodes:
options
{
output=AST;
language=C;
ASTLabelType=pANTLR3_BASE_TREE; // <= I mean this line!
}
I don't know what the equivalent type for C# would be though.
Groeten,
Ramon
>>> Andrew More <jandrewmore at gmail.com> wrote:
> Does anybody have these working? Right now I'm attempting to get my
> grammar to work with CSharp2, but I could use CSharp1 or CSharp2.
> Right now I seem to be running into a number of compiler errors and
> warnings, so I'm not even confident that this works. Maybe I've got
> something setup wrong? Anyway, I'm using the latest version of the
> compiler (3.2), and I'm attempting to compile the results using Visual
> Studio 2008. I can't use anything but C# since that's what the rest
> of the project is using. (I guess I could go to C, but I'd REALLY
> rather avoid it, if possible.)
>
> Here are a couple of the errors I ran into:
> 1) "using Stack =
> Antlr.Runtime.Collections.StackList;" (line 61 of CSharp2.stg)
> This doesn't appear to be tied into anything in the DLLs I'm
> attempting to use. Right now I have references to Antlr3.Runtime,
> Antlr3.Runtime.Debug, Antlr3.StringTemplate. I couldn't find any
> references to it, so I removed it.
>
> 2) "override public object Tree" (line 59 of AST.stg)
> I removed "override" because there didn't appear to be anything to override.
>
> Once I removed these two things, I got a ton of other errors, which
> makes me wonder if I'm doing this right, or if the C# target(s) work
> at all.
>
> Here are my options for the grammar:
>
> grammar RuleEngine;
>
> options {
> language=CSharp2;
> output=AST;
> }
>
> I'm hoping this is something simple that I'm missing. I've been very
> impressed with ANTLRWorks, the ANTLR compiler and the documentation in
> Terence's book (which I've read cover to cover). Any help that
> anybody could give me would be appreciated.
>
> Thanks!
>
> Andrew
>
> 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