diverse-project / melange

The Melange Language Workbench
http://melange-lang.org
Eclipse Public License 1.0
28 stars 7 forks source link

Add keyword "annotation" to annotate langs with key:value pairs #84

Closed ebousse closed 7 years ago

ebousse commented 7 years ago

I propose to add a generic annotation keyword to melange, to be able to annotate a language with key:value pairs. Both keys and values are simple strings.

This would allow anyone that wants to experiment with new concepts declared at the language level to do so in a Melange language. For instance, this could have been used to declare the xmof semantics, instead of adding the xmof keyword.

Illustration: capture du 2017-06-13 10-02-41

fcoulon commented 7 years ago

Seems a good idea!

We had consider an extension mechanism to provide custom language operators in Melange but XText (& ANTLR) doesn't support composite grammar. Key-Values can be an alternative.

From memory, the xmof keyword is used by the MelangeResource to get a Configuration (& by the Gemoc Engine/Launch config ?)

Do you want to use annotations during the Melange internal process (such as merge/slice, ModelTypes computation etc...) or just after the whole build?

ebousse commented 7 years ago

It's true that now that there is code in Melange to convert static xmof models to dynamic xmof models, the xmof keyword does have its place in the Melange syntax. So my example was not that good :). But early in the xmof experiments, this would have been useful.

For now I'm only using annotations after the whole build, in the GEMOC execution code, to find extensions based on the two annotations shown above. Maybe later an extension point to be able to customize the Melange internal process based on such annotations could be useful, but for now basically I just wanted to declare stuff :).

tdegueul commented 7 years ago

As a first step, it sounds good to me. We may come back to this issue later if needed. Go ahead!