A domain-specific language (DSL) is a
computer language
A computer language is a formal language used to communicate with a computer. Types of computer languages include:
* Construction language – all forms of communication by which a human can specify an executable problem solution to a compu ...
specialized to a particular application
domain
Domain may refer to:
Mathematics
*Domain of a function, the set of input values for which the (total) function is defined
**Domain of definition of a partial function
**Natural domain of a partial function
**Domain of holomorphy of a function
* Do ...
. This is in contrast to a
general-purpose language
A general-purpose language is a computer language that is broadly applicable across application domains, and lacks specialized features for a particular domain. This is in contrast to a domain-specific language (DSL), which is specialized to a par ...
(GPL), which is broadly applicable across domains. There are a wide variety of DSLs, ranging from widely used languages for common domains, such as
HTML
The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScri ...
for web pages, down to languages used by only one or a few pieces of software, such as
MUSH
In multiplayer online games, a MUSH (a backronymed variation on MUD most often expanded as Multi-User Shared Hallucination, though Multi-User Shared Hack, Habitat, and Holodeck are also observed) is a text-based online social medium to which mult ...
soft code. DSLs can be further subdivided by the kind of language, and include domain-specific
''markup'' languages, domain-specific
''modeling'' languages (more generally,
specification language
A specification language is a formal language in computer science used during systems analysis, requirements analysis, and systems design to describe a system at a much higher level than a programming language, which is used to produce the executa ...
s), and domain-specific
''programming'' languages. Special-purpose computer languages have always existed in the computer age, but the term "domain-specific language" has become more popular due to the rise of
domain-specific modeling. Simpler DSLs, particularly ones used by a single application, are sometimes informally called mini-languages.
The line between general-purpose languages and domain-specific languages is not always sharp, as a language may have specialized features for a particular domain but be applicable more broadly, or conversely may in principle be capable of broad application but in practice used primarily for a specific domain. For example,
Perl
Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offici ...
was originally developed as a text-processing and glue language, for the same domain as
AWK
AWK (''awk'') is a domain-specific language designed for text processing and typically used as a data extraction and reporting tool. Like sed and grep, it is a filter, and is a standard feature of most Unix-like operating systems.
The AWK lang ...
and
shell script
A shell script is a computer program designed to be run by a Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be scripting languages. Typical operations performed by shell scripts include file manip ...
s, but was mostly used as a general-purpose programming language later on. By contrast,
PostScript
PostScript (PS) is a page description language in the electronic publishing and desktop publishing realm. It is a dynamically typed, concatenative programming language. It was created at Adobe Systems by John Warnock, Charles Geschke, Doug Br ...
is a
Turing-complete
In computability theory, a system of data-manipulation rules (such as a computer's instruction set, a programming language, or a cellular automaton) is said to be Turing-complete or computationally universal if it can be used to simulate any Tur ...
language, and in principle can be used for any task, but in practice is narrowly used as a
page description language
In digital printing, a page description language (PDL) is a computer language that describes the appearance of a printed page in a higher level than an actual output bitmap (or generally raster graphics). An overlapping term is printer control la ...
.
Use
The design and use of appropriate DSLs is a key part of
domain engineering Domain engineering, is the entire process of reusing domain knowledge in the production of new software systems. It is a key concept in systematic code reuse, software reuse and product line engineering. A key idea in systematic software reuse is th ...
, by using a language suitable to the domain at hand – this may consist of using an existing DSL or GPL, or developing a new DSL.
Language-oriented programming
Language-oriented programming (LOP) is a software-development paradigm where "language" is a software building block with the same status as objects, modules and components, and rather than solving problems in general-purpose programming languages, ...
considers the creation of special-purpose languages for expressing problems as standard part of the problem-solving process. Creating a domain-specific language (with software to support it), rather than reusing an existing language, can be worthwhile if the language allows a particular type of problem or solution to be expressed more clearly than an existing language would allow and the type of problem in question reappears sufficiently often. Pragmatically, a DSL may be specialized to a particular problem domain, a particular problem representation technique, a particular solution technique, or other aspects of a domain.
Overview
A domain-specific language is created specifically to solve problems in a particular domain and is not intended to be able to solve problems outside of it (although that may be technically possible). In contrast, general-purpose languages are created to solve problems in many domains. The domain can also be a business area. Some examples of business areas include:
* life insurance policies (developed internally by a large insurance enterprise)
* combat simulation
* salary calculation
* billing
A domain-specific language is somewhere between a tiny programming language and a
scripting language
A scripting language or script language is a programming language that is used to manipulate, customize, and automate the facilities of an existing system. Scripting languages are usually interpreted at runtime rather than compiled.
A scripting ...
, and is often used in a way analogous to a
programming library
In computer science, a library is a collection of non-volatile resources used by computer programs, often for software development. These may include configuration data, documentation, help data, message templates, pre-written code and su ...
. The boundaries between these concepts are quite blurry, much like the boundary between scripting languages and general-purpose languages.
In design and implementation
Domain-specific languages are languages (or often, declared syntaxes or grammars) with very specific goals in design and implementation. A domain-specific language can be one of a visual diagramming language, such as those created by the
Generic Eclipse Modeling System
Generic Eclipse Modeling System (GEMS) is a configurable toolkit for creating domain-specific modeling and program synthesis environments for Eclipse. The project aims to bridge the gap between the communities experienced with visual metamodeling ...
, programmatic abstractions, such as the
Eclipse Modeling Framework
Eclipse Modeling Framework (EMF) is an Eclipse-based modeling framework and code generation facility for building tools and other applications based on a structured data model.
From a model specification described in XML Metadata Interchange ...
, or textual languages. For instance, the command line utility
grep
grep is a command-line utility for searching plain-text data sets for lines that match a regular expression. Its name comes from the ed command ''g/re/p'' (''globally search for a regular expression and print matching lines''), which has the sam ...
has a
regular expression
A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or ...
syntax which matches patterns in lines of text. The
sed
sed ("stream editor") is a Unix utility that parses and transforms text, using a simple, compact programming language. It was developed from 1973 to 1974 by Lee E. McMahon of Bell Labs,
and is available today for most operating systems.
sed w ...
utility defines a syntax for matching and replacing regular expressions. Often, these tiny languages can be used together inside a
shell
Shell may refer to:
Architecture and design
* Shell (structure), a thin structure
** Concrete shell, a thin shell of concrete, usually with no interior columns or exterior buttresses
** Thin-shell structure
Science Biology
* Seashell, a hard o ...
to perform more complex programming tasks.
The line between domain-specific languages and
scripting language
A scripting language or script language is a programming language that is used to manipulate, customize, and automate the facilities of an existing system. Scripting languages are usually interpreted at runtime rather than compiled.
A scripting ...
s is somewhat blurred, but domain-specific languages often lack low-level functions for filesystem access, interprocess control, and other functions that characterize full-featured programming languages, scripting or otherwise. Many domain-specific languages do not compile to
byte-code
Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normall ...
or executable code, but to various kinds of media objects: GraphViz exports to
PostScript
PostScript (PS) is a page description language in the electronic publishing and desktop publishing realm. It is a dynamically typed, concatenative programming language. It was created at Adobe Systems by John Warnock, Charles Geschke, Doug Br ...
,
GIF
The Graphics Interchange Format (GIF; or , see pronunciation) is a bitmap image format that was developed by a team at the online services provider CompuServe led by American computer scientist Steve Wilhite and released on 15 June 1987. ...
,
JPEG
JPEG ( ) is a commonly used method of lossy compression for digital images, particularly for those images produced by digital photography. The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and imag ...
, etc., where
Csound
Csound is a domain-specific computer programming language for audio programming. It is called Csound because it is written in C, as opposed to some of its predecessors.
It is free software, available under the LGPL-2.1-or-later.
Csound was or ...
compiles to audio files, and a ray-tracing domain-specific language like
POV compiles to graphics files. A computer language like
SQL presents an interesting case: it can be deemed a domain-specific language because it is specific to a specific domain (in SQL's case, accessing and managing relational databases), and is often called from another application, but SQL has more keywords and functions than many scripting languages, and is often thought of as a language in its own right, perhaps because of the prevalence of database manipulation in programming and the amount of mastery required to be an expert in the language.
Further blurring this line, many domain-specific languages have exposed APIs, and can be accessed from other programming languages without breaking the flow of execution or calling a separate process, and can thus operate as programming libraries.
Programming tools
Some domain-specific languages expand over time to include full-featured programming tools, which further complicates the question of whether a language is domain-specific or not. A good example is the
functional language
In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that m ...
XSLT
XSLT (Extensible Stylesheet Language Transformations) is a language originally designed for transforming XML documents into other XML documents, or other formats such as HTML for web pages, plain text or XSL Formatting Objects, which may subseque ...
, specifically designed for transforming one XML graph into another, which has been extended since its inception to allow (particularly in its 2.0 version) for various forms of filesystem interaction, string and date manipulation, and data typing.
In
model-driven engineering
Model-driven engineering (MDE) is a software development methodology that focuses on creating and exploiting domain models, which are conceptual models of all the topics related to a specific problem. Hence, it highlights and aims at abstract re ...
, many examples of domain-specific languages may be found like
OCL, a language for decorating models with assertions or
QVT
QVT (Query/View/Transformation) is a standard set of languages for model transformation defined by the Object Management Group.
Overview
Model transformation is a key technique used in model-driven architecture. As the name QVT indicates, the ...
, a domain-specific transformation language. However, languages like
UML
The Unified Modeling Language (UML) is a general-purpose, developmental modeling language in the field of software engineering that is intended to provide a standard way to visualize the design of a system.
The creation of UML was originally m ...
are typically general-purpose modeling languages.
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 domain-specific language 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. A General Purpose Language is a complete workbench, with a variety of tools intended for performing a variety of tasks. Domain-specific languages should be used by programmers who, looking at their current workbench, realize they need a better drill and find that a particular domain-specific language provides exactly that.
Domain-specific language topics
External and Embedded Domain Specific Languages
DSLs implemented via an independent interpreter or compiler are known as ''External Domain Specific Languages''. Well known examples include LaTeX or AWK. A separate category known as ''Embedded (or Internal) Domain Specific Languages'' are typically implemented within a host language as a library and tend to be limited to the syntax of the host language, though this depends on host language capabilities.
Usage patterns
There are several usage patterns for domain-specific languages:
[Marjan Mernik, Jan Heering, and Anthony M. Sloane. When and how to develop domain-specific languages. ''ACM Computing Surveys'', 37(4):316–344, 2005.][Diomidis Spinellis]
Notable design patterns for domain specific languages
''Journal of Systems and Software'', 56(1):91–99, February 2001.
* Processing with standalone tools, invoked via direct user operation, often on the command line or from a
Makefile
In software development, Make is a build automation tool that automatically builds executable programs and libraries from source code by reading files called ''Makefiles'' which specify how to derive the target program. Though integrated develo ...
(e.g., grep for regular expression matching, sed, lex, yacc, the
GraphViz
Graphviz (short for ''Graph Visualization Software'') is a package of open-source tools initiated by AT&T Labs Research for drawing graphs specified in DOT language scripts having the file name extension "gv". It also provides libraries for sof ...
toolset, etc.)
* Domain-specific languages which are implemented using programming language macro systems, and which are converted or expanded into a host general purpose language at compile-time or realtime
* embedded domain-specific language (eDSL), implemented as libraries which exploit the syntax of their host general purpose language or a subset thereof while adding domain-specific language elements (data types, routines, methods, macros etc.). (e.g.
jQuery
jQuery is a JavaScript library designed to simplify HTML DOM tree traversal and manipulation, as well as event handling, CSS animation, and Ajax. It is free, open-source software using the permissive MIT License. As of Aug 2022, jQuery is used ...
,
React REACT or React may refer to:
Science and technology
*REACT (telescope), a telescope at Fenton Hill Observatory, New Mexico, US
Computing
* React (JavaScript library) , a JavaScript library for building user interfaces, from Facebook
** React Nati ...
,
Embedded SQL
Embedded SQL is a method of combining the computing power of a programming language and the database Data Manipulation Language, manipulation capabilities of SQL. Embedded SQL statement (programming), statements are SQL statements written inline wi ...
,
LINQ
Language Integrated Query (LINQ, pronounced "link") is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages, originally released as a major part of .NET Framework 3.5 in 2007.
LINQ extends the langua ...
)
* Domain-specific languages which are called (at runtime) from programs written in general purpose languages like
C or
Perl
Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offici ...
, to perform a specific function, often returning the results of operation to the "host" programming language for further processing; generally, an interpreter or
virtual machine
In computing, a virtual machine (VM) is the virtualization/emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized hardw ...
for the domain-specific language is embedded into the host application (e.g.
format string
The printf format string is a control parameter used by a class of functions in the input/output libraries of C and many other programming languages. The string is written in a simple template language: characters are usually copied literal ...
s, a
regular expression engine)
* Domain-specific languages which are embedded into user applications (e.g., macro languages within spreadsheets) and which are (1) used to execute code that is written by users of the application, (2) dynamically generated by the application, or (3) both.
Many domain-specific languages can be used in more than one way. DSL code embedded in a host language may have special syntax support, such as regexes in sed, AWK, Perl or JavaScript, or may be passed as strings.
Design goals
Adopting a domain-specific language approach to software engineering involves both risks and opportunities. The well-designed domain-specific language manages to find the proper balance between these.
Domain-specific languages have important design goals that contrast with those of general-purpose languages:
* Domain-specific languages are less comprehensive.
* Domain-specific languages are much more expressive in their domain.
* Domain-specific languages should exhibit minimal
redundancy.
Idioms
In programming,
idioms
An idiom is a phrase or expression that typically presents a figurative, non-literal meaning attached to the phrase; but some phrases become figurative idioms while retaining the literal meaning of the phrase. Categorized as formulaic language, ...
are methods imposed by programmers to handle common development tasks, e.g.:
* Ensure data is saved before the window is closed.
* Edit code whenever command-line parameters change because they affect program behavior.
General purpose programming languages rarely support such idioms, but domain-specific languages can describe them, e.g.:
* A script can automatically save data.
* A domain-specific language can parameterize command line input.
Examples
Examples of domain-specific languages include
HTML
The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScri ...
,
Logo
A logo (abbreviation of logotype; ) is a graphic mark, emblem, or symbol used to aid and promote public identification and recognition. It may be of an abstract or figurative design or include the text of the name it represents as in a wordma ...
for pencil-like drawing,
Verilog
Verilog, standardized as IEEE 1364, is a hardware description language (HDL) used to model electronic systems. It is most commonly used in the design and verification of digital circuits at the register-transfer level of abstraction. It is also ...
and
VHDL
The VHSIC Hardware Description Language (VHDL) is a hardware description language (HDL) that can model the behavior and structure of digital systems at multiple levels of abstraction, ranging from the system level down to that of logic gates ...
hardware description languages,
MATLAB
MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementation ...
and
GNU Octave
GNU Octave is a high-level programming language primarily intended for scientific computing and numerical computation. Octave helps in solving linear and nonlinear problems numerically, and for performing other numerical experiments using a langu ...
for matrix programming,
Mathematica
Wolfram Mathematica is a software system with built-in libraries for several areas of technical computing that allow machine learning, statistics, symbolic computation, data manipulation, network analysis, time series analysis, NLP, optimizat ...
,
Maple
''Acer'' () is a genus of trees and shrubs commonly known as maples. The genus is placed in the family Sapindaceae.Stevens, P. F. (2001 onwards). Angiosperm Phylogeny Website. Version 9, June 2008 nd more or less continuously updated since http ...
and
Maxima for
symbolic mathematics
In mathematics and computer science, computer algebra, also called symbolic computation or algebraic computation, is a scientific area that refers to the study and development of algorithms and software for manipulating mathematical expressions ...
,
Specification and Description Language Specification and Description Language (SDL) is a specification language targeted at the unambiguous specification and description of the behaviour of reactive and distributed systems.
Overview
The ITU-T has defined SDL in Recommendations Z.100 t ...
for reactive and distributed systems,
spreadsheet
A spreadsheet is a computer application for computation, organization, analysis and storage of data in tabular form. Spreadsheets were developed as computerized analogs of paper accounting worksheets. The program operates on data entered in cel ...
formulas and macros,
SQL for
relational database
A relational database is a (most commonly digital) database based on the relational model of data, as proposed by E. F. Codd in 1970. A system used to maintain relational databases is a relational database management system (RDBMS). Many relatio ...
queries,
YACC
Yacc (Yet Another Compiler-Compiler) is a computer program for the Unix operating system developed by Stephen C. Johnson. It is a Look Ahead Left-to-Right Rightmost Derivation (LALR) parser generator, generating a LALR parser (the part of a com ...
grammars for creating
parsers
Parsing, syntax analysis, or syntactic analysis is the process of analyzing a string of symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal grammar. The term ''parsing'' comes from L ...
,
regular expressions
A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or ...
for specifying
lexers, the
Generic Eclipse Modeling System
Generic Eclipse Modeling System (GEMS) is a configurable toolkit for creating domain-specific modeling and program synthesis environments for Eclipse. The project aims to bridge the gap between the communities experienced with visual metamodeling ...
for creating diagramming languages,
Csound
Csound is a domain-specific computer programming language for audio programming. It is called Csound because it is written in C, as opposed to some of its predecessors.
It is free software, available under the LGPL-2.1-or-later.
Csound was or ...
for sound and music synthesis, and the input languages of
GraphViz
Graphviz (short for ''Graph Visualization Software'') is a package of open-source tools initiated by AT&T Labs Research for drawing graphs specified in DOT language scripts having the file name extension "gv". It also provides libraries for sof ...
and
GrGen
GrGen.NET is a software development tool that offers programming languages ( domain-specific languages) that are optimized for the processing of graph structured data.
The core of the languages consists of modular graph rewrite rules, which ...
, software packages used for
graph layout
Graph drawing is an area of mathematics and computer science combining methods from geometric graph theory and information visualization to derive two-dimensional depictions of graphs arising from applications such as social network analysis, ...
and
graph rewriting
In computer science, graph transformation, or graph rewriting, concerns the technique of creating a new graph out of an original graph algorithmically. It has numerous applications, ranging from software engineering (software construction and also ...
,
Hashicorp Configuration Language
HashiCorp is a software company with a freemium business model based in San Francisco, California. HashiCorp provides open-source tools and commercial products that enable developers, operators and security professionals to provision, secure, run ...
used for
Terraform and other
Hashicorp
HashiCorp is a software company with a freemium business model based in San Francisco, California. HashiCorp provides open-source tools and commercial products that enable developers, operators and security professionals to provision, secure, run ...
tools,
Puppet
A puppet is an object, often resembling a human, animal or Legendary creature, mythical figure, that is animated or manipulated by a person called a puppeteer. The puppeteer uses movements of their hands, arms, or control devices such as rods ...
also has its own
configuration language.
GameMaker Language
The GML scripting language used by
GameMaker Studio
GameMaker (originally Animo, Game Maker ''(until 2011)'' and GameMaker Studio) is a series of cross-platform game engines created by Mark Overmars in 1999 and developed by YoYo Games since 2007. The latest iteration of ''GameMaker'' released ...
is a domain-specific language targeted at novice programmers to easily be able to learn programming. While the language serves as a blend of multiple languages including
Delphi
Delphi (; ), in legend previously called Pytho (Πυθώ), in ancient times was a sacred precinct that served as the seat of Pythia, the major oracle who was consulted about important decisions throughout the ancient classical world. The oracle ...
,
C++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
, and
BASIC
BASIC (Beginners' All-purpose Symbolic Instruction Code) is a family of general-purpose, high-level programming languages designed for ease of use. The original version was created by John G. Kemeny and Thomas E. Kurtz at Dartmouth College ...
, there is a lack of structures, data types, and other features of a full-fledged programming language. Many of the built-in functions are
sandboxed
In computer security, a sandbox is a security mechanism for separating running programs, usually in an effort to mitigate system failures and/or software Vulnerability (computing), vulnerabilities from spreading. The isolation metaphor is taken ...
for the purpose of easy portability. The language primarily serves to make it easy for anyone to pick up the language and develop a game.
ColdFusion Markup Language
ColdFusion
Adobe ColdFusion is a commercial rapid web-application development computing platform created by J. J. Allaire in 1995. (The programming language used with that platform is also commonly called ColdFusion, though is more accurately known as CF ...
's associated scripting language is another example of a domain-specific language for data-driven websites.
This scripting language is used to weave together languages and services such as Java, .NET, C++, SMS, email, email servers, http, ftp, exchange, directory services, and file systems for use in websites.
The
ColdFusion Markup Language
ColdFusion Markup Language, more commonly known as CFML, is a scripting language for web development that runs on the JVM, the .NET framework, and Google App Engine. Multiple commercial and open source implementations of CFML engines are availab ...
(CFML) includes a set of tags that can be used in ColdFusion pages to interact with data
sources, manipulate data, and display output. CFML tag syntax is similar to HTML element syntax.
Erlang OTP
The Erlang Open Telecom Platform was originally designed for use inside
Ericsson
(lit. "Telephone Stock Company of LM Ericsson"), commonly known as Ericsson, is a Swedish multinational networking and telecommunications company headquartered in Stockholm. The company sells infrastructure, software, and services in informat ...
as a domain-specific language. The language itself offers a platform of libraries to create finite state machines, generic servers and event managers that quickly allow an engineer to deploy applications, or support libraries, that have been shown in industry benchmarks to outperform other languages intended for a mixed set of domains, such as C and C++. The language is now officially open source and can be downloaded from their website.
FilterMeister
FilterMeister is a programming environment, with a programming language that is based on C, for the specific purpose of creating
Photoshop
Adobe Photoshop is a raster graphics editor developed and published by Adobe Inc. for Windows and macOS. It was originally created in 1988 by Thomas and John Knoll. Since then, the software has become the industry standard not only in raster ...
-compatible image processing filter plug-ins; FilterMeister runs as a Photoshop plug-in itself and it can load and execute scripts or compile and export them as independent plug-ins.
Although the FilterMeister language reproduces a significant portion of the C language and function library, it contains only those features which can be used within the context of Photoshop plug-ins and adds a number of specific features only useful in this specific domain.
MediaWiki templates
The ''Template'' feature of
MediaWiki
MediaWiki is a free and open-source wiki software. It is used on Wikipedia and almost all other Wikimedia websites, including Wiktionary, Wikimedia Commons and Wikidata; these sites define a large part of the requirement set for MediaWiki ...
is an embedded domain-specific language whose fundamental purpose is to support the creation of
page templates and the
transclusion
In computer science, transclusion is the inclusion of part or all of an electronic document into one or more other documents by reference via hypertext. Transclusion is usually performed when the referencing document is displayed, and is normal ...
(inclusion by reference) of MediaWiki pages into other MediaWiki pages.
Software engineering uses
There has been much interest in domain-specific languages to improve the productivity and quality of
software engineering
Software engineering is a systematic engineering approach to software development.
A software engineer is a person who applies the principles of software engineering to design, develop, maintain, test, and evaluate computer software. The term '' ...
. Domain-specific language could possibly provide a robust set of tools for efficient software engineering. Such tools are beginning to make their way into the development of critical software systems.
The Software Cost Reduction Toolkit is an example of this. The toolkit is a suite of utilities including a specification editor to create a
requirements specification, a dependency graph browser to display variable dependencies, a
consistency checker to catch missing cases in
well-formed formula
In mathematical logic, propositional logic and predicate logic, a well-formed formula, abbreviated WFF or wff, often simply formula, is a finite sequence of symbols from a given alphabet that is part of a formal language. A formal language can be ...
s in the specification, a
model checker
In computer science, model checking or property checking is a method for checking whether a finite-state model of a system meets a given specification (also known as correctness). This is typically associated with hardware or software system ...
and a
theorem prover to check program properties against the specification, and an invariant generator that automatically constructs invariants based on the requirements.
A newer development is
language-oriented programming
Language-oriented programming (LOP) is a software-development paradigm where "language" is a software building block with the same status as objects, modules and components, and rather than solving problems in general-purpose programming languages, ...
, an integrated software engineering
methodology
In its most common sense, methodology is the study of research methods. However, the term can also refer to the methods themselves or to the philosophical discussion of associated background assumptions. A method is a structured procedure for bri ...
based mainly on creating, optimizing, and using domain-specific languages.
Metacompilers
Complementing
language-oriented programming
Language-oriented programming (LOP) is a software-development paradigm where "language" is a software building block with the same status as objects, modules and components, and rather than solving problems in general-purpose programming languages, ...
, as well as all other forms of domain-specific languages, are the class of compiler writing tools called
metacompiler
In computer science, a compiler-compiler or compiler generator is a programming tool that creates a parser, interpreter, or compiler from some form of formal description of a programming language and machine.
The most common type of compiler- ...
s. A metacompiler is not only useful for generating
parser
Parsing, syntax analysis, or syntactic analysis is the process of analyzing a string of symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal grammar. The term ''parsing'' comes from Lati ...
s and
code generators for domain-specific languages, but a
metacompiler
In computer science, a compiler-compiler or compiler generator is a programming tool that creates a parser, interpreter, or compiler from some form of formal description of a programming language and machine.
The most common type of compiler- ...
itself compiles a domain-specific
metalanguage
In logic and linguistics, a metalanguage is a language used to describe another language, often called the ''object language''. Expressions in a metalanguage are often distinguished from those in the object language by the use of italics, quot ...
specifically designed for the domain of
metaprogramming
Metaprogramming is a programming technique in which computer programs have the ability to treat other programs as their data. It means that a program can be designed to read, generate, analyze or transform other programs, and even modify itself ...
.
Besides parsing domain-specific languages, metacompilers are useful for generating a wide range of software engineering and analysis tools. The meta-compiler methodology is often found in
program transformation systems.
Metacompilers that played a significant role in both computer science and the computer industry include
Meta-II
META II is a domain-specific programming language for writing compilers. It was created in 1963–1964 by Dewey Val Schorre at UCLA. META II uses what Schorre called syntax equations. Its operation is simply explained as:
Each ''syntax equation'' ...
, and its descendant
TreeMeta.
Unreal Engine before version 4 and other games
Unreal
Unreal may refer to:
Books and TV
* ''Unreal'' (short story collection), a 1985 book of short stories by Paul Jennings
* ''Unreal'' (TV series), a 2015 television drama series on Lifetime
Computing and games
* ''Unreal'' (video game series), ...
and
Unreal Tournament
''Unreal Tournament'' is a first-person arena shooter video game developed by Epic Games and Digital Extremes. The second installment in the ''Unreal'' series, it was first published by GT Interactive in 1999 for Microsoft Windows, and later r ...
unveiled a language called
UnrealScript
Unreal Engine (UE) is a 3D computer graphics game engine developed by Epic Games, first showcased in the 1998 first-person shooter game ''Unreal (1998 video game), Unreal''. Initially developed for Personal computer, PC first-person shooters, i ...
. This allowed for rapid development of modifications compared to the competitor
Quake (using the
Id Tech 2
The ''Quake II'' engine is a game engine developed by id Software for use in their 1997 first-person shooter ''Quake II''. It is the successor to the Quake engine, ''Quake'' engine. Since its release, the ''Quake II'' engine has been licensed f ...
engine). The Id Tech engine used standard
C code meaning C had to be learned and properly applied, while UnrealScript was optimized for ease of use and efficiency. Similarly, the development of more recent games introduced their own specific languages, one more common example is
Lua
Lua or LUA may refer to:
Science and technology
* Lua (programming language)
* Latvia University of Agriculture
* Last universal ancestor, in evolution
Ethnicity and language
* Lua people, of Laos
* Lawa people, of Thailand sometimes referred t ...
for scripting.
Rules Engines for Policy Automation
Various
Business Rules Engines have been developed for automating policy and business rules used in both government and private industry.
ILOG
ILOG S.A. was an international software company purchased and incorporated into IBM announced in January, 2009. It created enterprise software products for supply chain, business rule management, visualization and optimization. The main product ...
,
Oracle Policy Automation,
DTRules,
Drools
Drools is a business rule management system (BRMS) with a forward and backward chaining inference based rules engine, more correctly known as a production rule system, using an enhanced implementation of the Rete algorithm.
Drools supports ...
and others provide support for DSLs aimed to support various problem domains.
DTRules goes so far as to define an interface for the use of multiple DSLs within a Rule Set.
The purpose of Business Rules Engines is to define a representation of business logic in as human-readable fashion as possible. This allows both
subject-matter expert
A subject-matter expert (SME) is a person who has authority, accumulated great knowledge in a particular field or topic and this level of knowledge is demonstrated by the person's degree, licensure, and/or through years of professional experience ...
s and developers to work with and understand the same representation of the business logic. Most Rules Engines provide both an approach to simplifying the control structures for business logic (for example, using Declarative Rules or
Decision Tables
Decision tables are a concise visual representation for specifying which actions to perform depending on given conditions. They are algorithms whose output is a set of actions. The information expressed in decision tables could also be represented ...
) coupled with alternatives to programming syntax in favor of DSLs.
Statistical modelling languages
Statistical modelers have developed domain-specific languages such as
R (an implementation of the
S language),
Bugs,
Jags, and
Stan. These languages provide a syntax for describing a Bayesian model and generate a method for solving it using simulation.
Generate model and services to multiple programming Languages
Generate object handling and services based on an
Interface Description Language
interface description language or interface definition language (IDL), is a generic term for a language that lets a program or object written in one language communicate with another program written in an unknown language. IDLs describe an inter ...
for a domain-specific language such as JavaScript for web applications, HTML for documentation, C++ for high-performance code, etc. This is done by cross-language frameworks such as
Apache Thrift
Thrift is an interface definition language and
binary communication protocol
used for defining and creating services for numerous programming languages. It was developed at Facebook for "scalable cross-language services development" and as of ...
or
Google Protocol Buffers
Protocol Buffers (Protobuf) is a free and open-source cross-platform data format used to serialize structured data. It is useful in developing programs to communicate with each other over a network or for storing data. The method involves an i ...
.
Gherkin
Gherkin
A pickled cucumber (commonly known as a pickle in the United States and Canada and a gherkin in Britain, Ireland, South Africa, Australia, and New Zealand) is a usually small or miniature cucumber that has been pickled in a brine, vinegar, or ...
is a language designed to define test cases to check the behavior of software, without specifying how that behavior is implemented. It is meant to be read and used by non-technical users using a natural language syntax and a
line-oriented design. The tests defined with Gherkin must then be implemented in a general programming language. Then, the steps in a Gherkin program acts as a syntax for method invocation accessible to non-developers.
Other examples
Other prominent examples of domain-specific languages include:
*
Emacs Lisp
Emacs Lisp is a dialect of the Lisp programming language used as a scripting language by Emacs (a text editor family most commonly associated with GNU Emacs and XEmacs). It is used for implementing most of the editing functionality built into Ema ...
*
Game Description Language Game Description Language, or GDL, is a logic programming language designed by Michael Genesereth for general game playing, as part of the General Game Playing Project at Stanford University. GDL describes the state of a game as a series of facts, ...
*
OpenGL Shading Language
OpenGL Shading Language (GLSL) is a high-level shading language with a syntax based on the C programming language. It was created by the OpenGL ARB (OpenGL Architecture Review Board) to give developers more direct control of the graphics pipelin ...
*
Gradle
Gradle is a build automation tool for multi-language software development. It controls the development process in the tasks of compilation and packaging to testing, deployment, and publishing. Supported languages include Java (as well as Kotli ...
*
ActionScript
ActionScript is an object-oriented programming language originally developed by Macromedia Inc. (later acquired by Adobe). It is influenced by HyperTalk, the scripting language for HyperCard. It is now an implementation of ECMAScript (meaning i ...
Advantages and disadvantages
Some of the advantages:
* Domain-specific languages allow solutions to be expressed in the idiom and at the level of abstraction of the problem domain. The idea is that domain experts themselves may understand, validate, modify, and often even develop domain-specific language programs. However, this is seldom the case.
* Domain-specific languages allow
validation
Validation may refer to:
* Data validation, in computer science, ensuring that data inserted into an application satisfies defined formats and other input criteria
* Forecast verification, validating and verifying prognostic output from a numerica ...
at the domain level. As long as the language constructs are safe any sentence written with them can be considered safe.
* Domain-specific languages can help to shift the development of business information systems from traditional software developers to the typically larger group of domain-experts who (despite having less technical expertise) have a deeper knowledge of the domain.
* Domain-specific languages are easier to learn, given their limited scope.
Some of the disadvantages:
* Cost of learning a new language
* Limited applicability
* Cost of designing, implementing, and maintaining a domain-specific language as well as the tools required to develop with it (
IDE)
* Finding, setting, and maintaining proper scope.
* Difficulty of balancing trade-offs between domain-specificity and general-purpose programming language constructs.
* Potential loss of processor
efficiency
Efficiency is the often measurable ability to avoid wasting materials, energy, efforts, money, and time in doing something or in producing a desired result. In a more general sense, it is the ability to do things well, successfully, and without ...
compared with hand-coded software.
* Proliferation of similar non-standard domain-specific languages, for example, a DSL used within one insurance company versus a DSL used within another insurance company.
* Non-technical domain experts can find it hard to write or modify DSL programs by themselves.
* Increased difficulty of integrating the DSL with other components of the IT system (as compared to integrating with a general-purpose language).
* Low supply of experts in a particular DSL tends to raise labor costs.
* Harder to find code examples.
Tools for designing domain-specific languages
*
JetBrains MPS
JetBrains MPS (Meta Programming System) is a language workbench developed by JetBrains. MPS is a tool to design domain-specific languages (DSL). It uses projectional editing which allows users to overcome the limits of language parsers, and build ...
is a tool for designing domain-specific languages. It uses
projectional editing which allows overcoming the limits of language parsers and building DSL editors, such as ones with tables and diagrams. It implements language-oriented programming. MPS combines an environment for language definition, a
language workbench A language workbench is a tool or set of tools that enables software development in the language-oriented programming software development paradigm. A language workbench will typically include tools to support the definition, reuse and composition o ...
, and an Integrated Development Environment (IDE) for such languages.
*
MontiCore is a language workbench for the efficient development of domain-specific languages. It processes an extended grammar format that defines the DSL and generates Java components for processing the DSL documents.
*
Xtext
Xtext is an open-source software framework for developing programming languages and domain-specific languages (DSLs). Unlike standard parser generators, Xtext generates not only a parser, but also a class model for the abstract syntax tree, as ...
is an open-source software framework for developing programming languages and domain-specific languages (DSLs). Unlike standard parser generators, Xtext generates not only a parser but also a class model for the abstract syntax tree. In addition, it provides a fully featured, customizable Eclipse-based IDE.
*
Racket is a cross-platform language toolchain including native code, JIT and Javascript compiler, IDE (in addition to supporting Emacs, Vim, VSCode and others) and command line tools designed to accommodate creating both domain-specific and general purpose languages.
[
]
See also
*
Language workbench A language workbench is a tool or set of tools that enables software development in the language-oriented programming software development paradigm. A language workbench will typically include tools to support the definition, reuse and composition o ...
*
Architecture description language
Architecture description languages (ADLs) are used in several disciplines: system engineering, software engineering, and enterprise modelling and engineering.
The system engineering community uses an architecture description language as a langua ...
*
Domain-specific entertainment language Domain-specific entertainment languages are a group of domain-specific languages that are used describe computer games or environments, or potentially used for other entertainment such as video or music.
Game languages
* Extensible Graphical Gam ...
*
Language for specific purposes
Language for specific purposes (LSP) has been primarily used to refer to two areas within applied linguistics:
# One focusing on the needs in education and training
# One with a focus on research on language variation across a particular subject ...
*
Jargon
Jargon is the specialized terminology associated with a particular field or area of activity. Jargon is normally employed in a particular Context (language use), communicative context and may not be well understood outside that context. The conte ...
*
Metalinguistic abstraction
In computer science, metalinguistic abstraction is the process of solving complex problems by creating a new language or vocabulary to better understand the problem space. More generally, it also encompasses the ability or skill of a programmer to ...
*
Programming domain
The term programming domain is mostly used when referring to domain-specific programming languages. It refers to a set of programming languages or programming environments that were written specifically for a particular domain, where ''domain'' m ...
References
Further reading
*
*
*
*
*
*
*
*
*
External links
*
Minilanguages, ''
The Art of Unix Programming
''The Art of Unix Programming'' by Eric S. Raymond is a book about the history and culture of Unix programming from its earliest days in 1969 to 2003 when it was published, covering both genetic derivations such as BSD and conceptual ones such ...
,'' by
Eric S. Raymond
Eric Steven Raymond (born December 4, 1957), often referred to as ESR, is an American software developer, open-source software advocate, and author of the 1997 essay and 1999 book ''The Cathedral and the Bazaar''. He wrote a guidebook for the ...
Martin Fowler on domain-specific languagesan
Also i
a video presentationDomain-Specific Languages: An Annotated Bibliography
*
ttp://www.usenix.org/publications/library/proceedings/dsl97 Usenix Association: Conference on Domain-Specific Languages (DSL '97)an
2nd Conference on Domain-Specific Languages (DSL '99)The complete guide to (external) Domain Specific Languages
jEQNexample of internal Domain-Specific Language for the Modeling and Simulation of Extended
Queueing Networks.
; Articles
External DSLs with Eclipse technology*
Using Acceleo with GMF : Generating presentations from a MindMap DSL modelerUML vs. Domain-Specific Languages*
{{DEFAULTSORT:Domain-Specific Language
Programming language classification