[antlr-interest] Apparent problem with dynamic scopes in C target
Richard Thrippleton
richard.thrippleton at progress.com
Tue Mar 31 09:46:57 PDT 2009
Daniel Jensen wrote:
>
>
> Yes, this looks like the problem, but I think we need a new libantlr3c
> to fix it. I used the jar file you referred to but, other than a couple
> of dates and version numbers in comments, the generated parser was the
> same as before.
I don't actually know how they've fixed it - seems plausible that the
fix was in libantlr (we did our own in-house grim hack/patch because we
were in a hurry).
>> On another note, I will admit to being slightly baffled by
>> 'exprScopeDepth' - is it correct that it's only ever incremented?
>>
>
> Er, yeah ... I'm sure I would have noticed that eventually. :-/ Just
> pretend that there are @after actions that decrement exprScopeDepth
> following the @init actions that increment it.
:-)
You could use SCOPE_SIZE(ExprScope); this ought to do exactly the same
thing with less chance of mistakes, as well as being more threadsafe
(@members generates global variables in the C backend, scopes are local
to the parser's context).
Richard
More information about the antlr-interest
mailing list