I would like to have two generators with 1 language. Conform <a href='https://www.jetbrains.com/help/mps/generator-cookbook.html#howtogeneratemultipletargetsfromsinglesource?'>this</a> hint, I made tw...

This is an auto-generated question from the MPS Slack community: I would like to have two generators with 1 language. Conform this hint, I made two separate empty languages containing only the generators: • my.language (no generator) • my.language.gen1 (extends my.language) • my.language.gen2 (extends my.language) However, the generators are not activated, when I preview text of a root node in a model expressed in my.language. Any hints what might be going wrong?
9 comments
Comment actions Permalink
Did you 'import the appropriate extension language', i.e. gen1 or gen2, into your model?
0
Comment actions Permalink
Under 'Used Languages', I added both 'my.language' and 'my.language.gen1'. I didn't import any specific models, if that is relevant. In 'show generation plan' I see that 'my.language' is not covered by the generation plan, because it has no generators (duh). More strangely, I don't see 'my.language.gen1' in the generation plan at all.
0
Comment actions Permalink
and thanks for your help, Sergej, again!
0
Comment actions Permalink
there's another setting in model properties, 'Languages engaged on generation' (on the Advanced tab). This might help.
0
Comment actions Permalink
Then there are generation plans, etc. It's possible that generators from a particular language only get involved if the model uses the language 'for real', i.e. has a node with a concept from that language.
0
Comment actions Permalink
I think the 'Languages engaged on generation' did the trick. I'll double check with the voicemenu sample, as I was told that it uses my approach. I must say that 'languages engaged on generation' feels a bit 'awkward', because this means that I will have to specify it on every model. But anyway, thanks.
0
Comment actions Permalink
And just for the record... the generator cookbook is a bit misleading. 1. The generator language doesn't really have to extend the my.language. All that's required is the engaged-languages flag. 2. The sentence 'The developer will select the desired target platform by importing the appropriate extension language.' imho should become 'The developer will select the desired target platform by adding the generator language to the languages engaged on generation.'
0
Comment actions Permalink
to avoid specifying the generator on every model one usually creates a devkit with the necessary languages and a generation plan, then the users only have to use the devkit to get both the languages and the proper generators
0
Comment actions Permalink
This is auto-generated question from the MPS Community Slack Workspace. If you want to comment on the question, do it from the Slack workspace
0

Post is closed for comments.