Cleaner direct left-recursion algorithm, but still hairy.