Chapter 13. A real-world DSL implementation

 

In this chapter

  • Building real-world DSLs
  • Exploring the language usage
  • Going beyond the code

We’ve covered a lot of ground in our journey to learn about and build DSLs. We’ve explored the reasons for building them, the intricacies of their implementation, and how to extend a language to meet specific needs. We considered what’s involved in creating a good language: testing, versioning, documentation, user interface, and supporting tools. We also spent the previous chapter reviewing a host of implementation challenges related to particular needs, along with approaches for solving them.

The only thing we haven’t done yet is use all that knowledge in a cohesive manner. The languages we’ve built so far were meant to showcase specific features, so they were fairly focused and simplistic.

This chapter will demonstrate how to create and use a DSL, how to evolve it along with a project, and how to understand the domain and the requirements. The first half of the chapter is dedicated to concepts, and to designing and building a DSL. The second half is dedicated to the implementation details of that DSL. We’ll start as we would in the real world, by looking into the scenario where a DSL might be useful.

13.1. Exploring the scenario

13.2. Designing the order-processing system

13.3. Thinking in tongues

13.4. Moving from an acceptable to an excellent language

13.5. Implementing the language

13.6. Using the language

13.7. Looking beyond the code

13.8. Going beyond the limits of the language

13.9. Summary