The code looks clean and it works. It's fun to implement your own understandable parser. After doing such an exercise, suddenly a seemingly complex file format doesn't look like such a black box anymore. When I implemented my decompressor, I also looked at https://github.com/pfalcon/pyflate , to understand and verify the inner gzip/deflate RFC workings. Pyflate is also pretty small, especially after removing the bzip2 code, after which only ~450 lines are left. Laiho's code seems more readable, though.
Comments
The code looks clean and it works. It's fun to implement your own understandable parser. After doing such an exercise, suddenly a seemingly complex file format doesn't look like such a black box anymore. When I implemented my decompressor, I also looked at https://github.com/pfalcon/pyflate , to understand and verify the inner gzip/deflate RFC workings. Pyflate is also pretty small, especially after removing the bzip2 code, after which only ~450 lines are left. Laiho's code seems more readable, though.