How to generate code for my DSL? #900
-
Are there any tools that could help me programatically write code for my DSL? I want to automate a initial version of the code, I know I can just concatenate strings and generate the code, but I was wondering if langium has anything that would help me with that. I was thinking more in the lines that ts-morph works for typescript. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @luiz290788, Langium comes with a templating library out of the box. You can see it's usage in the statemachine example generator. It's main entry points are the |
Beta Was this translation helpful? Give feedback.
Hey @luiz290788,
Langium comes with a templating library out of the box. You can see it's usage in the statemachine example generator. It's main entry points are the
expandToNode
andtoString
functions exported from Langium. It's used to print human-readable, correctly indented code. It's relatively new and we are currently in the process of writing documentation and adding tracing support.