Part 2. Implementing DSLs

On the surface, DSL syntax appears to be aligned to the dialect that the domain user speaks in his daily life. Part 1 focused mainly on the importance of making your software speak the language of the domain. But even when you’ve accomplished this, behind the syntax of the DSL is an underlying semantic model that you need to develop, following principles of well-designed abstractions. Unless you have a semantic model that is extensible, malleable, and composable, it’ll be difficult to have an expressive syntax on top.

Part 2 (chapters 4 through 8) discusses all the idioms and best practices that make a good semantic model.

When you design a DSL, it is important to use the most appropriate language that offers the level of abstraction that you need to program in. In this part of DSLs in Action I discuss DSL implementation using Groovy, Ruby, Scala, and Clojure. Each of these languages has its own strengths and weaknesses and each offers features that you can use to model the components of your DSL. As a developer seeking to use DSL-based development, you need to be aware of the idioms that these languages offer and the ways they integrate with your main application stack.

Part 2 also covers external DSL development using modern frameworks like ANTLR and Xtext (from Eclipse). ANTLR is a parser generator that helps you write custom parsers for the DSL that you’re developing. Xtext is an environment that gives you a full stack for developing and managing external DSLs.

I cap off part 2 with a discussion of parser combinators, the beautiful functional abstractions for developing external DSLs.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.148.107.254