-
Notifications
You must be signed in to change notification settings - Fork 0
/
ToyCListener.py
480 lines (321 loc) · 13.5 KB
/
ToyCListener.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
# Generated from ToyC.g4 by ANTLR 4.9
from antlr4 import *
if __name__ is not None and "." in __name__:
from .ToyCParser import ToyCParser
else:
from ToyCParser import ToyCParser
# This class defines a complete listener for a parse tree produced by ToyCParser.
class ToyCListener(ParseTreeListener):
# Enter a parse tree produced by ToyCParser#prog.
def enterProg(self, ctx:ToyCParser.ProgContext):
pass
# Exit a parse tree produced by ToyCParser#prog.
def exitProg(self, ctx:ToyCParser.ProgContext):
pass
# Enter a parse tree produced by ToyCParser#include.
def enterInclude(self, ctx:ToyCParser.IncludeContext):
pass
# Exit a parse tree produced by ToyCParser#include.
def exitInclude(self, ctx:ToyCParser.IncludeContext):
pass
# Enter a parse tree produced by ToyCParser#itemFunction.
def enterItemFunction(self, ctx:ToyCParser.ItemFunctionContext):
pass
# Exit a parse tree produced by ToyCParser#itemFunction.
def exitItemFunction(self, ctx:ToyCParser.ItemFunctionContext):
pass
# Enter a parse tree produced by ToyCParser#funcBody.
def enterFuncBody(self, ctx:ToyCParser.FuncBodyContext):
pass
# Exit a parse tree produced by ToyCParser#funcBody.
def exitFuncBody(self, ctx:ToyCParser.FuncBodyContext):
pass
# Enter a parse tree produced by ToyCParser#parameters.
def enterParameters(self, ctx:ToyCParser.ParametersContext):
pass
# Exit a parse tree produced by ToyCParser#parameters.
def exitParameters(self, ctx:ToyCParser.ParametersContext):
pass
# Enter a parse tree produced by ToyCParser#parameter.
def enterParameter(self, ctx:ToyCParser.ParameterContext):
pass
# Exit a parse tree produced by ToyCParser#parameter.
def exitParameter(self, ctx:ToyCParser.ParameterContext):
pass
# Enter a parse tree produced by ToyCParser#body.
def enterBody(self, ctx:ToyCParser.BodyContext):
pass
# Exit a parse tree produced by ToyCParser#body.
def exitBody(self, ctx:ToyCParser.BodyContext):
pass
# Enter a parse tree produced by ToyCParser#block.
def enterBlock(self, ctx:ToyCParser.BlockContext):
pass
# Exit a parse tree produced by ToyCParser#block.
def exitBlock(self, ctx:ToyCParser.BlockContext):
pass
# Enter a parse tree produced by ToyCParser#initBlock.
def enterInitBlock(self, ctx:ToyCParser.InitBlockContext):
pass
# Exit a parse tree produced by ToyCParser#initBlock.
def exitInitBlock(self, ctx:ToyCParser.InitBlockContext):
pass
# Enter a parse tree produced by ToyCParser#initArrBlock.
def enterInitArrBlock(self, ctx:ToyCParser.InitArrBlockContext):
pass
# Exit a parse tree produced by ToyCParser#initArrBlock.
def exitInitArrBlock(self, ctx:ToyCParser.InitArrBlockContext):
pass
# Enter a parse tree produced by ToyCParser#ifBlocks.
def enterIfBlocks(self, ctx:ToyCParser.IfBlocksContext):
pass
# Exit a parse tree produced by ToyCParser#ifBlocks.
def exitIfBlocks(self, ctx:ToyCParser.IfBlocksContext):
pass
# Enter a parse tree produced by ToyCParser#ifBlock.
def enterIfBlock(self, ctx:ToyCParser.IfBlockContext):
pass
# Exit a parse tree produced by ToyCParser#ifBlock.
def exitIfBlock(self, ctx:ToyCParser.IfBlockContext):
pass
# Enter a parse tree produced by ToyCParser#elifBlock.
def enterElifBlock(self, ctx:ToyCParser.ElifBlockContext):
pass
# Exit a parse tree produced by ToyCParser#elifBlock.
def exitElifBlock(self, ctx:ToyCParser.ElifBlockContext):
pass
# Enter a parse tree produced by ToyCParser#elseBlock.
def enterElseBlock(self, ctx:ToyCParser.ElseBlockContext):
pass
# Exit a parse tree produced by ToyCParser#elseBlock.
def exitElseBlock(self, ctx:ToyCParser.ElseBlockContext):
pass
# Enter a parse tree produced by ToyCParser#condition.
def enterCondition(self, ctx:ToyCParser.ConditionContext):
pass
# Exit a parse tree produced by ToyCParser#condition.
def exitCondition(self, ctx:ToyCParser.ConditionContext):
pass
# Enter a parse tree produced by ToyCParser#whileBlock.
def enterWhileBlock(self, ctx:ToyCParser.WhileBlockContext):
pass
# Exit a parse tree produced by ToyCParser#whileBlock.
def exitWhileBlock(self, ctx:ToyCParser.WhileBlockContext):
pass
# Enter a parse tree produced by ToyCParser#assignBlock.
def enterAssignBlock(self, ctx:ToyCParser.AssignBlockContext):
pass
# Exit a parse tree produced by ToyCParser#assignBlock.
def exitAssignBlock(self, ctx:ToyCParser.AssignBlockContext):
pass
# Enter a parse tree produced by ToyCParser#forBlock.
def enterForBlock(self, ctx:ToyCParser.ForBlockContext):
pass
# Exit a parse tree produced by ToyCParser#forBlock.
def exitForBlock(self, ctx:ToyCParser.ForBlockContext):
pass
# Enter a parse tree produced by ToyCParser#forExpr.
def enterForExpr(self, ctx:ToyCParser.ForExprContext):
pass
# Exit a parse tree produced by ToyCParser#forExpr.
def exitForExpr(self, ctx:ToyCParser.ForExprContext):
pass
# Enter a parse tree produced by ToyCParser#returnBlock.
def enterReturnBlock(self, ctx:ToyCParser.ReturnBlockContext):
pass
# Exit a parse tree produced by ToyCParser#returnBlock.
def exitReturnBlock(self, ctx:ToyCParser.ReturnBlockContext):
pass
# Enter a parse tree produced by ToyCParser#ARRAY.
def enterARRAY(self, ctx:ToyCParser.ARRAYContext):
pass
# Exit a parse tree produced by ToyCParser#ARRAY.
def exitARRAY(self, ctx:ToyCParser.ARRAYContext):
pass
# Enter a parse tree produced by ToyCParser#OR.
def enterOR(self, ctx:ToyCParser.ORContext):
pass
# Exit a parse tree produced by ToyCParser#OR.
def exitOR(self, ctx:ToyCParser.ORContext):
pass
# Enter a parse tree produced by ToyCParser#CHAR.
def enterCHAR(self, ctx:ToyCParser.CHARContext):
pass
# Exit a parse tree produced by ToyCParser#CHAR.
def exitCHAR(self, ctx:ToyCParser.CHARContext):
pass
# Enter a parse tree produced by ToyCParser#FUNCTION.
def enterFUNCTION(self, ctx:ToyCParser.FUNCTIONContext):
pass
# Exit a parse tree produced by ToyCParser#FUNCTION.
def exitFUNCTION(self, ctx:ToyCParser.FUNCTIONContext):
pass
# Enter a parse tree produced by ToyCParser#INT.
def enterINT(self, ctx:ToyCParser.INTContext):
pass
# Exit a parse tree produced by ToyCParser#INT.
def exitINT(self, ctx:ToyCParser.INTContext):
pass
# Enter a parse tree produced by ToyCParser#NEG.
def enterNEG(self, ctx:ToyCParser.NEGContext):
pass
# Exit a parse tree produced by ToyCParser#NEG.
def exitNEG(self, ctx:ToyCParser.NEGContext):
pass
# Enter a parse tree produced by ToyCParser#ADDSUB.
def enterADDSUB(self, ctx:ToyCParser.ADDSUBContext):
pass
# Exit a parse tree produced by ToyCParser#ADDSUB.
def exitADDSUB(self, ctx:ToyCParser.ADDSUBContext):
pass
# Enter a parse tree produced by ToyCParser#AND.
def enterAND(self, ctx:ToyCParser.ANDContext):
pass
# Exit a parse tree produced by ToyCParser#AND.
def exitAND(self, ctx:ToyCParser.ANDContext):
pass
# Enter a parse tree produced by ToyCParser#EQUA.
def enterEQUA(self, ctx:ToyCParser.EQUAContext):
pass
# Exit a parse tree produced by ToyCParser#EQUA.
def exitEQUA(self, ctx:ToyCParser.EQUAContext):
pass
# Enter a parse tree produced by ToyCParser#STRING.
def enterSTRING(self, ctx:ToyCParser.STRINGContext):
pass
# Exit a parse tree produced by ToyCParser#STRING.
def exitSTRING(self, ctx:ToyCParser.STRINGContext):
pass
# Enter a parse tree produced by ToyCParser#DOUBLE.
def enterDOUBLE(self, ctx:ToyCParser.DOUBLEContext):
pass
# Exit a parse tree produced by ToyCParser#DOUBLE.
def exitDOUBLE(self, ctx:ToyCParser.DOUBLEContext):
pass
# Enter a parse tree produced by ToyCParser#ID.
def enterID(self, ctx:ToyCParser.IDContext):
pass
# Exit a parse tree produced by ToyCParser#ID.
def exitID(self, ctx:ToyCParser.IDContext):
pass
# Enter a parse tree produced by ToyCParser#MULDIV.
def enterMULDIV(self, ctx:ToyCParser.MULDIVContext):
pass
# Exit a parse tree produced by ToyCParser#MULDIV.
def exitMULDIV(self, ctx:ToyCParser.MULDIVContext):
pass
# Enter a parse tree produced by ToyCParser#EXP.
def enterEXP(self, ctx:ToyCParser.EXPContext):
pass
# Exit a parse tree produced by ToyCParser#EXP.
def exitEXP(self, ctx:ToyCParser.EXPContext):
pass
# Enter a parse tree produced by ToyCParser#itemType.
def enterItemType(self, ctx:ToyCParser.ItemTypeContext):
pass
# Exit a parse tree produced by ToyCParser#itemType.
def exitItemType(self, ctx:ToyCParser.ItemTypeContext):
pass
# Enter a parse tree produced by ToyCParser#itemArray.
def enterItemArray(self, ctx:ToyCParser.ItemArrayContext):
pass
# Exit a parse tree produced by ToyCParser#itemArray.
def exitItemArray(self, ctx:ToyCParser.ItemArrayContext):
pass
# Enter a parse tree produced by ToyCParser#itemVoid.
def enterItemVoid(self, ctx:ToyCParser.ItemVoidContext):
pass
# Exit a parse tree produced by ToyCParser#itemVoid.
def exitItemVoid(self, ctx:ToyCParser.ItemVoidContext):
pass
# Enter a parse tree produced by ToyCParser#arrayItem.
def enterArrayItem(self, ctx:ToyCParser.ArrayItemContext):
pass
# Exit a parse tree produced by ToyCParser#arrayItem.
def exitArrayItem(self, ctx:ToyCParser.ArrayItemContext):
pass
# Enter a parse tree produced by ToyCParser#func.
def enterFunc(self, ctx:ToyCParser.FuncContext):
pass
# Exit a parse tree produced by ToyCParser#func.
def exitFunc(self, ctx:ToyCParser.FuncContext):
pass
# Enter a parse tree produced by ToyCParser#strlenFun.
def enterStrlenFun(self, ctx:ToyCParser.StrlenFunContext):
pass
# Exit a parse tree produced by ToyCParser#strlenFun.
def exitStrlenFun(self, ctx:ToyCParser.StrlenFunContext):
pass
# Enter a parse tree produced by ToyCParser#atoiFun.
def enterAtoiFun(self, ctx:ToyCParser.AtoiFunContext):
pass
# Exit a parse tree produced by ToyCParser#atoiFun.
def exitAtoiFun(self, ctx:ToyCParser.AtoiFunContext):
pass
# Enter a parse tree produced by ToyCParser#printfFun.
def enterPrintfFun(self, ctx:ToyCParser.PrintfFunContext):
pass
# Exit a parse tree produced by ToyCParser#printfFun.
def exitPrintfFun(self, ctx:ToyCParser.PrintfFunContext):
pass
# Enter a parse tree produced by ToyCParser#scanfFun.
def enterScanfFun(self, ctx:ToyCParser.ScanfFunContext):
pass
# Exit a parse tree produced by ToyCParser#scanfFun.
def exitScanfFun(self, ctx:ToyCParser.ScanfFunContext):
pass
# Enter a parse tree produced by ToyCParser#getsFun.
def enterGetsFun(self, ctx:ToyCParser.GetsFunContext):
pass
# Exit a parse tree produced by ToyCParser#getsFun.
def exitGetsFun(self, ctx:ToyCParser.GetsFunContext):
pass
# Enter a parse tree produced by ToyCParser#otherFun.
def enterOtherFun(self, ctx:ToyCParser.OtherFunContext):
pass
# Exit a parse tree produced by ToyCParser#otherFun.
def exitOtherFun(self, ctx:ToyCParser.OtherFunContext):
pass
# Enter a parse tree produced by ToyCParser#argument.
def enterArgument(self, ctx:ToyCParser.ArgumentContext):
pass
# Exit a parse tree produced by ToyCParser#argument.
def exitArgument(self, ctx:ToyCParser.ArgumentContext):
pass
# Enter a parse tree produced by ToyCParser#itemID.
def enterItemID(self, ctx:ToyCParser.ItemIDContext):
pass
# Exit a parse tree produced by ToyCParser#itemID.
def exitItemID(self, ctx:ToyCParser.ItemIDContext):
pass
# Enter a parse tree produced by ToyCParser#itemINT.
def enterItemINT(self, ctx:ToyCParser.ItemINTContext):
pass
# Exit a parse tree produced by ToyCParser#itemINT.
def exitItemINT(self, ctx:ToyCParser.ItemINTContext):
pass
# Enter a parse tree produced by ToyCParser#itemDOUBLE.
def enterItemDOUBLE(self, ctx:ToyCParser.ItemDOUBLEContext):
pass
# Exit a parse tree produced by ToyCParser#itemDOUBLE.
def exitItemDOUBLE(self, ctx:ToyCParser.ItemDOUBLEContext):
pass
# Enter a parse tree produced by ToyCParser#itemCHAR.
def enterItemCHAR(self, ctx:ToyCParser.ItemCHARContext):
pass
# Exit a parse tree produced by ToyCParser#itemCHAR.
def exitItemCHAR(self, ctx:ToyCParser.ItemCHARContext):
pass
# Enter a parse tree produced by ToyCParser#itemSTRING.
def enterItemSTRING(self, ctx:ToyCParser.ItemSTRINGContext):
pass
# Exit a parse tree produced by ToyCParser#itemSTRING.
def exitItemSTRING(self, ctx:ToyCParser.ItemSTRINGContext):
pass
# Enter a parse tree produced by ToyCParser#itemLIB.
def enterItemLIB(self, ctx:ToyCParser.ItemLIBContext):
pass
# Exit a parse tree produced by ToyCParser#itemLIB.
def exitItemLIB(self, ctx:ToyCParser.ItemLIBContext):
pass
del ToyCParser