Parser generator module #1493
tdermendjiev
started this conversation in
Ideas
Replies: 1 comment
-
@colameo could give professional hints here as well |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It would be useful to provide a built-in parser generator module in Dirigible. The parser generator and the generated files should be accessible from javascript. The most popular (and viable) options are:
ANTLR
ANTLR is written in Java but can generate javascript parsers too (with the
Dlanguage=JavaScript
option). A possible solution is to create a module in Java, accessible via js api, which will generate the parser files and add them to the Dirigible project. The js parsers are considerably slower (at least as tested in Dirigible) than those generated in Java.PEG.js
PEG.js is a popular parser generator written in javascript. The grammar syntax is simple and it has a good error reporting. It is usable from browser out of the box which would make it easier to integrate into Dirigible.
Jison and Nearley
These are probably the two most popular javascript parser generators but they are not so straightforward to add to Dirigible because of some node.js native module dependencies. Still it shouldn’t be that hard to integrate using Webpack.
Chevrotrain
This is not exactly a parser generator but rather a parsing DSL. The grammar is defined directly using javascript which makes it way easier to debug because there isn’t a level of abstraction between the grammar implementation and the parser. Concatenated and minified js files for use in browser are also provided so using it in Dirigible is straightforward.
Beta Was this translation helpful? Give feedback.
All reactions