/* Test File for CS 447 - Fall 2002 IMPORTANT NOTICE PLEASE READ CAREFULLY Please note that this file does not include ALL the test cases that will be used to evaluate your project, however it is a good guideline for ensuring the correctness of your project You are still required to accurately examing the assignment description and make sure you complied with all the requirements, and you still need to stress test your program You still need to independantly test your handling of syntax errors For the groups who wisht to implement (as a bonus) type checking, individual DOCUMENTED test files need to be included with yous submission */ --Test for syntax parsing and variable scoping (no syntax or semantic errors) const K1 : int := 5 ; const K2 : real := 6.7e3 ; var X1,X2 : char := '\t' ; var X3 : bool[5]; Record R1 { F1 : int; F2 : char; } var X4 : R1; const K3 :R1 : = X4; Function Dummy (IN1:int; var OUT1: int){} function Func1 (PK1, PK2 : int; var PX1 : R1; const PK3 : in[ 10]) : real { const LK1: int : = 5; const LK2: char[17] := "this is a string\n" var LX1,LX2,LX3,LX4,LX5,LX6,LX7 : int[100]; Dummy (PK1,PX1); Record R2 { F1: R1; F2: char[45]; F3: real; F4: R1; F5: char [54]; } var RX1,RX2,RX3,RX4,RX5,RX6,RX7,RX8,RX9,RX0 : R2[100]; LX1 := LX2 * LX3 AND LK1; IF (X3 < X2) const LK1 : int := PK1; while ( LX6 OR LX7) const LK1 : int := Pk2; Else LX4[50] := LX4 [51]; RX1[12].F2[25].F1 := PK2; output(1,2,3,4,5,6,"hello Mr. Parameter \n"); input (3,4,5,6,"see you later", FALSE); return 1*2/3+4-5 MOD 6 <= 6*5 MOD 4/3 AND TRUE OR FALSE; }--end funtion Func1 --for testing semantic errors function Func2 (const IN1,IN2:int; var OUT1,OUT2):bool { Y1 := IN1 * 55; --undeclared identifier; var LLX1 : R5;--undefined record type var LLX2 : R1; LLX2.Y5 := 65; --invalid field var LLX2 : R1; --not again func99(); - undefined function Func1(); --wrong number of parameters In1 := IN2; --can't assign to const parameter Dummy(IN1,IN2); --can't assign const variable to var parameter IN1[22] := False; -- not an array type IN2.bogus := 5; -- not a record type either }