TextGen: multiple files output per concept instance?


Is it possible to generate, via TextGen, multiple output files for single concept instance?
My use case is C++ header and body files (.h, .C).
I have two TextGen roots ("text gen component for concept X"). But it looks like only one gets used.

Plus, is it possible to generate via TextGen, while at the same generating Java through normal BaseLanguage generator templates?
So far looks like BaseLanguage intercepts it, and my custom TextGen does not run till I delete corresponding generator's root mapping rule...

Best Regards,
Karol Depka
Comment actions Permalink
That's a wish we've had for a long time. No luck yet, though :-)
Comment actions Permalink
Ähm. You are generating C++?

Have you heard about mbeddr? We're in the (slow) process of
integrating C++ to MPS (we already have C). Want to help?

Comment actions Permalink
Hallo Markus.

Thanks for your reply. Yes, I have heard about mbeddr :). And I've seen your cool videos :). Currently I don't have the bandwidth to help with that, unfortunately.
I think I will genrate the C++ more "directly into text", through make facets, skipping the concepts and the "wysiwyg" MPS generators. Low tech, but would be high ROI for us.

Good luck with mbeddr!

Kind Regards,
Comment actions Permalink

I found a trick to generate several models from one model:


Set the "keep input root" on a root reduction rule to true. It allows to create another mapping rule for the same node...


My 2 cents...

PS: I'm using MPS 3.3.5

Comment actions Permalink

I found a work-around to have two TextGen components.

In my case I wanted to create a header and a c-file (and I was too lazy to use the mbeddr c-language model, as the concrete use case is rather simplistic): I created an additional language that had exactly two structures, CFILE and HFILE. The only content in these structures is a reference to the original model root. Then I use a generator post-script that would just run over my original model, add these two structures and inside the reference to the original root.

In this new language, you can then add textgen files for each new root concept.


Please sign in to leave a comment.