Sunday, December 06, 2009

The Last Byte

Finished up my LZW compression/decompression code today. It took my all day to figure out the last byte of the compression algorithm was not getting written out to the encoded file. x_x

The problem was masked by several things: (1) confusion over whether the problem existed in the compression or decompression algorithm; (2) careless (in my opinion) compression/decompression pseudo-code provided in the class notes (for example, the pseudo-code compression algorithm is just plain wrong as written); (3) intermittent nature of reproducing the problem: input "abababa\r\nabababa" decompressed OK, but "abababa\r\nabababa\r\n}" did not (the byte for character "}" was not getting written to file by the compression algorithm)....; (4) complexity of the algorithm; (5) some limitations of using stock tools (for example, jdb).

Happily, it is now done. On to the final program for the semester: an implementation of a lexer using hashing functions.

No comments:

Blog Archive