Softw Syst Model (2012) 11:251–272
DOI 10.1007/s10270-010-0176-6
SPECIAL SECTION PAPER
Code generation for a family of executable modelling notations
Adam Prout · Joanne M. Atlee · Nancy A. Day ·
Pourya Shaker
Received: 30 June 2009 / Revised: 5 September 2010 / Accepted: 20 September 2010 / Published online: 27 October 2010
© Springer-Verlag 2010
Abstract We are investigating semantically configurable
model-driven engineering (MDE). The goal of this work is
a modelling environment that supports flexible, configurable
modelling notations, in which specifiers can configure the
semantics of notations to suit their needs and yet still have
access to the types of analysis tools and code generators
normally associated with MDE. In this paper, we describe
semantically configurable code generation for a family of
behavioural modelling notations. The family includes vari-
ants of statecharts, process algebras, Petri Nets, and SDL88.
The semantics of this family is defined using template seman-
tics, which is a parameterized structured operational seman-
tics in which parameters represent semantic variation points.
A specific notation is derived by instantiating the fam-
ily’s template semantics with parameter values that specify
semantic choices. We have developed a code-generator gen-
erator (CGG) that creates a suitable Java code generator for a
subset of derivable modelling notations. Our prototype CGG
supports 26 semantics parameters, 89 parameter values, and
7 composition operators. As a result, we are able to produce
code generators for a sizable family of modelling notations,
though at present the performance of our generated code is
Communicated by Prof. Krzysztof Czarnecki.
A. Prout · J. M. Atlee (B ) · N. A. Day · P. Shaker
David R. Cheriton School of Computer Science,
University of Waterloo, Waterloo, ON N2L 3G1, Canada
e-mail: jmatlee@uwaterloo.ca
A. Prout
e-mail: aprout@uwaterloo.ca
N. A. Day
e-mail: nday@uwaterloo.ca
P. Shaker
e-mail: p2shaker@uwaterloo.ca
about an order of magnitude slower than that produced by
commercial-grade generators.
Keywords Model-driven engineering · Code generation
1 Introduction
A significant obstacle to successful model-driven engineer-
ing (MDE) is the semantic mismatch between the problem or
system being modelled and the chosen modelling notation.
A primary reason for this mismatch is that many modellers
restrict themselves to notations that have tool support (i.e.,
model editors, simulators, analyzers, and code generators).
However, only a small fraction of notations—or, more spe-
cifically, a small fraction of the semantic variants of nota-
tions—are supported by substantial tool suites.
There is ample anecdotal evidence to suggest that mod-
ellers want to be able to use a wider set of notations and
semantics. Consider the many variants of statecharts [62],
some of which were invented precisely because neither
the original variants [23, 24] nor the tool-supported variants
[12, 25] suited the modellers’ needs. As another prominent
data point, consider the semantics of the United Modeling
Language (UML) [50, 59], which includes several seman-
tic variation points because the Object Management Group
(OMG) members who define and maintain the UML spec-
ification could not agree on a single semantics. As addi-
tional evidence, the authors have witnessed cases where
notations are tweaked in ad hoc ways to ease the modelling of
a particular problem. We have also witnessed graduate-level
formal-methods students who, when given the flexibility to
do so, combine the features and semantics of multiple model-
ling notations rather than express their modelling problems
in some (single) standard notation. For example, they will
123