Skip to content

Instantly share code, notes, and snippets.

View nathan's full-sized avatar

Nathan nathan

View GitHub Profile
@nathan
nathan / parse.js
Last active August 29, 2015 13:56
Earley parser
~ function(exp) {
function Rule(name, symbols, postprocess) {
this.name = name;
this.symbols = symbols;
this.postprocess = postprocess || function(a){return a};
}
Rule.prototype.getStartState = function(location) {
return new State(this, 0, location);
}
function State(rule, expect, reference) {