This repository has been archived by the owner on Aug 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode_gen.py
163 lines (161 loc) · 5.78 KB
/
code_gen.py
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
file = [
"int + int -> int",
"int + string -> string",
"int + point -> point",
"string + int -> string",
"string + string -> string",
"string + point -> string",
"point + int -> point",
"point + string -> string",
"point + point -> point",
"int - int -> int",
"int - string -> undefined",
"int - point -> point",
"string - int -> undefined",
"string - string -> undefined",
"string - point -> undefined",
"point - int -> point",
"point - string -> undefined",
"point - point -> point",
"int * int -> int",
"int * string -> string",
"int * point -> point",
"string * int -> string",
"string * string -> undefined",
"string * point -> undefined",
"point * int -> point",
"point * string -> undefined",
"point * point -> point",
"int / int -> int",
"int / string -> undefined",
"int / point -> point",
"string / int -> undefined",
"string / string -> undefined",
"string / point -> undefined",
"point / int -> point",
"point / string -> undefined",
"point / point -> point",
"int % int -> int",
"int % string -> undefined",
"int % point -> point",
"string % int -> undefined",
"string % string -> undefined",
"string % point -> undefined",
"point % int -> point",
"point % string -> undefined",
"point % point -> point",
"int != int -> int",
"int != string -> undefined",
"int != point -> undefined",
"int == int -> int",
"int == string -> undefined",
"int == point -> undefined",
"string == int -> undefined",
"string == string -> int",
"string == point -> undefined",
"string != int -> undefined",
"string != string -> int",
"string != point -> undefined",
"point == int -> undefined",
"point == string -> undefined",
"point == point -> int",
"point != int -> undefined",
"point != string -> undefined",
"point != point -> int",
"int < int -> int",
"int < string -> undefined",
"int < point -> undefined",
"string < int -> undefined",
"string < string -> undefined",
"string < point -> undefined",
"point < int -> undefined",
"point < string -> undefined",
"point < point -> undefined",
"int < int -> int",
"int < string -> undefined",
"int < point -> undefined",
"string < int -> undefined",
"string < string -> undefined",
"string < point -> undefined",
"point < int -> undefined",
"point < string -> undefined",
"point < point -> undefined",
"int <= int -> int",
"int <= string -> undefined",
"int <= point -> undefined",
"string <= int -> undefined",
"string <= string -> undefined",
"string <= point -> undefined",
"point <= int -> undefined",
"point <= string -> undefined",
"point <= point -> undefined",
"int <= int -> int",
"int <= string -> undefined",
"int <= point -> undefined",
"string <= int -> undefined",
"string <= string -> undefined",
"string <= point -> undefined",
"point <= int -> undefined",
"point <= string -> undefined",
"point <= point -> undefined",
"int > int -> int",
"int > string -> undefined",
"int > point -> undefined",
"string > int -> undefined",
"string > string -> undefined",
"string > point -> undefined",
"point > int -> undefined",
"point > string -> undefined",
"point > point -> undefined",
"int > int -> int",
"int > string -> undefined",
"int > point -> undefined",
"string > int -> undefined",
"string > string -> undefined",
"string > point -> undefined",
"point > int -> undefined",
"point > string -> undefined",
"point > point -> undefined",
"int >= int -> int",
"int >= string -> undefined",
"int >= point -> undefined",
"string >= int -> undefined",
"string >= string -> undefined",
"string >= point -> undefined",
"point >= int -> undefined",
"point >= string -> undefined",
"point >= point -> undefined",
"int >= int -> int",
"int >= string -> undefined",
"int >= point -> undefined",
"string >= int -> undefined",
"string >= string -> undefined",
"string >= point -> undefined",
"point >= int -> undefined",
"point >= string -> undefined",
"point >= point -> undefined",
]
#
counter = 0;
#for line in file:
#items = line.split()
#print("let v" + str(counter) + " = " + items[0][0] + " " + items[1] + " " + items[2][0] + "; //" + items[4])
#counter += 1
#if(items[4] != "undefined"):
# print('put(new Triple("' + items[0] + '", "' + items[1] + '", "' + items[2] + '"), ("' + items[4] + '"));')
header = ["int", "string", "point"]
tabela = [[0 for x in range(3)] for y in range(3)]
for line in file:
items = line.split()
if counter % 9 == 0:
if counter == 0:
print("| " + items[1] + " | " + header[0] + " | " + header[1] + " | " + header[2])
else:
print("|-----|---------|------|-----|")
print("| " + header[0] + " | " + tabela[0][0] + " | " + tabela[0][1] + " | " + tabela[0][2] + " |")
print("| " + header[1] + " | " + tabela[1][0] + " | " + tabela[1][1] + " | " + tabela[1][2] + " |")
print("| " + header[2] + " | " + tabela[2][0] + " | " + tabela[2][1] + " | " + tabela[2][2] + " |")
print("")
print("| " + items[1] + " | " + header[0] + " | " + header[1] + " | " + header[2])
tabela[int(counter/3) % 3][counter%3] = items[4]
counter += 1