Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problem Importing a DSL into another
Problem Importing a DSL into another [message #1609656] Tue, 10 February 2015 08:51 Go to next message
Andy Ed is currently offline Andy EdFriend
Messages: 64
Registered: December 2009
Member
Hi I've been trying to follow the example from:

https://christiandietrich.wordpress.com/2012/08/07/xtext-referencing-elements-of-one-dsl-from-another-dsl/

I have a DSL, called state-MachineDSL, that I want to import into another DSL, but I get an error on the URL part.

The line with generate is: generate stateMachineDsl "http://ac.soton/iumlb/xtext/StateMachineDsl"

The error is: Generated package 'stateMachineDsl' may not be empty

What is the 'generate' statement for, and how do I resolve the error?

Regards,
Andy



Re: Problem Importing a DSL into another [message #1609657 is a reply to message #1609656] Tue, 10 February 2015 08:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14668
Registered: July 2009
Senior Member
Hi,

so in your importing grammar you completely use the metamodel that is imported?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem Importing a DSL into another [message #1609658 is a reply to message #1609657] Tue, 10 February 2015 08:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14668
Registered: July 2009
Senior Member
the generate statement derives a epackage from the grammar rules

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem Importing a DSL into another [message #1609675 is a reply to message #1609657] Tue, 10 February 2015 09:06 Go to previous messageGo to next message
Andy Ed is currently offline Andy EdFriend
Messages: 64
Registered: December 2009
Member
Yes, it is a sub-component of the importing DSL.
Re: Problem Importing a DSL into another [message #1609682 is a reply to message #1609675] Tue, 10 February 2015 09:11 Go to previous messageGo to next message
Andy Ed is currently offline Andy EdFriend
Messages: 64
Registered: December 2009
Member
No Message Body
Re: Problem Importing a DSL into another [message #1609684 is a reply to message #1609682] Tue, 10 February 2015 09:12 Go to previous messageGo to next message
Andy Ed is currently offline Andy EdFriend
Messages: 64
Registered: December 2009
Member
This is the generated EPackage statement that is registered in the mwe2 file. Is this not the same?

registerGeneratedEPackage = "ac.soton.eventb.statemachines.StatemachinesPackage"

Andy
Re: Problem Importing a DSL into another [message #1609716 is a reply to message #1609684] Tue, 10 February 2015 09:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14668
Registered: July 2009
Senior Member
No,

the one (mwe) is the "already generated" imported one - the other is the "to be generated", that will be derived from the grammar


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem Importing a DSL into another [message #1609728 is a reply to message #1609716] Tue, 10 February 2015 09:49 Go to previous messageGo to next message
Andy Ed is currently offline Andy EdFriend
Messages: 64
Registered: December 2009
Member
I don't understand the error message, then, since it states that the package to be derived cannot be empty; yet it is still to be generated, so why wouldn't it be empty?

Do you generate the derived package separately?

Cheers,
Andy
Re: Problem Importing a DSL into another [message #1609842 is a reply to message #1609728] Tue, 10 February 2015 11:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14668
Registered: July 2009
Senior Member
Hi,

can you post both grammars:

if you use the metamodel of the first grammar in the second grammar and you do not introduce any new elements,
the generated package will be empty.
this you wont need the generate statement in the grammar nor the fragment in the workflow


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem Importing a DSL into another [message #1609927 is a reply to message #1609842] Tue, 10 February 2015 12:36 Go to previous messageGo to next message
Andy Ed is currently offline Andy EdFriend
Messages: 64
Registered: December 2009
Member
I've attached the DSLs, without my attempt to import it, and also cleaned out our comments to make it clearer.

The 'machineDSL' will import the 'statemachineDSL'; a machine can have zero or more state-machines. The genmodels are not the same for both DSLs.

Cheers,
Andy
Re: Problem Importing a DSL into another [message #1609949 is a reply to message #1609927] Tue, 10 February 2015 12:59 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14668
Registered: July 2009
Senior Member
you do obviosly import an existing metamodel so simply do not
- have a generate statement in the dsls
- a ecoregeenratorfragment in the workflow


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Problem with quoted string that should be split
Next Topic:Problem adding custom feature & operations with implementations to Xtext generated ECore model
Goto Forum:
  


Current Time: Fri Apr 26 18:46:40 GMT 2024

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

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

Back to the top