Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtend vs. Xpand?(Noob)
Xtend vs. Xpand? [message #1149285] Tue, 22 October 2013 02:37 Go to next message
Gary Worsham is currently offline Gary WorshamFriend
Messages: 176
Registered: September 2013
Senior Member
The Xtext tutorial references Xtend for code generation.

http://www.eclipse.org/Xtext/documentation.html

What I need to do is iterate through my model line by line and for the most part translate specific instructions into Java and align the arguments correctly. In other cases I will need to count forward from a skip instruction until I find the matching label. Finally I may need to make value substitutions from a list of equates declared at the top of the file. I will create one output file per input file (model). As I gather the example generates a bunch of Java output files from individual Entities in the model.

The Xtend code generation example given above doesn't seem like it maps to my goal, but maybe it does and I just don't realize it yet.

I found an Xpand code generation example here:

http://www.danielschneller.com/2010/08/code-generation-with-xtext.html

and this is a lot easier for me to grasp. However I don't know whether Xpand will do everything I am looking for.

One thing I read indicated that Xtend was a superset of Xpand, or better for some reason.

Any opinions as to which one is easier to deal with or more appropriate for my application?

Many thanks!

GW

[Updated on: Tue, 22 October 2013 04:26]

Report message to a moderator

Re: Xtend vs. Xpand [message #1149494 is a reply to message #1149285] Tue, 22 October 2013 05:56 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Xtend does support your requirements.
It is much faster than Xpand, has much better IDE support (incl.
debugging) and is simpler, once you understood it.

I have written a blog post about the advantages :
http://blog.efftinge.de/2013/06/five-good-reasons-to-port-your-code.html

There is very little reason (if any) to use Xpand nowadays.
Please come up with specific questions and I'm sure someone will be
happy to guide you.

Also searching github for code generators written in Xtend might be helpful.

Sven


Am 10/22/13 4:37 AM, schrieb Gary Worsham:
> The Xtext tutorial references Xtend for code generation.
>
> http://www.eclipse.org/Xtext/documentation.html
>
> What I need to do is iterate through my model line by line and for the
> most part translate specific instructions into Java and align the
> arguments correctly. In other cases I will need to count forward from a
> skip instruction until I find the matching label. Finally I may need to
> make value substitutions from a list of equates declared at the top of
> the file. I will create one output file per input file (model). As I
> gather the example generates a bunch of Java output files from
> individual Entities in the model.
>
> The Xtend code generation example given above doesn't seem like it maps
> to my goal, but maybe it does and I just don't realize it yet.
>
> I found an Xpand code generation example here:
>
> http://www.danielschneller.com/2010/08/code-generation-with-xtext.html
>
> and this is a lot easier for me to grasp. However I don't know whether
> Xpand will do everything I am looking for.
>
> One thing I read indicated that Xtend was a superset of Xpand, or better
> for some reason.
>
> Any opinions as to which one is easier to deal with or more appropriate
> for my application?
>
> Many thanks!
>
> GW


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: Xtend vs. Xpand [message #1149770 is a reply to message #1149494] Tue, 22 October 2013 09:41 Go to previous message
Gary Worsham is currently offline Gary WorshamFriend
Messages: 176
Registered: September 2013
Senior Member
Thanks Sven for the comment. For some reason I have not found the Xtext tutorials to be all that helpful. It's probably my age Very Happy , but after trying for a few weeks I do have a working grammar. So I am hopeful.

So thanks for the idea about finding more examples on GitHub.

I will certainly come back with some questions when I can think of something specific!

GW
Previous Topic:Railroad image for grammar documentation
Next Topic:How does an Xtext-generated plugin write to the workspace log?
Goto Forum:
  


Current Time: Fri Mar 29 10:10:42 GMT 2024

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

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

Back to the top