Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » linking performance
linking performance [message #977605] Fri, 09 November 2012 07:19 Go to previous message
Vlad Dumitrescu is currently offline Vlad Dumitrescu
Messages: 313
Registered: July 2009
Location: Gothenburg
Senior Member
Hi!

This question is related to my previous ones, regarding to performance when running the Xtext builder on files. I found that part of the problem is caused by the linking step that needs to do a lot of work. However, I can't see how to change the grammar so as to need a lighter linker. I hope someone can give me some pointers.

The language has symbols that can either just represent themselves or be references to named elements in the code. Originally I modeled all these symbols as potential links and used the linker to decide whether it's a real one or not. But that slows it down considerably.

I tried to specify the exact kind of reference that is expected, since in several places it is possible to know that statically and that resulted in a halving of the time the Xtext builder needed!

But of course the joy didn't last long, because in the general case of an expression, a symbolic value may be any of these references or a simple name and the parser can't discern which, because they all look alike. Of course, it has the info higher up in the stack, but this isn't a context-sensitive parser.

Is there any trick that I can use, or is my initial solution the only one that works? Or maybe I just misunderstood a lot of things about how to use Xtext?

Code example to understand the problem. A function call's target can be a general expression.

In the case where the reference can be resolved statically, we want two cross-references, one to the "mod" and one to the "fun".
mod.fun(1,mod,fun)

Here, ?MOD is a macro that is known at compile time. Here we want two cross-references from it, one to the macro definition and in case the value is a symbol, to that module.
?MOD.fun(1,?MOD,fun)

In this third case, Fun is a variable and we don't know its value. No cross-references.
mod.Fun(1,mod,Fun)

In the parameter lists, "mod" and "fun" are just names unrelated to the ones before. The macro and variable should reference their respective definitions.

best regards,
Vlad

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Strategies for using embedded editor
Next Topic:Introduce factory created EObjects
Goto Forum:
  


Current Time: Tue May 21 17:06:26 EDT 2013

Powered by FUDForum. Page generated in 0.01599 seconds