Complete tracing




The generation of code can be done with some additional features. The example below shows the output when code is generated so that each assignment prints the value which has been assigned. It also prints the invocation of each function or procedure with a list of its arguments, and upon exit, the value(s) returned. (The indentation of the output corresponds to the indentation of the statements in the converted program.) Alternatively, code that counts number of times a statement is executed, or does any other ancillary function can also be generated.

{--> enter MovingParabApprox, args = 10, 5,
  array, array, array, array
      a0[1] := 6;
      a1[1] := 0;
      a2[1] := 0;
      a0[2] := 11;
      a1[2] := 5;
      a2[2] := 0;
    sx := 17;
    sjx := 6;
    sj2x := 6;
    sj2x := 35;
    sjx := 23;
    sx := 35;
      t15 := 69;
      t9 := 9;
      t14 := 315;
      t13 := -107;
      t12 := .0166666666666667;
      t11 := .00833333333333333;
      a0[3] := 18;
      a1[3] := -8;
      a2[3] := 1;
    sj2x := 116;
    sjx := 58;
    sx := 62;
      t15 := 232;
      t9 := 16;
      t14 := 992;
      t13 := -272;
      t12 := .00833333333333333;
      t11 := .00138888888888889;
      a0[4] := 27;
      a1[4] := -10;
      a2[4] := 1;
    sj2x := 294;
    sjx := 120;
    sx := 100;
      t15 := 600;
      t9 := 25;
      t14 := 2500;
      t13 := -580;
      t12 := .00476190476190476;
      t11 := .000396825396825397;
      a0[5] := 38;
      a1[5] := -12;
      a2[5] := 1;
  . . . .
<-- exit MovingParabApprox }