Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtext] managing large numbers of rules(how to have several xtext files just for a language (extension))
[Xtext] managing large numbers of rules [message #1399012] Fri, 11 July 2014 23:15 Go to next message
duke vah is currently offline duke vahFriend
Messages: 33
Registered: December 2013
Member
I wonder if there is a way to have several grammar files for a language (metamodel)? I mean just for one file extension.
In large projects, writing all of rules inside a xtext file reduces modularity and needs lots of time for finding and managing.


[Updated on: Fri, 11 July 2014 23:16]

Report message to a moderator

Re: [Xtext] managing large numbers of rules [message #1399239 is a reply to message #1399012] Sat, 12 July 2014 08:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

there is only the single inheriance solution for that. depending on your usecase you could build several languages for different concerns as well


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtext] managing large numbers of rules [message #1399538 is a reply to message #1399239] Sat, 12 July 2014 20:20 Go to previous messageGo to next message
Neeraj Bhusare is currently offline Neeraj BhusareFriend
Messages: 177
Registered: July 2009
Location: Canada
Senior Member
Hi,

Take a look at the example project [0]. I have abstracted out the common rules in the Parent dsl [1], and all the other dsl's [2] inherit from the parent. Hope this helps.

[0]https://github.com/nbhusare/Xtext-sandbox
[1]https://github.com/nbhusare/Xtext-sandbox/blob/master/org.neclipse.xtext.parentdsl/src/org/neclipse/xtext/parentdsl/ParentDsl.xtext
[2]
https://github.com/nbhusare/Xtext-sandbox/blob/master/org.neclipse.xtext.entitydsl/src/org/neclipse/xtext/entitydsl/EntityDsl.xtext
https://github.com/nbhusare/Xtext-sandbox/blob/master/org.neclipse.xtext.functiondsl/src/org/neclipse/xtext/functiondsl/FunctionDsl.xtext


Twitter : @NeerajBhusare
Blog : https://nbhusare.github.io/
Best regards, Neeraj

[Updated on: Sat, 12 July 2014 20:45]

Report message to a moderator

Re: [Xtext] managing large numbers of rules [message #1400003 is a reply to message #1399239] Sun, 13 July 2014 14:38 Go to previous messageGo to next message
duke vah is currently offline duke vahFriend
Messages: 33
Registered: December 2013
Member
Thanks for response.
What I need is something else. What you indicated is used for importing a new EMF model. Therefore, in these case we will have two or three meta models for two , three extensions. What I need is a concrete metamodel with just an extension. I just need a method to put grammars in several files so that I can manage them easily.
For example,
a language called "mydsl" with extexnsion ".dsl"
there are several xtext files when we compile them we'll get just one metdamodel related to just that extension.

[Updated on: Sun, 13 July 2014 14:54]

Report message to a moderator

Re: [Xtext] managing large numbers of rules [message #1400057 is a reply to message #1400003] Sun, 13 July 2014 16:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
the only chance is to have a single inhertiance hierarchy and only the specialized one beeing exposed with a file extension.
have a look what xtext does for xtend/xbase


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtext] managing large numbers of rules [message #1401764 is a reply to message #1400057] Wed, 16 July 2014 04:04 Go to previous message
duke vah is currently offline duke vahFriend
Messages: 33
Registered: December 2013
Member
Thanks,
I'll explore it.
Previous Topic:createInjectorAndDoEMFRegistration Vs Guice.createInjector
Next Topic:JvmType Reference in XText DSL based on XCore model [Luna]
Goto Forum:
  


Current Time: Fri Apr 19 22:44:34 GMT 2024

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

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

Back to the top