4 ms·
chevrotain's playground tool - https://sap.github.io/chevrotain/playground/?example=JSON%20grammar%20and%20automatic%20CST%20output https://sap.github.io/chevro
by davidkellis 8y ago
chevrotain'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.