On Wed, 2008-11-26 at 23:42 +0100, Christian Hoffmann wrote:
> Hello,
>
> converting from antlr2 to antlr3 becomes a horror! ;-)
>
>
> Now I am tumbling over some c-codegeneration.
> Don't know if its me or a real bug...
Could be a real bug - I'll look on Friday.
Try $declaration rather than $tree though.
Jim
>
>
> declaration
> : declSpecifiers variableDeclarations
> -> ^(TOK_VAR_DEF declSpecifiers variableDeclarations)
> { m_Symbols.AddVarDef($tree); } // add the variable
> ^^^^problem is here
> ;
>
>
> should result to somthing like
> { m_Symbols.AddVarDef(retval.tree); } // add the variable
>
> instead the resulting c-code becomes
> m_Symbols.AddVarDef(((pANTLR3_COMMON_TOKEN)retval).tree); );
>
> 2 Bugs in one line!
> 1. bug: retval.tree is not a pANTLR3_COMMON_TOKEN, its of type
> pANTLR3_BASE_TREE
>
> Bugfix??: C.stg lines 3013 and 3035 ??
> line 3013> rulePropertyRef_tree(scope,attr) ::= "retval.tree"
> line 3050> ruleSetPropertyRef_tree(scope,attr,expr) ::= "retval.tree=<expr>;"
>
> 2. bug:
> original code:
> ADAPTOR->addChild(ADAPTOR, root_0,
> pVMCompiler->m_Symbols.AddVarDef(((pANTLR3_COMMON_TOKEN)retval).tree); );
> look at the end of the line,
> somthing like func(... func(...); ); would not compile ;)
> Bugfix:
> Swapping the lines helps, but...
> declaration
> : declSpecifiers variableDeclarations
> { m_Symbols.AddVarDef($tree); } // add the variable
> -> ^(TOK_VAR_DEF declSpecifiers variableDeclarations)
> ;
>
>
> Thx in advance for your comments...
>
>
> ---
> Christian Hoffmann
> D-38118 Braunschweig
>
>
> List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org:8080/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
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address