Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Multiple versions of a grammar in parallel
Multiple versions of a grammar in parallel [message #1760000] Fri, 21 April 2017 06:46 Go to next message
Kevin Wiedener is currently offline Kevin WiedenerFriend
Messages: 9
Registered: May 2012
Junior Member
Hi xtext community,

does anybody know a concept how to run different versions of a grammar in parallel?
We have a version identifier in our grammar (like Version 2.5) in order differ between all published grammar versions. However it is only possible to install one eclipse plugin (for the latest version usually) and our customers have different versions of the grammar in use (each project may use a separate grammar version).
I know that I can add backwards compatibility to the grammar and the code, but we do not want to maintain this stuff and get rid of it. Is there any way to handle this except of providing some backwards compatibility with the latest grammar version?

Many thanks for your ideas and opinions.

Best regards,
Re: Multiple versions of a grammar in parallel [message #1760005 is a reply to message #1760000] Fri, 21 April 2017 07:09 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14496
Registered: July 2009
Senior Member
well there are multiple thinks of this.

(a) you can't install multiple versions of the same plugin, you can install multiple plugins only => no simple update mechanism
(b) xtext supports content type based language differentiations by some adoptions of plugin.xml (and maybe other places)
e.g. org.eclipse.xtext.content_resourceServiceProvider instead of org.eclipse.xtext.extension_resourceServiceProvider,
register editor based on content type instead of file extension
i dont know of any documentation or tutorials on this nor have a ever don this myself
and i dont know if this runs properly with all features you use and need.
(c) xtext 2.11 has the option to switch parser entry rule from outside, maybe you can leverage this from your usecase as well (e.g. adoption XtextResourceFactory)
(d) just have one grammar/parser and do the distinction there somehow (dont know where the version idenitifer is at your code)

=> you need to find a way to mitigate the usability flaws of (a) and have a look if you can get (b) running

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Re: Multiple versions of a grammar in parallel [message #1760028 is a reply to message #1760005] Fri, 21 April 2017 10:32 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7595
Registered: July 2009
Senior Member

If your multiple grammar versions represent a largely compatible evolution (such as you observe with Java) you probably do not want multiple grammars. Your users will find it more helpful to have a single grammar that warns when facilities not available with the selected version are in use.

If your multiple grammar versions are seriously incompatible, you probably want independent plugins and perhaps a little content-type cleverness to allow the same extension to be used by multiple versions.


Ed Willink
Previous Topic:Active Annotation Concept in a XBase and JvmModel based DSL
Next Topic:Launch Runtime Eclipse run configuration unreliable?
Goto Forum:

Current Time: Sat Jun 03 05:54:54 GMT 2023

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

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

Back to the top