Creating the meta-language


I'm trying to create language that will be generated into j.m.l.structure. I've specified that my language extends the j.m.l.structure, added the generator. Now I expect that I can create a new generation template based on ConceptDeclaration. But there is no "j.m.l.structure" group in the "New" menu on generator model. What am I doing wrong?

Comment actions Permalink
Your generator should have j.m.l.structure in "Used Languages".
You will not be able to create concepts from "new" menu but ConceptDeclaration will be available in templates, which is effectively the same.
Comment actions Permalink
Creating a meta-language reducing down to structure language is rather difficult.

1. Structure model is partly compiled and partly interpreted at runtime (for example anyone can get node<LinkDeclaration> instance using smodel language).

This means you should generate structure model from the meta-language, store it on disk and apply generation to it once again (to get generated structure classes). Model-to-model transformation using a certain generator (or set of generators) doesn't work out of the box yet. You have to use MPS internals to invoke generator as a transformation.

2. References to concepts & links are ID based. It means when you regenerate a model, all entities get new IDs and all external references are broken.

Before storing structure model to disk you should adjust node identifiers, either reusing ones from the previous generation or reassigning them completely (using some rule).

We plan to support model to model transformations including a generic merge mechanism in 3.0.

Please sign in to leave a comment.