How to do "or" creating DSL? What is the right way?
I am new in MPS world... and wondering what is the right way to do something like...
Lets forget about this "Terminal terminalXX".
My question is how to do DSL in which I have "create", then "bash" OR "ssh"... and then only if "ssh" was entered "session" is allowed.
I know how to write such grammar in ANTLR for example... but I don't know how to write such thing in MPS... expecialy in proper way.
Should I for example create "create" concept which has "bash" and "ssh" concepts as children and then change its visibility using inspector and... actions(?). Or should I create... concepts... two different or more... But I don't know what these concepts should look like.
So I want to create such flow:
----- bash ---------------------
create --| | --- terminal
----- ssh ---- session -----
Please help.
terminal terminal01 = create bash terminal terminal terminal02 = create ssh session terminal
Lets forget about this "Terminal terminalXX".
My question is how to do DSL in which I have "create", then "bash" OR "ssh"... and then only if "ssh" was entered "session" is allowed.
I know how to write such grammar in ANTLR for example... but I don't know how to write such thing in MPS... expecialy in proper way.
Should I for example create "create" concept which has "bash" and "ssh" concepts as children and then change its visibility using inspector and... actions(?). Or should I create... concepts... two different or more... But I don't know what these concepts should look like.
So I want to create such flow:
----- bash ---------------------
create --| | --- terminal
----- ssh ---- session -----
Please help.
Please sign in to leave a comment.
from the brief sample you gave I would propose the following solution:
This should give you the desired syntax.
Thank you for reply. I fully understand your solution.
So every time one needs "or" one should use subconcepts.
Thank you.