I'm happy to announce that I will be writing a chapter for an upcoming
book on Domain Specific Languages. The chapter description is given
Extensible languages -- blurring the distinction between DSLs and GPLs
Domain-specific language (DSL) design and implementation is inherently a
transversal activity. It usually requires from the application
developers knowledge and expertise in both the application domain and in
language design and implementation, two completely orthogonal areas of
expertise. The difficulty is that either one needs to find people with
such dual competence, which is rare, or one needs to add manpower to the
project by means of different teams which in turn need to coordinate
their efforts and communicate together, something not easy to do either.
From the programming language perspective, one
is that being an expert developer in one specific
does not make you an expert in language design and implementation --
only in using one of them. DSLs, however, are most of the time
completely different from the language in which the embedding
application is written. A general-purpose programming language (GPL),
suitable to write a large application, is generally not suited to
domain-specific modeling, precisely because it is too general. Using a
GPL for domain-specific modeling would require too much expertise from
the end-users and wouldn't be expressive enough for the very specific
domain the application is supposed to focus on.
As a consequence, it is often taken for granted that your application's
DSL has to be completely different from your application's GPL. But what
if this assumption was wrong in the first place ?
The need for designing a DSL as a completely new language often comes
from the lack of extensibility of your GPL of choice. By imposing a
rigid syntax, a set of predefined operators and data structures on you,
the traditional GPL approach gives you no choice but to implement your
application's DSL as a different language, with its own lexical and
syntactic parser, semantic analyzer and possibly its own brand new
interpreter or even compiler.
A much less widely accepted view, however, is that some GPLs are
extensible, or customizable enough to let you implement a DSL merely as
either a subset or an extension of your original language. The result is
that your final application, as a whole, is now written in a completely
unified language. While the end-user does not have access to the whole
backstage infrastructure and hence does not really see a difference with
the traditional approach, the gain for the developer is substantial.
Since the DSL is now just another entry point for the same original GPL,
there is essentially only one application written in only one language
to maintain. Moreover, no specific language infrastructure (parser,
interpreter, compiler etc.) is required for the DSL anymore, since it is
simply expressed in terms of the original GPL. The already existing GPL
infrastructure is all that is needed.
Resistance is futile. You will be jazzimilated.
Scientific site: http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com
EPITA/LRDE, 14-16 rue Voltaire, 94276 Le Kremlin-Bicêtre, France
Tel. +33 (0)1 44 08 01 85 Fax. +33 (0)1 53 14 59 22