Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [XCore] extending XCore
[XCore] extending XCore [message #1223428] Mon, 23 December 2013 05:56 Go to next message
Joel Greenyer is currently offline Joel Greenyer
Messages: 170
Registered: July 2009
Senior Member
Hi,
my idea is to extend XCore and I need some pointers on how to start and what I have to consider.
I've been using XCore and have some knowledge of XText, but I don't know much about XBase and how XCore works exactly.

I sketched my idea in the attached PDF. I want to build a language that I call XSpec. The idea is that developers should be able to model a class model in XCore (see lower part of middle column), but intead of --or in addition to-- implementing the operations in XBase, it should be possible to specify behavior in a sequence diagram fashion (see top part of middle column). This XSpec model should then be translated automatically into an XCore model that consists of (1) Classes that represent the scenarios (2) the class model, which is 1-to-1 the class model as modeled previously. The scenarios classes contain XBase code for executing the scenarios. The details of how that should work are not relevant here.

So, my questions are:
1. Has anybody done anything similar, i.e., extended XCore? Are there any projects that I could have a look at?
2. How do I get started with defining "XSpec"? Do I create a new XText grammar, e.g.

grammar org.example.xspec.XSpec with org.eclipse.emf.ecore.xcore.Xcore
....
?

3. If so, how can I specify that a package can contain not only classes, data types, enums, but also "scenarios"?
Is it wise to override the XText rule, e.g.

XClassifier:
XClass |
XDataType |
XEnum |
XScenario
;
?

4. How can I extend/hook into/trigger the generator workflow of XCore? I think what I want is, whenever one saves an XSpec, do <translate XSpec->XCore> then <trigger existing XCore generator process>

5. Any recommendations for setting up my development environment to get started?


Sorry for so many nooby questions.
Any pointers on how to get started are welcome!

Best

Joel
Re: [XCore] extending XCore [message #1223466 is a reply to message #1223428] Mon, 23 December 2013 08:26 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25950
Registered: July 2009
Senior Member
Joel,

Comments below.

On 23/12/2013 11:56 AM, Joel Greenyer wrote:
> Hi,
> my idea is to extend XCore and I need some pointers on how to start
> and what I have to consider.
The incquery folks have done that, but nothing in Xcore is API, so keep
in mind that arbitrary changes can and are likely to appear in the code...
> I've been using XCore and have some knowledge of XText, but I don't
> know much about XBase and how XCore works exactly.
It's not trivial, that's for sure.
>
> I sketched my idea in the attached PDF. I want to build a language
> that I call XSpec. The idea is that developers should be able to model
> a class model in XCore (see lower part of middle column), but intead
> of --or in addition to-- implementing the operations in XBase, it
> should be possible to specify behavior in a sequence diagram fashion
> (see top part of middle column).
Like the incquery guy want derived features to be computed with an
incremental query that then supports notification for the derived
feature just like you get for a normal feature...
> This XSpec model should then be translated automatically into an XCore
> model that consists of (1) Classes that represent the scenarios (2)
> the class model, which is 1-to-1 the class model as modeled
> previously. The scenarios classes contain XBase code for executing the
> scenarios. The details of how that should work are not relevant here.
>
> So, my questions are:
> 1. Has anybody done anything similar, i.e., extended XCore? Are there
> any projects that I could have a look at?
Yes, IncQuery. But they literally extend the Xcore grammar to create a
new language, must as Xcore extends Xbase's grammar...
> 2. How do I get started with defining "XSpec"? Do I create a new XText
> grammar, e.g.
Yes...
>
> grammar org.example.xspec.XSpec with org.eclipse.emf.ecore.xcore.Xcore
> ...
> ?
>
> 3. If so, how can I specify that a package can contain not only
> classes, data types, enums, but also "scenarios"?
That's more of an Xtext question...
> Is it wise to override the XText rule, e.g.
>
> XClassifier:
> XClass |
> XDataType |
> XEnum |
> XScenario
> ;
> ?
Yes, that's the general idea...
>
> 4. How can I extend/hook into/trigger the generator workflow of XCore?
Xcore's generator really is mostly just EMF's generator, but we have
hooks to compile Xbase's XBlockExpressions into text that are then added
as annotations to the Ecore model so that the normal EMF generator
generates them... If you really need additional files EMF doesn't
normally generate, you'd need to look a generator extensions.
> I think what I want is, whenever one saves an XSpec, do <translate
> XSpec->XCore> then <trigger existing XCore generator process>
>
> 5. Any recommendations for setting up my development environment to
> get started?
Eike has been creating a tool to set up development environments
automatically. Maybe you can figure out how to use it from the wiki:

https://wiki.eclipse.org/Setup-Eclipse

I created a project description for Xtext that will provision a
workspace with all of Xtext and Xcore as source, so that might be a good
starting point for exploration.
>
>
> Sorry for so many nooby questions.
> Any pointers on how to get started are welcome!
>
> Best
>
> Joel
Previous Topic:[Edapt] visualizing the migration process
Next Topic:EMF code generator [Error emf.Ecore2Java]
Goto Forum:
  


Current Time: Fri Aug 01 18:48:09 EDT 2014

Powered by FUDForum. Page generated in 0.01445 seconds