I have been using CSharp2 successfully for some time now.

In my Parser grammar:

options
{
language = CSharp2;
ASTLabelType=CommonTree;
   output = AST;
}

In my Tree grammar:
options
{
tokenVocab=<my vocab name>;
language = CSharp2;
   ASTLabelType=CommonTree;
   output = template;
}


I have not been able to get antlrworks to do its nice debugging work with
CSharp however.  I believe this is a current limitation that antlrworks in
that it assumes all your grammar-embedded code is Java.

On Mon, Nov 2, 2009 at 9:32 AM, Ramon Verbruggen <
[email protected]> wrote:

>
> 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 <[email protected]> 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
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to