Programming Interface (API) for JetBrains MPS ?

I would like to access AST data created with JetBrains MPS from the outside to do some program analysis on it with external tools. Does MPS provide a programming interface (API) to get access to that data? Or are there at least export/import functionalities available in MPS?

Torsten
1 comment
Hi,

Though it's theoretically possible to get the model from outside of MPS, I wouldn't recommend to do so. The problem is that working with this tree requires all MPS infrastructure.

For example,you'll most probably need "types" of AST nodes. For now, you can get only a Java String containing a type name from the node, but can't say whether this type inherits some other. Supposing you have a node with type "jetbrains.mps.baseLanguage.ClassConcept", you'll be unable to say whether you can assign it to a node of type "jetbrains.mps.baseLanguage.Interface" if you haven't hard-coded this into your analyzer.

You are right, it's possible to extract all the information required just from MPS and save it into your own format (you can do this by writing an action that will export your model or by writing a custom model persistence, which will save required information together with the model data). It's also possible to "generate" this information by using our generator. You choose the best way.

BTW, depending on how your analyzers are deployed, maybe it's possible to just launch them in MPS (by creating an action that launches the analyzer in MPS environment, which you already have in this case).

Regards,
Mihail
0

Please sign in to leave a comment.