How to extend language's structure

So, I have language #1 with concept named "Constant"

My goal is to create a language #2, which extends language #1 and which has textGen model with ConceptTextGenDeclaration for concept "Constant". Language #2 depends on language #1, #2.structure depends on #1.structure and etc, but when I am trying to rebuild language, I get

/textGen/TextGenAspectDescriptor.java: Constant cannot be resolved or not a field

So I think language #2 doesn't extend lang #1, or I don't get it.

3 comments
Comment actions Permalink

Please see reply to similar question regarding custom textgen. Simply put, it's not what extends between languages mechanism has been intended for.

0
Comment actions Permalink

Tikhomirov Artem could you link this question here? It's difficult to find.

I'm trying to do a similar thing so I will continue here. I have three languages: 
- #1 defines structure and editor
- #2 extends #1 and defines a generator which uses #1 concepts. This works well, when I choose this language in "languages engaged in generation" in my sandbox project
- #3 also extends #1 but defines a textGen for #1 concepts. This doesn't work when I choose this language in "languages engaged in generation" in my sandbox project and I get the same error as Enchantinggg4.

It's possible to extend a language in order to create a new generator. Why isn't the same possible with textGen? How can I acheve such separation of the theese two generators (textGen and the actual generator) to make this work?

0
Comment actions Permalink

Here's the link, https://mps-support.jetbrains.com/hc/en-us/community/posts/115000469310-How-to-extend-language-with-custom-text-gen

As I pointed out in the referenced post, textgen is tightly bound to the langguage and its concepts, it's not possible to have a textgen separate, in another language. The whole idea of language module/aspect model distinction is that textgen is just an aspect/facet/specialization of particular language functionality. Language module is not merely a container, it's a language entity, with various aspects described independently from each other, but all in tight coupling with the language itself.

Generators, OTOH, are not aspects, and are distinct modules. We envision support for multiple generator modules, so that one can define M2M transformation for a single source language but multiple target languages (which, in turn, could get translated with M2T, TextGen, into appropriate source code).

0

Please sign in to leave a comment.