Xtext success story: Google’s protobuf-dt

Session Type: 
Extended [55 minutes]

Xtext 2.0, part of the Eclipse Indigo release, provides a solid framework for creating Domain-Specific Languages. With only a few clicks, Xtext is capable of generating language interpreters and full-blown editors, all from a single grammar definition.

Even though Xtext provides practical and functional defaults, it is often necessary to customize the looks and behavior of the generated editor. Thanks to Xtext’s well-thought architecture and detailed documentation, extending the generated editor is usually a painless exercise. Sometimes, depending on the requirements of your language, such customizations can be non-trivial and difficult to achieve.

This session introduces lessons learned while developing protobuf-dt, Google’s open source Xtext-based editor for protocol buffer (protobuf) descriptors.

This session covers:

  • Introduction to grammar definitions
  • Xtext’s usage of dependency injection, and its benefits.
  • Xtext’s dynamic method dispatching: pros and cons
  • Creating scopes for type resolution and challenges faced due to the protobuf’s language semantics
  • Customizing the appearance and contents of the Outline View
  • Customizing the editor: syntax highlighting, Javadoc-like documentation and hyperlinking
  • Customizing content-assist beyond the language syntax
  • Validating the language’s semantics
  • Extending XtextBuilder
  • What to expect from Xtext’s documentation and forum

We will also cover many of the challenges faced when figuring out existing language features on the fly, and how Xtext’s flexible structure made it pretty easy to adapt to the newly discovered language rules.

Each of the topics mentioned above will be explained using protobuf-dt’s code as reference.