Dr. Wong asked me where he could get the most recent version of Kooprey, my object-oriented parser generator. I gave him the URL, but when I tested Kooprey on a sample grammar, I noticed that the grammar could not be compiled. Something was wrong. Because I was still working on the predicate annotations for the thread checker, I had to shelve this problem for a few hours, but around 5:30 AM I finally had a chance to look at it.
There was something seriously wrong. In fact, I don’t know how it could ever have worked! Quoted string literals, i.e. terminal symbols that are always the same, are just given numbers. However, when I was generating the AST classes that contained the string literals, I was using one numbering scheme, and when I generated the terminal classes, I used a completely different numbering. I guess I must have been incredibly lucky to always get the same scheme… Even though that is highly unlikely.
In addition to that, factories for non-terminals were written out using the original grammar that may not have been left-factored and atomized, which makes absolutely no sense. Left-factoring and atomization are absolutely necessary. Perhaps I only tried it with grammars that I had left-factored or atomized myself. I don’t know. I’m embarrassed that I released code that was this broken in January, but apparently not too many people have noticed it.
Now these problems are fixed, it’s 7:13 AM, which means I have 43 minutes before my morning alarm clock goes off, which typically tells me it’s time to take a nap. After that, I’ll review the parsing paper and Kooprey some more, and then I’ll help Dr. Wong with his lecture at 1 AM, if he wants.
Again, I’m happy. I got a lot done tonight.