Earley Parser in Python 3