concept dsl design in category dsl

appears as: DSL design, DSL design, DSL designs
DSLs in Action

This is an excerpt from Manning's book DSLs in Action.

Abstraction is a cognitive process of the human brain that enables us to focus on the core aspects of a subject, ignoring the unnecessary details. You’ll talk more about abstractions and DSL design in section 1.7. Appendix A is all about abstractions.

From a high-level view, a DSL design is, in some way, an exercise in building the most expressive API you can within the confines of your environment. In the case of internal DSLs, you’re limited to the host language that you use. With external DSLs, you design your own syntax, subject to the restrictions of your parser generator or combinator. In all these cases, we’re talking about textual DSLs; whatever interface you present to your user, it’s in the form of text-based structures. You can give very expressive APIs to your users, but if they’re implemented in a specific language, the user has to abide by the rules and regulations that the language runtime mandates.

Recently a school of thought has questioned this paradigm of text-based DSL development. Suppose I, as an expert in data analytics, want to embed Excel macros within the calculation engine of my weather forecasting system. To me, a spreadsheet seems to be the most intuitive way to express the logic that the macro encapsulates. In the text-only-based world of DSL design, there’s no way you can compose higher-order structures like a spreadsheet or a charting engine within the scope of your language.