Tuesday, July 10, 2007

Parsing changes for Version 1.0

After a small hiatus, I Started working on version 1.0. The focus will be on implementing the "logic arc" from chapters 8 thru 19. The propositional logic part has been done but first order logic and planning is very sparse.

One of the problems of working with logic in java is that one ends up writing custom parsers. I don't want to use parser generators (like jlex/cup), because that would increase the number of jars/libraries that users need to download. Thus the recursive descent parsers in aima java.

Coding the lexer and parser and associated visitors is very tedious and I was a little desperate to remove the tedium. One approach is to write an SExp parser that takes care of generic sexp parsing and another need specific parser that parses the resulting sexps into the required dtata structures. I've prototyped this and it does seem to work.

I am still stuck on visitors though. Most tree walking needs double despatch and "visitor" seems to be the only way to do this in Java. The code is f_ugly though.