Re:Parsing in JavaScript: all the tools and libraries you ca...
by lgessler on Monday May 24, 2021 @04:31PM
(#27269345)
It's a Clojure(Script) library, but it's still so good it's worth mentioning: Instaparse[0] generates a parser for you from a BNF-y grammar specification. Sample from the readme:
[0]: https://github.com/Engelberg/instaparse
[ Parent
| on HN ]
Re:Parsing in JavaScript: all the tools and libraries you ca...
by fjfaase on Tuesday May 25, 2021 @02:42AM
(#27273599)
I wrote something similar in JavaScript. You need something like:
function as_and_bs() { return parse_text("aaaaabbbaaaabb", make_grammar( parse_text("root : (\"a\" SEQ \"b\" SEQ)SEQ OPT", iparse_grammar))) }
The code can be found at https://github.com/FransFaase/ParserWorkshop/