When using MPS to generate two langauges together, second one is always ignored.
Hi,
I have three language projects defined, one for language itself, one for using plaintextgen to generate c++ code, one for using plaintextgen to generate python code.
When I use either c++ or python in a solution to generate target code, any of them are fine.
But when I include them both, c++ source code can always generated, but python code is always empty.
Does anyone know the possible reason of this?
I assume I could generate multiple languages in one go, otherwise it's too inconvenient.
Thanks.
Please sign in to leave a comment.
Generation plan:
I don't know why python was not engaged, only cpp.
> #showGenPlan LMESelectV10
--------------------- mappings partitioning -----------------------------------
[ 1 ]
eb_lang_cpp.generator.templates.*
[ 2 ]
eb_lang_python.generator.templates.*
[ 3 ]
jetbrains.mps.lang.core.generator.template.main.*
[ 4 ]
main.* [com.dslfoundry.plaintextflow#01]
---------------------------------------------------------------------------------
Model directly uses next languages (including explicitly engaged, if any):
Beware, some languages used in the model are not covered by the generation plan!
eb_lang_cpp
eb_lang [Language without generators]
eb_lang_python
=================================
Engaged generators with trace:
EngagedGenerator: eb_lang_cpp/main as OWNED through [EngagedLanguage: eb_lang_cpp]
EngagedGenerator: eb_lang_python/main as OWNED through [EngagedLanguage: eb_lang_python]
EngagedGenerator: jetbrains.mps.lang.core/generator as OWNED through [EngagedLanguage: jetbrains.mps.lang.core as EXTENDS through [EngagedLanguage: eb_lang_cpp]]
EngagedGenerator: com.dslfoundry.plaintextflow/main as OWNED through [EngagedLanguage: com.dslfoundry.plaintextflow as GENERATES INTO through [EngagedGenerator: eb_lang_cpp/main as OWNED through [EngagedLanguage: eb_lang_cpp]]]
=================================
1 roots, 1 components
#0(1): LMESelectV10
Strong:
1 roots, 1 components
#0(1): LMESelectV10
For whatever reason when multiple generators are engaged, they are engaged in sequence. This means that if the first generator transforms your DSL successfully into C++, there will be no DSL nodes left for the Python generator to work on. You probably want to look into creating a generation plan with a fork instead.
Hi Sergej Koščejev,
Thanks very much for the reply.
I tried generation plan, but no luck.
do you have a working example?
I followed this link https://www.f1re.io/multi-generators , seems the code doesn't work in new MPS any more.
And I used the same way applied to my project, didn't work.