Thursday, April 12, 2012

Optimizing Interpreter for Whenever

I have edited the original interpreter for the Whenever programming language (http://www.dangermouse.net/esoteric/whenever.html) so that it performs the following optimization:

* Temporarily remove all copies of a deferred statement from the to-do list until you do a non-deferred statement.

It results in quite a speed-up of many whenever programs. In particular, the Fibonacci program provided on the page linked above calculates all 50 Fibonacci numbers very quickly.

Two other changes made:
* read() is implemented
* replaced the subtraction operator '-' (which wasn't working) with '_'

The new version of Command.java is here and the new version of CodeTable.java is here.

Any suggestions that I have just done this in order to submit a solution to the Google Code Jam in the Whenever programming language seem very unlikely.