eMoflon / emoflon-tool

Source code of eMoflon::TIE-SDM
https://emoflon.org
Other
3 stars 2 forks source link

MOSL SDM language and feature discussion #56

Closed RolandKluge closed 7 years ago

RolandKluge commented 8 years ago

From @gervarro on June 17, 2016 23:33

Here are my first set of comments to @anthonyanjorin @erhanleblebici @RolandKluge regarding the textual SDM language

I would define patterns as follows:

pattern getFirstAndLast(list : List, first : Node, last : Node) {
   nodes(list, first);
   nodes(list, last);
   neg nac1(first);
   neg nac2(last);
}

pattern nac1(first : Node) {
   local noPrev : Node;
   previous(first, noPrev);
}

pattern nac2(last : Node) {
   local noNext : Node;
   next(last, noNext);
}

Explanation:

When the pattern language already exists, I would extend it to a GT rule language. Markers ++ and -- would only occur in the GT rule language but not in the pattern language. My key requirement is that the (core) pattern language must be usable without the GT and the control flow languages.

I think that the ++ and -- markers are OK in a textual GT rule specification, however, note that the GT rules have to be mapped to several Democles patterns in the internal process.

Copied from original issue: eMoflon/emoflon#747

RolandKluge commented 8 years ago

From @anthonyanjorin on June 18, 2016 6:25

I've thought a while about having an ecore textual syntax and I'm now against it:

RolandKluge commented 8 years ago

From @anthonyanjorin on June 18, 2016 7:7

Well I thought the @ to refer to variables in expressions would be a nice touch :)

As we, however, must have a normal return statement anyway, we might as well use it for all cases.

RolandKluge commented 8 years ago

From @anthonyanjorin on June 18, 2016 7:12

Good point with complex NACs, as simple NACs are used quite often it wouldn't be bad to support both (as Greg already suggests): so ! noPrev : Node as well as ! complexNACPattern

RolandKluge commented 8 years ago

From @anthonyanjorin on June 18, 2016 7:14

From the end user's point of view, why do we need to "separate" the languages? We can transform specifications to any number of disjunct metamodels but for the end user everything is the same language (the core pattern language is just a subset of all language features). Am I missing something here?

Xtext's support is not that amazing for modular languages, I'm not sure how much we should try to separate the actual technical language specifications.

RolandKluge commented 8 years ago

From @anthonyanjorin on June 18, 2016 7:27

I have to admit that I don't yet understand how pattern invocation works. This is sort of some kind of control flow in patterns, and how is recursion handled? This is completely new language feature that I'll have to get used to and can't really say much about

RolandKluge commented 8 years ago

From @anthonyanjorin on June 18, 2016 7:30

I've gotten used to the tgg pattern textual syntax and actually quite like the way the pattern is organised into object variables (top level) and outgoing link variables in each object variable scope (this also works nicely with code completion). If no one else wants to have SDM patterns this way then we can forget it. We could also support it and allow for the more general syntax Greg suggests. One decision would be if one must use the explicit syntax for graph patterns or if one can choose.

RolandKluge commented 8 years ago

From @gervarro on June 18, 2016 23:42

I've thought a while about having an ecore textual syntax and I'm now against it:

I know that this requires additional efforts. I think that this would be the nicest solution, but you are right that this is not a top priority task, so we can forget about it for a while. Btw. cannot we integrate our SDM/TGG textual language into Xcore in the same way as we integrated SDMs into Ecore?

Well I thought the @ to refer to variables in expressions would be a nice touch :)

I might have misinterpreted something. In your example, @ referred to a variable in a GT rule application, and not in an expression.

From the end user's point of view, why do we need to "separate" the languages? We can transform specifications to any number of disjunct metamodels but for the end user everything is the same language (the core pattern language is just a subset of all language features). Am I missing something here?

There are many cases (e.g., declarative validation patterns for Democles/SDM/TGG specifications), when only declarative patterns are aimed to be defined (without SDMs, without TGGs). The role of the core pattern language would be to enable the direct specification of Democles patterns exactly on the abstraction level that is supported by the pattern matcher. Some language extensions (e.g., simple NACs like! node : Node) are simply non-existing on this level. As far as I know, there is a concept of non-terminal subclassing in Xtext, which could be used to separate the core pattern language from the rest.

One decision would be if one must use the explicit syntax for graph patterns or if one can choose.

I would like to open up further possibilities for the pattern matcher, and restricting the core pattern language only to 'graph' patterns would be against this step.

I have to admit that I don't yet understand how pattern invocation works. This is sort of some kind of control flow in patterns, and how is recursion handled?

Pattern invocation is a way to declaratively specify patterns of arbitrary size. http://dx.doi.org/10.1007/978-3-540-89020-1_31

Summary: I would like to have a core pattern language that can be directly mapped to Democles patterns. I can support any kinds of extensions (simple NACs, ...) or alternative solutions (explicit syntax for graph patterns, ...), if these do not affect the core pattern language.

RolandKluge commented 8 years ago

From @gervarro on June 19, 2016 8:39

Just one additional comment. I think that it is practical to define the SDM textual syntax for the internal ControlFlow metamodel and not for the current SDM metamodel, as in this case the ugly and complex control flow validation, which turns the spaghetti control flow into a structured Java-like control flow, could be completely eliminated. However, if the textual syntax is mapped to the internal metamodel, then the closer they are in their structure, the easier it is to implement the mapping/synchronization. The internal metamodel invokes Democles patterns, which means that the extensions (e.g., the simple NAC notation ! node : Node) and the alternative solutions require additional implementation efforts and result in a more complex mapping in the end.

RolandKluge commented 8 years ago

The discussion has become quite long now and we are discussing many topics.

I try to give my opinion in a short way for each topic: ---NACs

---Support for meta-modeling?

---Link variables

---Pattern vs. Rule

---using and import

---op's

---AT - Referencing match variables

RolandKluge commented 8 years ago

Assigned @gervarro since he is the MOSL-SDM lead developer.

RolandKluge commented 7 years ago

Closing this issue do. Results of the discussion are documented here:

https://github.com/eMoflon/emoflon-docu/wiki/Discussion-on-MOSL-GT