Answers
Here are the answers to this chapter’s questions:
- As opposed to a GPL, a DSL is a language tailored toward a particular problem domain. It features concepts of that problem domain as primitives and aims to be more effective than a GPL for problem-solving within that domain.
- Embedding is a lightweight implementation technique for DSLs that makes use of the facilities of a general-purpose programming language, called the host language.
Typically, an embedded DSL is set up as a library of the host language. This way, it has to abide by the syntax, type system, and abstraction mechanisms of the host language. In exchange, the development effort is very low as no custom facilities for parsing syntax, type-checking programs, and low-level code generation have to be created; the host language takes care of this.
Typically, an embedded DSL revolves around one or more abstract data types. It provides a range of combinators for creating values of this abstract data type...