A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Domain Specific Language (DSL)
A domain specific language (DSL) is
a programming language designed to be useful for a specific set
of tasks, in contrast to general-purpose programming languages.
The term DSL stands in contrast to General Purpose Language
(which refers to languages intended for solving a wide variety of
problems, but not adapted or optimized for solving problems in a
particular domain. Examples of General Purpose Languages: C,
Java, Haskell, Common Lisp, and Perl.
A DSL is somewhere between a tiny programming language and a scripting language,
and is often used in a way analogous to a programming library.
DSLs are languages (or most often, declared syntaxes or grammars) with very specific goals
in design and implementation. For instance, the command line utility grep has a regular expression
syntax which matches patterns in lines of text. The sed utility defines a syntax for matching and
replacing regular expressions. Often, these tiny languages can be used together inside a shell to
perform more complex programming tasks.
A computer language like SQL presents
an interesting case: it can be deemed a DSL because it is specific
to a specific domain (in SQL's case, accessing and managing relational
databases), and is often called from another application
A good example of DSL is the functional language
XSLT, specifically designed for transforming one XML graph into
another.
To summarize, an analogy might be useful: a Very
Little Language is like a knife, which can be used in thousands
of different ways, from cutting food to cutting down trees. A DSL
is like an electric drill: it is a powerful tool with a wide variety
of uses, but a specific context, namely, putting holes in things
(although it might also be used to mix paint or remove screws).
A General Purpose Language is a complete workbench, with a variety
of tools intended for performing a variety of tasks. DSLs should
be used by programmers who, looking at their current workbench,
realize they need a better drill, and find that a specific DSL provides
exactly that.