How to migrate existing data into MPS? Follow
I am learning MPS and would like to use it in my project.
I want to use MPS to create a IDL to describe protocol msgs. The created IDL would be very like google protobuf, e.g. define msgs, msg fields could be primitive types or existing msgs. Eventually I will generate c++ and python code.
The question I have right now is that, there are some existing XML files, each of them has thousands of lines to define one protocol. How could I import this kind of XML to MPS? Also the vendors keep releasing new version of XML files, I need to figure out a easy way to import it into MPS.
I could write python code to convert XML to the IDL file(plan text) if no way to import XML directly, but how to import plain text IDL file into MPS as a new model?
Please sign in to leave a comment.
You would need to write a parser for your XML files inside of MPS which then creates the model from that XML. The importer can then take care of merging this with existing instance of the imported file in MPS etc.
Alternatively you could write a custom persistence that can load the XML files directly into MPS similar to what the java stubs are doing.
Thank you so much for your help, your comments mean a lot to me.
Now I could fully dive into the MPS since it really can satisfy all my needs and have much better user experience than other solutions.
I have implemented a simple DSL, actually I learnt most of them from your HEAVY META Tutorials, thanks very much!!!
Now it's time to write the code to import my XML files in to MPS.
Regarding "write a parser for your XML files inside of MPS", do you have a tutorial/project to show me how to do it?
Is this way still good to use? The author created it couple of years ago.