I have a grammar for a domain specific language, and I need to create a javascript code editor for that language. Are there any tools that would allow me to generate a) a javascript incremental parser b) a javascript auto-complete / auto-suggest engine?
Thanks!
Different browsers have different JavaScript engines to parse and execute our code. The first thing that happens within the JavaScript engine is parsing of our code by parser.
Parsing means analyzing and converting a program into an internal format that a runtime environment can actually run, for example the JavaScript engine inside browsers. The browser parses HTML into a DOM tree.
Parse Arguments using process.argv is the simplest way of parsing arguments in Node. js and you do not need to install any additional package or library for that.
js-dsl is Javascript framework for developing internal domain specific languages (DSLs) that let you declaratively build arbitrary trees to parallel your abstract syntax tree (AST) or semantic model (SM).
An Example of implementing content assist (auto-complete) using Chevrotain Javascript Parsing DSL:
https://github.com/SAP/chevrotain/tree/master/examples/parser/content_assist
Chevrotain was designed specifically to build parsers used (as part of) language services tools in Editors/IDEs. Some of the relevant features are:
You may want jison, a js parser generator. In terms of auto-complete / auto-suggest...most of the stuff out there I know if more based on word completion rather than code completion. But once you have a parser running I don't think that part is too difficult..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With