Katana VentraIP

Domain-specific language

A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (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 for web pages, down to languages used by only one or a few pieces of software, such as MUSH 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 languages), 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 was originally developed as a text-processing and glue language, for the same domain as AWK and shell scripts, but was mostly used as a general-purpose programming language later on. By contrast, PostScript is a Turing-complete language, and in principle can be used for any task, but in practice is narrowly used as a page description language.

Use[edit]

The design and use of appropriate DSLs is a key part of domain engineering, 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 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.

life insurance policies (developed internally by a large insurance enterprise)

combat simulation

salary calculation

billing

Domain-specific language topics[edit]

External and Embedded Domain Specific Languages[edit]

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.[1]

Usage patterns[edit]

There are several usage patterns for domain-specific languages:[2][3]

Emacs Lisp

Game Description Language

OpenGL Shading Language

Gradle

ActionScript

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.

[8]

Domain-specific languages allow at the domain level. As long as the language constructs are safe any sentence written with them can be considered safe.

validation

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.

[9]

Domain-specific languages are easier to learn, given their limited scope.

Some of the advantages:[2][3]


Some of the disadvantages:

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, and an Integrated Development Environment (IDE) for such languages.[11]

JetBrains MPS

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.[12]

MontiCore

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.[13] The project was archived in April 2023.

Xtext

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.[14][15]

Racket

Language workbench

Architecture description language

Domain-specific entertainment language

Language for specific purposes

Jargon

Metalinguistic abstraction

Programming domain

Dunlavey (1994). Building Better Applications: a Theory of Efficient Software Development. . ISBN 0-442-01740-5.

International Thomson Publishing

Heitmeyer, Constance (1999). (PDF). Proceedings. 2nd IEEE Workshop on Industrial Strength Formal Specification Techniques. pp. 12–13. doi:10.1109/WIFT.1998.766290. ISBN 0-7695-0081-1. S2CID 16079058. Archived (PDF) from the original on February 1, 2020.

"Using the SCR* toolset to specify software requirements"

Mernik, Marjan; Heering, Jan & Sloane, Anthony M. (2005). . ACM Computing Surveys. 37 (4): 316–344. doi:10.1145/1118890.1118892. S2CID 207158373.

"When and how to develop domain-specific languages"

Spinellis, Diomidis (2001). "Notable design patterns for domain specific languages". Journal of Systems and Software. 56 (1): 91–99. :10.1016/S0164-1212(00)00089-3.

doi

Parr, Terence (2007). The Definitive ANTLR Reference: Building Domain-Specific Languages. Pragmatic Bookshelf.  978-0-9787392-5-6.

ISBN

(2009). "Spending Moore's Dividend". Communications of the ACM. 52 (5): 62–69. doi:10.1145/1506409.1506425. ISSN 0001-0782. S2CID 2803479.

Larus, James

Werner Schuster (June 15, 2007). . C4Media. Retrieved 2009-09-08.

"What's a Ruby DSL and what isn't?"

Fowler, Martin (2011). . Addison-Wesley. ISBN 978-0-321-71294-3.

Domain-Specific Languages

Brambilla, Marco; Cabot, Jordi; Wimmer, Manuel (2012). Model Driven Software Engineering in Practice. Synthesis Lectures on Software Engineering. Vol. #1. Morgan & Claypool.  978-1-62705-708-0.

ISBN

and Language Workbenches. Also in a video presentation

Martin Fowler on domain-specific languages

Archived 2016-03-16 at the Wayback Machine

Domain-Specific Languages: An Annotated Bibliography

One Day Compilers: Building a small domain-specific language using OCaml

and 2nd Conference on Domain-Specific Languages (DSL '99)

Usenix Association: Conference on Domain-Specific Languages (DSL '97)

Internal Domain-Specific Languages

The complete guide to (external) Domain Specific Languages

Archived 2021-01-31 at the Wayback Machine example of internal Domain-Specific Language for the Modeling and Simulation of Extended Queueing Networks.

jEQN