Model-Driven Engineering (MDE) emerged to allow the development of applications based on the definition of models closer to the problem domain than to the implementation domain, alleviating the complexity of platforms. In order to do so, MDE makes uses of Domain-Specific Modelling Languages (DSMLs), which are modeling languages defined for a specific domain that allow users to perceive themselves as working directly with domain concepts. Do you know how these DSMLs are defined?
Domain-Specific Modeling Languages (DSMLs) formalize the application structure, behavior, and requirements within particular domains. A DSML follows the domain abstractions and semantics, allowing modelers to perceive themselves as working directly with domain concepts.
The definition of a DSML involves at least three aspects: the domain concepts and rules (abstract syntax); the notation used to represent these concepts—let it be textual or graphical (concrete syntax); and the semantics of the language:
- The abstract syntax of a DSML is usually specified by a metamodel, which is itself a model and describes the concepts of the language, the relationships among them, and the structuring rules that constrain the model elements and their combinations in order to respect the domain rules.The following figure shows an example of a metamodel:
We have defined this metamodel using the EMF . It is a metamodel of a DSML for simple production systems. It includes the elements involved in a production system and how they are related, which could be summarized as follows: a production system is made of plants that are composed of machines: generators (HeadGen and HandleGen) and assemblers; containers, which can be trays, conveyors and users; and parts: heads, handles and hammers. Trays can be connected to machines; machines are connected to conveyors, and conveyors are connected to trays. Trays, conveyors, and users can hold different parts (heads, handles and hammers).
Note that in a metamodel is not specified the behavior of domain element. This can be accomplished using complementary approaches (see ).
- The concrete syntax of a DSML provides a realization of its abstract syntax as a mapping between the metamodel concepts and their textual or graphical representation. For visual languages, it is necessary to establish links between these concepts and the visual symbols that represent them. Similarly, with textual languages links are required between metamodel elements and the syntactic structures of the textual DSML.The following figure shows a simple visual concrete syntax for the DSML for production systems:
In this figure, we have associated an image to each domain concept defined in the metamodel. For instance, machines are represented as cogwheels with an icon showing the kind of part they generate.More sophisticated graphical concrete syntaxes can be defined by using, e.g., the GMF tool .
- The semantics of a DSML is normally given with natural language. However, although users can normally guess the meaning of most terms of a DSML (a good language designer probably chooses keywords and special symbols with a meaning similar to some accepted norm), a computer cannot act on such assumptions. Furthermore, in MDE, where models are not to be used as mere documentation but key artefacts from which the whole system can be derived and implemented, a precise and formal basis will significantly help us in their definition not to produce unexpected results, and to be able to perform formal analysis over the models.
Therefore, although less commons, there are also formal approaches to define the semantics of DSML. One example is the translational semantics approach, which involves the definition of the semantics of a DSML through thedefinition of a mapping between the language itself and another language with well-defined semantics, such as Abstract State Machines, Petri Nets, or rewriting logic.
You can find an example of this approach, further details about it in and alternative approaches in .
-  The Eclipse Modeling Framework (EMF). Available at https://www.eclipse.org/modeling/emf/
-  Rivera, Jose E. (2010) On the Semantics of Real-Time Domain Specific Modeling Languages. Computer Science thesis, University of Malaga.
-  The Eclipse Graphical Modeling Framework (GMF). Available at https://www.eclipse.org/modeling/gmp/