Declarative Math

Ovid on 2005-02-05T21:35:48

Today I spent a fair amount of time trying to implement math in AI::Prolog. I had (tried) to snag some code to do it but misread the code and wound up barking up the wrong tree. Regrettably, XProlog's parser is created by JavaCC and is not designed to be human-readable. Thus, I wind up trying to decipher this:

switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 19:
    case 21:
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 21:
        jj_consume_token(21);
        tok = jj_consume_token(NUMBER);
        // and so on

This is less than helpful.

I may have to spend some time porting XProlog rather than just stealing the shiny bits. This is further complicated by the fact that XProlog does not compile with Java 1.4 and above because assert is now a keyword.

Update: Once again I am getting bit by subtleties in Java. t.bound and t.bound() are not the same thing. I was rather casual about that distinction in my Perl code. Damn.