Generate Meta-Model for/from my own Language
I wonder if I can generate a meta-model for my language, so an overview about all concepts of the language and their relations. This information has to be represented in MPS anyway and I would like to render a (visual) representation from it.
So maybe a generator of my language would have to operate not on the models / sandbox of my language, but on the language concepts itself.
Is that possible? Do you have any ideas or hints?
Or is there maybe even a representation like that somewhere hidden in the gears and guts of MPS?
Thanks for any hints,
Arne
So maybe a generator of my language would have to operate not on the models / sandbox of my language, but on the language concepts itself.
Is that possible? Do you have any ideas or hints?
Or is there maybe even a representation like that somewhere hidden in the gears and guts of MPS?
Thanks for any hints,
Arne
Please sign in to leave a comment.
model baseLangStructure = SModelRepository.getInstance().getModelDescriptor( new SModelReference("jetbrains.mps.baseLanguage.structure", "")).getSModel();model, module/.../ and model/.../ are concepts of the language jetbrains.mps.lang.smodel
After that you can access the concepts of your language like this:
foreach concept in baseLangStructure.roots(ConceptDeclaration) { string name = concept.name; nlist<PropertyDeclaration> properties = concept.getPropertyDeclarations(); nlist<LinkDeclaration> childs = concept.getLinkDeclarations(); nlist<LinkDeclaration> references = concept.getReferenceLinkDeclarations(); // ... }