[antlr-interest] Bug report; generated C code fails to compile with empty scopes

Richard Thrippleton richard.thrippleton at progress.com
Mon Mar 30 09:30:45 PDT 2009


Jim Idle wrote:
> Richard Thrippleton wrote:
>> With rules of the form
>>
>> "rulename
>> scope {}
>> ..."
>>
>> the generated code for that rule will attempt to push and pop the 
>> rulename scope stack, but the Push, Pop and Top members have not been 
>> defined.
>>
>> (fwiw, empty scopes are actually useful in the grammars I'm building :-) )
>>   
> Sorry, but empty scopes are not supported. Just do this:
> 
> scope
> {
>    int placeHolder;
> }
Yeah, that's pretty much what I figured, and looking at the code 
generated for scope stacks, I can see why. However, is there any reason 
why antlr wasn't warning me about my invalid scope definition?

Richard


More information about the antlr-interest mailing list