Model to model transformation (How to do it?)
Hello,
I would like to do some model-to-model transforms using JetBrains MPS, but can't find how to transform a language LangA into a language LangB.
For example, let's say I have two simple languages:
I would like to transform models for the language LangA into models for the language LangB, mapping the RootA nodes to RootB nodes, where the Bar attribute will be the .ToString() of the Foo attribute.
The idea is to transform LangA into LangB and then LangB into text (using the TextGen aspect).
How could I create such a transformation? I can only see the TextGen aspect, to transform LangA directly into text, and the Generator aspect, to transform LangA into the BaseLanguage, but nothing that would allow me to transform LangA into LangB.
Thank you.
I would like to do some model-to-model transforms using JetBrains MPS, but can't find how to transform a language LangA into a language LangB.
For example, let's say I have two simple languages:
- LangA with a root concept RootA, which has an integer attribute Foo
- LangB with a root concept RootB, which has a string attribute Bar
I would like to transform models for the language LangA into models for the language LangB, mapping the RootA nodes to RootB nodes, where the Bar attribute will be the .ToString() of the Foo attribute.
The idea is to transform LangA into LangB and then LangB into text (using the TextGen aspect).
How could I create such a transformation? I can only see the TextGen aspect, to transform LangA directly into text, and the Generator aspect, to transform LangA into the BaseLanguage, but nothing that would allow me to transform LangA into LangB.
Thank you.
Please sign in to leave a comment.
We've got a tutorial for code generation at https://confluence.jetbrains.com/display/MPSD31/Generator+Demos
You can learn about how to set dependencies at https://confluence.jetbrains.com/display/MPSD32/Getting+the+dependencies+right
Vaclav