When you told that the issue has to do with presenters, I remembered that I am using them in a slightly unusual way. I suppose my construction provokes the pending variables display. I want to note however that in build 906 it had worked out well. Let me explain what I am doing:
My code contains an Earley-style parser. The parsing method invented by Jay Earley works with any context-free grammar and can thus parse all context-free languages. The greater parsing capability in contrast to the limitations of a LALR parser has however to be paid for by higher computational costs.
An Earley parser will typically be slower by a factor compared to a LARL parser for a language which they both can parse. To compensate for that I have put efforts in speeding up my parser as much as possible.
One trick which I am using to speed up my Earley parser is, that my terminals have type positive rather than symbol. The main advantage of positive over symbol is that a look-up with a positive key can be accomplished very fast in constant time. I.e. when the data is held in an array.
However when stepping through the code with the debugger, numbers for terminals are not really pleasant to read. Thatfore I am giving them a presenter to display them in text form:
Code: Select all
domains
terminalNum = positive [presenter(terminalsSupport::present_terminal)].
For each grammar I keep its terminalNum translation in an object of type terminals. To switch the decoding of the terminal numbers respectively to the grammar in focus I am introducing a fact:
Code: Select all
class facts
presentingInstance_terminals : weakReference{terminals} := erroneous.
Code: Select all
clauses
present_terminal(TNum) =
if Terminals = notErroneous(presentingInstance_terminals):tryDeref() then
Terminals:instancePresent_terminal(TNum)
else
present_terminal_uniform(TNum)
end if.