Glossary · Automation software engineering and architecture
Domain-specific language (DSL)
Also known as: DSL
German: Domänenspezifische Sprache (DSL)
In software engineering, a domain-specific language (DSL) is a programming, modeling or specification language designed for a particular application domain, offering notation and concepts of that domain rather than general-purpose programming constructs.
- Software engineering
In one sentence
A domain-specific language is a programming or modeling language designed for one application domain, with that domain's concepts.
Example
Sequential function chart is a DSL for step sequences in control software, and a machine builder's recipe language is a DSL for process parameters.
How it applies
- Engineering: DSLs let domain experts express logic in familiar terms. In automation, examples include ladder diagram and sequential function chart, robot programming languages, G-code for CNC and configuration languages for safety controllers.
- Tools: A DSL needs an editor, validation, a compiler, interpreter or code generator, and documentation. The cost of building and maintaining these is often underestimated for in-house DSLs.
- Documentation: A DSL's users need a language reference, examples and error message explanations. The documentation team is well placed to write these and to keep the terminology of the DSL consistent with that of the machine's manuals.
DSL vs. general-purpose language
A General-purpose programming language such as C or Python can express almost anything; a DSL expresses a narrower range of things more clearly. DSLs reduce errors within their domain but become awkward when requirements go beyond it. Many DSLs are embedded in a general-purpose language as libraries.