How to develop a generator to complete your input model (weaving or not weaving)

  • 2
  • 6

Hi,

I have a DSL1 with concepts and generator from concepts to xml.
In which the State concept exists (from statemachine), State has children states for compound states.
I have a DSL2 with generator, I want to add new substates to the input model.
I have no root mapping rules, since I want the statemachine in input copied as it is in the output model.
I am trying weaving rule :
concept   State                -->  weave_State
condition node.needsProcess         context : genContext.get copied output for (node);

in weave_State I have template fragments for substates.

When I launch generation I have the following error :
failed to generate output after 10 repeated mappings
No transient models are generated (with option ON)

I can make a testcase languages zip for anyone.
Question is not answered.
Also asked by Amarjeet Singh  
In whatever I could find from other Google searches, it appears that there is an infinite loop while generating model -> generated code cycle. I am trying a very simple example, as shown in the following links:

https://code.google.com/p/mps-lwc11/wiki/lwc11step1At01
https://code.google.com/p/mps-lwc11/wiki/lwc11step2At02

My model looks like:

module Company {
entity Employee {
firstName : string
lastName : string
}
entity Department {
name : string
manager : Employee
}
}

I am making my root mapping concept to be of type, Entity here. As you can see, I can have an attribute of Entity type inside of an another Entity as a reference.

When I run the generator, I get the following error:

"failed to generate output after 10 repeated mappings".

When I see the transient models, this is what I see:


Screen Shot 2014-08-04 at 6.11.24 PM.png


Clearly, something is recursive infinitely.

Were you able to resolve this issue at your end?

Regards

I didn't have any transient model generated so I am not sure it is the exactly the same issue here (but it looks similar).
But I will not continue with this because I read a comment saying weaving rules are a hack and should not be used.
Moreover, since 3.0 or 3.1, in place generation is used by default. Using weaving rules break this functionality and since in place generation will maybe the only available mecanism, I dumped using weaving rules and doing all with $IF$ and $MAP_SRC$ macros. Still I believe weaving is an elegant way of implementing generation and I hope they will come with something new.