optimization of clearAllLeftRecursion