iconmaster5326 / ecmascript4mps

ECMAScript language implementation for JetBrains MPS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ECMAScript4MPS

ECMAScript4MPS is the implementation of the ECMAScript 5.1 for JetBrains MetaProgrammingSystem, a.k.a. MPS.

At the moment branches are as follow:

  • master: where we started implementing ECMAScript, following version 5.1 as stated above.
  • development: a general ESNext implementation (ES2016, ES2017...) plus some features stage-x features not yet in the standard specification, e.g. decorators.

Probably they won't be never merged and the master will be replaced by the code from the development branch once completed.

Introduction

The constructed AST is identical (with very small exceptions) to the one described by the Mozilla Parser API and implemented, for example, by parsers like Esprima. It's still quite incomplete being my focus on javascript generation. Read more on this announcement post.

Resources

Try it out

  • clone the github project.
  • install MPS version 2018.3.1 .
  • open the project with MPS.
  • rebuild the project.
  • the sandbox solution contains a complete javascript example I use to test the language and the generation to text.

Build the plugin

If for instance you have installed MPS in /opt/MPS/MPS-2018.3/, execute:

$ ant -Dartifacts.mps=/opt/MPS/MPS-2018.3/  assemble

The last message of the build process will tell you where the zip file with the plugin is.

An EcmaScript4MPS plugin

To get a pre-prepared and packaged ecmaScript4mps language you can install the IDEA/MPS plugin in either IntelliJ IDEA or MPS and start using the language right-away.

Future improvements

ECMAScript4MPS is rather primitive with respect to its editing capabilities that are still "AST like" and not "text like". Also it's missing almost all "lexer like" rules.

My objective is to generate javascript so a "text like" editor experience while editing ECMAScript4MPS models is out of scope. Nevertheless I think to further improve the editor while I'll be using it.

Writing a developer's guide that could help other developers understanding MPS is also one of my goals.

About

ECMAScript language implementation for JetBrains MPS

License:Apache License 2.0