Search code examples
mps

MPS: abstract (generatorless?) language and it's implementations


I used MPS in the past in a small project (like a lab-project), so I have basic understandings of how to use MPS (though it was version 2.4 or something alike). Now I'm trying to introduce some utility software (ideally, plugin for IntelliJ) built on top of MPS functionality. As MPS is not that widely used, I'd like to consult with experienced people here.

What I want to do is to wrap some relational knowledge database access (SQL queries) into MPS-based plugin. I want to be able to start quickly and generate code to already existing jdbc-wrapping library, and in future I want to be able to switch to my implementation with added db-specific features. In the same time I want to preserve existing user models so that they could switch to a new language easily, and fall back if something is wrong with this new language. How this easy-switch feature could be achieved? My first idea was using abstract language without generators, and adding implementation language in mps-based module in Idea as a dependency (one or another), but I'm not sure if this is easily possible.


Solution

  • Yeah, if I understand you correctly, this should be easily possible. You don't need to make a language without generators, but can design your language with generators and all. Then, if you want to simply add new constructs that users will be able to use in addition to already defined constructs, you can extend this language with a more specific language for db-specific features (in case you want to have more than one specializing language). Alternatively, if you want to keep using the same language and update it, MPS offers migration scripts in which you can specify how to upgrade existing models that were built in an older version of your language to a newer version. For a starting point on making an Idea plugin with MPS, please see https://confluence.jetbrains.com/display/MPSD30/Using+MPS+inside+IntelliJ+IDEA.