Database Queries, Matlab For Data Acquisition And Mathematical Modelling
1023 WordsDec 18, 20165 Pages
Domain Specific Languages (DSLs) are invented to focus and only applies to the context of its narrow domain (eg. SQL for database queries, Matlab for data acquisition and mathematical modelling). For research and special purpose, DSLs ensure the advantages of convenience and effectiveness over the General Purpose Language (GPLs). There are two main approaches to DSLs:
1. Standalone DSLs with its own complier or interpreter, and it is often used in its own ecosystem. The most common one within object-oriented circles.
2. Other type is a DSLs embedded in a host GPLs. Such languages can have the look and feel of being their own language, but they leverage the host GPL’s existing ecosystem and initial semantics. This is usually used by functional programmers.
Creating a full-blown language may contain one or more DSLs, which an Embedded Domain Specific Language (eDSL) is one of the popular implementation technique. The idea of eDSL is a domain specific language defined in terms of a more powerful general purpose host language. The advantages are that DSLS obtains the infrastructure of the host language and the GPLs can be used for metaprogramming, creating manipulate programs in DSLs.
This paper will focus on the second type of approach, embedded DSLs inside a language, Haskell, a pure functional programming language. Haskell is a good host GPL because of it’s flexible overloading, a powerful type system, and lazy semantics.
Embedded domain specific