Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [SOLVED] Transformation of Abstract Syntax Tree
[SOLVED] Transformation of Abstract Syntax Tree [message #642005] Mon, 29 November 2010 14:12 Go to next message
Florian Gessner is currently offline Florian GessnerFriend
Messages: 20
Registered: November 2010
Junior Member
Hi all,

is it possible to manipulate the abstract syntax tree programatically? If yes, is there a default approach how to do this?

I need this to do some defaulting which depends on input of the user.

If I have understood the user guide right, XTEND can only be used for M2M transformation during parser generation but not during runtime.

Thank and Best Regards
Florian

[Updated on: Wed, 01 December 2010 07:02]

Report message to a moderator

Re: Transformation of Abstract Syntax Tree [message #642032 is a reply to message #642005] Mon, 29 November 2010 15:39 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Florian,

you are free to use the EMF API to manipulate the semantic model.
Call resource#save() to persist your changes. Please have a look at
http://koehnlein.blogspot.com/2010/06/semantic-model-access- in-xtext.html for
more information.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 29.11.10 15:12, schrieb Florian Gessner:
> Hi all,
>
> is it possible to manipulate the abstract syntax tree programatically?
> If yes, is there a default approach how to do this?
>
> I need this to do some defaulting which depends on input of the user.
>
> If I have understood the user guide right, XTEND can only be used for
> M2M transformation during parser generation but not during runtime.
>
> Thank and Best Regards
> Florian
Re: Transformation of Abstract Syntax Tree [message #642086 is a reply to message #642005] Mon, 29 November 2010 18:39 Go to previous messageGo to next message
Florian Gessner is currently offline Florian GessnerFriend
Messages: 20
Registered: November 2010
Junior Member
Hi Sebastian,

thanks for your fast reply.
The example described in the blog uses the IDocumentEditor to manipulate the data. I do not want to implement this in the UI layer but in the backend.
I think EMF should would independent from this, but for me it is not clear how I can integrate this into the backend. I think it would be a bit strange if I would enrich the model by some logic during validation or linking. Or is this how it works?

The best solution would be to have a post-processing step after linking.

Thanks and best regards
Florian

[Updated on: Tue, 30 November 2010 09:27]

Report message to a moderator

Re: Transformation of Abstract Syntax Tree [message #642346 is a reply to message #642086] Tue, 30 November 2010 21:39 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Florian,

you can use the resource / EMF API directly in a plain (non-interactive)
environment.
If you want to enrich your model you should investigate using imported
metamodels and derived properties for the derivable information.
However, the Linker#afterModelLinked is usually a good place to enhance
the model.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 29.11.10 19:39, schrieb Florian Gessner:
> Hi Sebastian,
>
> thanks for your fast reply.
> The example described in the blog uses the IDocumentEditor to manipulate
> the data. I do not want to implement this in the UI layer but in the
> backend.
> I think EMF should would independent from this, but for me it is not
> clear how I can integrate this into the backend. I think it would be a
> bit strange if I would enrich the model by some logic during validation
> or linking. Or is this how it works?
>
> Thanks and best regards
> Florian
Re: Transformation of Abstract Syntax Tree [message #642382 is a reply to message #642005] Wed, 01 December 2010 07:02 Go to previous message
Florian Gessner is currently offline Florian GessnerFriend
Messages: 20
Registered: November 2010
Junior Member
Hi Sebastian,

I now solve the issue be creating an own implementation of LazyLinker and adding the required logic after the linking process. This can easly be done by overwriting the link model method.

Thanks and Best Regards
Florian
Previous Topic:Duplicate error
Next Topic:How to convert between from sourceScriptFile and ObjectFile
Goto Forum:
  


Current Time: Thu Apr 25 14:12:57 GMT 2024

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

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

Back to the top