Partial and tentative grading policy for the term project: 10 marks for each non-extra testcase. 9 marks for compilation and (correct) objectfile. 1 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 at most for the whole assignment. Each of the extra test cases are worth 2 extra credit points. Total: 60 points. There is no test case for exercise 9.8 in this file. Please provide an example of use of the initializing variable declaration. Exercise 9.8 is worth 10 points, like the other exercises. Exercise 9.6(a) and 9.6(b) are treated as a two separate exercises. The test cases (in order: repeat (9.6(a)) for (9.6(b)), case (9.7), string (9.12(a)), index (9.15)) follow. ! 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 !Extra test for Ex. 9.6(a): !Test: Check a correct repeat command !Expected result: Print the numbers 1-20 let var i:Integer; var sum : Integer in begin sum := 0; repeat sum := sum + 1; putint(sum); puteol() until (sum >= 20) end !Extra test for Ex. 9.6(a): !Test: Invalid type of expression used in the repeat !Expected result: The error is caught at compilation time. let var i:Integer; var sum : Integer in begin sum := 0; repeat sum := sum + 1 until (sum) end !Extra test for Ex. 9.6(a): !Test: Provide an expression that is false from the beginning !Expected result: The repeat is going to execute at least once ! before checking the expression. Prints 2 !Note: The specifications of repeat...until are ambiguous. The example below ! assumes a Command between repeat and until, as in the Pascal language. ! If you assume a single-Command (as for the Triangle while command), then ! you need to add "begin" after "repeat" and "end" before "until" ! The ssme comment applies to other tests that have a Command between ! repeat and until let var i:Integer; var sum : Integer in begin sum := 1; repeat sum := sum + 1; putint(sum); puteol() until (sum > 0) 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 !Extra test for Ex. 9.6(b): !Test: Check that the use of an expression leading to an integer value is valid !as !expression in the for command !Expected result: Print the number from 5 to 20. !NOTE: the specifications of "for I from E1 to E2 do C" are ambiguous. Please try to ! specify in such a way that the example below is correct. So: C is a simple-Command, ! I is implicitly declared and has as its scope the "for" command. If you have already ! done otherwise, change the test example, and provide a note with your project ! submission explaining your decision. let var sum : Integer; var A : Integer in begin A := 10/2; sum := 0; for i from A to 20 do begin sum := sum + 1; putint(i) end 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 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 !Extra test for Ex. 9.15: !Test: Try to access an out of bounds value of an array. !Expected result: Prints D let var myArray : array 4 of Char; var i : Integer in begin i := 3; myArray[0] := 'A'; myArray[1] := 'B'; myArray[2] := 'C'; myArray[3] := 'D'; put(myArray[i]) end !Extra test for Ex. 9.15: !Test: Try to access an out of bounds value of an array. !Expected result: Runtime error of range check. let var myArray : array 4 of Char; var i : Integer in begin i := 4; myArray[0] := 'A'; myArray[1] := 'B'; myArray[2] := 'C'; myArray[3] := 'D'; myArray[i] := 'E'; !put(myArray[i]) end