So I'm still trying to incorporate the XProlog work into my WProlog port. Unfortunately, while they're related, they certainly are not of the same species. I can't simply steal the shiny bits like I intended to. Part of the reason for this is XProlog's use of JavaCC. The latter tool is a type of compiler compiler. Given a grammar, it can write out a Java class that can compile code from said grammar.
I can try to just port it, but the code is very convoluted and will be very difficult to debug. Instead, since I already have a character-based parser, why not just use that? Well, AI::Prolog::Parser, based on the original parser code, can't parse much of anything. It mainly provides the tools for parsing. The AI::Prolog::Term and AI::Prolog::TermList classes know how to parse terms and term lists respectively. I suppose having classes know how to parse the bits of grammar they represent is understandable, but this means the parsing code is spread out over three classes and cannot get easily integrated back into the parse class (something XProlog requires.) However, XProlog has operators, uses less memory and runs faster. I have to move forward.
Now what the hell do I do? Do I try to fold those extra parsing bits back into the parser class? Do I switch to Parse::RecDescent or perl-byacc? None of these solutions sound appealing. Lots of work ahead of me. I have some ideas, but so far I've wasted about half of today on a failed approach.