|Ecore -> Text inverse transformation [message #1005399]
||Fri, 25 January 2013 04:05
| Alex G
Registered: January 2012
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?
Powered by FUDForum
. Page generated in 0.05086 seconds