rascal

Bi-directional translation with RascalMPL


What are the approaches to do a bi-directional translation between language A and language B in RascalMPL, I was considering using either a Model2Model or a Model2Text translation (although I don't have the clear picture of Model2Model how is implemented in Rascal) and also what are the necessary components (like grammar, ADT etc.) required to do a bi-directional translation in RascalMPL? Pros, cons and any resources will be appreciated. :-)


Solution

  • Rascal does not support automatic bidirectional transformations (e.g., as studied in the BX community: http://bx-community.wikidot.com/), however, you can implement them if you want.

    Model2Model in Rascal would roughly correspond to AST2AST (where the type of AST is defined in an ADT); and Model2Text would correspond to AST2string.

    There is library for importing ECore models into Rascal (and generate ADTs from ECore metamodels), however, it is a bit old, and in alpha stage: https://github.com/cwi-swat/rascal-ecore .