attempt to implement Earley parser.