RepreZen DSL: Pushing the limits of language usability with XText
Many DSLs are convenient alternatives to hand-coding or generic data formats. Others are unique in their solution space, providing the best way, sometimes the only way, to describe a particular model or program.
But what about DSLs that have to compete with other languages? When language readability, extensibility, and efficiency of expression are key to the success of your product, what language design ideas can we bring to the table, and what techniques will make them work in XText?
RepreZen is an Eclipse-based API design environment, with its own DSL to describe REST APIs and supporting data types. As a new entry in the competitive and rapidly evolving API design space, it wasn't enough to offer new capabilities; we needed to raise the already high bar of usability set by other API description languages. And we needed to streamline the DSL design process for fast evolution, adding new language constructs with each beta release.
In this talk, we'll explain our language design goals, and show how we implemented some especially challenging language features, including:
* Use of a generic meta-syntax to formalize grammatical patterns in the DSL, enabling greater consistency and more centralized logic for formatting, syntax highlighting, code assist, etc. Language extensibility and platform portability are also benefits of this DSL design pattern.
* Optional fluency, which accommodates concise or fluent coding styles, according to the user's preference, through the use of optional keywords.
* Indent-based block scoping in XText, similar to YAML or Python.
* Flexible sequencing of language constructs for improved usability, with an option to automate canonical ordering for consistency across models.