|Re: linking cross-references manually [message #813772 is a reply to message #813650]
||Mon, 05 March 2012 17:28
| Henrik Lindberg
Registered: July 2009
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.
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?
Powered by FUDForum
. Page generated in 0.03501 seconds