Inheritance of abstract concepts and IF intention

Hello fellows.

I have a problem when i try to define how to generate code from my DSL, and can't solve it by myself as I don't have any experience in using MPS.

I have defined several concepts to model a Logo Program.
One of those is an abstract concept that I call Instruction.
A program contains several instructions and each instruction extend the Instruction concept.

In my Java Program, I want to go through all the instructions, so I defined a $LOOP$ intention with node.instructions in mapped nodes. In this LOOP intention, what has to be displayed depends on the type of the instruction So i used an $IF$ intention with node.isInstanceOf(MY CONCEPT); in the condition.

And here come the problem.

I want in that if to access attribute proper to the concept that extend INSTRUCTION, but as i'm iterating over instruction in the loop the node is of type INSTRUCTION instead of the more specific type.
I tried to cast the node in my intentions, but concepts are not Java types.

Does someone have a quick fix for my problem ?


PS: this is a concrete example of my problem.

$LOOP$  $IF$forward(0);
/* Here I want to set a macro property on 0 in order to replace it by a value of a property of the FORWRD concept, which is not available as we are iterating over INSTRUCTION concepts




Please sign in to leave a comment.