Code generator support #642
Replies: 1 comment 3 replies
-
Hey @luan-xiaokun,
As of now, there's no other way to make use of Langium without defining your language in Langium's grammar language. The framework relies on the structural and syntactical information provided in your grammar to work.
Sure, having your generator as an injected service sounds perfectly reasonable. Especially, since you'll have access to all your other services in there as well.
You mean like running two languages in a language server and have them interact with each other? Yes, although we don't have documentation on that yet, this feature has been available for quite some time (see #311). You can simply have both languages in your langium config file (which is why the
Langium is the spiritual successor of Eclipse Xtext which has a more opinionated approach to code generation. We wanted to give users more options on how to they want to generate their code. For code generation in Langium itself, you can use every kind of text templating system that you like.
After almost 18 months of development we believe that the framework is already in a good position. We use it in several production-ready projects already. For code generation support especially, we tried to keep it hands-off and let users implement it the way they want. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The document says that a code generator can be plugged to provide a more powerful toolchain. Many DSL languages, such as modeling languages, expect code generation to get executable code, or input models for model checkers.
As a newcomer to TypeScript, I find it hard to figure out how to support code generation with the langium tool. I am more concerned about the following problems, and any discussion on this is welcome.
Since langium development is probably still at a relatively early stage, I have a feeling there may not be direct support, but I would love to have such features.
Beta Was this translation helpful? Give feedback.
All reactions