Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » EMF-Text or Xtext?
EMF-Text or Xtext? [message #902904] Tue, 21 August 2012 04:55 Go to next message
Jeeeyul Lee is currently offline Jeeeyul LeeFriend
Messages: 111
Registered: July 2009
Location: Seoul
Senior Member

Personally, I prefer to use Xtext than EMF-text because of xbase jvm integration and easiness.

But I want to listen some opinions from who love EMF-text.
Re: EMF-Text or Xtext? [message #903028 is a reply to message #902904] Tue, 21 August 2012 17:02 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 601
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On 20.08.12 21.55, Jeeeyul Lee wrote:
> Personally, I prefer to use Xtext than EMF-text because of xbase jvm
> integration and easiness.
>
> But I want to listen some opinions from who love EMF-text.

I mainly use xtext, but used emftext for a Java-transformation project a
couple of years ago. In general, I'm satisfied with both.

My impression is that the xtext's tooling and jvm integration is better.
However, emftext seems to handle large grammars better and already comes
with a complete grammar for Java (the jamopp project).

I would use xtext in the general case and emftext if I needed a Java
grammar, e.g. for analysing or transforming Java code, or if the grammar
was similar to Java's.

Hallvard
Re: EMF-Text or Xtext? [message #903334 is a reply to message #903028] Thu, 23 August 2012 08:11 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1771
Registered: July 2009
Senior Member
Hi Hallvard,

Am 8/21/12 7:02 PM, schrieb Hallvard Trætteberg:
> However, emftext seems to handle large grammars better

Could you elaborate on what you mean here?
Did you run into problems with a too large grammar?

Sven

--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: EMF-Text or Xtext? [message #903492 is a reply to message #903334] Thu, 23 August 2012 22:19 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 601
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On 23.08.12 01.11, Sven Efftinge wrote:
> Hi Hallvard,
>
> Am 8/21/12 7:02 PM, schrieb Hallvard Trætteberg:
>> However, emftext seems to handle large grammars better
>
> Could you elaborate on what you mean here?
> Did you run into problems with a too large grammar?

My own grammars haven't been that large, but when combined with Xbase I
have often had problems with size/time of generation, particularly when
the Xbase grammar has been extended.

The biggest model and grammar I've worked with was EMFText's Java model
(the JaMoPP project), and since it covered all of Java 5, it was pretty
big. It might very well be possible/practical in Xtext, too, but based
on my experience I wouldn't try. Please take it as a challenge ;-)

Hallvard
Re: EMF-Text or Xtext? [message #903505 is a reply to message #903492] Fri, 24 August 2012 02:53 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 2942
Registered: July 2009
Senior Member
Hi Hallvard,

one might argue that the Xtend grammar is pretty much the same as Java5
(- support for array + support for lambdas) and it works like a charm.
So I'd say challenge accepted. Achievement aquired :-) Since there are
even grammars out there that cover e.g. PL/SQL (the spec alone is 1000++
page) I'd say there is no such limitation as my-grammar-is-too-big for
Xtext.

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 24.08.12 00:19, schrieb Hallvard Trætteberg:
> On 23.08.12 01.11, Sven Efftinge wrote:
>> Hi Hallvard,
>>
>> Am 8/21/12 7:02 PM, schrieb Hallvard Trætteberg:
>>> However, emftext seems to handle large grammars better
>>
>> Could you elaborate on what you mean here?
>> Did you run into problems with a too large grammar?
>
> My own grammars haven't been that large, but when combined with Xbase I
> have often had problems with size/time of generation, particularly when
> the Xbase grammar has been extended.
>
> The biggest model and grammar I've worked with was EMFText's Java model
> (the JaMoPP project), and since it covered all of Java 5, it was pretty
> big. It might very well be possible/practical in Xtext, too, but based
> on my experience I wouldn't try. Please take it as a challenge ;-)
>
> Hallvard
Re: EMF-Text or Xtext? [message #903784 is a reply to message #902904] Sat, 25 August 2012 23:38 Go to previous messageGo to next message
Marcus Munzert is currently offline Marcus MunzertFriend
Messages: 3
Registered: August 2012
Location: Freiburg, Germany
Junior Member
I prefer the EMFText approach to first create the meta-model and develop the grammar based on that (in Xtext the meta-model is derived from the grammar). Maybe this is because I am more used to think in meta-models than to think in grammars.

Also, I found it easier to learn how to use EMFText as compared to Xtext. The well written EMFText documentation and the so-called EMFText Syntax-Zoo (100 examples of concrete syntaxes) were really helpful in that respect.

Since we use the generated DSL parser within Eclipse as well as outside Eclipse, the easiness to do so played a role in our decision, too. And with EMFText this was easy to accomplish.

Please note that we have no need for using Xtend since we use our own code-generation framework. So Xtend/Xbase and its interaction/integration with Xtext does not affect my opinion.

Cheers,
Marcus
Re: EMF-Text or Xtext? [message #903846 is a reply to message #903784] Sun, 26 August 2012 11:23 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26231
Registered: July 2009
Senior Member
Marcus,

Comments below.

On 26/08/2012 1:38 AM, Marcus Munzert wrote:
> I prefer the EMFText approach to first create the meta-model and
> develop the grammar based on that (in Xtext the meta-model is derived
> from the grammar).
No, you can derive a grammar from the model and then development them
relatively independently with the caveat that of course you must
maintain a bidirectional mapping between the two. Or you can develop
them separately from the start. Or, as was the case with Xcore, you can
start with the grammar, derive an Ecore model, and then separate them so
you can develop them independently. In other words, there are many
different approaches you can choose, depending on your preference. In
the case of defining a textual syntax for Ecore, I didn't want to modify
Ecore itself, but rather chose to develop a new model, Xcore, and define
a mapping from that onto Ecore/GenModel. In this case, the framework
provided by Xtext was ideal; *.xcore resources contain an Ecore and a
GenModel instance so such a resource can be used in downstream
frameworks that know nothing about Xcore.

> Maybe this is because I am more used to think in meta-models than to
> think in grammars.
>
> Also, I found it easier to learn how to use EMFText as compared to
> Xtext. The well written EMFText documentation and the so-called
> EMFText Syntax-Zoo (100 examples of concrete syntaxes) were really
> helpful in that respect.
Good documentation is indeed a huge asset. Xtext has some really nice
examples, but the documentation is not as extensive as one might
desire. The help on the newsgroup is excellent though...
>
> Since we use the generated DSL parser within Eclipse as well as
> outside Eclipse, the easiness to do so played a role in our decision,
> too. And with EMFText this was easy to accomplish.
>
> Please note that we have no need for using Xtend since we use our own
> code-generation framework.
That's fine. It's available to use or not to use as is most appropriate
for your application. For developing Xcore I do make some use of
Xtend, but not for the code generation framework because EMF has one
already.
> So Xtend/Xbase and its interaction/integration with Xtext does not
> affect my opinion.
No, but for many users, developing something like Xbase to support both
a JVM-based interpreter and a Java generator is a big investment of
effort whereas reusing the completed Xbase effort is a huge saving of
such effort. From my Xcore experience, I must say that it's extremely
well designed for such reuse.
>
> Cheers,
> Marcus
Re: EMF-Text or Xtext? [message #903861 is a reply to message #903505] Sun, 26 August 2012 18:18 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 601
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Sebastian,

On 23.08.12 19.53, Sebastian Zarnekow wrote:
>
> one might argue that the Xtend grammar is pretty much the same as Java5
> (- support for array + support for lambdas) and it works like a charm.
> So I'd say challenge accepted. Achievement aquired :-) Since there are
> even grammars out there that cover e.g. PL/SQL (the spec alone is 1000++
> page) I'd say there is no such limitation as my-grammar-is-too-big for
> Xtext.

I'm not an expert on grammars, but there seems to be an important
distinction between complexity (interaction between rules) and size
(number of rules). It's not the number of rules that causes problems,
but how they interact. Sometimes simple changes to a grammar may cause
or remove problems, and it's not always easy to understand why (before
you dig into the details and start thinking like a parser).

I've often wondered whether some of Xtend's choices (where it differs
from Java) was due to (technical) grammar problems with the Java syntax
instead of usability:
- references to class use typeof(class)
- casts use the 'as' keyword
- references to static identifiers use :: as the separator
- xtend uses val and def keywords

To what extent were these choices made to simplify the grammar (for the
parser, not the user)?

Hallvard
Re: EMF-Text or Xtext? [message #904292 is a reply to message #903861] Tue, 28 August 2012 07:19 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1771
Registered: July 2009
Senior Member
Am 8/26/12 8:18 PM, schrieb Hallvard Trætteberg:
> I'm not an expert on grammars, but there seems to be an important
> distinction between complexity (interaction between rules) and size
> (number of rules). It's not the number of rules that causes problems,
> but how they interact. Sometimes simple changes to a grammar may cause
> or remove problems, and it's not always easy to understand why (before
> you dig into the details and start thinking like a parser).

You certainly have to understand how lexing and parsing works.
And what limitations and strengths the underlying parsing technology has
(i.e. ANTLR).

> I've often wondered whether some of Xtend's choices (where it differs
> from Java) was due to (technical) grammar problems with the Java syntax
> instead of usability:

Yes, we made some choices to avoid complication of the Xbase
implementation. This is not because we couldn't solve it, but we wanted
people to be able to extend and use Xbase in their own language.

For instance, using the '.' for namespaces (i.e. in static feature
calls) would have been very familiar for Java users, but it would have
been very complicated for langauge designers to understand what's goig
on there. This is because if there is no syntactical difference, you'll
have to parse into the same structure and make decisions based on
semantic analysis later on (i.e. shoehorn very different things into the
same structure).

But I don't think that this has to do something with a grammar being too
large for Xtext. It's merely about the natural limitations of the
parsing technique Xtext is based on and which features Xtext allows to use.

Sven


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: EMF-Text or Xtext? [message #904303 is a reply to message #903784] Tue, 28 August 2012 07:47 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1771
Registered: July 2009
Senior Member
Am 8/26/12 1:38 AM, schrieb Marcus Munzert:
> I prefer the EMFText approach to first create the meta-model and develop
> the grammar based on that (in Xtext the meta-model is derived from the
> grammar). Maybe this is because I am more used to think in meta-models
> than to think in grammars.

This is simply not true.
Xtext supports both: Imported *and* generated Ecore models.

Having an ecore file derived from the grammar is an extremely convenient
feature in early stages.

>
> Also, I found it easier to learn how to use EMFText as compared to
> Xtext. The well written EMFText documentation and the so-called EMFText
> Syntax-Zoo (100 examples of concrete syntaxes) were really helpful in
> that respect.

I can understand that it looks more appealing to read through 40 pages,
than around 400 pages of documentation. Xtext supports many helpful but
advanced aspects. Just consider the whole Java integration or the
namespace index. Yes, you'll have to learn a bit about it, but it's
worth it.

Also note that it's a reference documentation so you don't need to read
everything. There are many different tutorials preceding the reference
documentation, which help people get started.

Regarding examples: There are many real-world examples on the community
page (http://www.eclipse.org/Xtext/community.html) and we maintain
high-quality examples including detailed documentation of how they are
built (http://www.eclipse.org/Xtext/7languagesDoc.html)

> Since we use the generated DSL parser within Eclipse as well as outside
> Eclipse, the easiness to do so played a role in our decision, too. And
> with EMFText this was easy to accomplish.

Parsing a file outside Eclipse is two lines of code in Xtext.
Actually if you use EMF Resource APIs, you don't even 'see' Xtext API in
the code if you don't want to.

> Please note that we have no need for using Xtend since we use our own
> code-generation framework.

Xtend is a language not a framework. And you can generate code with what
any technology you want when using Xtext. After all you end up with EMF
models. So using Xtend is not mandatory (but a good idea, though).

> So Xtend/Xbase and its interaction/integration with Xtext does not affect my opinion.

Xbase has nothing to do with being a code generation framework.
It's an expression language which you can embed in your DSL and it
provides deep integration with a surrounding Java context. See the seven
examples to get en idea what it's all about.

Given all the false statemantes and implications you made about Xtext,
it sounds like you prefer EMF-Text just because you know it. Which is
ok, but not very helpful as an advice.

Sven


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: EMF-Text or Xtext? [message #904557 is a reply to message #904303] Tue, 28 August 2012 17:20 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 601
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Sven,

On 28.08.12 00.47, Sven Efftinge wrote:
>
>> Please note that we have no need for using Xtend since we use our own
>> code-generation framework.
>
> Xtend is a language not a framework. And you can generate code with what
> any technology you want when using Xtext. After all you end up with EMF
> models. So using Xtend is not mandatory (but a good idea, though).
>
>> So Xtend/Xbase and its interaction/integration with Xtext does not affect my opinion.
>
> Xbase has nothing to do with being a code generation framework.
> It's an expression language which you can embed in your DSL and it
> provides deep integration with a surrounding Java context. See the seven
> examples to get en idea what it's all about.
>
> Given all the false statemantes and implications you made about Xtext,
> it sounds like you prefer EMF-Text just because you know it. Which is
> ok, but not very helpful as an advice.

It takes some time and experience to understand how EMF, Xtext, Xtend
and XBase fits together, and it can be confusing if you only read about
them separately. E.g. Xtend is presented as a nicer Java language, that
also happens to be suited for code generation, particularly in
combination with Xtext and particularly when you also use Xbase. So what
is it, a general purpose language or a code generation framework? Well,
you can use it as both, and that may be confusing, until you get to know
it by using it.

Tomorrow I'm presenting all these for a group at UC Berkeley, and from
their questions in advance I get the impression that they are also
confused. These are very bright people, but with limited time to dig
into all the technologies that are available for this and that. It's
normal to keep using what you know (and trust) and that does what you
want and just that.

Hallvard
Re: EMF-Text or Xtext? [message #904828 is a reply to message #904557] Wed, 29 August 2012 08:24 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1771
Registered: July 2009
Senior Member
Am 8/28/12 7:20 PM, schrieb Hallvard Trætteberg:

> It takes some time and experience to understand how EMF, Xtext, Xtend
> and XBase fits together, and it can be confusing if you only read about
> them separately. E.g. Xtend is presented as a nicer Java language, that
> also happens to be suited for code generation, particularly in
> combination with Xtext and particularly when you also use Xbase. So what
> is it, a general purpose language or a code generation framework?

The main reason why there are such things as code generation frameworks
is, that Java is so bad at concatenating strings.

Xtend is a general purpose language which is among other things well
suited to do string concatenation (i.e. code generation).

> Well,
> you can use it as both, and that may be confusing, until you get to know
> it by using it.

Yes, it's confusing and I understand that. Many people in the modeling
community are used to have special languages for different tasks (M2M,
M2T, Validation, etc.). After all it seems like it nicely supports the
idea of DSLs. But I've learned that there's often not enough value in
having these strict separations. Actually the contrary is the case, it
often has been a limitation in the old Xpand/Xtend/Check times.
For instance, I often want to be able to have small local functions in
almost any of these tasks. Also model transformation and code generation
are often mixed, like in Xbase's model inferrer where you transform to
coarse grained Java models but can attach the body of a method as a string.

Sven

--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: EMF-Text or Xtext? [message #904869 is a reply to message #904303] Wed, 29 August 2012 09:47 Go to previous messageGo to next message
Marcus Munzert is currently offline Marcus MunzertFriend
Messages: 3
Registered: August 2012
Location: Freiburg, Germany
Junior Member
Thank you for the clarifications and for correcting me, Sven.

As you said: "... Yes, you'll have to learn a bit about it, but it's worth it. ...". Obviously, I do not know enough about Xtext to be able to assess all the differences between Xtext and EMFText and to appreciate the capabilities of Xtext.

Jeeeyul Lee was saying "But I want to listen some opinions from who love EMF-text.". And that's exactly what I was giving him, an opinion. I am not in a position to state that EMFText is generally better than Xtext or Xtext is generally better than EMFText. Actually, I am not sure whether it is possible at all, to make such a statement. For my personal needs, EMFText was easy to learn and works well, so I decided to continue using it.

Our own code-generation framework doesn't have any dependencies to EMFText. So it can well be used in conjunction with Xtext. And our cloudbased code-generation plattform "Virtual Developer" will surely host code-generators that consume models created with Xtext-based DSL-Editors.

Cheers,
Marcus
Re: EMF-Text or Xtext? [message #904877 is a reply to message #903846] Wed, 29 August 2012 09:56 Go to previous messageGo to next message
Marcus Munzert is currently offline Marcus MunzertFriend
Messages: 3
Registered: August 2012
Location: Freiburg, Germany
Junior Member
Ed, thank you for the clarifications. That's right, the help on the newsgroup is really excellent.

Cheers,
Marcus
Re: EMF-Text or Xtext? [message #905123 is a reply to message #904828] Wed, 29 August 2012 18:27 Go to previous message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 601
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On 29.08.12 01.24, Sven Efftinge wrote:
> Am 8/28/12 7:20 PM, schrieb Hallvard Trætteberg:
>
> ... Many people in the modeling
> community are used to have special languages for different tasks (M2M,
> M2T, Validation, etc.). After all it seems like it nicely supports the
> idea of DSLs. But I've learned that there's often not enough value in
> having these strict separations. Actually the contrary is the case, it
> often has been a limitation in the old Xpand/Xtend/Check times.
> For instance, I often want to be able to have small local functions in
> almost any of these tasks. Also model transformation and code generation
> are often mixed, like in Xbase's model inferrer where you transform to
> coarse grained Java models but can attach the body of a method as a string.

DSLs are nice when they match your needs, and example of the 80/20 rule:
20% of the effort with 80% of the features. But as you say, often you
need some feature outside the 80%, like defining utility functions,
accessing existing libraries, etc. Then you either have to extend the
language or you have to switch to a more general purpose one. The beauty
of Xtend is how it is both general purpose 95%, interoperates with Java
(adding the remaining 5%) and includes enough domain-specific (i.e.
code-generation) features to remove the need for a DSL (reduces the
effort back to 20% for template-based string concatenation). It was not
obvious that it could be done, but you did it!

Hallvard
Previous Topic:deleted
Next Topic:modeling external libraries
Goto Forum:
  


Current Time: Thu Nov 27 12:10:54 GMT 2014

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

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