Closely related to the programming paradigms which have been discussed above is an emerging concept for high-level languages, such as C++, domain-specific embedded languages.
First, a domain-specific language (DSL) is defined by a set of symbols as well as by a well-defined set of rules specifying how the symbols are used to build well-formed compositions . The domain-specific part of a DSL can then be employed by a simplified grammar and an increased expressiveness. The possibility of writing code in terms close to the level of abstraction of the initial problem domain is the characteristic property of DSLs.
The next relevant issue regarding a DSL is interoperability. A possible way of dealing with interoperability is to integrate the domain-specific language into a host language, finally obtaining a domain-specific embedded language (DSEL), e.g., YACC . All software engineering tasks, such as designing, implementing, and maintaining the DSL, are reduced to implementing and maintaining a library of the host language. And more importantly, the interoperability can be enhanced to the highest level, due to the fact that both concepts are now available in one host language. All the libraries already developed and their functionality are available at the same time. To summarize, the advantages of domain-specific embedded languages are:
The advent of having multiple paradigms available in a single programming language creates new possibilities for domain-specific languages. The advantages and disadvantages of several programming paradigms and the reduction of specification and implementation effort clearly suggest the use of domain-specific embedded languages, such as reducing the stated implementation effort of the object-oriented and generic programming paradigm to . This means that the effort of building applications can be reduced to a constant effort by utilizing a DSEL without additional transformation steps. Maintenance and further development for an extra transformation tool is thereby greatly reduced, compared to, e.g., the transformation tool for Sophus . But up to now, the implementation of a DSEL for non-trivial areas is far from simple or user-oriented. Also, domain-specific languages require various mechanisms from the host languages, where the following features are almost mandatory:
As can be seen from the brief comparison of languages provided in
Table 4.1, only a few languages are
available which allow an efficient modeling of operators. Languages
such as Haskell were not developed with an overall high performance
approach, but they still offer the definition of new operators which
extend the built-in language syntax. Based on this overview, the only
language offering the best support for DSELs with syntactic
expressiveness as well as run-time efficiency is C++.
In addition to the great possibilities of using C++ as a host language
for a DSEL, the multi-paradigm approach offers a great degree of
freedom in the implementation of high performance scientific code and
even applications [107,108].
The main feature is the paradigm of template meta-programming of C++,
introduced in Section 4.2, which
means that a DSEL can function as an extension to the general-purpose
host language. Meta-programming and DSEL are also actively developed
An example is given next which illustrates the embedded nature of a
grammar specification in C++. The first part yields the normal grammar
specification by YACC:
Next, an example of Spirit  is given, where Spirit is an
object-oriented, recursive-descent parser and output generation
framework enabling target grammars written entirely in C++ as a DSEL.
Another advantage of the DSEL concept is the further development of compiler technology, which drastically increases the performance of high-level code. Recent performance analysis has shown that each compiler generation increases the overall run-time performance .