Model to grammar [message #18117] |
Sun, 20 July 2008 19:27 |
Eclipse User |
|
|
|
Originally posted by: no.email.com
Hi,
A theoretical question :
As models are graphs and grammars are trees,
is it always possible to transform a model into a grammar? (I suppose not)
Also, are there advantages of using a model rather than a grammar?
|
|
|
Re: Model to grammar [message #18229 is a reply to message #18117] |
Wed, 23 July 2008 15:06 |
Frédéric Jouault Messages: 572 Registered: July 2009 |
Senior Member |
|
|
Hi,
> A theoretical question :
> As models are graphs and grammars are trees,
> is it always possible to transform a model into a grammar? (I suppose not)
Let M1 a model conforming to metamodel MMA and P1 the corresponding
program conforming to the corresponding grammar GA.
If M1 is a tree, then there is no problem mapping it to P1.
However, if M1 is a graph, then you need to define a specific
representation of cross-references (i.e., non-containment references
defined in MMA). This is typically implemented using symbol tables (in
addition to GA, not directly in GA). TCS uses the context, addToContext,
and refersTo constructions to deal with symbol tables.
More information about this is available in [1].
[1] Jouault, F, Bézivin, J, and Kurtev, I : TCS: a DSL for the
Specification of Textual Concrete Syntaxes in Model Engineering. In:
GPCE'06: Proceedings of the fifth international conference on Generative
programming and Component Engineering. 2006.
http://www.sciences.univ-nantes.fr/lina/atl/bibliography/GPC E06
> Also, are there advantages of using a model rather than a grammar?
The advantages of each approach mostly depend on what you want to achieve.
For instance, if you want to represent a graph, you will need more than
a grammar (i.e., the specification of the representation of
cross-references) whereas a metamodel will work directly.
Regards,
Frédéric Jouault
|
|
|
Powered by
FUDForum. Page generated in 0.03097 seconds