4 ms·
Ohm has several impressive features, such as separation of grammar and semantics and incremental parsing capabilities. The base performance however very low, a
by bd82 8y ago
Ohm has several impressive features, such as separation of grammar and semantics and incremental parsing capabilities.
The base performance however very low, as in two orders of magnitude lower than most other parsing libraries in JavaScript.
See benchmark at: https://sap.github.io/chevrotain/performance/ https://sap.github.io/chevrotain/performance/ that I have created.
- davidkellis 8y agochevrotain's playground tool - https://sap.github.io/chevrotain/playground/?example=JSON%20grammar%20and%20automatic%20CST%20output https://sap.github.io/chevrotain/playground/?example=JSON%20... - is sure nice! What parsing algorithm does chevrotain use under the hood? Does it allow left-recursive and right-recursive productions/rules?
- bd82 8y agoThanks. Chevrotain is an LL(K) Parser library, or more precisely SLL(K), It looks up-to K fixed token ahead to choose the next alternative. Because it is just a library to assist in hand crafting recursive decent parsers, the same limitations apply, left recursion would lead to an infinite loop...,however left recursion is detected during initialization and an descriptive error is thrown instead. Right recursion is allowed. It is possible to resolve more complex ambiguities using back tracking: http://sap.github.io/chevrotain/docs/features/backtracking.html http://sap.github.io/chevrotain/docs/features/backtracking.h... or other types of custom logic. However in general, the library does not try to be able to parse all the possible grammars in the world, instead the focus is more on performance, features and ease of development.