|Re: Split XText Grammar into multiple files [message #898820 is a reply to message #898778]
||Fri, 27 July 2012 14:59
| Alexander Nittka
Registered: July 2009
if its only to improve readablity and not about reusing a grammar for several languages (like the default Terminals or Xbase), don't do it. There are too many problems involved (at least think well on the cost/value balance).
Comment the grammar, structure it well (order of elements but also indentation etc for good readability), write a separate documentation for the main concepts and with entry points for working with it. Use the tooling (outline view, find references etc.)
There is no Xtext concept for: take these 5 files and act as if they were defined in a single grammar file. The rule of thumb is that each grammar comes with its own meta model and language infrastructure. Further a grammar can "extend" only one other grammar.
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to email@example.com
[Updated on: Fri, 27 July 2012 15:02]
Report message to a moderator
|Re: Split XText Grammar into multiple files [message #899059 is a reply to message #899011]
||Mon, 30 July 2012 07:40
| Henrik Lindberg
Registered: July 2009
On 2012-30-07 9:28, frank fotso wrote:|
> hi this means that i can't extend a grammar in another grammar twice ?,
grammar A and B can both extend grammar X, and grammar P can extend A, T
extend B etc. What you can not do is have a grammar that extends more
than one other grammar.
> so i want to create many different grammar with their own model and i
> want at the end to import all the grammar created in another one such
> that the one containing the imported can be consider as a big model.
No, that will not work.
You can however separate the model from the grammar and do the reuse,
combination in the models, and then use these models in various grammars.
> i also want to know if every grammar created since they have their own
> model , if i make a change in some of them , should i change my grammar
> containing that imported file too?
When a grammar is changed, you need to regenerate all grammars that
makes use of it to make it take effect.
If you import models instead of generating them from the grammar, you do
not need to regenerate the grammar/parsers as long as the model changes
are compatible with what is being used by the already built grammar.
Does that help you?
Powered by FUDForum
. Page generated in 0.01691 seconds