• Implementation Assets. Code generation tem-
plates and software components for executing a
program written in a generated DSL are defined as
the assets in the implementation technique layer.
The constraints such as the appearance order of
the domain-specific operators, the relation between
the argument types of a domain-specific operator
and domain-specific data types, and the dependency
among assets have to be defined in a feature model.
Argyle provides a diagram editor for modeling a
feature diagram consisting of the above four layers.
Domain analysis is performed by expert engineers fa-
miliar with domain knowledge and the theory of pro-
gramming languages. However, in Argyle, language
design shown in the next can be performed by ordi-
nary programmers. Compiler construction is fully au-
tomated.
3.2 Language Design Support
3.2.1 Overview
In Argyle, a DSL is constructed by configuring lan-
guage assets as follows:
1. Argyle acquires DSL requirements by letting a
DSL user (programmer)select the necessary func-
tions of the anticipated DSL from capability assets
and an execution platform from implementation
assets.
2. According to the above selection, Argyle extracts
the related syntax assets and data type assets. Af-
ter that, Argyle configures these assets to generate
the DSL grammar in the form of BNF consisting
of domain-specific operators, reserved words, and
data types. Using this DSL, we can write a pro-
gram that realizes the functions specified in step
1.
3. Argyle extracts a set of implementation assets for
the DSL compiler to generate the executable code
from a program written in the DSL generated in
step 2.
DSL users have only to execute a few simple oper-
ations in step 1. Even the ordinary programmers with-
out the deep knowledge of programming language
processors can develop a DSL, because step 2 and 3
can be automatically performed by Argyle. In Argyle,
a feature model, constraints among language assets,
and user requirements are encoded into logical for-
mulas. A generated DSL corresponds to the subset
of these assets satisfying constraints and user require-
ments. We use Alloy (Jackson, 2006) (Gheyi et al.,
2006) to obtain the subset(Nakajima and Ubayashi,
2007). Alloy, a name of both a formal specification
language used for describing structures (e.g., feature
model) and an analyzer tool for exploring them, has
been proved to be effective for describing and find-
ing structures. In this paper, we call the specification
language “Alloy language” and the analyzer tool “Al-
loy Analyzer” separately. Argyle can easily encode a
feature model, constraints, and user requirements into
Alloy code. We introduce the Alloy encoding pat-
terns.
3.2.2 Translation from Feature Model into Alloy
Language
Two elements (i.e., signatures and predicate) of the
Alloy language are mainly used in our encoding. Re-
served words, sig and pred, are used to declare these
two elements. A signature is used to define a set of
atoms and may have some fields in its body that can
be used to establish a relation to the other signature.
The concept of a signature is as similar as a class in
Java and a field in a signature looks like an attribute
or property in a Java class. On the other hand, a pred-
icate is used to define the interaction among signa-
tures. Using predicate in Alloy language is as similar
as using a method in Java.
The main encoding patterns consist of the encod-
ing of features (Figure 2), relations (Figure 3), and
composition rules (Figure 4).
An abstract signature “Feature” is defined at first
by using the reserved word abstract. “Feature” has
two fields: “up” and “select”. The “up” field points
to the super feature. If the current feature is selected,
the “select” field is set to “Yes” otherwise to “No”. A
concrete feature is defined by extending abstract sig-
nature using the reserved word extends. All concrete
features also have the above two fields.
The relations among features are defined by using
predicates. In a predicate, “... =>... else ...” signifies
the expression if ... then ... else ... and a reserved
word and means a logical conjunction. Each predi-
cate defines a relation among features by indicating,
for example, whether these features can be selected at
the same time or not.
A feature related to a syntax asset in the operat-
ing environment layer is distinctive from other fea-
tures, because it is considered as an “Operator” in our
encoding. An “Operator” is a special “Feature” that
has some new fields such as “next”. These fields are
used to define some additional information which are
necessary on constructing BNF. For example, “next”
is used to define the order between two “Operator”s
when they appear in a BNF. The details are described
inside the predicate “GeneratingRule”.
AutomatedDSLConstructionBasedonSoftwareProductLines
249