Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » specification of algorithms for code generation in different langs
specification of algorithms for code generation in different langs [message #990647] Thu, 13 December 2012 15:14 Go to next message
Bruce L. is currently offline Bruce L.Friend
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.
double foo = 0;
in C++,
foo = 0;
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
Re: specification of algorithms for code generation in different langs [message #990696 is a reply to message #990647] Thu, 13 December 2012 15:49 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
Hi just a small remark - you can use Google guice not only to wire up
things but to exchange things as well

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Filter content assist proposals
Next Topic:Hidden fields in the grammar?
Goto Forum:
  


Current Time: Sat Apr 27 02:53:27 GMT 2024

Powered by FUDForum. Page generated in 0.03209 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top