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:
image001.jpg


where RootOut is
image002.jpg


The input is
image003.jpg


When I’m looking generated output (Preview Generated Text), I have
image004.jpg



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:

image005.jpg

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.
6 comments
Hey,

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.
0
Thank you. I really missed the tab bellow. I also have added the Document concept into abandon roots and currently have only my RootOut node in the output, as I intended.
0
Thank you!
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.
0
I've asked for this in another thread some time ago, but unfortunately there is no answer yet. So I can't help you. But I'm still interested in the topic of debugging. I really hate printf debugging...
0
Well, hope MPS guys support it soon...
0

Please sign in to leave a comment.