<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Supporting Variability with Late Semantic Adaptations of Domain-Specific Modeling Languages</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Tom Dinkelaker</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Martin Monperrus</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Mira Mezini</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Technische Universität Darmstadt</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Germany</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>dinkelaker</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>monperrus</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>mezini}@cs.tu-darmstadt.de</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Design</institution>
          ,
          <addr-line>Languages</addr-line>
        </aff>
      </contrib-group>
      <abstract>
        <p>Meta-object protocols are used to open up the implementations of object-oriented general-purpose languages to support semantic variability. They enable performing application-level semantic adaptations to the language even at runtime. However, such meta-object protocols are not available for domain speci c-modeling languages. Also, existing approaches to implementing domain-speci c modeling languages do not support semantic adaptations, where the application basically rede nes speci c parts of the language semantics. We propose a new approach for the implementation of domain-speci c modeling languages that uses metaobjects and meta-object protocols to open up the implementation of domain-speci c abstractions. This approach enables runtime semantic variability of the form of applicationspeci c late semantic adaptations of domain-speci c modeling languages that depend on the runtime application context.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Categories and Subject Descriptors</title>
      <p>D.3.3 [Software Engineering]: Language Constructs and
Features|Classes and Objects, Frameworks ; D.2.11
[Software Architectures]: Languages</p>
    </sec>
    <sec id="sec-2">
      <title>1. INTRODUCTION</title>
      <p>Domain-speci c modeling languages (DSMLs) facilitate
the development of software in a certain application domain
by providing direct means to express domain-speci c
abstractions and operations. DSMLs are supported by
domainPermission to make digital or hard copies of all or part of this work for
personal or classroom use is granted without fee provided that copies are
not made or distributed for profit or commercial advantage and that copies
bear this notice and the full citation on the first page. To copy otherwise, to
republish, to post on servers or to redistribute to lists, requires prior specific
permission and/or a fee.</p>
      <p>
        First International Workshop on Composition and Variability colocated
with AOSD’2010 Rennes, St. Malo, France
Copyright 2010 ACM ...$10.00.
speci c interpreters or compilers, which implement DSML
syntax and semantics [
        <xref ref-type="bibr" rid="ref22">22</xref>
        ].
      </p>
      <p>
        Previous work showed that most of the current methods
for implementing DSMLs are closed with respect to changes
in their semantics [
        <xref ref-type="bibr" rid="ref22 ref30">30, 22</xref>
        ]. For instance, van Deursen pointed
that extensible DSL compilers and interpreters [
        <xref ref-type="bibr" rid="ref30">30</xref>
        ] have
been little explored and Mernik stated [
        <xref ref-type="bibr" rid="ref22">22</xref>
        ] that \building
DSLs [...] in an extensible way" is an open problem. To
support the need for extensible modeling languages, note
that even UML2 [
        <xref ref-type="bibr" rid="ref25">25</xref>
        ] de nes an extension mechanism of its
semantics called semantic variation point. This is where
this makes its contribution: we propose a new approach for
implementing DSMLs which supports semantic variability.
      </p>
      <p>
        This approach allows DSML users to de ne the DSML
semantics that exactly ts their needs, in the spirit of semantic
variation points of UML2 [
        <xref ref-type="bibr" rid="ref25">25</xref>
        ]. For illustration, consider a
model of a travel package booking Web service de ned in a
DSML for composing Web services. Let us assume that the
initial DSML semantics only supports synchronous events
consumption, thus DSML programs can only handle
synchronous Web service partners. What happens if the
default Web service for booking ights fails and that the only
other partner available works asynchronously? The DSML
application has to be rewritten using another modeling
language. If the user could change the DSML semantics in an
application-speci c manner, she could implement an
adaptation of the DSML semantics in order to enable asynchronous
event consumption to also support asynchronous partners,
while still reusing the initial DSML application and most of
the default DSML semantics. If the DSML application has
to support at runtime both synchronous and asynchronous
partners, i.e. be self-adaptive to recover dynamically if a
partner fails [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], the semantic adaptation has to depend on
the execution context.
      </p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref31">31</xref>
        ], van Gurp coined the term late variability in the
context of product lines, where it means changing a product
after its delivery. In this paper, we explore the use of late
variability in the context of DSML, which means being able
to change the DSML semantics after the default interpreter
or compiler has been delivered. To do so, we de ne the
concept of late semantic adaptation as a replacement of one
or more parts of the default semantics of the DSML within
a DSML program; late meaning that the adaptation occurs
after the delivery of the DSML and even as late as during
the execution of a DSML program.
      </p>
      <p>Let us now list and de ne what could be adapted in a
DSML: A domain type is a type of the metamodel of the
DSML, i.e. a type representing a domain abstraction.
Adapting a domain type means that every instance created after
the adaptation will have the new semantics. Domain types
contain domain operations that may change the state of
domain objects. A domain object is an instance of a domain
type. Adapting a domain object means that the semantics
(the implementation) of its domain operations (and only the
operations of this particular object) are changed.</p>
      <p>
        Existing approaches to implementing DSMLs (e.g. DSML
compilation [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], domain virtual machine [
        <xref ref-type="bibr" rid="ref23">23</xref>
        ], and
polymorphic embedding [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]) do not support such late semantic
adaptations, where the application basically rede nes
speci c parts of the language semantics. In existing approaches,
changing the semantics at runtime is only possible if the
semantic adaptations had already been anticipated at design
time. However, it is not possible to envision every
possible semantic adaptation a priori at design-time. Even if it
would be possible to embed into the DSML variation points
for the known adaptations, the resulting implementation of
the DSML semantics would be bloated with additional
attributes and conditional logic. Such a one-size- t-alls
solution hampers the design of the default semantics which is
used by most of the DSML programs. Last but not least,
the DSML semantics could not be causally connected to the
application state (i.e., dependent on the application state).
      </p>
      <p>
        Our contribution is a method to implement DSMLs which
are able to support runtime semantic adaptations.
Metaobject protocols (MOPs) are interfaces to change the
semantics of object-oriented programming languages [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ]. MOPs
de ne meta-objects that for instance handle the dispatch
of method calls. Our key insights are that: 1) domain
objects can be linked to a meta-object and 2) by implementing
a DSML in a speci c manner, an existing general-purpose
MOP enables to change the semantics of the DSML itself.
The method supports unanticipated semantic adaptations
after the default DSML implementation has been delivered
to a particular domain, as late as during the execution of a
DSML program.
      </p>
      <p>
        To evaluate our approach, we instantiate the method by
building a DSML for state machines. This DSML supports
semantic adaptations discussed previously in literature [
        <xref ref-type="bibr" rid="ref25 ref3">25,
3</xref>
        ].
      </p>
      <p>The remainder of this paper is structured as follows.
Section 2 presents di erent dimensions along which semantic
adaptations may be de ned. The proposed DSML method
is presented in Section 3. Section 4 evaluates the support for
semantic adaptations of a DSML implemented following our
method. Related work is discussed in Section 5. Section 6
concludes the paper and discusses future research directions.</p>
    </sec>
    <sec id="sec-3">
      <title>DIMENSIONS OF</title>
    </sec>
    <sec id="sec-4">
      <title>LATE SEMANTIC ADAPTATIONS</title>
      <p>It's not straightforward to adapt the DSML semantics at
the application level. DSML programmers require analysis
means to design their adaptations. Hence, we have identi ed
the following dimensions of semantic adaptations.
2.1</p>
    </sec>
    <sec id="sec-5">
      <title>Scope of Variability</title>
      <p>The rst dimension along which we classify DSML
semantic adaptations is the scope of variability. This dimension
is discrete and has two values: (a) domain type semantic
adaptation and (b) domain object semantic adaptation. A
domain type semantic adaptation a ects the semantics of
(D3.a) Pre-Execution</p>
      <p>Semantic Adaptation
--- DSL Loading
+++ Adaptation
+++ Adaptation
%%% DSL Execution
%%%
%%%
%%%
%%% End of Execution
(D3.b) Execution Context Dependent</p>
      <p>Semantic Adaptation
--- DSL Loading
%%% DSL Execution
%%%
+++ Adaptation
%%%
+++ Adaptation
%%%
%%% End of Execution
all domain objects of a given domain type. On the
contrary, a domain object semantic adaptation a ects only one
particular domain object.
2.2</p>
    </sec>
    <sec id="sec-6">
      <title>Granularity of Changes</title>
      <p>The second dimension of semantic adaptations is the
granularity of adaptations that are made. The size of these
adaptations ranges from one single domain operation to multiple
parts of the DSML semantics. Indeed changing one part of
the semantics often requires also changing another part of
the semantics, and multiple \elementary" semantic
adaptations have to be packed into a unit of change.
2.3</p>
    </sec>
    <sec id="sec-7">
      <title>Relation to DSML Execution</title>
      <p>The third dimension characterizes the relation between
the point in time in which the semantic adaptations happen
and the point in time when DSML programs are executed.
In most cases, the right semantics for a program execution
can be determined beforehand and stays xed for a complete
program run. Sometimes, the selection of the right
semantics depends on the execution state of a DSML program, i.e.,
a change in the DSML program context triggers a semantic
adaptation.</p>
      <p>Let us consider the following two abstract examples of
execution traces that illustrate the two possible points in time
when adaptations may take place. Figure 1 shows the di
erence in the execution traces of a pre-execution adaptation
and a context-dependent adaptation. In both traces, the
rst step is to load the DSML program of which the
corresponding trace is pre xed by \{ { {". Then, two kinds of
execution steps can occur: semantic adaptation (\+ + +")
and normal DSML execution (\% % %").</p>
      <p>The left-hand side of gure 1 schematically depicts a
preexecution semantic adaptation: the semantics of the DSML
changes before any domain object is created, or any call to a
domain operation has occurred. Note that multiple
adaptations can be applied as indicated. Then, the DSML program
is evaluated until completion. In this case, the adaptation
is independent of the DSML execution. The right-hand side
of gure 1 depicts an execution context-dependent
semantic adaptation, as used in the running example. Unlike the
previous trace, the adaptation happens during DSML
execution, depending on the concrete values of domain objects.
This is symbolized by the interlacing of several regular
domain operation execution and semantic adaptation steps.
Such context-dependent adaptations enable semantic
selfadaptation of DSML programs.</p>
    </sec>
    <sec id="sec-8">
      <title>A NEW METHOD FOR</title>
    </sec>
    <sec id="sec-9">
      <title>IMPLEMENTING DSMLS</title>
      <p>This section presents a method for implementing DSMLs.
DSMLs interpreters implemented with this method have
the particularity to allow late semantic adaptations (as
described in 2), i.e. semantic adaptations of the DSML inside
DSML programs. We use the Groovy programming
language to demonstrate the feasibility of the approach, as well
as to fully instantiate the approach later in section 4.
3.1</p>
    </sec>
    <sec id="sec-10">
      <title>Using Groovy to Implement DSMLs</title>
      <p>
        Groovy [
        <xref ref-type="bibr" rid="ref18 ref5">5, 18</xref>
        ] is an object-oriented scripting language
that nicely integrates with Java [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. We have selected
Groovy as the implementation language of our method for
the following reasons:
1. Groovy provides a runtime MOPs in which meta-objects
are rst-class entities that can be directly accessed and
modi ed by users1.
2. Groovy has a exible syntax that enables the de nition
of embedded DSMLs with a small syntax overhead.
While for other host languages, such as Haskell, a
large syntax overhead has been measured [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ], Groovy
supports named parameters and command expressions
that allow the DSML implementer to design the syntax
of the embedded DSML more openly.
3. Groovy is accessible to a broad community of
developers since it has a syntax that is close to the Java
syntax. Groovy is seamlessly integrated into Java and
Groovy code can be called from Java code and vice
versa. Hence, DSML programs can be called from Java
and DSML programs can call existing Java libraries.
All these argument allow an easy dissemination of our
method.
      </p>
      <p>
        While our method for implementing DSMLs could be
implemented using other programming languages that come with
a meta-object protocol (Smalltalk [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ], CLOS [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ], Ruby
[
        <xref ref-type="bibr" rid="ref27">27</xref>
        ]), none of these languages satisfy all the aforementioned
requirements.
      </p>
      <p>
        Let us now give a quick overview of the features of Groovy
that our method uses for implementing DSMLs2. Every
Groovy object is bound to a meta-object [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ]. This
metaobject has several responsibilities: 1) it contains the logic
related to introspection (e.g. the method getMethods) and
2) it handles every method call to this object. It is possible
to change or replace this meta-object at runtime.
      </p>
      <p>Also, there is a registry that links a class name to its
default meta-object. Every new instance of a class, say x, is
bound to the meta-object for its class in the registry. Hence,
when the registry is updated, already existing objects keep
the old meta-object and the new generation of objects is
bound to the updated meta-object.</p>
      <p>Groovy supports rst-class closures. A closure can be
created dynamically, passed as parameters to methods and
functions, and executed. Listing 1 illustrates these points
1Note that users do not have to understand and use the
MOP as long as they use the default semantics of a DSML
and do not need to adapt it.
2Note that our approach is not bound to Groovy speci cally,
but to dynamic languages with a MOP. For instance, our
approach is completely applicable in the context of Ruby.
1 // creating a closure
2 aClosure = {x-&gt;
3 print "hello "+x }
4
5 def m(Closure c) {
6 c("world") // executing the closure
7 }
8
9 // passing the closure as parameter
10 m(aClosure)
1 // creating a closure
2 aClosure = {-&gt; bar() }
3
4 // two di erent contexts
5 class Context1 {
6 def bar() { println "bar" } }
7 class Context2 {
8 def bar() { println "bar2" } }
9
10 // executing the closure with Context1
11 aClosure.delegate=new Context1()
12 aClosure() // output "bar"
13 // executing the closure with Context2
14 aClosure.delegate=new Context2()
15 aClosure() // output "bar2"</p>
      <sec id="sec-10-1">
        <title>Listing 1: Closures in Groovy</title>
      </sec>
      <sec id="sec-10-2">
        <title>Listing 2: Delegates in Groovy</title>
        <p>Also, an important feature of Groovy closures is that their
execution can be parameterized by a delegate context. By
default, a closure has access to the lexical context in which it
has been created. The lexical context contains all local
variables of the closure. If it has been created within a method
body, all variables available in the method are also
available for the closure. In particular, all instance attributes
and methods of the object that has created the closure are
available when the closure is executed. This creating object
is called the owner of the closure. In addition to the lexical
context, the available context can be extended. When using
a delegate for the closure, by changing its delegate attribute
to refer to the delegate, the lexical context of the delegate
becomes accessible in the closure. This way, the instance
attributes and methods of another object than its owner can
be used. If a function is not found in the closure's lexical
context, a method with same signature is looked up in the
delegate context, as shown in listing 2. Note that depending
on the current binding of the delegate, the execution of the
same closure can produce di erent results.</p>
        <p>Technically, extending the available context for a closure
is possible because Groovy uses a special meta-object for
every closure. This meta-object rst tries to lookup attribute
accesses and method calls in the lexical context of a closure,
i.e., in the local variables and in the owner. If no attribute or
method with a corresponding name or signature is available
in the lexical context and if the closure's delegate attribute
is set, then the meta-object tries to lookup the attribute or
method in the class of the delegate object. Only if the
attribute or method can be found neither in the lexical context
nor in the delegate, Groovy throws a runtime error.
3.2</p>
      </sec>
    </sec>
    <sec id="sec-11">
      <title>The Embedding of DSMLs</title>
      <p>
        Our method is based on Hudak's method to implement
DSLs [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ], i.e., no parser and compiler has to be written.
Implementing a DSML relies on two main steps. First, a
metamodel speci es domain types, domain operations, and
associated semantics in terms of a set of interrelated Groovy
classes. Second, a syntactic language interface { a Groovy
class { maps DSML syntax to DSML semantics by
mapping DSML keywords to domain objects. There is a method
in the syntactic language interface for each keyword in the
DSML. DSML programs are enclosed in Groovy closures and
the latter are assigned an instance of the language interface
class as their delegate. The delegation mechanism of Groovy
closures then maps DSML keywords to the corresponding
method calls to a closure's delegate.
      </p>
      <p>For instance, let us consider the implementation of the
default semantics for a DSML for state machines. Figure 2
depicts the design of this DSML. The metamodel consists
of classes Fsm, State, Transition, Actions. The Fsm class
maintains a set of states, refers to a current state and
implements some default semantics of state machines, e.g., the
method receiveEvents(...) de nes the dispatch
mechanism of events received by a state machine. State instances
maintain a set of outgoing transitions and may have an
on_entry action and implement the state semantics. For
instance, the method handleEvent(...) de nes the state
event handling mechanism. A Transition points to the
next state. The fire(...) method is called whenever a
transition is selected. The class Action encapsulates a set of
domain-speci c actions; the semantics of an action execution
is encoded in the doIt method. Finally, the syntactic
language interface is implemented in class StateMachineDSML.
There is a method in StateMachineDSML for each keyword in
the DSML. When called, these methods instantiate domain
objects.</p>
      <p>Listing 3 shows an excerpt of an embedded DSML
program for state machines. The DSML program is contained
in the closure dslPackage (cf. line 3) which is con gured in
line 22 to have an instance of StateMachineDSML as its
delegate and whose evaluation starts at line 24. The evaluation
is performed in two steps.</p>
      <p>The rst step transforms the textual DSML program (from
line 5 to 9), embedded into the host language syntax, to
a representation as a network of interrelated domain
objects (instances of the domain classes from the metamodel,
e.g., the instance MyFsm of class Fsm). During the
execution of the closure, keywords, e.g. fsm, state, and when,
are encountered in the DSML program. These keywords
are turned into method calls due to the exible syntax of
Groovy. When using curly brackets at the end of a
keyword method call, Groovy creates a closure and passes the
closure to the method call as the last parameter. For
instance, the program segment fsm 'MyFsm', {...} is turned
into a method call of the form fsm('MyFsm',
closure-inbrackets) with the dslPackage closure as the receiver. These
calls are dispatched to closure's delegate, in this case a
StateMachineDSML, of which the method with the corresponding
keyword name and signature is called. These methods serve
mostly as factories of domain objects. The second step, in
line 14, is the execution of the DSML program as a method
call to a domain object (resp. MyFsm and execute), given
a speci c execution context ({'ok','error',...}). This
triggers a cascade of method calls on domain objects
created during the rst step.
3.3</p>
    </sec>
    <sec id="sec-12">
      <title>How to Support Late Semantic Adaptations in DSMLs</title>
      <p>In the following, we explain how to use meta-objects to
enable late semantic adaptations. The meta-level introduced
by our method is schematically depicted in Figure 3. Every
domain type is mapped to a domain class A domain class,
e.g., DomainClass in Figure 3, de nes the domain operations
of its instances { the domain objects, e.g., aDomainObj. The
semantics of domain objects is rei ed in meta-objects, which
are responsible for handling the execution of domain
operations. Every domain class is associated with a meta-object,
which is the default meta-object of any new instance of the
domain class. Meta-objects, e.g., x in Figure 3, dispatch
method calls received by domain objects to concrete
implementations of domain operations. The links meta-object
and/or impl can be changed at runtime, which is the key to
allow dynamic semantic adaptations.</p>
      <p>New instances
have default
semantics
before semantic adaptation</p>
      <p>Our base embedding method in Groovy presented above
supports this meta-level: 1) all domain classes are Groovy
classes whose semantics can be modi ed at runtime; 2) all
domain objects are Groovy objects, and the corresponding
meta-object can be changed for a single instance only.
3.3.1</p>
      <sec id="sec-12-1">
        <title>Scope of Variability</title>
        <p>Figure 4 shows how the two kinds of variability with
regard to the scope dimension { domain type versus domain
object { are supported in the proposed meta-level.</p>
        <p>The upper part shows the e ects of semantic adaptations
whose scope is an entire domain type; the lower part
corresponds to an adaptation that is speci cally scoped for a
particular domain object, thus, only domain objects are shown
there. Both parts show the relation between domain types
and domain objects to their corresponding semantics
(encapsulated in a meta-object) before and after the adaptation.</p>
        <p>In the upper left quadrant, the domain type A is bound
to the default semantics represented by the meta-object x.
Every new domain object that is created, e.g., a, runs under
the default semantics. The semantic adaptation de nes new
semantics for domain type A. In the upper right quadrant,
a new meta-object y is de ned to represent the new
semantics and A is associated with it. Any domain object created
subsequently runs under the new semantics: the domain
object b is created after the adaptation, hence, it is linked to
the new meta-object y. Objects that were created before
the semantic adaptation continue to run under the previous
semantics, e.g., a is still linked to the meta-object x.</p>
        <p>In the lower left quadrant, the domain objects c and d are
created with the same semantics. The object-level semantic
adaptation depicted here modi es the semantics of d only.
The lower right quadrant shows the domain objects,
metaobjects, and their relations after the semantic adaptation
has taken place. While c keeps the former semantics, d uses
the new semantics represented by meta-object z.
3.3.2</p>
      </sec>
      <sec id="sec-12-2">
        <title>Granularity of Changes</title>
        <p>Figure 5 depicts how adaptations at di erent levels of
granularity are also supported by the proposed meta-level.
The upper part shows the most ne-grained semantic
adaptation at the level of an atomic domain operation. Unlike
gure 4, the meta-objects are represented along with the
domain operations. Doing so, we can highlight that the
adaptation can separately impact a particular operation. In the
upper left quadrant, the object a is attached to meta-object
x; in the upper right quadrant, the same object is attached
to a new meta-object y, which is the result of cloning x
and binding foo to a new implementation, called fooImpl2.
This way, the whole default semantics gets reused except the
re-bound domain operation(s).</p>
        <p>In general, it is likely that a semantic adaptation a ects
several places in the default implementation of the
semantics. Obviously, it is preferable to apply the changes together
as a unit of semantic adaptation. In contrast to the atomic
adaptation at the level of a single domain operation, in this
case the changes have to be packed into a bigger variability
unit. This abstract unit is depicted as the gray rectangle
in the lower left part of gure 5. When an adaptation
happens, all changes of this adaptation unit are performed in
concert. The impacted domain objects are then bound to
a new meta-object, which is the result of mixing the
previous meta-object and the semantic adaptation unit. In gure
5, after the change, the domain object a is attached to the
meta-object z, which binds both foo and bar to new
implementations.
3.3.3</p>
      </sec>
      <sec id="sec-12-3">
        <title>Relation to DSML Execution</title>
        <p>Semantic adaptations may occur at loading time or at
runtime of DSML programs. Figure 6 depicts the sequence
diagram of context-dependent semantic adaptation.
Normal execution and semantic adaptation are interlaced. After
loading DSML program the rst execution phase starts. In
this phase, while executing the DSML program and when
entering a context that requires a semantic adaptation, a
special phase is started that consists of applying
semantic adaptations onto domain objects (respectively domain
types). At the end of the adaptation phase, control is passed
back to DSML execution. The subsequent execution phase
will run under the new tailored semantics. It is worth
mentioning that several adaptation phases can be executed, e.g.,
the adaptation can be reverted or other semantics can be
installed.
4.</p>
      </sec>
    </sec>
    <sec id="sec-13">
      <title>APPLYING THE METHOD</title>
      <p>This section discusses an implementation of a DSML for
nite state machines (FSM DSML) using the method
described in section 3. We show why the DSML interpreter
supports semantic adaptations and how to implement them
in at the level of DSML programs.
4.1</p>
    </sec>
    <sec id="sec-14">
      <title>Possible Semantic Adaptations for the FSM</title>
    </sec>
    <sec id="sec-15">
      <title>DSML</title>
      <p>
        The UML speci cation [
        <xref ref-type="bibr" rid="ref25">25</xref>
        ] discusses several semantic
adaptations for state machines. We consider here two of them.
4.1.1
      </p>
      <sec id="sec-15-1">
        <title>Synchronous vs. asynchronous event handling.</title>
        <p>Listing 4 shows two possible implementations of State's
domain operation handleEvent. The rst implementation is
the default one and encodes synchronous event handling; the
second implementation supports asynchronous event
handling.
1 // default: synchronous event handling
2 def handleEvent(Event e) {
3 this.fsm.currentState =
4 this.transitionSelection(e).fire()
5 }
6
7 // alternative: asynchronous event handling
8 def handleEvent(Event e) {
9 if (this.queue.isEmpty) {
10 this.fsm.currentState =
11 this.transitionSelection(e).fire()
12 } else {
13 this.fsm.queue.add(e)
14 }
15 }</p>
        <p>Listing 4: Two Implementations of handleEvent
1 // default semantics: deterministic transition selection
2 def transitionSelection(Event e) {
3 return this.transitions.findAll(event).first
4 }
5
6 // alternative semantics: random transition selection
7 def transitionSelection(Event e) {
8 return this.transitions.findAll(event).getRandom()
9 }
Listing 5: Two Implementations of
transitionSelection
4.1.2</p>
      </sec>
      <sec id="sec-15-2">
        <title>Deterministic vs. random transition selections.</title>
        <p>A given state of a state machine can have several
transitions matching a given event. In this case, a state machine
implementation has to provide a transition selection policy.
Following our method, the semantics of transition selection
is encoded in the transitionSelection method of the
domain class State. Listing 5 shows two possible
implementations of transitionSelection. The default implementation
of the transition selection policy is a deterministic one. It
returns the rst element of the collection of matched
transitions. The alternative implementation selects a random
item in the collection of matched transitions for a fairer
loadbalancing.</p>
        <p>The following sub-sections will discuss scenarios of using
our method to apply alternative semantics for event
handling and transition selection thereby varying the kind of
adaptation along the three dimensions discussed previously.
Section 4.3, speci cally, will discuss how to combine several
variation points in one semantic module; for instance, how
to use the tailored version of both handleEvent and
transitionSelection in a concise and elegant manner.
4.2</p>
      </sec>
    </sec>
    <sec id="sec-16">
      <title>Scope of Adaptations</title>
      <p>Listing 6 shows the implementation of the rst dimension
presented in section 3.3.1.</p>
      <p>Listing 6 illustrates domain type semantic adaptation.
The module dslPackage (lines 5-9) is a Groovy closure,
which consists of three parts: (a) the declaration of a DSML
program (lines 5 to 9), (b) a piece of meta-program that
tailors the semantics of the DSML (lines 17 to 19), and (c) a
piece of code that starts the execution of the DSML program
(line 26). Parts (a) and (c) have been explained in 3.2. The
adaptation consists in changing the transitionSelection
method of the default state meta-object in line 17. As
explained earlier, all instances of class State are a ected by
this kind of adaptation and will execute with the tailored
transition selection semantics.</p>
      <p>For sake of space, we cannot elaborate on a complete
DSML program that performs a semantic adaptation at the
level of a single domain object. The code is similar to that
in listing 6, except that it is not the metaClass of class
State (line 17) that is changed but the metaClass of a
domain object. For example, we can change the meta-object
of S1 using MyFsm.S1.metaClass.transitionSelection =
{...} .
4.3</p>
    </sec>
    <sec id="sec-17">
      <title>Granularity of Adaptations</title>
      <p>This section illustrates the second semantic dimension,
presented in section 3.3.2. On the one extreme in this
dimension, a semantic adaptation a ects a single domain method;
on the other extreme, a semantic adaptation may imply the
construction of a completely new meta-object.</p>
      <p>Listing 7 shows DSML code that is embedded similarly
to listing 6. It focuses on the adaptation in lines 7 to 10.
The only element that is changed is a domain method of a
domain class.</p>
      <p>On the contrary, listing 8 shows the creation of a
semantic module and its use for tailoring the semantics of a
domain class. Similarly to using classes to represent domain
types, we use a new subclass for modularizing alternative
semantics for a domain type. In the example, lines 2{9
dene such a subclass called TailoredState. Subclassing a
domain type to create a new meta-object allows leveraging
two key Groovy features used in listing 8:
1. The possibility to attach new semantics to an existing
domain class, using a registry mechanism (line 13).
2. The automatic creation of a meta-object for each new
class (line 14).</p>
      <p>A meta-object for the new subclass is automatically
created and stored in the class variable
TailoredState.metaClass. In listing 8 lines 13{14, we register this meta-object
also for the State class. As a consequence, the domain
operation implementations of TailoredState will be used for
State objects.</p>
    </sec>
    <sec id="sec-18">
      <title>4.4 Moment of Adaptations</title>
      <p>As shown gure 1, a pre-execution adaptation is simply a
piece of code preceding the DSML program that changes the
semantics of the language itself. While our method enables
such adaptations, for sake of space, we cannot elaborate on
them.</p>
      <p>We now present a complete example of a semantic
adaptation that occurs during the execution of a DSML program,
i.e. a context-dependent adaptation. Consider now the
selfadaptive DSML program in listing 9. This DSML program
is a state machine representing a Web service composition
for a travel booking process. The machine consists of two
states, rst booking a ight and second booking a hotel. In
both states, a call to a Web service is made in the on_entry
blocks. States transitions are triggered by the reception of
Web service responses.</p>
      <p>This program is self-adaptive since it is able to recover
from failing synchronous partners, thanks to our FSM DSML
which supports semantic adaptations: the TravelPackage
program is able:
1. to handle the error event in the BookingFlight state
(line 12);
2. to replace the failing partner whith an asynchronous
one (line 14)
3. to adapt itself to the new webservice by changing the
event reception semantics of the DSML only for state
BookingFlight in order to listen to asynchronous events
(lines 12{21).</p>
      <p>In this section, we have presented an instantiation of our
method as a proof of concept that has shown its real
implementability. From the viewpoint of end-users of our method,
i.e. DSML designers, this section is fully complementary to
the conceptual presentation of our method in sections 2 and
3 and enables them to implement on their own a DSML that
supports late semantic adaptations.
5.</p>
    </sec>
    <sec id="sec-19">
      <title>RELATED WORK</title>
      <sec id="sec-19-1">
        <title>Domain-Specific Languages.</title>
        <p>
          The implementation of DSMLs using \traditional, closed"
compilers (e.g. [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ]) does not allow semantic adaptations.
In contrast, extensible compilers, such as Polyglot [
          <xref ref-type="bibr" rid="ref24">24</xref>
          ] or
JastAdd [
          <xref ref-type="bibr" rid="ref13 ref8">13, 8</xref>
          ], target semantic adaptations of the form of
extensions to Java language. Akesson et al. [
          <xref ref-type="bibr" rid="ref33">33</xref>
          ] address the
implementation of extensible DSMLs. However, extensible
compilers do not support all the semantic adaptation
dimensions discussed in this paper. Only class-level adaptations
are supported, in the sense that the adaptation granularity
is the class as well as in the sense that all domain objects are
executed under the same semantics. Furthermore, dynamic
semantic adaptation that depends on application execution
state is not supported. Last but not least, the application
adaptation are very di erent as opposed to our approach,
where { due to using the language embedding technology {
the same language is used for implementing an application
and the semantics of the DSML.
        </p>
        <p>
          Our approach follows the domain virtual machine pattern
[
          <xref ref-type="bibr" rid="ref9">9</xref>
          ], i.e., it is a DSML interpreter realized by a set of domain
classes implementing the domain semantics in their
methods. Kermeta [
          <xref ref-type="bibr" rid="ref23">23</xref>
          ] is a language to implement DSML
interpreters following the domain virtual machine pattern.
However, our domain classes are embedded into a host language
which allows to seamlessly integrate DSML programs and
programmatic semantic adaptations. More importantly, our
approach supports non-invasive, application-speci c, and even
execution context speci c semantic adaptations.
        </p>
        <p>
          Steele [
          <xref ref-type="bibr" rid="ref28">28</xref>
          ] proposes to build interpreters out of a set of
building blocks called pseudomonads, in reference to Haskell
monads [
          <xref ref-type="bibr" rid="ref32">32</xref>
          ]. Achieving a semantic adaptation can be done
by composing interpreters. Comparing to our method, the
DSML programmer has to understand not only the
interpreter of the DSML but also the composition operator of
pseudomonads.
        </p>
        <p>
          Ramsey [
          <xref ref-type="bibr" rid="ref26">26</xref>
          ] described the implementation of the Lua
scripting language as an embedded interpreter in Objective Caml.
While Ramsey implements a general-purpose language (Lua)
interpreter, our approach targets domain-speci c interpreters
in order to design them as extensible.
        </p>
        <p>
          The initial method of embedding DSMLs by Hudak [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ]
does not consider the issue of semantic adaptations.
Similar to our work, polymorphic embedding [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ] enables several
interpretations of a DSML program by employing a similar
architecture for the DSML implementation that separates
the language interface and the domain metamodel.
However, polymorphic embedding does not support a meta-level
architecture allowing DSML programs to change their
semantics in a ne-grained and application context-speci c
manner during their execution.
        </p>
      </sec>
      <sec id="sec-19-2">
        <title>Reflection and Meta-Object Protocols.</title>
        <p>
          Meta-interfaces have been implemented for various
languages, e.g., 3-KRS [
          <xref ref-type="bibr" rid="ref21">21</xref>
          ], CLOS [
          <xref ref-type="bibr" rid="ref17">17</xref>
          ], Smalltalk [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ].
Metaobject protocols (MOPs) provide \interfaces to the language
that give users the ability to incrementally modify the
language's behavior and implementation" [
          <xref ref-type="bibr" rid="ref17">17</xref>
          ]. MOPs are open
implementations [
          <xref ref-type="bibr" rid="ref16">16</xref>
          ] of (object-oriented) general-purpose
languages. Compile-time MOPs have been provided for
popular compiled languages OpenC++ [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ] and OpenJava [
          <xref ref-type="bibr" rid="ref29">29</xref>
          ].
MOPs have been adopted in dynamic scripting languages,
such as Ruby [
          <xref ref-type="bibr" rid="ref27">27</xref>
          ] and Groovy [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ]. Using the above MOPs
for extending DSML semantics have not been addressed.
        </p>
        <p>There are no methods for DSML implementation
available, that derive a MOP for the implemented DSML. The
approach proposed in this paper is generic for class-based
languages. Other dynamic languages that come with a MOP
can be used to provide a exible DSML semantics as
presented in this paper.</p>
        <p>
          xPico [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ] allows to extend the syntax and semantics even
at runtime by re ectively manipulating the AST at
wellde ned adaptation points. The idea to use re ection and
the targeted exibility is similar to our approach. Although
xPico allows syntactic variability, the semantic adaptation
of xPico is limited, as explicit adaptation points must be
dened to allow extensibility. The problem with the xPico
approach is that it does not provide an adequate meta-interface
and provides only access to the AST but not to domain
abstractions. However when implementing a DSML for
multiple users, it is impossible to envision every adaptation point
at design-time of the DSML semantics. On the contrary,
our approach permits unanticipated adaptation points, i.e.,
every domain class method is a latent adaptation point.
        </p>
        <p>
          A domain-speci c meta-object protocol for distributed
environment, called diMOP, has been presented in [
          <xref ref-type="bibr" rid="ref20">20</xref>
          ]. This
design-time MOP is used to specify behavioral
characteristics, such as non-functional concerns, at the design level in
extended UML diagrams. However, the focus of this paper
is the language level and executable meta-objects. The idea
of having a domain-speci c meta-object protocol is an
interesting one. The diMOP is only a MOP for one domain, while
every DSML implemented following our approach exposes a
domain-speci c MOP.
        </p>
      </sec>
    </sec>
    <sec id="sec-20">
      <title>6. SUMMARY AND FUTURE WORK</title>
      <p>
        In this paper, we have presented a method for
implementing DSMLs that support semantic adaptations that may be
application-speci c and may occur as late as during the
execution of DSML programs. The proposal leverages
metaobjects [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ] in the context of domain-speci c modeling
languages. Also, we have elaborated on an instantiation of the
method in the Groovy programming language in the context
of state machines. Although not shown in this paper, our
solution is applicable for DSMLs with more complex sets of
domain concepts (and language constructs), such as
workow languages, aspect languages, and others [
        <xref ref-type="bibr" rid="ref6 ref7">6, 7</xref>
        ].
      </p>
      <p>As usual for dynamic approaches, there is a trade-o
between adaptability and statically checked correctness. Our
approach supports a maximal adaptability and may su er
from possible correctness issues. For instance, DSML
programmers who override part of the default DSML semantics
might violate contracts and responsibilities that are implicit
in the DSML design. These limitations will be addressed
in future work. For instance, semantic adaptations may
require adaptations in several domain classes and operations
performed in concert. Our future work will also explore
explicit contracts that can be checked at runtime to ensure the
semantic consistency of adaptations.
7.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>D.</given-names>
            <surname>Batory</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Lofaso</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Y.</given-names>
            <surname>Smaragdakis</surname>
          </string-name>
          . Jts:
          <article-title>Tools for implementing domain-speci c languages</article-title>
          .
          <source>In Conference on Software Reuse</source>
          , pages
          <volume>143</volume>
          {
          <fpage>53</fpage>
          ,
          <year>1998</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>A.</given-names>
            <surname>Char</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Dinkelaker</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Mezini</surname>
          </string-name>
          .
          <article-title>A Plug-in Architecture for Self-Adaptive Web Service Compositions</article-title>
          .
          <source>In Proceedings of the 2009 IEEE International Conference on Web Services</source>
          , pages
          <volume>35</volume>
          {
          <fpage>42</fpage>
          . IEEE Computer Society,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>F.</given-names>
            <surname>Chauvel</surname>
          </string-name>
          and
          <string-name>
            <surname>J.-M. Jezequel</surname>
          </string-name>
          .
          <article-title>Code Generation from UML Models with Semantic Variations Points</article-title>
          . In L. Briand and C. Williams, editors,
          <source>UML MoDELs</source>
          , volume
          <volume>3713</volume>
          <source>of LNCS</source>
          , pages
          <volume>54</volume>
          {
          <fpage>68</fpage>
          ,
          <string-name>
            <surname>Montego</surname>
            <given-names>Bay</given-names>
          </string-name>
          , Jamaica,
          <year>October 2005</year>
          . Springer Verlag.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>S.</given-names>
            <surname>Chiba</surname>
          </string-name>
          .
          <article-title>A metaobject protocol for C++</article-title>
          .
          <source>In OOPSLA</source>
          , pages
          <volume>285</volume>
          {
          <fpage>299</fpage>
          . ACM Press New York, NY, USA,
          <year>1995</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Codehaus</surname>
          </string-name>
          .
          <article-title>The Groovy Home Page</article-title>
          . http://groovy.codehaus.org/.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>T.</given-names>
            <surname>Dinkelaker</surname>
          </string-name>
          .
          <article-title>Versatile language semantics with re ective embedding</article-title>
          .
          <source>In Proceedings of the 2009 OOPSLA Doctoral Symposium</source>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>T.</given-names>
            <surname>Dinkelaker</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Eichberg</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Mezini</surname>
          </string-name>
          .
          <article-title>An architecture for composing embedded domain-speci c languages</article-title>
          .
          <source>In Proceedings of AOSD</source>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>T.</given-names>
            <surname>Ekman</surname>
          </string-name>
          and
          <string-name>
            <surname>G. Hedin.</surname>
          </string-name>
          <article-title>The jastadd extensible java compiler</article-title>
          .
          <source>In Proceedings of OOPSLA'</source>
          <year>2007</year>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>J.</given-names>
            <surname>Estublier</surname>
          </string-name>
          ,
          <string-name>
            <surname>G.</surname>
          </string-name>
          <article-title>Vega, and</article-title>
          <string-name>
            <given-names>A. D.</given-names>
            <surname>Ionita</surname>
          </string-name>
          .
          <article-title>Composing domain-speci c languages for wide-scope software engineering applications</article-title>
          .
          <source>In Proceedings of MODELS/UML</source>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>A.</given-names>
            <surname>Goldberg</surname>
          </string-name>
          and
          <string-name>
            <given-names>D.</given-names>
            <surname>Robson</surname>
          </string-name>
          . Smalltalk-
          <volume>80</volume>
          :
          <article-title>the language and its implementation</article-title>
          .
          <source>Addison-Wesley</source>
          , Boston, MA, USA,
          <year>1983</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>S.</given-names>
            <surname>Gonzalez</surname>
          </string-name>
          , W. De Meuter, and
          <string-name>
            <given-names>V.</given-names>
            <surname>Brussel</surname>
          </string-name>
          .
          <string-name>
            <surname>Domain-Speci c Language De nition Through</surname>
          </string-name>
          <article-title>Re ective Extensible Language Kernels</article-title>
          .
          <source>In Workshop on Re ectively Extensible Programming Languages and Systems (at GPCE)</source>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>J.</given-names>
            <surname>Gosling</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Joy</surname>
          </string-name>
          , G. Steele, and
          <string-name>
            <given-names>G.</given-names>
            <surname>Bracha. The Java Language Speci cation Second Edition. Addison-Wesley</surname>
          </string-name>
          , Boston, Mass,
          <year>2000</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>G.</given-names>
            <surname>Hedin</surname>
          </string-name>
          and
          <string-name>
            <surname>E. Magnusson.</surname>
          </string-name>
          <article-title>JastAddUan aspect-oriented compiler construction system</article-title>
          .
          <source>Science of Computer Programming</source>
          ,
          <volume>47</volume>
          (
          <issue>1</issue>
          ):
          <volume>37</volume>
          {
          <fpage>58</fpage>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>C.</given-names>
            <surname>Hofer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Ostermann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Rendel</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Moors</surname>
          </string-name>
          .
          <article-title>Polymorphic embedding of DSLs</article-title>
          .
          <source>In Generative Programming and Component Engineering (GPCE'08)</source>
          , pages
          <fpage>137</fpage>
          {
          <fpage>148</fpage>
          . ACM New York, NY, USA,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>P.</given-names>
            <surname>Hudak</surname>
          </string-name>
          .
          <article-title>Modular domain speci c languages and tools</article-title>
          . In P. Devanbu and J. Poulin, editors,
          <source>Proceedings: Fifth International Conference on Software Reuse</source>
          , pages
          <volume>134</volume>
          {
          <fpage>142</fpage>
          . IEEE Computer Society Press,
          <year>1998</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>G.</given-names>
            <surname>Kiczales.</surname>
          </string-name>
          <article-title>Beyond the Black Box: Open Implementation</article-title>
          .
          <source>IEEE Software</source>
          ,
          <volume>13</volume>
          (
          <issue>1</issue>
          ):8{
          <fpage>11</fpage>
          ,
          <year>1996</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>G.</given-names>
            <surname>Kiczales</surname>
          </string-name>
          , J. d. Rivieres, and
          <string-name>
            <given-names>D. G.</given-names>
            <surname>Bobrow.</surname>
          </string-name>
          <article-title>The Art of the Metaobject Protocol</article-title>
          . MIT Press, Cambridge, MA,
          <year>1991</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>D.</given-names>
            <surname>Ko</surname>
          </string-name>
          <article-title>nig and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Glover</surname>
          </string-name>
          . Groovy in Action. Manning,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>T.</given-names>
            <surname>Kosar</surname>
          </string-name>
          , P. Mart nez Lopez,
          <string-name>
            <given-names>P.</given-names>
            <surname>Barrientos</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Mernik</surname>
          </string-name>
          .
          <article-title>A preliminary study on various implementation approaches of domain-speci c language</article-title>
          .
          <source>Information and software technology</source>
          ,
          <volume>50</volume>
          (
          <issue>5</issue>
          ):
          <volume>390</volume>
          {
          <fpage>405</fpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <given-names>J.</given-names>
            <surname>Lee</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Min</surname>
          </string-name>
          , and
          <string-name>
            <given-names>D.</given-names>
            <surname>Bae</surname>
          </string-name>
          .
          <article-title>Aspect-Oriented Design (AOD) Technique for Developing Distributed Object-Oriented Systems over the Internet</article-title>
          . In International Computer Science Conference. Springer,
          <year>1999</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [21]
          <string-name>
            <given-names>P.</given-names>
            <surname>Maes</surname>
          </string-name>
          . Computational Re ection.
          <source>PhD thesis</source>
          , Vrije Universiteit Brussel,
          <year>1987</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          [22]
          <string-name>
            <given-names>M.</given-names>
            <surname>Mernik</surname>
          </string-name>
          and
          <string-name>
            <given-names>A.</given-names>
            <surname>Sloane</surname>
          </string-name>
          .
          <article-title>When and how to develop domain-speci c languages</article-title>
          .
          <source>ACM Computing Surveys (CSUR)</source>
          ,
          <volume>37</volume>
          (
          <issue>4</issue>
          ):
          <volume>316</volume>
          {
          <fpage>344</fpage>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          [23]
          <string-name>
            <given-names>P. A.</given-names>
            <surname>Muller</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Fleurey</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J. M.</given-names>
            <surname>Jezequel</surname>
          </string-name>
          .
          <article-title>Weaving executability into object-oriented meta-languages</article-title>
          .
          <source>In Proceedings of MODELS/UML</source>
          <year>2005</year>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          [24]
          <string-name>
            <given-names>N.</given-names>
            <surname>Nystrom</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Clarkson</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Myers</surname>
          </string-name>
          . Polyglot:
          <article-title>An extensible compiler framework for java</article-title>
          .
          <source>In Proceedings of the 12th International Conference on Compiler Construction</source>
          , pages
          <volume>138</volume>
          {
          <fpage>152</fpage>
          . Springer,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          <source>[25] OMG. UML 2</source>
          .
          <article-title>0 superstructure</article-title>
          .
          <source>Technical report</source>
          , Object Management Group,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref26">
        <mixed-citation>
          [26]
          <string-name>
            <given-names>N.</given-names>
            <surname>Ramsey</surname>
          </string-name>
          .
          <article-title>Ml module mania: A type-safe, separately compiled, extensible interpreter</article-title>
          .
          <source>Electronic Notes in Theoretical Computer Science</source>
          ,
          <volume>148</volume>
          (
          <issue>2</issue>
          ):
          <volume>181</volume>
          {
          <fpage>209</fpage>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref27">
        <mixed-citation>
          [27]
          <article-title>Ruby programming language</article-title>
          . http://www.ruby-lang.org/.
        </mixed-citation>
      </ref>
      <ref id="ref28">
        <mixed-citation>
          [28]
          <string-name>
            <given-names>G. L.</given-names>
            <surname>Steele</surname>
          </string-name>
          .
          <article-title>Building interpreters by composing monads</article-title>
          .
          <source>In Proceedings of the Symposium on Principles of Programming Languages</source>
          , pages
          <volume>472</volume>
          {
          <fpage>492</fpage>
          . ACM New York, NY, USA,
          <year>1994</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref29">
        <mixed-citation>
          [29]
          <string-name>
            <given-names>M.</given-names>
            <surname>Tatsubori</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Chiba</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Killijian</surname>
          </string-name>
          , and
          <string-name>
            <given-names>K.</given-names>
            <surname>Itano. OpenJava</surname>
          </string-name>
          :
          <article-title>A class-based macro system for Java</article-title>
          .
          <source>Re ection and Software Engineering</source>
          ,
          <year>1826</year>
          ,
          <year>2000</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref30">
        <mixed-citation>
          [30]
          <string-name>
            <surname>A. van Deursen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Klint</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J.</given-names>
            <surname>Visser</surname>
          </string-name>
          .
          <article-title>Domain-speci c languages: an annotated bibliography</article-title>
          .
          <source>ACM SIGPLAN Notices</source>
          ,
          <volume>35</volume>
          (
          <issue>6</issue>
          ):
          <volume>26</volume>
          {
          <fpage>36</fpage>
          ,
          <year>2000</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref31">
        <mixed-citation>
          [31]
          <string-name>
            <surname>J. van Gurp.</surname>
          </string-name>
          <article-title>Variability in software systems: the key to software reuse</article-title>
          .
          <source>PhD thesis</source>
          , Blekinge Institute of Technology,
          <year>2000</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref32">
        <mixed-citation>
          [32]
          <string-name>
            <given-names>P.</given-names>
            <surname>Wadler</surname>
          </string-name>
          .
          <article-title>Comprehending monads</article-title>
          .
          <source>In Proceedings of the 1990 ACM conference on LISP and functional programming (LFP'90)</source>
          , pages
          <fpage>61</fpage>
          {
          <fpage>78</fpage>
          ,
          <year>1990</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref33">
        <mixed-citation>
          [33]
          <string-name>
            <given-names>J.</given-names>
            <surname>Akesson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Ekman</surname>
          </string-name>
          , and
          <string-name>
            <given-names>G.</given-names>
            <surname>Hedin</surname>
          </string-name>
          .
          <article-title>Development of a modelica compiler using jastadd</article-title>
          .
          <source>Electronic Notes in Theoretical Computer Science</source>
          ,
          <volume>203</volume>
          (
          <issue>2</issue>
          ):
          <volume>117</volume>
          {
          <fpage>131</fpage>
          ,
          <year>2008</year>
          . Workshop on Language Descriptions, Tools, and
          <string-name>
            <surname>Applications</surname>
          </string-name>
          (LDTA
          <year>2007</year>
          ).
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>