How to correctly link generators from different languages?


I've stumbled upon a small problem that I'd like to fix cleanly :)

When creating a generator with reducing rules all in the same configuration, everything works fine with $COPY_SRC$. No warnings.
However, i have tried to make a second language, to add logical operations to my language.

Basically, it throws errors such as:

"apply template child: [baseLangType] is not a sub-concept of [nodeType]"

That also happened when i tried to separate rules in different mapping configurations.

As an example, i have this AndExpression, in my other language's main generator.

And I have a WriteLineCommand in the main language generator that looks like this:

In this context, node.value contains an AndExpression, and this is where things start to scream out.
I get a warning: apply template: child 'jetbrains.mps.baseLanguage.structure.Expression' is expected for role 'actualArgument' but was 'AndExpression'.

The program generates and runs absolutely fine but i still want to know how i should somehow refactor this so it doesn't warn anymore (without suppressing the warnings ;p)

Note that if i put those (concepts and everything) in the main generator, nothing will make any warning.


1 comment
Comment actions Permalink

It looks like, you are missing a reduction that normally would transform the AndExpression, sorry if I am wrong :)
Maybe instead of $COPY_SRC$ $MAP_SRC$ would amend your problem, but I doubt, because the generator for the reduction of the AndExpression seems not to be involved anyway.
So you need to know the exact generation plan to decouple the generators.
If the language you are targeting has a generation by generator priorities, you need to adjust the priority of the mapping configuration according to the generation plan the original was facing



Please sign in to leave a comment.