-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Writing code is a craft which requires mature tools, conventions, and systematic approaches. One of crucial part of writing code is its representation which needs to be readable. The requirement can be solved by automatic code formatting, which represents the way to enforce coding conventions. A configuration of a code formatter represents coding conventions for a particular language used in a software project. The next mechanism improving the readability of code is syntax highlighting which allows for distinguishing different code parts by color, font, style, etc. Code formatting and syntax highlighting are basic elements of the concept called pretty-printing.
In these days most of development environments or language editors include a pretty printer designed for a particular language. These ad-hoc pretty printers tend to be hardly configurable and are mostly dedicated for only one language. Thus another crucial problem is to define a pretty printer for a general domain-specific language. Domain-specific language is a programming or specification language dedicated to a particular problem domain such as SQL, HTML, AWK, SED etc. Furthermore, this kind of languages can be created by utilizing the Xtext framework. A DSL often serves to describe a real life scenario with domain specific terms. But it means that each DSL closely related to its problem requires creation of ad-hoc pretty printer from scratch which takes a lot of time.
Code of DSLs can be often reflected into a model which facilitates code manipulation and creation of tools serving for work with DSLs. This approach of software development is called model-driven development. The core structure of final code can be generated from a model which reflects the process of design. This fact allows for reducing time-consuming and error-prone handwritten code. Although, the concept simplifies software development, the models of ad-hoc pretty printers contain many similarities. Therefore it would be beneficial to have a model-driven pretty printer that would be language independent and an implementation of differences derived from language features should be represented by an extension of the pretty-printer.
The aim of this project is to design a concept of a model-driven pretty-printer for the Xtext dealing with creation of domain-specific languages. The concept should be confirmed by an appropriately incorporated implementation into the environment of the Xtext framework. Code of imperative languages contains much syntax ballast, thus pretty-printer settings for particular language features and formatting settings should be configured with the best declaratively.
The Overview of Xtext Framework page and the Pretty Printers using Box Models page describe state of art. The first one explains possibilities of the Xtext framework. The second one discusses what a generic pretty printer is and how to configure it declaratively.
This project allows for defining configuration of generic pretty printer by utilizing the [ModelLang](https://github.com/mn-mikke/Model-driven-Pretty-Printer-for-Xtext-Framework/wiki/ModelLang-(Language-for-Defining-Box-Models\)) language. This language has configurable semantics. The semantics can be defined by [MetaModLang](https://github.com/mn-mikke/Model-driven-Pretty-Printer-for-Xtext-Framework/wiki/MetaModLang-(Language-for-Defining-Box--Meta-models\)) language. Since writting a configuration from scratch is time-consuming, the project offers possibility to define heuristics that describe way how an initial configuration will be generated from a grammar. These heuristics can be written in the [HeurLang](https://github.com/mn-mikke/Model-driven-Pretty-Printer-for-Xtext-Framework/wiki/HeurLang-(Language-for-Defining-Heuristics-of-the-Initial-Box-Model\)) language. Further, the Integrating the Box Model into Xtext Framework discusses interpretation of pretty printer's configuration and its integration into Xtext framework.
Tools concurrent to the Xtext framework and other types of DSLs are discussed in the Related Work page.
The Future Work page contains discussions about possible ways of further project's development. Moreover, the Suggestions Facilitating Development of the Project page discusses possible ways of further development of tools related to Xtext or model-driven development.