Skip to main content



      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 03:07 Go to next message
Eclipse UserFriend
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 05:34 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: How to generate code from Xbase expressions [message #1745291 is a reply to message #1745283] Fri, 07 October 2016 06:49 Go to previous messageGo to next message
Eclipse UserFriend
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 07:48 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: How to generate code from Xbase expressions [message #1745354 is a reply to message #1745304] Fri, 07 October 2016 16:15 Go to previous messageGo to next message
Eclipse UserFriend
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 01:30 Go to previous messageGo to next message
Eclipse UserFriend
From an API or from a impl point of view?
Re: How to generate code from Xbase expressions [message #1745358 is a reply to message #1745357] Sat, 08 October 2016 01:35 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: How to generate code from Xbase expressions [message #1745363 is a reply to message #1745354] Sat, 08 October 2016 06:23 Go to previous messageGo to next message
Eclipse UserFriend
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 03:58] by Moderator

Re: How to generate code from Xbase expressions [message #1745820 is a reply to message #1745363] Mon, 17 October 2016 17:40 Go to previous messageGo to next message
Eclipse UserFriend
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 03:59 Go to previous messageGo to next message
Eclipse UserFriend
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 16:28 Go to previous message
Eclipse UserFriend
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: Sun Apr 20 22:49:43 EDT 2025

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

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

Back to the top