Enclosed patch fixes a couple of bugs in the optimizer. The first was that the parser wasn't correctly recognising register names - it needs to check for these _before_ checking for labels, or else they're incorrectly identified as labels. Strangely, this wasn't causing any problems with the optimized code, at least as far as I could see, but this may be down to luck.
The other bug is a misplaced ? in the regex checking for integers. This makes the match non-greedy, so 10000.0 (for example) gets split up into 1000 (which matches the regex) and 0.0 (which matches as a float the next time around the loop). This means that code such as set N1, 10000.0 gets converted to set N1, 1000, 0.0 which quite rightly fails to assemble. Removing the ? appears to make everything work as intended. Simon --- Optimizer.pm.old Fri Dec 14 06:04:27 2001 +++ Optimizer.pm Mon Jan 21 17:35:47 2002 @@ -53,16 +53,16 @@ # Collect arbitrary parameters # while(/\S/) { - if(s/^([a-zA-Z][a-zA-Z0-9]+)//) { # global label + if(s/^([INSP]\d+\b)//) { # Register name + push @{$line->{parameter}},{type=>'register',value=>$1}; + } + elsif(s/^([a-zA-Z][a-zA-Z0-9]+)//) { # global label push @{$line->{parameter}},{type=>'label_global',value=>$1}; } elsif(s/^(\$\w+)//) { # local label push @{$line->{parameter}},{type=>'label_local',value=>$1}; } - elsif(s/^([INSP]\d+\b)//) { # Register name - push @{$line->{parameter}},{type=>'register',value=>$1}; - } - elsif(s/^(-?\d+)(?!\.)//) { # integer + elsif(s/^(-?\d+)(!\.)//) { # integer push @{$line->{parameter}},{type=>'constant_i',value=>$1}; } elsif(s/^(-?\d+\.\d+)//) { # float