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,
1 comment
Here are some ways to get a reference to the structure model of your language:

Language baseLang = (Language) module/jetbrains.mps.baseLanguage/; 
model baseLangStructure = LanguageAspect.STRUCTURE.get(baseLang).getSModel(); 
model baseLangStructure = model/jetbrains.mps.baseLanguage.structure/; 
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 =; 
  nlist<PropertyDeclaration> properties = concept.getPropertyDeclarations(); 
  nlist<LinkDeclaration> childs = concept.getLinkDeclarations(); 
  nlist<LinkDeclaration> references = concept.getReferenceLinkDeclarations(); 
  // ...

Please sign in to leave a comment.