-
Notifications
You must be signed in to change notification settings - Fork 0
/
sjp9
executable file
·131 lines (124 loc) · 4.49 KB
/
sjp9
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
1: Program
2: Vars
3: x Int
4: y Struct
5: x bool
6: y Int
7: EndStruct
8: z Array [10] Of bool
9: EndVars
10: Procedure P(ref a Array [10] Of bool,
11: val b Struct x Bool y Int EndStruct,
12: ref x Array [4] Of Int)
13: Vars
14: x Array [10] Of bool
15: y Array [4] of Int
16: EndVars
17: x[3]:=45+z[y.x]
18: x:=a
19: x:=y
20: EndProcedure
21: x:=z[3]
22: z[y.y+2]:=
23: z[x]+
24: y.x[3].y
25: EndProgram
26:
program
\__list
| \__ident(x)
| | \__int
| \__ident(y)
| | \__struct
| | \__ident(x)
| | | \__bool
| | \__ident(y)
| | \__int
| \__ident(z)
| \__array
| \__intconst(10)
| \__bool
\__list
| \__procedure
| \__ident(P)
| | \__list
| | \__ref
| | | \__ident(a)
| | | \__array
| | | \__intconst(10)
| | | \__bool
| | \__val
| | | \__ident(b)
| | | \__struct
| | | \__ident(x)
| | | | \__bool
| | | \__ident(y)
| | | \__int
| | \__ref
| | \__ident(x)
| | \__array
| | \__intconst(4)
| | \__int
| \__list
| | \__ident(x)
| | | \__array
| | | \__intconst(10)
| | | \__bool
| | \__ident(y)
| | \__array
| | \__intconst(4)
| | \__int
| \__list
| \__list
| \__:=
| | \__[
| | | \__ident(x)
| | | \__intconst(3)
| | \__+
| | \__intconst(45)
| | \__[
| | \__ident(z)
| | \__.
| | \__ident(y)
| | \__ident(x)
| \__:=
| | \__ident(x)
| | \__ident(a)
| \__:=
| \__ident(x)
| \__ident(y)
\__list
\__:=
| \__ident(x)
| \__[
| \__ident(z)
| \__intconst(3)
\__:=
\__[
| \__ident(z)
| \__+
| \__.
| | \__ident(y)
| | \__ident(y)
| \__intconst(2)
\__+
\__[
| \__ident(z)
| \__ident(x)
\__.
\__[
| \__.
| | \__ident(y)
| | \__ident(x)
| \__intconst(3)
\__ident(y)
Type Checking:
L. 14: Identifier x already declared.
L. 17: Operator struct. with incompatible types.
L. 17: Operator + with incompatible types.
L. 18: Assignment with incompatible types.
L. 21: Assignment with incompatible types.
L. 24: Operator array[] with incompatible types.
L. 23: Operator + with incompatible types.
L. 22: Assignment with incompatible types.
There are errors: no code generated