Long Night of Porting SimpleParse

So once again I tried to port SimpleParse to Python 3.x. After a half-hour or so of playing with doing a complete rewrite in Cython I realized that scope creep was going to kill me, so I went back to the C-coded mxTextTools and started working out how to port that.

First step up was to drop a whole heck of a lot of compatibility code. mxTextTools supported everything back to Python 1.5.2 with a huge collections of shims, back-ports, etc. I'm willing to drop everything below 2.7 (with 2.6 users able to use the last release). Next up, deal with the obvious porting issues (PyString vs. PyBytes, PyInt vs. PyLong), then start into the mess of object and module changes. ob_type is no longer there, ob_size apparently not either (I haven't yet determined if the embeded variable record actually works the same as the ob_size field), comparison methods don't work any more and don't have an obvious replacement other than coding a set of "if lt, -1 elif gt 1 else 0" checks, object header declarations are changed, module and type initialization seems to have changed dramatically (it looks like "for the better", but it also breaks the old code).

There's still lots more to do, particularly the type/module initialization hasn't even been looked at, and I'm blocked on the ob_size thing, which doesn't seem to have been discussed anywhere.

I wish that had all felt cathartic and satisfying, but the end result is just going to be the same code running on Python 3 instead of 2, when really I probably should have spent the time making a better parser engine (or actually doing something useful). In retrospect I likely should have kept going on the Cython port, that would have at least been more interesting.


Comments are closed.


Pingbacks are closed.