Simple generation test
Hi,
I have recently started studying MPS and trying to do some simple tests.
I’m trying to create some simplest generator which uses jetbrains.mps.sampleXML language as input and output languages.
I have only one mapping rule:
where RootOut is
The input is
When I’m looking generated output (Preview Generated Text), I have
I do not understand, WHY? I specified to generate RootOut node always in the conditional root rules.
If I remove the Input node, I have correct output:
Could anybody say, what is wrong here? Maybe it is just my misunderstanding of some MPS concepts, but currently it looks for me as some MPS bug.
I have recently started studying MPS and trying to do some simple tests.
I’m trying to create some simplest generator which uses jetbrains.mps.sampleXML language as input and output languages.
I have only one mapping rule:
where RootOut is
The input is
When I’m looking generated output (Preview Generated Text), I have
I do not understand, WHY? I specified to generate RootOut node always in the conditional root rules.
If I remove the Input node, I have correct output:
Could anybody say, what is wrong here? Maybe it is just my misunderstanding of some MPS concepts, but currently it looks for me as some MPS bug.
Please sign in to leave a comment.





I'm not sure if I really understand your problem. But could it be that you haven't recognized the bottom tab bar in the preview generated text window?
Your conditional root rule will add a new root in output model, which is independent of your input. Since you have no rules for transformation your input it will be copied to your output, as far as I know. So you will have two xml files in your output, you can select one with the tabs at the bottom.
There was a generator tutorial, I really recommend. But I can't find it at the moment.
Here is the generator tutorial/demo I mentioned:
http://confluence.jetbrains.net/display/MPSD2/Generator+Demos
Really I have seen it already, but I have another question. How can I debug code in inspector? I can place breakpoints in some functions used in macros, but they do not stop on Preview Generated Code. The only way I have found so far is usage of some debug output when MPS started under IntelliJ IDEA (I used something like "System.out.println(node.name)"). I hope there is better way.