Generate code in two different areas in a file

I have a specific structure in my language. For this structure, I want to be able to either use generator and/or textgen to be able to generate different code in two different areas. Is this possible? For example, maybe I want to create a field at the top of the class, and assign it somewhere in a function.

Thanks!
Chhavi
1 comment
Sure, this is possible. It is actually a pretty common scenario, that you generate an item into some sort of declaration together with references to it scattered across the model.

There are many options that the generator gives you - I'd recommend that you go through the Generator tutorial - https://confluence.jetbrains.com/display/MPSD32/Generator+Demos, which is specifically targeted towards exploring all the options of the generator. It builds on the knowledge acquired in the introductory tutorials, namely the Shapes tutorial (https://confluence.jetbrains.com/display/MPSD32/Shapes+-+an+introductory+MPS+tutorial) and the Fast Track tutorial (https://confluence.jetbrains.com/display/MPSD32/Fast+Track+to+MPS).

Vaclav
0

Please sign in to leave a comment.