Added handling of left recursion.