kach / nearley

📜🔜🌲 Simple, fast, powerful parser toolkit for JavaScript.
https://nearley.js.org
MIT License
3.57k stars 231 forks source link

unparse not requireable? #571

Open laduke opened 3 years ago

laduke commented 3 years ago

Hi! this project is so cool.

I may be missing something or forgetting node intricacies but I think there's no way to require(nearley/lib/unparse.js) or similar.


This may be for a misguided reason... I have an existing, hand-made parser that I've mostly redone in EBNF/nearley.

Now, for testing purposes, I'd like to do something like this rough psuedo js:

...
while (true) {
  var sampleCode = unparse(grammar)
  var results1 = oldParser(sampleCode)
  var results2 = newParser(sampleCode)
  assert.deepEqual(results1, results2)
}