Can java build be triggered in the middle of the generation?

Here's my case: DSL1 => base language => execute the built java class =java -jar...=> binary blob => DSL2 => textgen for DSL2

What I'm actually doing is I'm building a firmware for an embedded CPU.

DSL1 is a user-facing language. Then I transform it via series of mapping scripts (that perform inlining, convert the thing to assembler DSL, do register allocation, etc). The thing is "assembler to binary" is coded in java, so in order to convert my DSL into binary blob I need to call java somehow. I wonder how could (should) I do that in the middle of the generation.

The idea is I would need to wrap that blob with some more DSL (that is DSL2) after DSL1 gets compiled, so I would like to have more generation mappings after that "java call".

Just some pictures:

DSL1)

"converted to assembly" DSL)

"base language" for that assembly, so it is ready for java compiler)

So far so good, however I would like to compile and run the above "base language", and transform its output.

4 comments

To me, custom make action which would construct tailored make sequence (or rather two consecutive make sequences)  is the way to go. Default make action constructs make script based on used languages in the context model, and the script has no repetetive steps by design.

0

Can you elaborate on what you mean by "make action"?

Do you mean jetbrains.mps.execution.configurations.structure.BeforeTask that would orchestrate a couple of jetbrains.mps.make.MakeSessions ?

0

No, BeforeTask relates to debug/execution aspect. Take a look at MakeSelectedModels action and MakeActionImpl. There's some some unrelated code (model validation), the rest is starting a make session. My idea was to implement a custom action that would trigger two consecutive Make sessions, one to run generate/compile/reload(aka deploy) cycle for your auxiliary code, another one that would use it. It's not an easy task to fit it into single make session to the nature of make sequence construction (check MakeSequence and Cluster.createScriptBuilder(), where used languages trigger contribution of certain make facets). 

0

>Take a look at MakeSelectedModels

Ah, thanks for the pointer. It makes sense.

0

Please sign in to leave a comment.