Three DSL developing questions

Hi to all,

I need a guide or corrections:

I'm trying to develop DSL to create all types of different weapon, and I choosed to create close combat weapons first. So there I created abstract concept CCWeaponInterface which holds properties damageSlash, damageBlunt and damageStab, together with weight (all properties are integer). Then I created two more concepts which extend CCWeaponInterface, the Axe and the Sword concept. Axe has additional twoHanded and twoBladed boolean properties, and Sword holds bladeLength integer.

Question one: is this a proper path, or am I going the wrong way developing a language?

Second issue comes up when creating editor. I started by making horizontal collection, then constant cell "Create " and here, I wanted to add cell which would constrain choices to any weapon which extends CCWeaponInterface.

Question two: Is it possible and how can it be done?

Question three: In defining concepts, what are the "concept links" and "links" used for?

Thanks to anyone who replies.

Ivica

0
6 comments
Avatar
Permanently deleted user

I may be wrong, but from my perspective 'concept links' are like static fields of the class while just liks are like regular fields of the class...

0
Avatar
Permanently deleted user

Igor Karpov wrote:

I may be wrong, but from my perspective 'concept links' are like static fields of the class while just liks are like regular fields of the class...

Yes you are right.

0
Avatar
Permanently deleted user

Deus wrote:

Hi to all,

I need a guide or corrections:

I'm trying to develop DSL to create all types of different weapon, and I choosed to create close combat weapons first. So there I created abstract concept CCWeaponInterface which holds properties damageSlash, damageBlunt and damageStab, together with weight (all properties are integer). Then I created two more concepts which extend CCWeaponInterface, the Axe and the Sword concept. Axe has additional twoHanded and twoBladed boolean properties, and Sword holds bladeLength integer.

Question one: is this a proper path, or am I going the wrong way developing a language?

I think for beginning it is a pretty good way of defining concepts.

Second issue comes up when creating editor. I started by making horizontal collection, then constant cell "Create " and here, I wanted to add cell which would constrain choices to any weapon which extends CCWeaponInterface.

It looks like you are mixing concept instance and concept declaration.

Editor is thing defined for concept declaration to edit concept

instance. For what thing you are creating editor?

0
Avatar
Permanently deleted user

Uuuuh, I'm a bit lost about the concept declaration and concept instance.

When creating nodes in the concept tree, I am really declaring concepts, am I? And when writing code for the model in the custom-tailored editor, I am really modifying concept instance? I thought it works this way.

But nevertheless, I didn't quite understand if it was the answer to my question: I wanted to know if I can create only one editor instance that would create different types of weapons. I was educating myself somewhat about DSLs, and understood that good DSLs should be self-commenting. So I thought about syntax similar to this(applies only to CC weapons):

Create *Axe* which is *twoHanded* *,* *twoBladed* and weighs *around* *10* kg and has damage *around* *10* damage points.

Now, the explanation: everything between stars != constant.

- Instead of Axe, there can be any concept that extends CCWeaponInterface

- twoHanded and twoBladed are flags separated with comma, and the whole 'which is ....' part is not necessary (something like ORDER BY in SQL)

- 'around'-s can be switched with 'exactly'-s

- numbers are, normally, changeable.

For fixed choices (exactly and around) I thought about using enum concepts (this is their purpose, right?), but I would like to be able to easily extend choice of close combat weapons that are normally enough different from each other to stand by themselves as a concept.

For example, ShortSword could be calculated from a Sword concept, but an Mace wouldn't.

Sorry for lots of text, but I really don't know where to find any reference about MPS besides this forum and HelloWorld tutorial (and doubt there is any).

0
Avatar
Permanently deleted user

Deus wrote:

Uuuuh, I'm a bit lost about the concept declaration and concept instance.

When creating nodes in the concept tree, I am really declaring concepts, am I? And when writing code for the model in the custom-tailored editor, I am really modifying concept instance? I thought it works this way.

Yes, it works this way.

But nevertheless, I didn't quite understand if it was the answer to my question: I wanted to know if I can create only one editor instance that would create different types of weapons. I was educating myself somewhat about DSLs, and understood that good DSLs should be self-commenting. So I thought about syntax similar to this(applies only to CC weapons):

Create *Axe* which is *twoHanded* *,* *twoBladed* and weighs *around* *10* kg and has damage *around* *10* damage points.

Editor in MPS is created per concept instance. What is concept in this

case? If you change Axe to other weapon type the type of concpet

should be cahnged too, but you can't do it in MPS. But you can create

concept weapon declaration, create concepts for weapon properties etc,

than create concept weapon instance that points to weapon declaration

and create editor for it. If you done it this way you can change weapon

type and implement editor what you want.

0
Avatar
Permanently deleted user

Thanks, this is exactly what I've been trying to find out.

0

Please sign in to leave a comment.