-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo3.txt
executable file
·45 lines (40 loc) · 1.69 KB
/
demo3.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{ This program contains lots of semantic errors }
program program3
type t1 = integer;
t2 = tnotexist; { Undefined Type } { implemented }
var integer test1, test2;
char ch;
array [15..5] of integer t1; { Invalid Array Definition } { implemented }
{ Duplicated Identifier } { implemented }
procedure proc(integer param1);
var integer param1 { Duplicated Identifier } { implemented }
, param2
, proc; { Duplicated Identifier } { implemented }
char param3;
begin
notexist := param1; { Invalid Assignee } { implemented }
param3 := param2; { Assign Type Mismatch } { implemented }
param3 := 10 { Assign Type Mismatch } { implemented }
end
procedure recordtest();
var record
integer fieldA, fieldB;
array [0..10] of integer fieldArray;
end
rec1, rec2;
char testCh;
begin
write(rec1.fieldArray[5]);
write(rec1.fieldArray2[5]); { Undefined Record Field } { implemented }
write(rec1.fieldArray[testCh]) { Uncompatable Type } { implemented }
end
procedure test1(); { Duplicated Identifier } { implemented }
begin
test1() { No error, though it will cause stack overflow }
end
begin
proc(); { Call Parameter Count Mismatch } { implemented }
proc(ch); { Call Parameter Type Mismatch } { implemented }
proc(0);
test1() { Unexpected Type } { implemented }
end.