Executable Specifications for Xtext Languages

Session Type: 
Standard [35 minutes]

Every newly designed language starts with a discussion on how the syntax should be, which concepts should supported, what the behavior should be etc. Such a discussion is exercised best when having many examples documents of that language to talk about.

In this talk I explain how such examples can be formalised to serve both as a specification and a JUnit test suite.

Questions such as the following need to be answered.

  • Is this syntax valid?
  • What is this reference pointing to?
  • Which elements can be referenced here?
  • What is the error message for this invalid example?
  • How does the AST of this snippet look like?
  • What’s the result if this snippet is executed?
  • How does the formatted version of this snippet look like?
  • How can syntax highlighting increase readability?
  • etc.

In this talk I will show based on examples how the answers of these questions can be formalized so that they serve both as a specification of the language and as a JUnit test suite. In several customer projects, this specification has proven valuable to discuss semantics and tooling-properties of a language. The test suite guarantees for the spec and the language implementation to be in sync, indicates the level of completeness of the implementation and enables fear-free refactorings of the latter.

Schedule info



Experience level: 

Copyright © 2013 The Eclipse Foundation. All Rights Reserved.