Implement earley algorithm (in python)