Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Ecore -> Text inverse transformation
Ecore -> Text inverse transformation [message #1005399] Fri, 25 January 2013 09:05 Go to next message
Alex G is currently offline Alex G
Messages: 96
Registered: January 2012
Member
Hi!

I have an ecore metamodel upon which my XText grammar is based on. Now an ecore model can be created in three ways:
(1) with XText editor
(2) with Ecore reflective editor
(3) with a graphical editor.

Now I want to transform the ecore model to a possible textual representation (conform to the grammar).

Of course I could create another grammar, which parses the XML file of the ecore model and generates a text file by using grammar keywords by injecting the IGrammarAccess of the original grammar.

I want of course that all these transformation which happen, are structurally bijective. Concretely, if I have the following transformation functions

f : DSL-Text file -> Ecore
g : Ecore -> DSL-Text file

then I want that

f o g = identity on Ecore (by Ecore means: structurally)

g o f doesn't have to be necessarily identical (by String comparison).

Is the only possibility to achieve this, to write the generator manually and update it, if the grammar changes? Or are there some better convient methods for that issue?

Best regards,
Alex.
Re: Ecore -> Text inverse transformation [message #1005447 is a reply to message #1005399] Fri, 25 January 2013 13:28 Go to previous message
Alex G is currently offline Alex G
Messages: 96
Registered: January 2012
Member
I think, the solution to my problem is to run the serializer and implement some formatting stuff. I hope this will be enough for my problem.
Previous Topic:Alternative Cross reference not working as expected
Next Topic:Brother can you spare a grammar?
Goto Forum:
  


Current Time: Wed Sep 17 23:38:41 GMT 2014

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

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