[antlr-interest] Bug report; SCOPE_SIZE returning incorrect result in the C runtime
Jim Idle
jimi at temporal-wave.com
Mon Mar 30 08:15:51 PDT 2009
Richard Thrippleton wrote:
> I was finding that SCOPE_SIZE(somescope) would report a scope size of
> '1' when inside a dynamic scope (correct), '0' before entering that
> scope (correct), but then '1' after leaving that scope (incorrect).
>
> The issue seems to be that the 'size' method on a stack returns the
> amount of memory allocated for that stack, not the number of items in
> the stack. My workaround was to modify C.stg
> "#define SCOPE_SIZE(scope) ctx->p<name>_##scope##Stack_limit"
>
> (note that I've only verified this in 3.1.2, though it seems to be the
> same in 3.1.3 based on a brief skim of the source)
>
Yes, that is a bug caused by changing to caching the stack rather than
clearing and recreating thousands of them. I will fix it in the
development branch for tonights build.
You can now get the latest snapshot from:
http://antlr.org/downloads (look for
antlr-master-3.1.4-SNAPSHOT-completejar.jar).
This is a complete jar with all the dependencies built in so you can
execute it with:
java -jar antlr-master-3.1.4-SNAPSHOT-completejar.jar t.g x.g
The jar is built and redeployed at about 1AM PDT every night.
Jim
More information about the antlr-interest
mailing list