Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

feature set looks very similar to https://github.com/SAP/chevrotain

would be good to have a comparison

EDIT: actually there is one [1], and it includes Nearley which does quite poorly.

[1] http://sap.github.io/chevrotain/performance/



The difference in performance is explained by the capabilities of the algorithms used by each parser library.

The Earley algorithm can parse any context-free grammar while Chevrotain appears to be restricted to the LL(k) class of grammars. Earley is O(n³) in the worst case but it performs better with more restricted classes of context-free grammars. Even if given the same grammar, Earley will still incur the cost of generality, a cost which LL(k) parsers don't have to pay.


Okay, do you have a non-contrived, practical example that can be handled by Nearley but not LL(k)?

It also doesn't help that linear LL(k) performance/optimizations is the first feature listed.


Thanks for the link!

I am not sure though if performance should be the key metric here. Of course, it all depends on the details and use case, but in general correctness and extensibility should be more important in most scenarios.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: