[antlr-interest] Dynamic scopes with C backend

Dan S. compilers at gmail.com
Mon Feb 25 02:24:01 PST 2008


I have a rule which looks like the following:

rule
scope {
    char *foo;
}
@init {
    $rule::foo = 0;
}
@after {
    if ($rule::foo) free($rule::foo);
}
...

This code segfaults because the scope is popped before the @after
section is executed. The ANTLR Reference books seems to indicate that
it is valid to reference scope variables in an @after section (example
on page 140), so this looks like a bug.

Also, I'm sorry if this issue was addressed already, but I don't know
if there is an easy way to search all the mailing list archives. The
archives page has all the messages grouped by month and I'm not going
to do a search month by month.

Dan.


More information about the antlr-interest mailing list