ing if the MDA transformations are in fact semantic-
preserving. We have chosen to introduce reductions
in MDA by using model transformations. In partic-
ular, for each reduction, we have specified an ATL
module containing minor reductions specified as ATL
rules. In essence, they are rewrite rules that match
input models patterns, expressed as semantic algebra
elements on the input metamodel, and produce output
as semantic algebra patterns.
Our set of ATL transformation rules generates in-
termediate and final representations of semantic alge-
bra specifications. We have implemented the main λ-
reductions described in (Schmidt, 1986): α, β and η.
The reductions were implemented as ATL rules, using
ATL helpers for auxiliary functions or attributes. Due
to the lack of space, we illustrate the β-reduction. It is
useful for simplifying an expression, defining the idea
of evaluation of a function application (f x).
In the module BetaReduction, the formula in
which the β-transformation will be carried out is
(λv.E) e. The input expression needs to be an applica-
tion with the operator as an abstraction, as indicated
at lines 4-5 by the input match. This is necessary to
satisfy the β equation: (λv. E ) E1 ⇒β E[v → E1].
The rule (Abs2AbsFree) at lines 8-10 deals with the
input as a LambdaAbstraction. It invokes an auxiliary
function (line 10) to discover the free occurrences of
the formal parameter in the body of f which are to be
replaced for. The auxiliary function is implemented
with the ATL helper isFree at lines 11-15, which de-
clares that the parameter variable is free, considering
the body of the function as an expression, if: (i) it is
a variable with the same name of the parameter vari-
able; or (ii) it is an application and recursively the
variable is free for the operator or the operand, or (iii)
it is an abstraction with the same parameter and has a
free body.
1: module BetaReduction;
2: create OUT : LC from IN : LC;
...
3: rule Expression2Expression {
4: from
5: in:LC!Expression(in.isApp() and in.operator.isAbs())
6: to
7: out:LC!Expression
...
8: rule Abs2AbsFree {
9: from
10: in:LC!LambdaAbstraction(not(self.isFree(self.v,in)))
...
11: helper def: isFree (v:LC!Variable, e:LC!Expression):Boolean =
12: (e.isVar() and (v.name = e.name)) or
13: (e.isApp() and self.isFree(v,e.operator) or
14: self.isFree(v,e.operand)) or (e.isAbs() and
15: (not(v.name = e.parameter.name) and self.isFree(v,e.body)));
In order to build and validate our approach, we
have adopted the ATL-DT (AI0, 2004) framework.
It is an Eclipse plugin that allows in an integrated
way: (i) specifying and validating metamodels; (ii)
creating and validating models in conformance with
their provided metamodels; (iii) specifying and exe-
cuting model transformations based on metamodels
and applied to valid models. These transformations
are already being applied to several complex seman-
tic models. By adopting a framework that fully sup-
ports most of the OMG standards, we promote the in-
tegration of our work with other existing tools, such
as model or code editors.
5 AN INSTANTIATION EXAMPLE
In order to validate the proposed metamodel, we
reused several classical specifications from (Schmidt,
1986). In Fig. 6 we illustrate the specification for
imperative languages given in Section 2. The intro-
duced labeled boxes represent instantiations of the
metaclasses and the dotted arrows represent instanti-
ations outgoing from the box and ingoing the meta-
classes. First of all, one instance of the metaclass
SemanticAlgebra is shown in the box 1 and four in-
stances of the associated metaclass Domain in the box
2, corresponding to the four existing domains.
In Fig. 7 we give a general view of the instantiated
elements. We deal with three existing primitive do-
mains: TruthValues, NaturalNumbers and Identifiers
instantiated in box 3. We also have one compound
domain: Store, in box 4. Its operations are shown in
the top of box 5, except for Identifiers which have no
operation. It was also necessary to add to the hierar-
chy of the CompoundDomain a new subclass to rep-
resent Store. It was instantiated as a map from Iden-
tifier to a NaturalNumber (the two domains that to-
gether compose the store), implementing a Function-
Space. A domain is also composed by a Description
as shown in box 6. It applies the set of Natural num-
bers from mathematics into the NaturalNumbers do-
main, the commonly used Boolean values from pro-
gramming languages into TruthValues and a set of
identifiers composed by any character string into the
Identifiers domain.
The remaining expressions proposed in the Store
domain operations are instantiated as shown in Fig. 8.
In box 7 we have two nested λ-expressions delimited
by the λ symbol until the end. The first lambda ab-
straction receives the variable i as parameter and has
the second lambda abstraction as expression. The sec-
ond lambda abstraction receives the variable s as pa-
rameter and makes the function application of s onto i
as its expression. The expression in box 8 follows the
same idea, but the expression of a lambda abstraction
is a constant, zero in this case. Box 9 presents the cre-
ation of an anonymous lambda abstraction, with the
variable i as parameter, the variable n as expression
and the anonymous function is applied to the variable
ICSOFT 2008 - International Conference on Software and Data Technologies
334