OR rules on MPS

Hello, I’m a newbie on MPS platform. I am wondering on how to create OR-rules on nodes. In other words, I see how I can easily create a set of children A-B-C to represent a general language rule, but what if a node is defined as A-(B1 or B2)-C ? Have i necessarely to create a superclass of B1 and B2 ? How to create an editor for them?
Sorry for the very basic question, but I’m not familiar yet with the environment.

How is A-(B1 or B2)-C different from A-B1-B2-C?

B1 and B2 are alternatives. They can’t be present at the same time. How I define this in MPS? Creating two different concepts ?

@alessio.stalla I think the “-” is meant as a separator here, not as a minus.

Yes, just to say that A, B and C are sequential

Hi,

If what you want to have is more than one concept in a determined place, you create a superconcept, probably abstract and/or interface and then create the sub concepts that you need.

1 Like

To reply to the original question. Yes, you would typically create a superconcept or a super interface for B1 and B2, called e.g. B. And add this super concept/interface B should be part of the contaning concept. So you get A-B-C.

2 Likes

Ah, OK, I see. Yes I’d write a super concept/interface B and use that.

1 Like

Any reference to “black-magic” of layout symbols ? I can’t find them anywhere in jetbrains MPS site… :worried:
image

Have you readed the Editor—MPS ?

Are you seeing the extra info that appears in the Inspector Window Tool?

1 Like

Bad engineer’s habit to try before knowing :wink:
Thanks…

2 Likes

I’m the same :slight_smile:

Hi all, I’m reading doc before trying stuffs, but the tool is so powerful that learning curve is enough slow. I’m trying to understand how to say to the layout of a superconcept that it has to pick layout of sub-concepts… for instance: I declared a VarExpr and a NumExpr as sub-concepts of AtomicExpr.
when i open the editor and the cursor is in the position of an AtomicExpr, it just displays an alias because AtomicExpr is an empty superconcept. How to say that it has to pick VarExpr or NumExpr layout according to what char I pressed ?
Really appreciate your help.

Strange.

I think it should be picking the right editor.
I have similar situations and is working as expected.

can I send you some snapshots ?

If you like, we can try to make a call after the community zoom meeting.

would be great… i don’t want you to waste time, but if you are available i appreciate your help.

Can you create a zoom meeting? Or want to do the call using other tool?

i prefer Meet, are you ok ?