My tests for Kerkerkruip now include checking the correctness of numerical expressions - the output text is captured, and then numbers are parsed and evaluated. To do this, I have written these phrases:

[spoiler][code]To decide what number is digit (T - a text):

Repeat with value running from 0 to 9:

if character number (value + 1) in “0123456789” is T:

decide on value;

To decide what number is (T - a text) as a number:

Let the sign be 1;

Let the value be 0;

if T matches the regular expression “+”:

replace the regular expression “<^+>*+" in T with “”;
if T matches the regular expression “-”:
replace the regular expression "<^->*-” in T with “”;

now the sign is -1;

while T matches the regular expression “^\D*(\d)”:

now the value is (value * 10) + digit (text matching subexpression 1);

replace the regular expression “^\D*\d” in T with “”;

decide on the sign * the value;

[/code][/spoiler]

The tests are running really slowly, and I wonder if this is part of the reason. Is there a way to make use of parser routines to do this parsing for me? Or a way to make things run faster? I don’t know how fast Inform is at processing regular expressions, but I’ve been doing a lot of it and it might be worthwhile to know how to optimize them.

Any suggestions would be welcome - thanks in advance!