/
sjp7
60 lines (56 loc) · 1.58 KB
/
sjp7
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
1: Program
2: Vars
3: a Array [10] Of Int
4: b Bool
5: i Int
6: EndVars
7:
8: Procedure P(Const Ref x Array [10] Of Int, Const Ref y Int)
9: Procedure P2(Ref z Array [10] Of Int)
10: z[0] := y
11: P(z, i)
12: EndProcedure
13: Procedure P3(Val z Array [10] Of Int)
14: z[3] := 2
15: P(z, i)
16: EndProcedure
17: x[0] := y
18: P2(x)
19: P2(a)
20: P2(z)
21: P3(x)
22: y := 3
23: i := y
24: EndProcedure
25: Function F(Const Ref x Bool) Return Array[10] Of Int
26: x := True
27: If x Then
28: x := False
29: EndIf
30: Return a
31: EndFunction
32: Procedure PP(Const Ref s Struct a Array [10] Of Int EndStruct)
33: s.a[3] := 2
34: b := s.a[3] > 2
35: P(s.a, i)
36: P(s.a[3], i)
37: P(z, i)
38: EndProcedure
39: x := True
40: EndProgram
41:
Type Checking:
L. 17: Parameter is const and cannot be modified.
L. 18: Parameter is const and cannot be modified.
L. 20: Identifier z is undeclared.
L. 20: Parameter 1 is expected to be referenceable but it is not.
L. 22: Parameter is const and cannot be modified.
L. 26: Parameter is const and cannot be modified.
L. 28: Parameter is const and cannot be modified.
L. 33: Parameter is const and cannot be modified.
L. 36: Parameter 1 with incompatible types.
L. 37: Identifier z is undeclared.
L. 37: Parameter 1 is expected to be referenceable but it is not.
L. 39: Identifier x is undeclared.
L. 39: Left expression of assignment is not referenceable.
There are errors: no code generated