Thursday, July 12, 2012

Seven Languages By Seven Geeks

One of the most powerful new features of Xtext is the capability to build languages for the JVM. In my opinion, these languages are a real breakthrough in domain-specific language design:
  • These DSLs directly interoperate with Java. They compile to Java code and allow to refer to Java artifacts.
  • They not only cover structural aspects but also behavior. DSLs become really powerful with a rich expression language offering today what Java has been missing for years, like type inference, lambda expressions, extension methods etc.
  • Complicated integration patterns like Generation Gap or Protected Regions become obsolete. Everything can be expressed on the same level of abstraction
  • They offer top-notch Eclipse-based tooling and integrate into the Java IDE. Switch between the DSL and the Java code during debugging, refactor across multiple languages, navigate to source etc.
Yet we have the impression that the concept and the benefits of JVM DSLs have not been well understood and adopted. This is why we decided it was time for another example and documentation offensive. The result is the 7 Languages project: Seven example JVM languages highlighting the benefits of this approach in various use cases of Java development:
  1. A scripting language. Write code without any boilerplate.
  2. A build language similar to Gradle but statically typed.
  3. JavaBeans facades for mongoDB objects.
  4. A DSL to define Guice modules.
  5. A language to route HTTP requests with conditions, variables and dependency injection.
  6. A template language
  7. A LOGO-like turtle drawing environment.
Clone or fork the code from github and enjoy the documentation on theXtext website.