[antlr-interest] Curious behaviour: unused rule has unknown effects

Sam Barnett-Cormack s.barnett-cormack at lancaster.ac.uk
Tue Mar 24 05:07:26 PDT 2009


Gabriele Palma wrote:
> I'm modifying my working grammar. I created a new rule which does
> something previously done by another rule. I renamed the old rule and
> it is now unreferenced in the whole grammar, while old reference now
> go to the new rule. Everything seems fine, the grammar recognizes my
> test inputs.
> 
> But if i try to completely remove the old rule the grammar breaks and
> no longer recognizes my working input test.
> 
> Current file -> successfully generate code -> test -> everything ok
> Current file -> remove unreferenced rule -> succesfully generate code
> -> test -> grammar does not recognizes my input
> 
> I double checked and the rule is not referenced in any way, if i do a
> text search on the rule name the only instance found is in the rule
> definition.
> 
> I'm failing at undestanding the effect that an unreferenced rule has
> on the generated grammar.
> 
> Am I missing anything?

Is it a lexer rule, or a parser rule?

Sam


More information about the antlr-interest mailing list