Technical report

INGRID: Creating Languages in MPS from ANTLR Grammars
Přemysl Vysoký, Pavel Parízek, Václav Pech
Technical report no. D3S-TR-2018-01, Department of Distributed and Dependable Systems, Charles University

JetBrains MPS is a language workbench, an IDE that allows developers both to write code and create language definitions. It leverages the concept of projectional editing, where the developer directly manipulates the AST representation of program code. While MPS focuses on domain-specific languages (DSL), it needs to support also general-purpose programming languages (GPPLs) — for example, to compile and run programs written in some DSL. We present INGRID, a method for construction of a language definition in MPS based on its ANTLR grammar. The structure of a language is generated automatically, but its projectional editor and other aspects has to be adjusted manually. During the development of INGRID , we encountered several chal- lenges related to the mapping between grammars and language definitions in MPS that are based on object-oriented principles. Another difficulty is that grammars do not hold any information about code layout. We implemented INGRID as a plugin for MPS and evaluated it on several mainstream GPPLs, such as JavaScript and C#. Results show that our approach is practical, and it saves the user from many hours of tedious and error-prone work. Necessary manual adjustments take only a short time.

    title = {{INGRID: Creating Languages in MPS from ANTLR Grammars}},
    author = {Vysoký, Přemysl and Parízek, Pavel and Pech, Václav},
    year = {2018},
    institution = {Department of Distributed and Dependable Systems, Charles University},
    number = {D3S-TR-2018-01},
    pages = {1--18},