Partial and tentative grading policy for the term project: 10 marks for each testcase. 8 marks for compilation and (correct) objectfile. 2 marks for comments etc. 6 points for compilation and incorrect objectfile, e.g., output 1 when 113 is expected. 4 marks if testcase just compiles. If none of the testcases compile, then 20 marks. Test files (in order: repeat, for, case, var, string, index) ! This tests the repeat command (Ex.9.6(a)) let var i: Integer; var sum : Integer in begin i := 1; sum := 0; repeat sum := sum + i until (sum > 10); putint (sum) ! sum should be 11 end ! This tests the for command (Ex.9.6(b)) let var i : Integer; var sum : Integer in begin sum := 0; for i from 1 to 12 do sum := sum + 1; putint (sum) ! sum should be 12 end ! This tests the case command (Ex.9.7) let var i: Integer; var sum : Integer in begin sum := 15; i := 2; case i of 1: putint(1); 2: putint(sum); else: putint(3) ! should print 15 end ! This tests the string type (Ex.9.12a) let var mystr: string 10; var mystr1: string 3; var mystr2: string 3 in begin mystr[1] := 'a'; mystr[2] := 'b'; put(mystr[2]); ! should print b mystr1 := "foo"; mystr2 := "bar"; if (mystr1 << mystr2) then putint(1) else putint(0); ! Should print 0 if (mystr1 = mystr2) then putint(1) else putint(0) ! Should print 0 end ! This tests recursive data types (Ex. 9.13) rec type IntList ~ record head: Integer, tail : IntList end; func cons (n: Integer, ns: IntList) : IntList ~ {head ~ n , tail ~ ns}; proc putints (ns: IntList) ~ if ns \= nil then begin putint (ns.head); put(' '); putints (ns.tail) end; var primes: IntList primes := cons(2, (cons (3, cons(5, cons(7, (cons (11, nil))))); putints(primes) ! This tests the run-time index check. (Ex. 9.15) let var name: array 4 of Char; var i: Integer in begin i := 5; name[i] := ' ' end