Skip to main content

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: 125
Registered: July 2009
Location: New York City, NY
Senior Member

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?

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: 762
Registered: July 2009
Location: Dortmund, Germany
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.


Need professional support for Xtext, EMF, Eclipse IDE?
Go to:
Twitter : @kthoms
Blog :
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: 211
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: Fri Dec 08 02:56:13 GMT 2023

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

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

Back to the top