What is practical use of IDEA MPS and Eclipse Xtext
Asked Answered
C

3

10

Both of those frameworks deal with meta-model:

Do you have example of practical applications based on meta-model transformation with those tools?

Comedy answered 28/7, 2010 at 16:50 Comment(0)
S
11

We created whole bug tracker using MPS. Code generation is not the goal but mean to get some executable code. The goal is to give a tool to developer that allows creating DSLs with minimum effort.

Cool thing about MPS is that it also provides you with an IDE for your language. And different DSLs you create are compatible, i.e. you can create DSL that extends Java with closures and another DSL that enables external methods, and these extensions will work together.

Surcingle answered 7/10, 2010 at 18:1 Comment(2)
Could you please help me to find closure extension for java ? I cant find some examples how to extend java synthax.Golda
To use closures for Java in MPS you need just to import language jetbrains.mps.baseLanguage.closuresSurcingle
H
7

They are different in term of document storing the metamodel.

Regarding XText, this article illustrates one usage, when it comes to y create your own programming languages and domain-specific languages (DSLs).

Once you have a language, you want to process it and this means usually to transform your model into another representation.
The facility responsible for this transformation is called generator and consists of a bunch of transformation templates (e.G. XPand) and some code executing them. On some event, the model is read in and the transformations are applied to produce code.

Example of such a model transformation:

dot3zest, which comes with a DOT to Zest interpreter (which now uses the Xtext switch API generated for the DOT grammar) is support for ad-hoc DOT edge definitions.

alt text


Regarding MPS, you have here a serie of practical examples,
like this code generation to GPL such as Java, C#, C++ or XML:

alt text
(source: googlecode.com)

Homes answered 28/7, 2010 at 19:19 Comment(3)
Note: a conference in October 2010 will illustrate a practical example with both frameworks. For the differences, see also hereHomes
Is the code generation the ultimate goal or I am not seeing it far enough?Comedy
@S.R: no the ultimate goal remains model transformation. You transform an AST (abstract syntaxt tree) into another, and that will give you: code (code generation), or nodes (the node graph in the first examples), or any other AST which will represent whatever the destination model is supposed to.Homes
L
2

I think the main usage of XText is firstly to create a DSL from the grammer you defined and an eclipse workbench auto-generated for you. Secondly, it can transform the scrpit written in your DSL into java. The built-in expressions from XText2 is a plus. The framework gives you a free IDE to support your writing DSL you created. And the DSL is the ulimate product to provide. It can be used to abstract the rules and logics from the real world. For example, in our project, the product config rule. Only specialist knows them, so they write some in the DSL you create.

Leticia answered 18/8, 2011 at 13:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.