Generator distribution

Hi community,

I'm thinking about language modularity and a good DSL architecture. Thereby the question came up whether it is possible to distribute the generator over the different language modules.

For example if I have two languages L1 and L2 (and L1 imports L2), is it possible to define the generator rules for L2 directly in L2 (and, of course, those for L1 directly in L1)? Or do I have to specify my generation plan in a central way, i.e. in L1?

Or, as a third solution suggestion, is it better to create a third language L3 just for the generator aspect?

Thank you very much in advance,
LaAck
4 comments
Generally, you don't need to specify priority rules to control generation plan. In fact, you should try to avoid them as much as possible, as priority rules often cause hard-to-solve troubles. Indeed, there are cases when rules are inevitable, but these are quite rare cases (mostly, rules like 'together' aka '==' need explicit priority). Generator tries to deduce proper order based on languages template produces (i.e. if generator of L1 has templates that produce L2 concepts, then there'd be implicit priority rule L1 'not later' (<=) than L2. Any explicit rule would ruin this logic and you're on your own then.
0
Hi Artem,

thank you very much for your response. I'm sorry, I'm afraid I caused some confusion regarding what I'm talking about. My problem are not the generator priorities but the rules in the mapping configuration, e.g. the reduction rules. I don't know if it is possible to create a mapping configuration in L1 and L2 respectively, providing only the mapping rules for the concepts included in the respective language. So let's assume that I want to generate an XML document. Is is possible and useful to describe the transformation for each concept in the language where it is uncluded? Or do I have to describe it in one mapping configuration of the "overall container" language?

I hope this clarifies the issue. Thank you very much again!

Kind regards,
LaAck
0
Transformations for language concepts are grouped into generator (and further into mapping configurations) associated with the language. E.g. if you got concepts C1 and C2 in L1, and C3 and C4 in L2, it's reasonable to have reduction rules for C1 and C2 in L1's generator, and reduction rules for C3 and C4 in L2's generator. The purpose of a generator is to transform language's concepts into another language (think Model-to-Model transformations if you're familiar with MOF, where Model == Language in MPS terms). Thus, it's reasonable for a generator to focus on its language concepts only.
0
Hi again,

thank you very much! This is exactly what I wanted to know and what I hoped for.

Kind regards,
LaAck
0

Please sign in to leave a comment.