Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Binary code generation with Xtend/Xpand/Xtend2?
icon5.gif  Binary code generation with Xtend/Xpand/Xtend2? [message #647196] Wed, 05 January 2011 00:06 Go to next message
Mirko Raner is currently offline Mirko RanerFriend
Messages: 79
Registered: July 2009
Location: San Diego, CA
Member
Hi,

we have an Xtext grammar and an EMF model generated from that grammar, and now we want to generate binary code (similar to Java bytecode, for example).
It's obviously not a big deal to write some simple visitor that traverses the EMF model and spits out a sequence of bytes, but we're wondering whether we could leverage Xtend/Xpand or Xtend2 to perform the code generation.
So far, it seems like the code generation is geared towards generating other source code (not binaries). We understand that we could generate Java code that, in turn, generates the binary code, but if direct binary code generation is possible we might consider that option over a hand-written EMF-to-binary generator.
Any insights on this? Can Xtend/Xpand/Xtend2 be used for that purpose or are we better off with a hand-rolled code generator?

Thanks!
Re: Binary code generation with Xtend/Xpand/Xtend2? [message #647323 is a reply to message #647196] Wed, 05 January 2011 16:29 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 360
Registered: July 2009
Location: Dortmund
Senior Member

Hi Mirko,

Xpand is intended for plain-text code generation. I would go for a hand-written solution here. You could use the Switch class generated for your metamodel to realize your visitor-based binary compiler.

~Karsten


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: Binary code generation with Xtend/Xpand/Xtend2? [message #653058 is a reply to message #647323] Tue, 08 February 2011 10:12 Go to previous message
Andreas Graf is currently offline Andreas GrafFriend
Messages: 157
Registered: July 2009
Senior Member
You could always use Xpand/Xtend to generate a file in hexadecimal format and use tools like SRecord to make a binary out of that.
Command line tools for conversion can be integrated into the workflow bythe SystemCommand component.
Previous Topic:[XPand] questions in using AROUND
Next Topic:[Acceleo 3] Update in Model reflects regeneration
Goto Forum:
  


Current Time: Sat Dec 20 05:53:32 GMT 2014

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

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