Domain-specific languages
A language developed for expressing solutions to problems that are specific to a domain such as finance, payroll, electronic circuit design, parser generators, input validations, and so on is called a domain-specific language (DSL). Two common examples that are familiar to most programmers are Structured Query Language (SQL) and regular expression (RE). If we were to write imperative code for retrieving data from a database, it would have been a difficult task and error prone. SQL gives you a declarative language to achieve the same objective, and it has solid mathematical foundations. While searching strings, RE helps us to give complicated patterns to match against a string. It helps to avoid writing tedious logic for searching complicated string matches.
As a concrete example of a DSL, which is quite popular in the .NET and Java world, we are pasting here a specification given to the ANTLR tool to write a very simple arithmetic evaluator. The tool generates a...