Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Dynamic Elements of Language(Dynamically create new elements of language)
Dynamic Elements of Language [message #1805166] Tue, 09 April 2019 06:28 Go to next message
Santhiveeran S is currently offline Santhiveeran SFriend
Messages: 7
Registered: November 2018
Junior Member
Hi All,
Thanks for your guidance and support.

I want to know one of the feature availability in Xtext. Normally we have some language fundamentals which we used to write the program in the language.

For example,

Write "Hello world"

As per the language, this will get write in the output console as "Hello world".

In my case user also can create their own syntax of commands,

For example WriteString "I am new one"
For this, user will create a text file and write the name,format and description

like newcmd name="writestring" format="%s" desc="Print only String"

This can be changed, created at run time, based on the text file changes, it needs to refreshed automatically.

I need the help on the below,

1. Is it possible to import new grammar into already running eclipse?
2. Is it EMF model or some other concept help me to achieve this?
Re: Dynamic Elements of Language [message #1805188 is a reply to message #1805166] Tue, 09 April 2019 14:25 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6514
Registered: July 2009
Senior Member

In principle Eclipse added support for dynamic installs without restarting nearly 10 years ago, but I'm not sure that the facility is widely used and as a result may no longer work; certainly Acceleo has a broken functionality that appears to relate to this.

Even if it works, regenerating your Xtext plugins and installing them on the fly will take quite a few seconds.

But is it what you really want? Xtext doesn't execute Write "Hello world"; Xtext just parses it, then a generator converts it to an executable form or an interpreter executes it directly.

If your interpreter reads the *.xtext model, your interpreter may be able to pick up the new commands, possibly after intercepting the Token stream.

The add-on text file presumably has its own invariant meta-grammar, so perhaps your interpreter/token processing only needs to process the meta-grammar.


Ed Willink
Re: Dynamic Elements of Language [message #1805191 is a reply to message #1805188] Tue, 09 April 2019 15:48 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13223
Registered: July 2009
Senior Member
can the params be IDs too or strings, ints etc only.
if yes you could have two dsl (parts), one that declares things,
one that uses them.
if you know where params are and where a "call" is you could have a

callee=[Declaration] params+=Parameters*

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:Operators for operations with java.lang.Number
Next Topic:How to validate through all objects
Goto Forum:

Current Time: Sat Nov 23 01:32:29 GMT 2019

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

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

Back to the top