With the C target, you have to use:

    ASTLabelType = pANTLR3_BASE_TREE;

And all the nodes you get will be of this type.

Karim


On Fri, Feb 18, 2011 at 3:57 PM, Kevin J. Cummings <
[email protected]> wrote:

> I'm trying to implement a Tree Grammar for my Lexer and Parser.
>
> In my Tree Grammar, I specify:
>
> > tree grammar m2Emit;
> >
> > options { language=C;
> >           ASTLabelType=pANTLR3_COMMON_TREE;
> >         }
>
> Further down, I have a rule:
>
> > stmt
> >     : ^(ASSIGN assLhs=ref assExp=exp )
> >     ;
>
> When I compile, I see the following errors:
>
> > m2Emit.c: In function ‘m2Emit_exp_return exp(m2Emit_Ctx_struct*)’:
> > m2Emit.c:1113:20: error: cannot convert ‘ANTLR3_BASE_TREE_struct*’ to
> ‘ANTLR3_COMMON_TREE_struct*’ in assignment
> > m2Emit.c: In function ‘m2Emit_ref_return ref(m2Emit_Ctx_struct*)’:
> > m2Emit.c:2193:20: error: cannot convert ‘ANTLR3_BASE_TREE_struct*’ to
> ‘ANTLR3_COMMON_TREE_struct*’ in assignment
>
> In m2Emit.c, I can see the following code:
>
> >     retval.start = LT(1); retval.stop = retval.start;
>
> It looks like LT(1) is an ANTLR3_BASE_TREE_struct*, while retval.start
> is an ANTLR3_COMMON_TREE_struct*.
>
> Is this a bug, or did I miss some important documentation?
>
> In case it matters, I'm trying to compile as C++....
>
>
> --
> Kevin J. Cummings
> [email protected]
> [email protected]
> [email protected]
> Registered Linux User #1232 (http://counter.li.org)
>
> 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