Implementing Domain-Specific Languages with Xtext and Xtend(Second Edition)
上QQ阅读APP看书,第一时间看更新

Preface to the second edition

Since the very beginning, Xtext has always been a continuously evolving software. Each new version of Xtext comes with many new features and bugfixes.

When I wrote the first edition of the book, which was published in August 2013, Xtext 2.4.0 had been recently released. Since then, all the features introduced in each new release of Xtext aimed at making DSL implementation easier and at improving the user experience.

All these things came with a small price though—the contents of the book were getting stale in time, and they did not respect the features of Xtext in the new releases anymore.

In all these years, Xtext has always been my daily framework since my research is based on programming language design, theory, and most of all, implementation. I've been implementing lots of DSLs since the first edition of the book and doing that I've also learned many more aspects of Xtext and new best practices. I've also started to contribute more actively to the Xtext code base, and I can proudly announce that I recently became an Xtext committer.

Thus, at the end of 2015, I decided to propose to Packt a second edition of the book and they reacted very positively.

While working on this second edition, I updated all the contents of the previous edition in order to make them up to date with respect to what Xtext provides in the most recent release (at the time of writing, it is 2.10). All the examples have been rewritten from scratch. With respect to the examples of the first edition, many parts of the DSLs have been modified and improved, focusing on efficient implementation techniques and the best practices I learned in these years. Thus, while the features of most of the main example DSLs of the book is the same as in the first edition, their implementation is completely new. In the last chapters, many more examples are also introduced.

In particular, Chapter 11, Continuous Integration, which in the previous edition was called Building and Releasing, has been completely rewritten and it is now based on Maven/Tycho instead of Buckminster, since Xtext now provides a project wizard that also creates a Maven/Tycho build configuration for your Xtext DSL. This new chapter also briefly describes the new Xtext features that allow you to port your DSL editor on the web and also on IntelliJ. I also added a brand new chapter at the end of the book, Chapter 13, Advanced Topics, is loaded with much more advanced material and techniques that are useful when your DSL grows in size and features. For example, the chapter will show how to manually maintain the Ecore model for the AST of your DSL in several ways, including Xcore. This chapter also presents an example that extends Xbase, including the customization of its type system and compiler. An introduction to Xbase is still presented in Chapter 12, Xbase, as in the previous edition, but with more details.

As in the previous edition, the book fosters unit testing a lot. An entire chapter, Chapter 7, Testing, is devoted to testing all aspects of an Xtext DSL implementation. I also kept the same tutorial nature of most chapters as in the previous edition.

Summarizing, while the title and the subject of most chapters is still the same, their contents has been completely reviewed, extended, and hopefully, improved.

If you enjoyed the first edition of the book and found it useful, I hope you'll like this second edition even more.

Lorenzo Bettini