Transform Concept into other concept before TextGen

Hello,

Before my question I want to apologize because i'm not fluent in english.

My problem :
I have a concept A with some properties.
I have a concept B with an integer named b. In the generation, I want to transform my concept B in b concept A. Then, I want to use TextGen for the model-to-text transformation.

But, I dont't know if I can do this and how do this.
I tried to add some rules in the generator but this don't worked.
Do you have some ideas?

Thank you very much!
5 comments
Hello,

could I ask you to explain the desired transformation, please? What should be transformed into what? Maybe an example could help.

Vaclav
0
Hi,
I put the model in the attachement.

In fact, I want to transform the Exception concept in a Decision Concept.
(The user manipulate the concept of exception. However, in the target code, this is transform in a specific decision in wich I define "manually" all the properties.

To make a model-to-text transformation I use TextGen.
In the generator, I try to use the "weaving rule". But I don't understand what must return the "context".
Currently I make a pre-script. But I'm not sure that is the good solution.

For exemple :
we have this :
Code
//Exception
when conditions
do
   throw error 2
end

//And the generator transform this exception in the decision : 
when conditons
do
   ... some actions that I define "manually"
end
prettyPrint();
And then we give this code to TextGen.

Thank you very much.


Edit : model :
mdel.png
0
I guess you need to insert a link to the attached file into the comment so as we could get it. At least I cannot see it anywhere around :)
0
I may have misunderstood, but to mer this looks like a use-case for the COPY_SRC macro that would replace Exceptions with Decisions.

BTW, have you tried the MPS generator tutorial? - https://confluence.jetbrains.com/display/MPSD31/Generator+Demos
This should give you a solid introduction into the generator capabilities.
0

Please sign in to leave a comment.