Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Keyword Externalisation in Xtext file(Can we externalise the keywords in the xtext file?)
Keyword Externalisation in Xtext file [message #1719649] Mon, 11 January 2016 04:50 Go to next message
Puneet Patwari is currently offline Puneet PatwariFriend
Messages: 64
Registered: November 2014
Member
HI All

I am curious to know if there is any means by which we can externalise the keywords in the .xtext file. Actually the requirement is that the keywords might change based on the user of DSL.

Or can you suggest any other way of having the same grammar rules but different keywords in different context?

Thanks in advance.

Regards
Puneet Patwari
Re: Keyword Externalisation in Xtext file [message #1719666 is a reply to message #1719649] Mon, 11 January 2016 09:22 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 83
Registered: January 2016
Location: Kiel
Member

If you want to use words, that are defined and changed somewhere in the user-space, you should use cross references and a generic rule in the grammar such as ID.

You can adjust the syntax coloring, such that these names get colored like keywords.
Re: Keyword Externalisation in Xtext file [message #1719795 is a reply to message #1719666] Tue, 12 January 2016 06:34 Go to previous messageGo to next message
Puneet Patwari is currently offline Puneet PatwariFriend
Messages: 64
Registered: November 2014
Member
Hi Sven

Looks like this is your first messasge in this year. Smile Thanks for the reply. It's a rather interesting solution. I think its more of a workaround as it creates a projection of a keyword(by syntax coloring) rather than being an actual instance of 'Keyword' class in Xtext.

If you are interested I will try to elaborate on my problem a little further. I am planning to have a language which is like an Universal Language (UL) but specifcially for one domain. Then there are other languages(L1,L2,...) also in the same domain(languages might not be formalised into Xtext grammar) which are more specific according to its need. What I want is to have some way of mapping these languages L1,L2 etc. with the UL, seamlessly, so that users could use the grammar rules and have the abstract syntax from the UL but the keywords and representation of the DSL might change according to the specific languages L1,L2, etc. It is like the UL gets extended in a way to support other languages.

I know there are various other problems associated with this idea, which I would list:
1. It's difficult to know the completeness of the Universal Language, so that it can cover a lot of other languages.
2. The mapping of L1,L2 etc. with UL cannot be straight forward as a one-to-one mapping. It can be tricky actually.
3. At a higher level, this is a problem of Ontology change/evolution.
4. Even though, if I find some strategy, I do not know if it can be implemented using Xtext et al.

I am sorry beforehand, if what I expressed seem vague. I am just trying to think like a researcher as I am a fresher Smile. But You, being an expert in the area of language and knowledge, are in a better position to point me to some right directions so that I can do my research.

It would be fascinating if other experts/users can give their opinion in this aspect.

Regards
Puneet
Re: Keyword Externalisation in Xtext file [message #1720054 is a reply to message #1719795] Thu, 14 January 2016 07:29 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 83
Registered: January 2016
Location: Kiel
Member

Ok, if it doesn't need to be changed in the user's space but you the main purpose is to reuse the abstract syntax of UL, you can define L1s...Ln by reusing the UL ecore model.
So you would effectively define an alternative syntax for UL. Additionally you could add new concepts in L1 but as you mentioned they wouldn't be known in UL so you would have to subclass various implementation classes in L1 and add the needed semantics. Alternatively you extend UL but don'T add syntax in it for the new concepts.

Sven
Previous Topic:Generating indices from an XBase project
Next Topic:Change the length of text in the proposals
Goto Forum:
  


Current Time: Fri Apr 19 14:11:45 GMT 2024

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

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

Back to the top