|
Re: Manually Maintained Metamodel [message #878589 is a reply to message #878570] |
Tue, 29 May 2012 15:14 |
Henrik Lindberg Messages: 2509 Registered: July 2009 |
Senior Member |
|
|
On 2012-29-05 16:41, Stefan Kuhn wrote:
> hi, a) could someone give me a hint where manually maintained metamodels
> are explained in xTexts documentation?
>
> b) Are there examples using metamodel first, then textual DSL (eBNF)?
>
> c) Does xText leverage the abstract syntax of the metamodel? And if, how?
There are two ways to start; you either have an existing model you want
to create a concrete textual representation for, or you are creating a
new language (i.e. textual representation of a model).
When creating a new language, it is typical to start with a model that
is generated from the grammar. This is convenient for smaller languages
and while exploring options in a more complex language. After a while,
you typically want to switch to a manually maintained model (you can
start by simply copying the generated model). You want to do this, as
you want to prevent small changes in your grammar to have a potentially
dramatic effect on your model and then breaking lots of code you written
against the model.
A manually maintained model is also required if you want to be able to
specify things not expressed in the grammar, or deal with EMF "settings"
that are not available.
Basically, what you have to know is that features and containment
references are directly assignable, and non containment references are
links.
The best way to learn is to use a toy language and look at what is
generated.
Hope that helps you.
How Xtext generates the meta model is covered in the documentation.
Regards
- henrik
|
|
|
Powered by
FUDForum. Page generated in 0.03743 seconds