[antlr-interest] Remove left recursion function

Markus Stoeger spamhole at gmx.at
Sun Sep 28 10:31:36 PDT 2008


Hello,

I tried to use the "Refactor" -> "Remove left recursion" function but 
couldn't get it to work. When generating the parser ANTLR detects the 
left recursion. But when I place the cursor on the offending symbol and 
try to start the "Remove left recursion" function it says "The rule 
doesn't have a left recursion.".

Also ANTLR spits out the following exception in the console whenever it 
detects a left recursion while generating a grammar:

java.lang.ClassCastException: org.antlr.tool.Rule cannot be cast to 
java.lang.String
    at 
org.antlr.works.grammar.antlr.ANTLRGrammarEngineImpl.markLeftRecursiveRules(Unknown 
Source)
    at 
org.antlr.works.grammar.antlr.ANTLRGrammarEngineImpl.analyze(Unknown Source)
    at org.antlr.works.grammar.engine.GrammarEngineImpl.analyze(Unknown 
Source)
    at org.antlr.works.grammar.CheckGrammar.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

I'm not sure if this has anything to do with the "Remove left recursion" 
function not working.

These problems seem to happen with every grammar that has a left recursion.

Max



More information about the antlr-interest mailing list