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

Gabriele Palma gabrielepalma82 at gmail.com
Tue Mar 24 05:01:55 PDT 2009


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?


More information about the antlr-interest mailing list