Reduction rules for list types

Hi all,

I'm currently following the MPS tutorial of Markus Voelter at and have a question concerning reduction rules.
I modified the tutorial language in that way, that an entity attribute can either be a simple attribute (string, integer,.. ) or a reference attribute that points to another entity and also has a cardinality. I made that distinction so I can provide special editors for each entity attribute type.

The problem is, I'm not sure how to create a reduction rule, that also handles the cardinality. As you can see the reduction rules for the simple type are pretty much taken from the tutorial. With the reference attribute I can not figure out how to express that when the cardinality allows more than one I want a List with the referenced entity as type e.g. "List<Entity1>".

  • I found a ListType in the baseLanguage but "list<ClassifierType>" seems not an valid option.
  • The other problem is that I'm not sure how to pass the cardinality from the attribute reduction to the type reduction
  • I'm, also not completely satisfied with the redirection from the attributes reduction rules to the type reduction rules, it "feels" somehow inelegant, maybe there is a better way to do it in MPS?

Sources for the problem are available as a MPS project at:


1 comment
Comment actions Permalink
I somehow figured it out myself, I had to add the baseLanguage.collections where appropiate, the reduction rule now looks like this:


as well as the following generator priorities:


Please sign in to leave a comment.