Skip to main content



      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 19:15 Go to next message
Eclipse UserFriend
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 19:16] by Moderator

Re: [Xtext] managing large numbers of rules [message #1399239 is a reply to message #1399012] Sat, 12 July 2014 04:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

there is only the single inheriance solution for that. depending on your usecase you could build several languages for different concerns as well
Re: [Xtext] managing large numbers of rules [message #1399538 is a reply to message #1399239] Sat, 12 July 2014 16:20 Go to previous messageGo to next message
Eclipse UserFriend
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

[Updated on: Sat, 12 July 2014 16:45] by Moderator

Re: [Xtext] managing large numbers of rules [message #1400003 is a reply to message #1399239] Sun, 13 July 2014 10:38 Go to previous messageGo to next message
Eclipse UserFriend
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 10:54] by Moderator

Re: [Xtext] managing large numbers of rules [message #1400057 is a reply to message #1400003] Sun, 13 July 2014 12:40 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: [Xtext] managing large numbers of rules [message #1401764 is a reply to message #1400057] Wed, 16 July 2014 00:04 Go to previous message
Eclipse UserFriend
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: Wed Jul 16 01:53:24 EDT 2025

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

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

Back to the top