Python 3 compatibility fixes

The following changes were needed to successfully use slimit with Python 3 in my own project.

I had to use current (not yet released) [ply](https://github.com/dabeaz/ply) though.