9 Preventing things from blowing up
This chapter covers
- Determining the various ways the build system and Runtime can fail
- Adding constraints to the DSL so that domain experts are warned about “faulty” DSL content that can cause failures
- Strengthening the generator so it can deal with some failures
In chapter 8, we implemented a code generator to generate code from an AST representing DSL content. (This DSL content would be written using the Domain IDE.) That generator, and the generated code, worked for the AST of the example DSL content, and it would probably also work for a lot of other DSL content. However, some ASTs could cause the generator to produce code
that can’t be built, or code that crashes or runs incorrectly. The generator itself can even crash on a particular AST—for example, when the generator expects some property to have a setting, but it doesn’t.
Figure 9.1 divides the process of building a Runtime from DSL content into several stages and indicates how they might fail.
Figure 9.1 Building the Runtime from DSL content, divided into several separate stages with their failure modes

Table 9.1 explains these stages and their associated failure and success modes in a little more detail.