A sneak peek...

Finally, I get to write that work is actually progressing with pyRete. I've managed to take so many wrong turns and go down so many dead-ends while implementing the TestNodes I was starting to worry whether or not I was capable of pulling it off.

Things, however, changed quickly once I got enough free time to sit down and go through the code I had written so far. It turned out I was actually using the wrong information from the RuleParser to construct the Rete and ... well. It's a long story, and it won't make me look lika a very good programmer so I'll just stop here. I'm blaming job-related stress and the new Swedish government for my not-so-stellar performance ;-)

Anyway, I've re-implemented the RuleCompiler. It can now construct a Rete Network containing TestNodes and various NotNodes as well as all of the other types of Nodes (AlphaNodes, ..., ProductionNodes). I still have some work to do on some of the NotNode implementations though. It doesn't propagate tokens as I want it to.

I've simplified the construction algorithm quite a bit. I removed all node sharing to keep things as simple as possible. I'm hoping to be able to implement it later on, when I'm sure about how it works in corner-cases and when I can have a more complete set of tests to verify against.

Here's a peek at the Rete Network Viewer showing:

>>> @pyRete.Rule
... def test2_1(a = int, b = int):
... ab = a * b
... if a == 3 and ab == 9:
... pass

Silly rule? Yes, indeed. But when I finally got it compiled into the above Rete Network I was very happy. Probably more so than appropriate.

Inga kommentarer: