Thursday, August 18, 2011

Introducing KFlex

After writing a few new scripts for SWATH, I grew frustrated with the limitations of even this most powerful TradeWars helper. If I'm ever going to play TW2002 again, I'm going to have to write my own helper — an ultimate weapon for a master scripter.

When I wanted to do this years ago, the obstacle that proved insurmountable was writing a lexer. But now, armed with my new knowledge of the state machines underlying regular expression matching, I suddenly understand how lexers work. In fact, I understand them so well that I quickly saw room for improvement, and came up with what I think is the best thing since JFlex. Naturally, I'm calling it KFlex.

Without repeating too much of what I've already written, KFlex automates the process of writing lexers that can be plugged into different applications without any changes to the lexer itself. Many programmers could contribute to and benefit from a KFlex lexer without sharing any of their application code.

As with my own game, I want to encourage intermediate programmers to write their own helpers for TW2002. And for that, KFlex is an ideal tool. You can check out an early version of my TW lexer spec at the KFlex download page.

No comments:

Post a Comment