Supporting Meta-model-based Language Evolution and Rapid Prototyping with Automated Grammar Optimization
Preprint, 2023

In model-driven engineering, developing a textual domain-specific language (DSL) involves constructing a meta-model, which defines an underlying abstract syntax, and a grammar, which defines the concrete syntax for the DSL. Language workbenches such as Xtext allow the grammar to be automatically generated from the meta-model, yet the generated grammar usually needs to be manually optimized to improve its usability. When the meta-model changes during rapid prototyping or language evolution, it can become necessary to re-generate the grammar and optimize it again, causing repeated effort and potential for errors. 
In this paper, we present GrammarOptimizer, an approach for optimizing generated grammars in the context of meta-model-based language evolution. To reduce the effort for language engineers during rapid prototyping and language evolution, it offers a catalog of configurable grammar optimization rules. Once configured, these rules can be automatically applied and re-applied after future evolution steps, greatly reducing redundant manual effort. In addition, some of the supported optimizations can globally change the style of concrete syntax elements, further significantly reducing the effort for manual optimizations. The grammar optimization rules were extracted from a comparison of generated and existing, expert-created grammars, based on seven available DSLs. An evaluation based on the seven languages shows GrammarOptimizer’s ability to modify Xtext-generated grammars in a way that agrees with manual changes performed by an expert and to support language evolution in an efficient way, with only a minimal need to change existing configurations over time.

Xtext

DSL

Language Evolution

Domain-specific Languages

Language Prototyping

Grammar

Author

Weixing Zhang

Chalmers, Computer Science and Engineering (Chalmers), Interaction Design and Software Engineering

Jörg Holtmann

Digitale Schiene Deutschland

Chalmers, Computer Science and Engineering (Chalmers), Interaction Design and Software Engineering

Regina Hebig

University of Rostock

Chalmers, Computer Science and Engineering (Chalmers), Interaction Design and Software Engineering

Jan-Philipp Steghöfer

XITASO GmbH IT Software Solutions

Chalmers, Computer Science and Engineering (Chalmers), Interaction Design and Software Engineering

Areas of Advance

Information and Communication Technology

Subject Categories

Software Engineering

DOI

10.2139/ssrn.4379232

Related datasets

GrammarOptimizer_data [dataset]

URI: https://zenodo.org/records/10045477 DOI: 10.5281/zenodo.10045477

More information

Created

11/13/2023