Simplifying and removing left recursions