translation of earley3.py to Coffeescript sourced from the "Earley Parser" wikipedia page