specification of algorithms for code generation in different langs [message #990647] |
Thu, 13 December 2012 15:14 |
Bruce L. Messages: 81 Registered: June 2011 |
Member |
|
|
Hello,
suppose I have a DSL whose documents encode some sort of information, and a code generator that generate the implementation of an algorithm tailored for the document.
Example: the doc contain just the items of an array, and I generate the implementation of a an algorithm that sorts that array only (i know it does not make much sense, but it is just an example)
If i want to generate the same thing in two different languages, I have to write two code generator templates that both encode the logic of the algorithm, and differ only in the details related to the syntax of the target language (e.g. in C++, in matlab).
I wonder if there exist some sort of facilities, in the Xtext world, to provide an abstract description of algorithms, so that I don't have to write many code generator templates which basically duplicates the same logic (with obvious issues if I have to change this logic)
I know I could do it by hand, by writing a single code generator function for my algorithm, which is fully parametrized to be able to generate multiple laguages.
But maybe something already exists...
Many thanks
B
|
|
|
|
Powered by
FUDForum. Page generated in 0.03209 seconds