Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Model to grammar
Model to grammar [message #18117] Sun, 20 July 2008 19:27 Go to next message
Eclipse UserFriend
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 Go to previous message
Frédéric Jouault is currently offline Frédéric JouaultFriend
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
Previous Topic:[TCS] referstoKeyPArg
Next Topic:Mode, Deep and WordRule
Goto Forum:
  


Current Time: Fri Jan 03 03:13:27 GMT 2025

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

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

Back to the top