def eliminate(grammar: Grammar): dup = grammar.duplicate() elim = _EliminateLeftRecursion(dup) return elim.grammar