DSL Product Lines

Hi community,

I'm currently trying to figure out if it is possible to define a DSL product line using MPS. So I want to generate a language module in MPS based on contents I specify using my DSL for DSL product lines. Let's say I have a feature model saying that the DSL has a feature called Color and one called Size. The generation result should be a new language module with two concepts in the structure aspect - namely Color and Size.

The two questions are:
  1. How can I generate a new language module during generation phase?
  2. How can I insert contents to the respective aspects of the language, e.g. new ConceptDeclarations to the structure aspect, etc? I know that I can use reduction rules to create the ConceptDeclarations. But how can I "move" them to the desired language?

Thank you very much in advance,
1. A mapping Script doesn't seem to work but you could use a button with an Listener or an intention in your editor that triggers the following code.

For example:
model structureModel = LanguageAspect.STRUCTURE.get(language/EmpTyLanguage/); 
node<ConceptDeclaration> newConcept = new node<ConceptDeclaration>(); 
newConcept.name = "New concept"; 
structureModel.add root(newConcept); 
model editorModel = LanguageAspect.EDITOR.get(language/EmpTyLanguage/); 
node<ConceptEditorDeclaration> newConceptEditor = new node<ConceptEditorDeclaration>(); 
newConceptEditor.conceptDeclaration = newConcept; 
editorModel.add root(newConceptEditor);
Hi fxlex,

thank you very much for the response. I will evaluate your solution suggestions!


Please sign in to leave a comment.