Search code examples
javascriptpythonrubyprogramming-languagesebnf

EBNF syntax parser module


Do you know of a syntax parser module (written in Ruby, Python, Javascript...) that, given a list of tokens and a EBNF-like grammar (passed as a simple string), returns the parsed tree? The closest I've found to this is SimpleParse, which is a nice library, but unfortunately it uses a single-step parsing (no tokenization). If possible I'd rather not use libraries in which the implementation is entangled with the language itself (pyparsing, treetop, ...).

I am not worried about the lexing/tokenization because there are a lot of libraries available (and even writing your own is pretty easy), but implementing a ENBF parser is not exactly a trivial task. I've checked the Python wiki LanguageParsing and tested some of them to no avail (maybe I overlooked the one I am looking for, there are so many...)


Solution

  • After some more searching I've decided to take the typical lex/yacc approach using Jison for node.js.