Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » linking cross-references manually
linking cross-references manually [message #813650] Mon, 05 March 2012 14:58 Go to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 430
Registered: July 2009
Location: Gothenburg
Senior Member
Hi!

My language has no special syntax for declaring variables, but they are created when they are first used. This use can be in arbitrary places in an expression.

If I understand correctly, this makes it impossible to use the normal reference declarations in the grammar. I would have to do it manually in the linking step, by traversing the expression tree, deciding which is the first use and make all other uses point to it.

Is this correct or at least in the right direction? Did I miss some major detail? Is there some example somewhere about how to manipulate the parse tree while linking?

best regards,
Vlad
Re: linking cross-references manually [message #813772 is a reply to message #813650] Mon, 05 March 2012 17:28 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
Hi,
This is similar to what I had to do in stackhammer/geppetto @ github -
as the Puppet DSL language it supports is difficult to link.

You can take a look at the linking I am doing - it runs after the
regular linker, it uses adapters to store resolved links, and provides
all the necessary information to the Xtext framework to play nice when
building etc. I also implemented "Open declaration" and "Find
references" based on the "links in adapters".

It works quite well.

(As you will find out, the implementation is somewhat messy, as I
learned how to do things step by step, and it could probably be cleaned
up and made a lot nicer).

If you are interested - the actual linking starts in PPLinker, and the
interesting stuff is in PPResourceLinker.

Happy to answer any questions you may have.

Regards
- henrik

On 2012-05-03 15:58, Vlad Dumitrescu wrote:
> My language has no special syntax for declaring variables, but they are
> created when they are first used. This use can be in arbitrary places in
> an expression.
>
> If I understand correctly, this makes it impossible to use the normal
> reference declarations in the grammar. I would have to do it manually in
> the linking step, by traversing the expression tree, deciding which is
> the first use and make all other uses point to it.
> Is this correct or at least in the right direction? Did I miss some
> major detail? Is there some example somewhere about how to manipulate
> the parse tree while linking?
Re: linking cross-references manually [message #813808 is a reply to message #813772] Mon, 05 March 2012 18:33 Go to previous message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 430
Registered: July 2009
Location: Gothenburg
Senior Member
Thanks Henrik!

I learned to check the geppetto code before asking any question Smile but in this case I saw the documentation linking stuff and thought that was all of it...

> I also implemented "Open declaration" and "Find
> references" based on the "links in adapters".

Does this mean that not all UI functionality gets supported by default? Do you have any
idea which parts do and which don't? I wouldn't want to end up with just as much own code as in the handwritten version I already have; one of the reasons of switching to Xtext is that maintenance should be less demanding.

regards,
Vlad
Previous Topic:M2M transformation reports
Next Topic:Help with xtext grammar void method
Goto Forum:
  


Current Time: Mon Mar 30 23:49:56 GMT 2020

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

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

Back to the top