Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Xtend vs. Xpand?(Noob)
Xtend vs. Xpand? [message #1149285] Mon, 21 October 2013 22:37 Go to next message
Eclipse UserFriend
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 00:26] by Moderator

Re: Xtend vs. Xpand [message #1149494 is a reply to message #1149285] Tue, 22 October 2013 01:56 Go to previous messageGo to next message
Eclipse UserFriend
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 05:41 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 21:19:57 EDT 2025

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

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

Back to the top