[antlr-interest] C# Question: cannot convert from 'method group' to'antlr.collections.AST

Micheal J open.zone at virgin.net
Thu Mar 2 06:30:23 PST 2006


Either label ID and componentSelection (i.e. label:ruleOrTerminal) and use
those labels or, use the ## notation. The componentSelection in the
generated code is a method not an AST instance.
 
Micheal
 

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Vladimir S.
Sent: 02 March 2006 02:47
To: antlr-interest at antlr.org
Subject: [antlr-interest] C# Question: cannot convert from 'method group'
to'antlr.collections.AST


Dear Group,

I am generating C# code and I am using C#.NET 2005 express. 
ANTLR does NOT complain about the syntax, but C# seems to when I compile the
code:
The grammar in question is:

variable :     ID
        (componentSelection )?
        { #variable= 
            #(
            [VARIABLE,"VARIABLE"],
            ID,
            componentSelection
            );
        }
    ;

In this case componentSelection is another rule in the grammar; From this
rule I wanted to generate a node with root node being "VARIABLE" first child
being the ID, and the second child being the tree of the result of expanding
the componentSelection rule. It seems like when I am using a NON terminals
in this context, I get  this error:

I keep getting this error:
        Error    4    Argument '3': cannot convert from 'method group' to
'antlr.collections.AST'
C:\=PROGRAMMING=\=Compilers=\ParserFormV03\Parser\ParserCore.cs    1801
79    ParseFormV02

This is the C# code that was generated from that grammar:
variable_AST= 
                    (AST)
astFactory.make(astFactory.create(VARIABLE,"VARIABLE"), tmp93_AST,
componentSelection);
        

Thanks for all your help,
Vladimir 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060302/fda474de/attachment.html


More information about the antlr-interest mailing list