xMOF Case Study: Imperative Modeling Language

 

The imperative modeling language (IML) allows to define imperative statements that express calculations. Additionally it supports the definition of variables and the assignment of calculated values to these variables as well as goto statements.

The distinctive feature of this language is its imperative nature as well as its sequential execution model requiring a statement counter which holds the index of the statement to be executed next similarly to a program counter in CPUs.

Example

This exemplary model of the IML DSML (depicted in textual concrete syntax) consists of the three Variables a, b, and c which are initialized with the values 1, 1, and 10 respectively (lines 1-3). Further, the model consists of two Assignments (line 5, line 7) and one Goto statement (line 6). In the given example the Variable a is incremented by adding the value of the Varaible b (line 5) until a reaches the value 10 (line 6) and then 10 (value of Variable c) is added to a (line 7). Thus, in the end of the execution of this model a has the value 20 and the other variables remain unchanged (b=1, c=10).

1 var a value 1;
2 var b value 1;
3 var c value 10;
4
5 mark add: a a + b;
6 goto add when a < c;
7 a a + c;

Language Specification

Ecore-based metamodel of IML DSML

Resources

Ecore-based Metamodel: ImpModLang.ecore (MetaModelbrowser: ImpModLang.ecore)
xMOF-based Configuration: impl.xmof

© 2012 moliz by Vienna University of Technology Suffusion theme by Sayontan Sinha