Well, I couldn't sleep last night. I kept tossing and turning while thinking about how to get math working right. I got up early and rather than implement the complete parser solution, I went ahead and used predicates instead of operators for math. It's clumsy, but it is how Prolog works underneath the hood:
% X is 3 + 4.
% Once again: patches welcome
The snippet above binds X to 7 (obviously). The predicates I have working are:
Unfortunately, I can only declare integer numbers (though the math supports floats), but that's a limitation of my parser. I'll fix that.
What this means, however, is after some polishing, the Prolog engine is mostly feature complete. Yeah, I can use a new parser, but I'm not too worried about that right now. Instead, since I have the features I want, I can get this ready for distribution and start working on performance. For example, I've written a tiny scheduling program. It's very slow. However, the Towers of Hanoi is very fast
my $prolog = AI::Prolog->new(<<'END_PROLOG');
move(N, left, center, right).
move(0, NULL1, NULL2, NULL3)
print("Move a disc from the "),
print(" pole to the "),
Hopefully I'll have something uploaded by this weekend.