Saturday, March 17, 2012

First Lex

This... is a beautiful thing.

What you see here is one of the TradeWars intro files read into a ByteBuffer and written to my Java terminal exactly as if it had been read over the network. Whereas hitherto I have been testing my terminal by poking characters into its buffer, today I used my lexer generator to create an ANSI interpreter. Not only was it very quick and easy to write, but it almost worked perfectly on the first try. And the bug, quickly squashed, was in my hand-written parser code, not in the generated lexer code.

So my lexer generator has finally proved itself. I hope writing the data parser will be just as simple.

No comments:

Post a Comment