Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext DSL evolution
Xtext DSL evolution [message #1780093] Wed, 17 January 2018 10:44 Go to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 46
Registered: December 2014
Member
Hello,

currently we have an outdated DSL. For this reason, a new one has been created with xText.
However, it would be utopian that all projects immediately migrate to the new DSL.
The model information looks pretty much the same. Only the syntax is different.

Are there any best practices or recommendations on how to support the old/legacy DSL anyway (for a while)? Should we create a second xtext file for the old DSL? Can we share the model classes between the different parser?

Thanks
Re: Xtext DSL evolution [message #1780096 is a reply to message #1780093] Wed, 17 January 2018 11:06 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6066
Registered: July 2009
Senior Member
Hi

If you plan to improve your DSL every year, you may want to plan for that....

You could share common functionality in an AbstractDSL, but this will then give you three 'DSL's. Much easier to just have two.

By default Xtext will auto-generate the CS model for you e.g. DSL.ecore. This can be very helpful when it is an artefact entirely derived from the syntax. However as soon as you have two different syntaxes you will have two probably only slightly different DSL1.ecore and DSL2.ecore and you will need to perform an M2M between them.

If you decide to treat DSL.ecore as a primary design artefact that Xtext uses, you can relatively easily create a composite DSL.ecore that avoids the need for distinct DSL1.ecore and DSL2.ecore and the corresponding M2M. If new and old syntax and are sufficiently similar job done. If not you may need to have a smaller M2M that upgraded old syntax elements to new ones. You will end up with distinct DSL1 and DSL2 editors both of which maintain a model conforming to DSL.ecore.

Taking control of DSL.ecore as a primary artefact requires more effort but it has many benefits. I do it for all my OCL and QVTd 'DSL'.ecores since I like to have direct rather than inferred control of inhertance structures, property placement etc.

Once your many DSLs drft too far apart you may want to revert to an automatic DSLx.ecore for each DSL and use genuine M2Ms from each DSLx.ecore to an externally independent DSL.ecore.

Regards

Ed Willink
Re: Xtext DSL evolution [message #1780938 is a reply to message #1780093] Tue, 30 January 2018 08:13 Go to previous message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 759
Registered: July 2009
Location: Hamburg
Senior Member
What is the old DSL based on technically? Is it EMF based? Why not use both in parallel? Which parts do you want to reuse?

You can also have to different grammars (syntaxes) on the same Ecore model. This kind of binds the new DSL to the legacy of the old one, may prohibit independent evolution in the future, but may be a viable solution in your scenario.





---
Get professional support from the Xtext committers at www.typefox.io
Previous Topic:Rule to ignore a whole line of text
Next Topic:How to remove prefix in cross-reference
Goto Forum:
  


Current Time: Tue Oct 16 06:23:17 GMT 2018

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

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

Back to the top