Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to generate code from Xbase expressions(I want to generate code (Xtend) from Xbase expressions)
How to generate code from Xbase expressions [message #1745268] Fri, 07 October 2016 07:07 Go to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
I am experimenting with Xbase my first time. I want to generate code from my Xbase expressions I entered into my DSL but if I parse the Xbase expression object tree I find some bogus JvmVoidImplCustom objects.
I guess that there must be some linking behind the scenes.
How can I get the identifiers I entered to my expressions ?
What do I need to do ?
Is there some standard mechanism to privide Xbase with a set of valid identifieres ?
Re: How to generate code from Xbase expressions [message #1745283 is a reply to message #1745268] Fri, 07 October 2016 09:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13884
Registered: July 2009
Senior Member
i am not sure: JvmModelGenerator + XbaseCompiler asume to find a model that ran through the inferrer and XbaseTypeComputer having seen the complete expression tree.
so can you elabtorate what you are actually doing.


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to generate code from Xbase expressions [message #1745291 is a reply to message #1745283] Fri, 07 October 2016 10:49 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
I am using XExpressions in my DSL but I am not using the JvmInferrer and I don't know the XbaseCompiler and XbaseTypeComputer.
Can I use the later ones outside the JvmInferrer ?
I want to generate Xtend instead of Java and I have my own Generator. I want to use the Xbase syntax to form java/xtend-like expressions and transform them into Xtend code in the end.
Re: How to generate code from Xbase expressions [message #1745304 is a reply to message #1745291] Fri, 07 October 2016 11:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13884
Registered: July 2009
Senior Member
generating xtend wont work anyway since the xtext builder wont pick up files generated by xtext. and yes you need a jvmmodelinferrer and types computer run to be able to generate from the expressions using the exising generator.

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to generate code from Xbase expressions [message #1745354 is a reply to message #1745304] Fri, 07 October 2016 20:15 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
How does the TypesComputer work ? Do you have some code examples or a pointer ?
Re: How to generate code from Xbase expressions [message #1745357 is a reply to message #1745354] Sat, 08 October 2016 05:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13884
Registered: July 2009
Senior Member
From an API or from a impl point of view?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to generate code from Xbase expressions [message #1745358 is a reply to message #1745357] Sat, 08 October 2016 05:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13884
Registered: July 2009
Senior Member
I just reccommend you to have a look at the domain model example and see how

Inferrer (provides jvmmodelassociations and logical containers for expressions - e.g. To which field initializers and methods bodies which expression should be mapped

The type computer

And the xbase compiler

Play together and how to components are called

By do some debugging


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to generate code from Xbase expressions [message #1745363 is a reply to message #1745354] Sat, 08 October 2016 10:23 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1775
Registered: July 2009
Location: Firenze, Italy
Senior Member
Olaf Bigalk wrote on Fri, 07 October 2016 20:15
How does the TypesComputer work ? Do you have some code examples or a pointer ?


Besides having a look at the domain model example, Xbase and a few advanced concepts related to Xbase (like the type computer and compiler customization) are covered to some extent in the second edition of my Xtext book, https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition

hope it helps
Lorenzo


[Updated on: Tue, 18 October 2016 07:58]

Report message to a moderator

Re: How to generate code from Xbase expressions [message #1745820 is a reply to message #1745363] Mon, 17 October 2016 21:40 Go to previous messageGo to next message
Ajit Dingankar is currently offline Ajit DingankarFriend
Messages: 12
Registered: July 2011
Junior Member
Lorenzo, thanks for the pointer! You may want to remove the period from the end of the URL though. Smile
Re: How to generate code from Xbase expressions [message #1745834 is a reply to message #1745820] Tue, 18 October 2016 07:59 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1775
Registered: July 2009
Location: Firenze, Italy
Senior Member
Done Smile

Everything was much better with NNTP... :'(


Re: How to generate code from Xbase expressions [message #1745886 is a reply to message #1745834] Tue, 18 October 2016 20:28 Go to previous message
Ajit Dingankar is currently offline Ajit DingankarFriend
Messages: 12
Registered: July 2011
Junior Member
Thanks, Lorenzo! And thanks for writing the book! I got some really good tips from it re Xbase to Java model transformations!
Previous Topic:Xtext web content proposal
Next Topic:XtextActivator instead of <MyLang>Activator
Goto Forum:
  


Current Time: Fri Apr 16 15:46:10 GMT 2021

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

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

Back to the top