|Adding function calls to DSL syntax [message #1386691]
||Thu, 19 June 2014 13:48
| Gary Worsham
Registered: September 2013
This is probably pretty easy but I thought I'd ask about it here because it strikes me as possibly a common problem that people encounter.|
The big benefit I have gained from using Xtext/Xtend as a supplement to my Java application is collapsing of patterns I saw in my Java code to a more compact representation in the DSL.
Now I'm starting to see patterns develop in my DSL source code itself and I would like to collapse those again, if possible. If I were writing this in a normal language I would simply put those statements into a subroutine and then call them while passing any needed parameters. Or, I might pull that code out to be a separate object that could be re-used by other classes. This is what I'd really like to do.
Currently, my DSL simply goes line by line. The model is built up and then when the Xtend code generators are called, the model is iterated and the structure is created then, all according to the template code in the generator.
Adding the concept of a subroutine means that I need to isolate a certain group of statements and not treat those exactly like the rest of them. It would require some of the structural decisions to be managed at parsing rather than code generation time.
Is this a common problem? Any examples available showing how it's already been solved?
[Updated on: Thu, 19 June 2014 13:50]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.09866 seconds