Shane Calimlim wrote: > You can see the generated PIR here: http://theguildforge.com/ack.pir
Wow, that's nice tight code for something that's spat out by a compiler. Well done Shane! I've appended Amber's generated PIR to this message. No need to tell me all the ways that it can be improved, because I can already see plenty! I've shown just the 'ack' method, but the compiler also puts some library code into the PIR file. Regards, Roger Browne -- ack(m, n) -- do -- result := if m = 0 then -- n + 1 -- elseif n = 0 then -- ack(m - 1, 1) -- else -- ack(m - 1, ack(m, (n - 1))) -- end -- end .sub "ack" :method .param pmc m .param pmc n .check_private() .local pmc result $P2 = m $I0 = find_type 'Amber_INTEGER' new $P3, $I0, '0' iseq $I1, $P2, $P3 new $P1, 'Amber_BOOLEAN' set $P1, $I1 unless $P1, ELSEIF8b14470 $P2 = n $I0 = find_type 'Amber_INTEGER' new $P3, $I0, '1' $P1 = n_add $P2, $P3 goto END8b14470 ELSEIF8b14470: $P2 = n $I0 = find_type 'Amber_INTEGER' new $P3, $I0, '0' iseq $I1, $P2, $P3 new $P1, 'Amber_BOOLEAN' set $P1, $I1 unless $P1, ELSE8b14470 $P3 = m $I0 = find_type 'Amber_INTEGER' new $P4, $I0, '1' $P2 = n_sub $P3, $P4 $I0 = find_type 'Amber_INTEGER' new $P3, $I0, '1' .set_private() $P1 = self."ack"($P2, $P3) .unset_private() goto END8b14470 ELSE8b14470: $P3 = m $I0 = find_type 'Amber_INTEGER' new $P4, $I0, '1' $P2 = n_sub $P3, $P4 $P4 = m $P6 = n $I0 = find_type 'Amber_INTEGER' new $P7, $I0, '1' $P5 = n_sub $P6, $P7 .set_private() $P3 = self."ack"($P4, $P5) .unset_private() .set_private() $P1 = self."ack"($P2, $P3) .unset_private() END8b14470: result = $P1 .return(result) .end