Skip to main content



      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 10:14 Go to next message
Eclipse UserFriend
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 10:49 Go to previous message
Eclipse UserFriend
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
Previous Topic:Filter content assist proposals
Next Topic:Hidden fields in the grammar?
Goto Forum:
  


Current Time: Tue Jul 08 11:16:35 EDT 2025

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

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

Back to the top