Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Multiple DSLs - Single EMF Model?
Multiple DSLs - Single EMF Model? [message #639063] Mon, 15 November 2010 07:51 Go to next message
Chris Ainsley is currently offline Chris AinsleyFriend
Messages: 78
Registered: March 2010
Location: UK
Member
I have a tricky scenario. I have a framework that is based around multiple DSLs (each dealing with a different part of the same conceptual model). As such, a lot of detail is externalized in separate files.

I am attempting to use XText purely as a rich editor with validation between the various files as currently the user must execute the framework to discover syntax or referencing issues.

You can think of the top-level business logic being in a master DSL file and the implementation specific to each rule being in a separate DSL.

Adding to this complexity is that I have a list of Beans that I wish to reference from these files (but not defined in these files) - for simplicity - assume that there is a text file with a list of bean descriptions and full classnames in the following format somewhere that I can access via XText.


  • 1 master DSL (per model instance)
  • 1 beaninfo DSL (always referenced by every model instance)
  • '0'..'n' detail level DSLs (referenced by main DSL)


So, my questions are:


  • Do I require one or more XText projects?
  • Do I require one or more EMF models?
  • If just a single model, how do I share the model between .xtext files?
  • My detail level DSL can override model elements that can also be defined in the top-level DSL (but written in a different format), is it possible to describe the same entity in multiple DSLs referencing the same model?
  • How do I share the model between multiple projects or multiple files?


A link to an xtext project that supports multiple file formats across a single or multiple models would exactly suit my requirements here.

Thanks.

I have another question that is slightly unrelated so will post separately.
Re: Multiple DSLs - Single EMF Model? [message #639129 is a reply to message #639063] Mon, 15 November 2010 11:58 Go to previous message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Quote:

Do I require one or more XText projects?


This is optional. You could have several several Xtext grammars in one project integrated or decide to split that into seperate Xtext projects. If you have a look at the sources of the org.eclipse.xtext.xbase plugin then you can see an example for the first alternative.
Quote:

Do I require one or more EMF models?


No, you could map all of them to a single (likely manual maintained) Ecore model. Search the Xtext User Guide for the "returns" keyword.
Quote:

If just a single model, how do I share the model between .xtext files?


This would be done from Xtext automagically through the Index.
Quote:

My detail level DSL can override model elements that can also be defined in the top-level DSL (but written in a different format), is it possible to describe the same entity in multiple DSLs referencing the same model?


Basically yes. This would mean mapping the concepts to the same type in your common Ecore metamodel.
Quote:

How do I share the model between multiple projects or multiple files?


Also here the Xtext Index would do that for you. Therefore the projects need to have the Xtext Nature activated. Also you might need to implement Scoping for your project needs.

Quote:
A link to an xtext project that supports multiple file formats across a single or multiple models would exactly suit my requirements here.


You could search the projects listed in Bug#328477 for candidates. The sources of Xbase (part of Xtext development) and B3 I would investigate first.

HTH,
~Karsten


Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Previous Topic:control values by antlr
Next Topic:Content assist / scoping issue
Goto Forum:
  


Current Time: Thu Apr 25 11:31:52 GMT 2024

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

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

Back to the top