[antlr-interest] Apparent problem with dynamic scopes in C target

Richard Thrippleton richard.thrippleton at progress.com
Tue Mar 31 02:25:44 PDT 2009


Daniel Jensen wrote:
> Hi folks,
> 
<snip>
> extractFn scope ExprScope;
> @init {
>     if (exprScopeDepth++ == 0)
>         $ExprScope::in_extract = 0;
>     else
>         $ExprScope::in_extract = $ExprScope[-1]::in_extract;
> }
I'm not sure if this is the cause of your bug, but the C code generated 
by $ExprScope[-1]::in_extract in the current release will not be 
reliable as it uses the underlying stack size to calculate the offset 
(see http://www.antlr.org/pipermail/antlr-interest/2009-March/033760.html).

Try the latest development build (linked in the reply to the above 
message), see if this clears your problem up.

On another note, I will admit to being slightly baffled by 
'exprScopeDepth' - is it correct that it's only ever incremented?

Richard


More information about the antlr-interest mailing list