Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » interdependence between your Ecore and your Grammar(editor)
interdependence between your Ecore and your Grammar(editor) [message #898540] Thu, 26 July 2012 14:37 Go to next message
frank fotso is currently offline frank fotsoFriend
Messages: 91
Registered: May 2012
Member
hi,
i wanted to know if after creating your ecore model and then generating your DSL grammar and your editor, you have to regenerate it (grammar) every time you change your ecore model.
that means if i create an Ecore call paul.ecore and from that i generate the paul.genmodel and then generate paul's grammar(xtext) and to finish i create my editor with that grammar . if now i wanted to modify my ecore model by adding somes €attributes to a specific class or add somes €classes for example. should i regenerate the genModel and the grammar ? or there is a way for me to apply ecore model changes directly in my old xtext grammar without generating a new grammar evry time i make a change in my ecre model.
Re: interdependence between your Ecore and your Grammar(editor) [message #898563 is a reply to message #898540] Thu, 26 July 2012 15:25 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
On 2012-26-07 16:37, frank fotso wrote:
> hi,
> i wanted to know if after creating your ecore model and then generating
> your DSL grammar and your editor, you have to regenerate it (grammar)
> every time you change your ecore model.
> that means if i create an Ecore call paul.ecore and from that i generate
> the paul.genmodel and then generate paul's grammar(xtext) and to finish
> i create my editor with that grammar . if now i wanted to modify my
> ecore model by adding somes €attributes to a specific class or add
> somes €classes for example. should i regenerate the genModel and the
> grammar ? or there is a way for me to apply ecore model changes
> directly in my old xtext grammar without generating a new grammar evry
> time i make a change in my ecre model.

The generation of a grammar from an ecore model should be seen as an
initial rough estimate of what a concrete syntax could look at. You
typically want to edit this.

If you are making a lot of changes, it may be better to do the opposite
- generate the ecore from the grammar.

When reaching a steady state, you probably want to not generate the
model from the grammar, and that this point you maintain things manually
(i.e. changes in the model may require changes to the grammar).

Does that help you figure out how you want to work?
- henrik
Re: interdependence between your Ecore and your Grammar(editor) [message #898655 is a reply to message #898540] Fri, 27 July 2012 05:47 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Frank,

Comments below.

On 26/07/2012 4:37 PM, frank fotso wrote:
> hi,
> i wanted to know if after creating your ecore model and then
> generating your DSL grammar and your editor, you have to regenerate it
> (grammar) every time you change your ecore model.
> that means if i create an Ecore call paul.ecore and from that i
> generate the paul.genmodel and then generate paul's grammar(xtext) and
> to finish i create my editor with that grammar . if now i wanted to
> modify my ecore model by adding somes €attributes to a specific class
> or add somes €classes for example. should i regenerate the genModel
> and the grammar ?
If you create a GenModel from Ecore, there's generally no need to
regenerate the GenModel. You can invoke Reload... if you like, but the
GenModel does an analysis when it's open to make sure it's properly
wrapped the Ecore model it's currently using and that will, for example,
create new GenFeatures to wrap any new EStructuralFeatures and new
GenClassifiers to wrap any new EClassifiers, as well as clean up broken
proxies for removed things.
> or there is a way for me to apply ecore model changes directly in my
> old xtext grammar without generating a new grammar evry time i make a
> change in my ecre model.
I imagine the tool that produces the grammar isn't incremental and
doesn't do merging, and that even if it did, it's result would be no
different from what you see now, i.e., a new grammar with some changes
in it that reflect the changes in your Ecore. Of course you'd need to
run the workflow to generate the other project artifacts each time too.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: interdependence between your Ecore and your Grammar(editor) [message #899358 is a reply to message #898655] Tue, 31 July 2012 14:28 Go to previous messageGo to next message
frank fotso is currently offline frank fotsoFriend
Messages: 91
Registered: May 2012
Member
hi
i understood what you said but @Henrik looking at what you said:
> If you are making a lot of changes, it may be better to do the opposite
> generate the ecore from the grammar.
i would like to know how to do it . generate the Ecore from the grammar.
i have check inside the src-gen which is the place where i suppose to see the Ecore model corresponding to my grammar , but there is no Ecore there, only Xmi file , so i ask myself if there is no plugin to doit or may be there is a special way to do it.
Thks in advance,
Frank
Re: interdependence between your Ecore and your Grammar(editor) [message #899363 is a reply to message #899358] Tue, 31 July 2012 14:45 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Create a new Xtext project and paste body (no grammar statement, no
imports, no generate statement) of your grammar to the one created by
the wizard. I have n Xtext here so I cannot paste an example

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:NPE during serializing
Next Topic:The path is unmapped after changing Directorylayout
Goto Forum:
  


Current Time: Fri Mar 29 02:39:31 GMT 2024

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

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

Back to the top