Sunday, March 3, 2013

My urgent to-do list

I fixed a design flaw in JPlex this weekend. The fix is not backward-compatible, but updating code that uses JPlex only requires changing the imports for the exceptions. I could add an option to make the old behavior optional, but I'll do that only if it's requested.

The problem was that JPlex was generating its boilerplate exceptions in the krum.jplex package, which could lead to those exceptions being duplicated in the classpath. This wasn't creating any conflicts yet because the implementation of those exceptions has never changed. But if it ever did, it could lead to version mismatches. Now the exceptions are generated in each lexer's own package, so it can reliably refer to the version it was generated to use.

Speaking of JPlex... I've recommitted to using it in Weapon M's data parser. I was frustrated by the difficulty of parsing some of the more complex patterns in the game, such as sector displays. (This actually held up the public release by a couple weeks, and it's still not finished.) I would love to use a tree-building parser for the game data, but no suitable parser exists. Every tree-building parser I've looked at waits until the end of input to construct its parse tree, which makes it useless for parsing a continuous stream of text. Writing a forest-building stream parser sounds like a really exciting project, so it's something I'll probably eventually undertake. But for now, I will make the best of the tools I have.

What this means is that I'm ready to begin an extensive audit of the JPlex spec for the data parser. The first step will be to create a comprehensive list of player-entered text that can appear to other players. A complete understanding of the context surrounding player-entered text will allow me to reduce the amount of context matched by the lexer rules without introducing opportunities for spoofing. This will simplify the hand-coded parsing, reduce the compile time of the lexer spec, and increase runtime performance. Second, I will make a side-by-side comparison of all game text in TWGS versions 1 and 2 and rewrite the lexer rules to handle both versions.

I noticed that I didn't publish the source of the scripts I included with Weapon M. I'm going to correct that oversight as soon as I decide where to put it.

Last but not least, I recognize the need for a document describing how to build Weapon M. Maven is becoming more appealing, but I still need to learn more about it.

No comments:

Post a Comment