Domain-Specific Language is a programming language intended for a particular application domain
A domain-specific language (DSL) is a programming language intended for a particular application domain.
Well-known examples that can be considered DSLs include html for markup, r for statistics.
There are three key points in above mentioned definition.
- Programming Language: DSL is a programming language, which is used by humans to instruct a computer to do something.
- Limited Expressiveness: DSL is not a general purpose language like C, Java, etc. It supports minimum features needed to support its domain. Programmer cannot build entire software system using DSL.
- Domain focus: DSL focuses on a small domain. The limited focus makes it easy to understand and easy to use.
Martin Fowler divides DSL mainly into two categories :
- A External DSL : it is a standalone language with its own custom syntax, but adopting other language such as XML syntax is common. Example of external DSLs are sql for database queries, regular-expression languages.
- An Internal DSL : They are intrinsically embedded inside a general-purpose language, such as Lava (hardware description language on top of haskell), rake (build system on top of ruby), or latex (structured markup language on top of tex).