I'm currently following the MPS tutorial of Markus Voelter at http://code.google.com/p/mps-lwc11/wiki/GettingStarted
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: https://github.com/pellepelster/mango