[antlr-interest] [C] scope pop function

Gonzague Reydet gonzague.reydet at gmail.com
Wed Nov 30 07:25:04 PST 2011


Hi all,

When I try to use a scope in my tree parser, I encounter an error in the
generated code.
The scope pop function is generated as follow (I removed the generated
comments to make it more readable) :

void pmyparser_tree_myScopePop(pmyparser_tree ctx)
{
    if    (SCOPE_TOP(myScope)->free != NULL)
    {
        SCOPE_TOP(myScope)->free(SCOPE_TOP(myScope));
    }

    ctx->pmyparser_tree_myScopeStack_limit--;
    SCOPE_TOP(myScope) =
(pmyparser_tree_myScope_SCOPE)(ctx->pmyparser_tree_myScopeStack->get(ctx->,
ctx->pmyparser_tree_myScopeStack_limit - 1));
}

As you can see in the last function line, the first parameter of the get
function call is missing a field descriptor: "get(ctx->, ...)".
Is there something wrong in my parser to provoque this issue? Is this a
known issue of ANTLR 3.4?

The tree parser generator outputs the following messages that I don't
really understand :

ASTTreeParser.stg 321:25: anonymous template has 0 arg(s) but mapped across
1 value(s)
ASTTreeParser.stg 323:25: anonymous template has 0 arg(s) but mapped across
1 value(s)
context [/outputFile /treeParser /genericParser /_sub50
/globalAttributeScopeFuncMacro] 24:112 no such template: /bscopeStack
context [/outputFile /treeParser /genericParser /_sub50
/globalAttributeScopeFuncMacro] 24:113 passed 1 arg(s) to template null
with 0 declared arg(s)
context [/outputFile /treeParser /genericParser /_sub50
/globalAttributeScopeFuncMacro] 24:113 attribute sname isn't defined
context [/outputFile /treeParser /genericParser /rule /ruleCleanUp] 13:5
passed 1 arg(s) to template /_sub16 with 0 declared arg(s)
context [/outputFile /treeParser /genericParser /rule /ruleCleanUp] 15:5
passed 1 arg(s) to template /_sub17 with 0 declared arg(s)
...
context [/outputFile /treeParser /genericParser /rule /ruleCleanUp] 13:5
passed 1 arg(s) to template /_sub16 with 0 declared arg(s)
context [/outputFile /treeParser /genericParser /rule /ruleCleanUp] 15:5
passed 1 arg(s) to template /_sub17 with 0 declared arg(s)


Regards,
Gonzague


More information about the antlr-interest mailing list