What are the main differences between Jetbrains' MPS and Eclipse Xtext?

北战南征 提交于 2019-12-02 15:24:16
Heiko Behrens

Xtext is a traditional parser-based approach that works with ordinary textual files. Those can be mailed, stored and compared with any version control system and even modified outside the editor using your favorite command line tool. It tightly integrates into Eclipse EMF and works pretty well with a whole bunch of tools you can find in the Eclipse eco-system. Recently, it evolved (and is doing so still) into some kind of "programming language development toolkit" where it allows you to support all kind of additional tooling.

MPS on the other side works with a projection-based editor that just "looks" like text while you are working within the environment. The underlying storage format is tool-specific (read: unusable without special programs) and does not parse plain text files. This offers some great advantages such as embedding of arbitrary langauges (e.g. Regex inside SQL inside Java). The toolchain enables generation in form of model to model transformations that -as the editor- feel unusual at the beginning but are powerful, too.

Both tools are somehow locking you into their world (MPS/Eclipse). Even though you could run both in a headless mode, one cannot easily launch the Xtext editor inside another IDE. The same is true for MPS. I would argue that Xtext is "more open", since it works with ordinary text files on one hand and plays well with established tools (EMF and Eclipse in general) on the other hand.

Does this answer your question? I will try to give you more precise answers if you have more detailed questions.

The main idea of MPS isn't using a projectional editor instead of a text based one. It's the language compasability. For example, you can extend Java with tuples, and another person could extend Java with async method calls. In text based tools (like XText), it's impossible to guarantee that two extensions work well together, since the resulting grammar might be ambiguous. MPS makes this possible. You just add language to your project like you add libraries.

In my opinion Jetbrain's MPS is easier to learn at first. You don't need to work with configuration files like the Workflow-Files in xtext.

A main difference is that in MPS you edit the model directly and this model is shown to you in a syntax/editor view. In xtext you edit the syntax and the model is generated/parsed.

In my opinion MPS is more powerful. You can combine languages much easier and extend them. A big advantage of projectional editors is that you can hide information or show additional information retrieved from the model. You can also used different views like tables or graphs (coming up in MPS 2.1).

Version control can be done with MPS. Theres a merge/diff tool that works on the tree-model.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!