-
Notifications
You must be signed in to change notification settings - Fork 0
/
LilaParser.py
3021 lines (2456 loc) · 115 KB
/
LilaParser.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
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Generated from Lila.g4 by ANTLR 4.7.2
# encoding: utf-8
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys
from IntermediateGenerator import IntermediateGenerator, Quadruple
from Classes import Semantic, Function, Operand, VirtualAddress
gen = IntermediateGenerator()
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3=")
buf.write("\u024f\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
buf.write("\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16")
buf.write("\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23\t\23")
buf.write("\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31")
buf.write("\t\31\4\32\t\32\3\2\3\2\3\2\3\2\5\29\n\2\3\2\7\2<\n\2")
buf.write("\f\2\16\2?\13\2\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\3\3\3\6")
buf.write("\3J\n\3\r\3\16\3K\3\3\3\3\3\4\3\4\3\4\3\4\5\4T\n\4\3\4")
buf.write("\3\4\3\4\3\4\3\4\7\4[\n\4\f\4\16\4^\13\4\3\4\3\4\3\4\3")
buf.write("\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\6\7\6m\n\6\f\6\16")
buf.write("\6p\13\6\3\6\3\6\3\7\3\7\3\b\3\b\3\b\5\by\n\b\3\b\3\b")
buf.write("\3\b\3\b\3\b\3\b\5\b\u0081\n\b\3\b\3\b\3\b\5\b\u0086\n")
buf.write("\b\3\b\6\b\u0089\n\b\r\b\16\b\u008a\3\b\3\b\3\b\3\b\3")
buf.write("\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\7\t\u0099\n\t\f\t\16\t")
buf.write("\u009c\13\t\3\n\3\n\3\n\3\n\3\n\3\n\3\n\3\n\5\n\u00a6")
buf.write("\n\n\3\13\3\13\3\13\3\13\3\13\3\13\3\13\5\13\u00af\n\13")
buf.write("\3\13\3\13\3\f\3\f\3\f\7\f\u00b6\n\f\f\f\16\f\u00b9\13")
buf.write("\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\7\r\u00c5\n")
buf.write("\r\f\r\16\r\u00c8\13\r\3\r\3\r\3\r\3\16\3\16\3\16\3\16")
buf.write("\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\6\16\u00d9\n")
buf.write("\16\r\16\16\16\u00da\3\16\3\16\3\16\3\16\5\16\u00e1\n")
buf.write("\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\17\3\17\3\17")
buf.write("\3\17\3\17\3\17\3\20\3\20\3\20\3\20\7\20\u00f4\n\20\f")
buf.write("\20\16\20\u00f7\13\20\3\20\3\20\3\20\3\20\3\20\3\20\7")
buf.write("\20\u00ff\n\20\f\20\16\20\u0102\13\20\3\20\3\20\7\20\u0106")
buf.write("\n\20\f\20\16\20\u0109\13\20\3\21\3\21\3\21\3\21\3\21")
buf.write("\3\21\5\21\u0111\n\21\3\21\3\21\3\21\7\21\u0116\n\21\f")
buf.write("\21\16\21\u0119\13\21\3\22\3\22\3\22\3\22\3\22\3\22\3")
buf.write("\22\3\22\3\22\3\22\3\22\3\22\3\22\5\22\u0128\n\22\3\22")
buf.write("\3\22\3\22\3\22\5\22\u012e\n\22\3\23\3\23\3\23\3\23\3")
buf.write("\23\3\23\5\23\u0136\n\23\3\23\3\23\3\23\7\23\u013b\n\23")
buf.write("\f\23\16\23\u013e\13\23\3\24\3\24\3\24\3\24\3\24\3\24")
buf.write("\5\24\u0146\n\24\3\24\3\24\3\24\7\24\u014b\n\24\f\24\16")
buf.write("\24\u014e\13\24\3\25\3\25\3\25\3\25\3\25\3\25\3\25\3\25")
buf.write("\3\25\5\25\u0159\n\25\3\25\3\25\3\25\5\25\u015e\n\25\3")
buf.write("\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26")
buf.write("\3\26\3\26\7\26\u016d\n\26\f\26\16\26\u0170\13\26\5\26")
buf.write("\u0172\n\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3")
buf.write("\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\6\26\u0184\n\26")
buf.write("\r\26\16\26\u0185\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3")
buf.write("\26\3\26\3\26\3\26\3\26\5\26\u0194\n\26\3\27\3\27\3\27")
buf.write("\3\27\3\27\3\27\3\27\3\30\3\30\3\30\3\30\3\30\3\30\3\30")
buf.write("\3\30\3\30\3\30\3\30\3\30\3\30\7\30\u01aa\n\30\f\30\16")
buf.write("\30\u01ad\13\30\5\30\u01af\n\30\3\30\3\30\3\30\3\30\3")
buf.write("\30\3\30\3\31\3\31\3\31\3\31\3\31\5\31\u01bc\n\31\3\31")
buf.write("\3\31\3\31\3\31\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32")
buf.write("\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32")
buf.write("\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32")
buf.write("\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32")
buf.write("\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32")
buf.write("\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32")
buf.write("\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32")
buf.write("\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32")
buf.write("\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32")
buf.write("\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32")
buf.write("\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32")
buf.write("\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32")
buf.write("\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\5\32")
buf.write("\u024d\n\32\3\32\2\2\33\2\4\6\b\n\f\16\20\22\24\26\30")
buf.write("\32\34\36 \"$&(*,.\60\62\2\3\3\2\f\17\2\u027a\2\64\3\2")
buf.write("\2\2\4G\3\2\2\2\6S\3\2\2\2\bb\3\2\2\2\nf\3\2\2\2\fs\3")
buf.write("\2\2\2\16u\3\2\2\2\20\u0090\3\2\2\2\22\u00a5\3\2\2\2\24")
buf.write("\u00a7\3\2\2\2\26\u00b2\3\2\2\2\30\u00bc\3\2\2\2\32\u00e0")
buf.write("\3\2\2\2\34\u00e9\3\2\2\2\36\u00ef\3\2\2\2 \u010a\3\2")
buf.write("\2\2\"\u012d\3\2\2\2$\u012f\3\2\2\2&\u013f\3\2\2\2(\u015d")
buf.write("\3\2\2\2*\u0193\3\2\2\2,\u0195\3\2\2\2.\u019c\3\2\2\2")
buf.write("\60\u01b6\3\2\2\2\62\u024c\3\2\2\2\64\65\7\4\2\2\65\66")
buf.write("\7;\2\2\668\b\2\1\2\679\5\4\3\28\67\3\2\2\289\3\2\2\2")
buf.write("9=\3\2\2\2:<\5\16\b\2;:\3\2\2\2<?\3\2\2\2=;\3\2\2\2=>")
buf.write("\3\2\2\2>@\3\2\2\2?=\3\2\2\2@A\b\2\1\2AB\5\b\5\2BC\b\2")
buf.write("\1\2CD\b\2\1\2DE\b\2\1\2EF\b\2\1\2F\3\3\2\2\2GI\7\t\2")
buf.write("\2HJ\5\6\4\2IH\3\2\2\2JK\3\2\2\2KI\3\2\2\2KL\3\2\2\2L")
buf.write("M\3\2\2\2MN\b\3\1\2N\5\3\2\2\2OT\5\f\7\2PQ\5\f\7\2QR\5")
buf.write("\n\6\2RT\3\2\2\2SO\3\2\2\2SP\3\2\2\2TU\3\2\2\2UV\7;\2")
buf.write("\2V\\\b\4\1\2WX\7\30\2\2XY\7;\2\2Y[\b\4\1\2ZW\3\2\2\2")
buf.write("[^\3\2\2\2\\Z\3\2\2\2\\]\3\2\2\2]_\3\2\2\2^\\\3\2\2\2")
buf.write("_`\b\4\1\2`a\7\31\2\2a\7\3\2\2\2bc\7\3\2\2cd\b\5\1\2d")
buf.write("e\5\26\f\2e\t\3\2\2\2fn\b\6\1\2gh\7\22\2\2hi\7\'\2\2i")
buf.write("j\b\6\1\2jk\7\23\2\2km\b\6\1\2lg\3\2\2\2mp\3\2\2\2nl\3")
buf.write("\2\2\2no\3\2\2\2oq\3\2\2\2pn\3\2\2\2qr\b\6\1\2r\13\3\2")
buf.write("\2\2st\t\2\2\2t\r\3\2\2\2ux\7\b\2\2vy\5\f\7\2wy\7\5\2")
buf.write("\2xv\3\2\2\2xw\3\2\2\2yz\3\2\2\2z{\7;\2\2{|\b\b\1\2|}")
buf.write("\b\b\1\2}~\b\b\1\2~\u0080\7\24\2\2\177\u0081\5\20\t\2")
buf.write("\u0080\177\3\2\2\2\u0080\u0081\3\2\2\2\u0081\u0082\3\2")
buf.write("\2\2\u0082\u0083\7\25\2\2\u0083\u0085\7\26\2\2\u0084\u0086")
buf.write("\5\4\3\2\u0085\u0084\3\2\2\2\u0085\u0086\3\2\2\2\u0086")
buf.write("\u0088\3\2\2\2\u0087\u0089\5\22\n\2\u0088\u0087\3\2\2")
buf.write("\2\u0089\u008a\3\2\2\2\u008a\u0088\3\2\2\2\u008a\u008b")
buf.write("\3\2\2\2\u008b\u008c\3\2\2\2\u008c\u008d\7\27\2\2\u008d")
buf.write("\u008e\b\b\1\2\u008e\u008f\b\b\1\2\u008f\17\3\2\2\2\u0090")
buf.write("\u0091\5\f\7\2\u0091\u0092\7;\2\2\u0092\u009a\b\t\1\2")
buf.write("\u0093\u0094\7\30\2\2\u0094\u0095\5\f\7\2\u0095\u0096")
buf.write("\7;\2\2\u0096\u0097\b\t\1\2\u0097\u0099\3\2\2\2\u0098")
buf.write("\u0093\3\2\2\2\u0099\u009c\3\2\2\2\u009a\u0098\3\2\2\2")
buf.write("\u009a\u009b\3\2\2\2\u009b\21\3\2\2\2\u009c\u009a\3\2")
buf.write("\2\2\u009d\u00a6\5\32\16\2\u009e\u00a6\5\24\13\2\u009f")
buf.write("\u00a6\5,\27\2\u00a0\u00a6\5\30\r\2\u00a1\u00a6\5\60\31")
buf.write("\2\u00a2\u00a6\5.\30\2\u00a3\u00a6\5\34\17\2\u00a4\u00a6")
buf.write("\5\62\32\2\u00a5\u009d\3\2\2\2\u00a5\u009e\3\2\2\2\u00a5")
buf.write("\u009f\3\2\2\2\u00a5\u00a0\3\2\2\2\u00a5\u00a1\3\2\2\2")
buf.write("\u00a5\u00a2\3\2\2\2\u00a5\u00a3\3\2\2\2\u00a5\u00a4\3")
buf.write("\2\2\2\u00a6\23\3\2\2\2\u00a7\u00a8\7\13\2\2\u00a8\u00a9")
buf.write("\5 \21\2\u00a9\u00aa\b\13\1\2\u00aa\u00ae\5\26\f\2\u00ab")
buf.write("\u00ac\7\n\2\2\u00ac\u00ad\b\13\1\2\u00ad\u00af\5\26\f")
buf.write("\2\u00ae\u00ab\3\2\2\2\u00ae\u00af\3\2\2\2\u00af\u00b0")
buf.write("\3\2\2\2\u00b0\u00b1\b\13\1\2\u00b1\25\3\2\2\2\u00b2\u00b3")
buf.write("\7\26\2\2\u00b3\u00b7\5\22\n\2\u00b4\u00b6\5\22\n\2\u00b5")
buf.write("\u00b4\3\2\2\2\u00b6\u00b9\3\2\2\2\u00b7\u00b5\3\2\2\2")
buf.write("\u00b7\u00b8\3\2\2\2\u00b8\u00ba\3\2\2\2\u00b9\u00b7\3")
buf.write("\2\2\2\u00ba\u00bb\7\27\2\2\u00bb\27\3\2\2\2\u00bc\u00bd")
buf.write("\7\6\2\2\u00bd\u00be\7\24\2\2\u00be\u00bf\5 \21\2\u00bf")
buf.write("\u00c6\b\r\1\2\u00c0\u00c1\7\30\2\2\u00c1\u00c2\5 \21")
buf.write("\2\u00c2\u00c3\b\r\1\2\u00c3\u00c5\3\2\2\2\u00c4\u00c0")
buf.write("\3\2\2\2\u00c5\u00c8\3\2\2\2\u00c6\u00c4\3\2\2\2\u00c6")
buf.write("\u00c7\3\2\2\2\u00c7\u00c9\3\2\2\2\u00c8\u00c6\3\2\2\2")
buf.write("\u00c9\u00ca\7\25\2\2\u00ca\u00cb\7\31\2\2\u00cb\31\3")
buf.write("\2\2\2\u00cc\u00cd\7;\2\2\u00cd\u00e1\b\16\1\2\u00ce\u00cf")
buf.write("\7;\2\2\u00cf\u00d0\b\16\1\2\u00d0\u00d1\b\16\1\2\u00d1")
buf.write("\u00d8\b\16\1\2\u00d2\u00d3\7\22\2\2\u00d3\u00d4\b\16")
buf.write("\1\2\u00d4\u00d5\5$\23\2\u00d5\u00d6\b\16\1\2\u00d6\u00d7")
buf.write("\7\23\2\2\u00d7\u00d9\3\2\2\2\u00d8\u00d2\3\2\2\2\u00d9")
buf.write("\u00da\3\2\2\2\u00da\u00d8\3\2\2\2\u00da\u00db\3\2\2\2")
buf.write("\u00db\u00dc\3\2\2\2\u00dc\u00dd\b\16\1\2\u00dd\u00de")
buf.write("\b\16\1\2\u00de\u00df\b\16\1\2\u00df\u00e1\3\2\2\2\u00e0")
buf.write("\u00cc\3\2\2\2\u00e0\u00ce\3\2\2\2\u00e1\u00e2\3\2\2\2")
buf.write("\u00e2\u00e3\7\"\2\2\u00e3\u00e4\b\16\1\2\u00e4\u00e5")
buf.write("\5 \21\2\u00e5\u00e6\b\16\1\2\u00e6\u00e7\3\2\2\2\u00e7")
buf.write("\u00e8\7\31\2\2\u00e8\33\3\2\2\2\u00e9\u00ea\7\20\2\2")
buf.write("\u00ea\u00eb\5 \21\2\u00eb\u00ec\b\17\1\2\u00ec\u00ed")
buf.write("\b\17\1\2\u00ed\u00ee\7\31\2\2\u00ee\35\3\2\2\2\u00ef")
buf.write("\u00f0\7\22\2\2\u00f0\u00f5\5*\26\2\u00f1\u00f2\7\30\2")
buf.write("\2\u00f2\u00f4\5*\26\2\u00f3\u00f1\3\2\2\2\u00f4\u00f7")
buf.write("\3\2\2\2\u00f5\u00f3\3\2\2\2\u00f5\u00f6\3\2\2\2\u00f6")
buf.write("\u00f8\3\2\2\2\u00f7\u00f5\3\2\2\2\u00f8\u0107\7\23\2")
buf.write("\2\u00f9\u00fa\7\30\2\2\u00fa\u00fb\7\22\2\2\u00fb\u0100")
buf.write("\5*\26\2\u00fc\u00fd\7\30\2\2\u00fd\u00ff\5*\26\2\u00fe")
buf.write("\u00fc\3\2\2\2\u00ff\u0102\3\2\2\2\u0100\u00fe\3\2\2\2")
buf.write("\u0100\u0101\3\2\2\2\u0101\u0103\3\2\2\2\u0102\u0100\3")
buf.write("\2\2\2\u0103\u0104\7\23\2\2\u0104\u0106\3\2\2\2\u0105")
buf.write("\u00f9\3\2\2\2\u0106\u0109\3\2\2\2\u0107\u0105\3\2\2\2")
buf.write("\u0107\u0108\3\2\2\2\u0108\37\3\2\2\2\u0109\u0107\3\2")
buf.write("\2\2\u010a\u010b\5\"\22\2\u010b\u0117\b\21\1\2\u010c\u010d")
buf.write("\7%\2\2\u010d\u0111\b\21\1\2\u010e\u010f\7&\2\2\u010f")
buf.write("\u0111\b\21\1\2\u0110\u010c\3\2\2\2\u0110\u010e\3\2\2")
buf.write("\2\u0111\u0112\3\2\2\2\u0112\u0113\5\"\22\2\u0113\u0114")
buf.write("\b\21\1\2\u0114\u0116\3\2\2\2\u0115\u0110\3\2\2\2\u0116")
buf.write("\u0119\3\2\2\2\u0117\u0115\3\2\2\2\u0117\u0118\3\2\2\2")
buf.write("\u0118!\3\2\2\2\u0119\u0117\3\2\2\2\u011a\u0127\5$\23")
buf.write("\2\u011b\u011c\7\37\2\2\u011c\u0128\b\22\1\2\u011d\u011e")
buf.write("\7\36\2\2\u011e\u0128\b\22\1\2\u011f\u0120\7 \2\2\u0120")
buf.write("\u0128\b\22\1\2\u0121\u0122\7!\2\2\u0122\u0128\b\22\1")
buf.write("\2\u0123\u0124\7$\2\2\u0124\u0128\b\22\1\2\u0125\u0126")
buf.write("\7#\2\2\u0126\u0128\b\22\1\2\u0127\u011b\3\2\2\2\u0127")
buf.write("\u011d\3\2\2\2\u0127\u011f\3\2\2\2\u0127\u0121\3\2\2\2")
buf.write("\u0127\u0123\3\2\2\2\u0127\u0125\3\2\2\2\u0128\u0129\3")
buf.write("\2\2\2\u0129\u012a\5$\23\2\u012a\u012b\b\22\1\2\u012b")
buf.write("\u012e\3\2\2\2\u012c\u012e\5$\23\2\u012d\u011a\3\2\2\2")
buf.write("\u012d\u012c\3\2\2\2\u012e#\3\2\2\2\u012f\u0130\5&\24")
buf.write("\2\u0130\u013c\b\23\1\2\u0131\u0132\7\32\2\2\u0132\u0136")
buf.write("\b\23\1\2\u0133\u0134\7\33\2\2\u0134\u0136\b\23\1\2\u0135")
buf.write("\u0131\3\2\2\2\u0135\u0133\3\2\2\2\u0136\u0137\3\2\2\2")
buf.write("\u0137\u0138\5&\24\2\u0138\u0139\b\23\1\2\u0139\u013b")
buf.write("\3\2\2\2\u013a\u0135\3\2\2\2\u013b\u013e\3\2\2\2\u013c")
buf.write("\u013a\3\2\2\2\u013c\u013d\3\2\2\2\u013d%\3\2\2\2\u013e")
buf.write("\u013c\3\2\2\2\u013f\u0140\5(\25\2\u0140\u014c\b\24\1")
buf.write("\2\u0141\u0142\7\34\2\2\u0142\u0146\b\24\1\2\u0143\u0144")
buf.write("\7\35\2\2\u0144\u0146\b\24\1\2\u0145\u0141\3\2\2\2\u0145")
buf.write("\u0143\3\2\2\2\u0146\u0147\3\2\2\2\u0147\u0148\5(\25\2")
buf.write("\u0148\u0149\b\24\1\2\u0149\u014b\3\2\2\2\u014a\u0145")
buf.write("\3\2\2\2\u014b\u014e\3\2\2\2\u014c\u014a\3\2\2\2\u014c")
buf.write("\u014d\3\2\2\2\u014d\'\3\2\2\2\u014e\u014c\3\2\2\2\u014f")
buf.write("\u0150\7\24\2\2\u0150\u0151\b\25\1\2\u0151\u0152\5 \21")
buf.write("\2\u0152\u0153\7\25\2\2\u0153\u0154\b\25\1\2\u0154\u015e")
buf.write("\3\2\2\2\u0155\u0159\7\32\2\2\u0156\u0157\7\33\2\2\u0157")
buf.write("\u0159\b\25\1\2\u0158\u0155\3\2\2\2\u0158\u0156\3\2\2")
buf.write("\2\u0158\u0159\3\2\2\2\u0159\u015a\3\2\2\2\u015a\u015b")
buf.write("\5*\26\2\u015b\u015c\b\25\1\2\u015c\u015e\3\2\2\2\u015d")
buf.write("\u014f\3\2\2\2\u015d\u0158\3\2\2\2\u015e)\3\2\2\2\u015f")
buf.write("\u0160\7;\2\2\u0160\u0161\7\24\2\2\u0161\u0162\b\26\1")
buf.write("\2\u0162\u0163\b\26\1\2\u0163\u0164\b\26\1\2\u0164\u0165")
buf.write("\b\26\1\2\u0165\u0171\b\26\1\2\u0166\u0167\5 \21\2\u0167")
buf.write("\u016e\b\26\1\2\u0168\u0169\7\30\2\2\u0169\u016a\5 \21")
buf.write("\2\u016a\u016b\b\26\1\2\u016b\u016d\3\2\2\2\u016c\u0168")
buf.write("\3\2\2\2\u016d\u0170\3\2\2\2\u016e\u016c\3\2\2\2\u016e")
buf.write("\u016f\3\2\2\2\u016f\u0172\3\2\2\2\u0170\u016e\3\2\2\2")
buf.write("\u0171\u0166\3\2\2\2\u0171\u0172\3\2\2\2\u0172\u0173\3")
buf.write("\2\2\2\u0173\u0174\b\26\1\2\u0174\u0175\7\25\2\2\u0175")
buf.write("\u0176\b\26\1\2\u0176\u0177\b\26\1\2\u0177\u0194\b\26")
buf.write("\1\2\u0178\u0179\7;\2\2\u0179\u0194\b\26\1\2\u017a\u017b")
buf.write("\7;\2\2\u017b\u017c\b\26\1\2\u017c\u017d\b\26\1\2\u017d")
buf.write("\u0183\b\26\1\2\u017e\u017f\7\22\2\2\u017f\u0180\5$\23")
buf.write("\2\u0180\u0181\b\26\1\2\u0181\u0182\7\23\2\2\u0182\u0184")
buf.write("\3\2\2\2\u0183\u017e\3\2\2\2\u0184\u0185\3\2\2\2\u0185")
buf.write("\u0183\3\2\2\2\u0185\u0186\3\2\2\2\u0186\u0187\3\2\2\2")
buf.write("\u0187\u0188\b\26\1\2\u0188\u0189\b\26\1\2\u0189\u018a")
buf.write("\b\26\1\2\u018a\u0194\3\2\2\2\u018b\u018c\7\'\2\2\u018c")
buf.write("\u0194\b\26\1\2\u018d\u018e\7)\2\2\u018e\u0194\b\26\1")
buf.write("\2\u018f\u0190\7(\2\2\u0190\u0194\b\26\1\2\u0191\u0192")
buf.write("\7*\2\2\u0192\u0194\b\26\1\2\u0193\u015f\3\2\2\2\u0193")
buf.write("\u0178\3\2\2\2\u0193\u017a\3\2\2\2\u0193\u018b\3\2\2\2")
buf.write("\u0193\u018d\3\2\2\2\u0193\u018f\3\2\2\2\u0193\u0191\3")
buf.write("\2\2\2\u0194+\3\2\2\2\u0195\u0196\7\7\2\2\u0196\u0197")
buf.write("\b\27\1\2\u0197\u0198\5 \21\2\u0198\u0199\b\27\1\2\u0199")
buf.write("\u019a\5\26\f\2\u019a\u019b\b\27\1\2\u019b-\3\2\2\2\u019c")
buf.write("\u019d\7;\2\2\u019d\u019e\7\24\2\2\u019e\u019f\b\30\1")
buf.write("\2\u019f\u01a0\b\30\1\2\u01a0\u01a1\b\30\1\2\u01a1\u01a2")
buf.write("\b\30\1\2\u01a2\u01ae\b\30\1\2\u01a3\u01a4\5 \21\2\u01a4")
buf.write("\u01ab\b\30\1\2\u01a5\u01a6\7\30\2\2\u01a6\u01a7\5 \21")
buf.write("\2\u01a7\u01a8\b\30\1\2\u01a8\u01aa\3\2\2\2\u01a9\u01a5")
buf.write("\3\2\2\2\u01aa\u01ad\3\2\2\2\u01ab\u01a9\3\2\2\2\u01ab")
buf.write("\u01ac\3\2\2\2\u01ac\u01af\3\2\2\2\u01ad\u01ab\3\2\2\2")
buf.write("\u01ae\u01a3\3\2\2\2\u01ae\u01af\3\2\2\2\u01af\u01b0\3")
buf.write("\2\2\2\u01b0\u01b1\b\30\1\2\u01b1\u01b2\7\25\2\2\u01b2")
buf.write("\u01b3\b\30\1\2\u01b3\u01b4\b\30\1\2\u01b4\u01b5\7\31")
buf.write("\2\2\u01b5/\3\2\2\2\u01b6\u01b7\7\21\2\2\u01b7\u01b8\7")
buf.write("\24\2\2\u01b8\u01bb\7;\2\2\u01b9\u01ba\7\30\2\2\u01ba")
buf.write("\u01bc\7(\2\2\u01bb\u01b9\3\2\2\2\u01bb\u01bc\3\2\2\2")
buf.write("\u01bc\u01bd\3\2\2\2\u01bd\u01be\b\31\1\2\u01be\u01bf")
buf.write("\7\25\2\2\u01bf\u01c0\7\31\2\2\u01c0\61\3\2\2\2\u01c1")
buf.write("\u01c2\7/\2\2\u01c2\u01c3\7\24\2\2\u01c3\u01c4\7;\2\2")
buf.write("\u01c4\u01c5\b\32\1\2\u01c5\u01c6\b\32\1\2\u01c6\u01c7")
buf.write("\7\25\2\2\u01c7\u024d\7\31\2\2\u01c8\u01c9\7\60\2\2\u01c9")
buf.write("\u01ca\7\24\2\2\u01ca\u01cb\7;\2\2\u01cb\u01cc\b\32\1")
buf.write("\2\u01cc\u01cd\b\32\1\2\u01cd\u01ce\7\25\2\2\u01ce\u024d")
buf.write("\7\31\2\2\u01cf\u01d0\7\61\2\2\u01d0\u01d1\7\24\2\2\u01d1")
buf.write("\u01d2\7;\2\2\u01d2\u01d3\b\32\1\2\u01d3\u01d4\b\32\1")
buf.write("\2\u01d4\u01d5\7\25\2\2\u01d5\u024d\7\31\2\2\u01d6\u01d7")
buf.write("\7\63\2\2\u01d7\u01d8\7\24\2\2\u01d8\u01d9\7;\2\2\u01d9")
buf.write("\u01da\b\32\1\2\u01da\u01db\b\32\1\2\u01db\u01dc\7\25")
buf.write("\2\2\u01dc\u024d\7\31\2\2\u01dd\u01de\7\64\2\2\u01de\u01df")
buf.write("\7\24\2\2\u01df\u01e0\7;\2\2\u01e0\u01e1\b\32\1\2\u01e1")
buf.write("\u01e2\b\32\1\2\u01e2\u01e3\7\25\2\2\u01e3\u024d\7\31")
buf.write("\2\2\u01e4\u01e5\7\62\2\2\u01e5\u01e6\7\24\2\2\u01e6\u01e7")
buf.write("\7;\2\2\u01e7\u01e8\b\32\1\2\u01e8\u01e9\b\32\1\2\u01e9")
buf.write("\u01ea\7\25\2\2\u01ea\u024d\7\31\2\2\u01eb\u01ec\7\65")
buf.write("\2\2\u01ec\u01ed\7\24\2\2\u01ed\u01ee\7;\2\2\u01ee\u01ef")
buf.write("\b\32\1\2\u01ef\u01f0\b\32\1\2\u01f0\u01f1\7\25\2\2\u01f1")
buf.write("\u024d\7\31\2\2\u01f2\u01f3\7.\2\2\u01f3\u01f4\7\24\2")
buf.write("\2\u01f4\u01f5\7;\2\2\u01f5\u01f6\b\32\1\2\u01f6\u01f7")
buf.write("\b\32\1\2\u01f7\u01f8\7\25\2\2\u01f8\u024d\7\31\2\2\u01f9")
buf.write("\u01fa\7+\2\2\u01fa\u01fb\7\24\2\2\u01fb\u01fc\7;\2\2")
buf.write("\u01fc\u01fd\b\32\1\2\u01fd\u01fe\b\32\1\2\u01fe\u01ff")
buf.write("\7\25\2\2\u01ff\u024d\7\31\2\2\u0200\u0201\7,\2\2\u0201")
buf.write("\u0202\7\24\2\2\u0202\u0203\7;\2\2\u0203\u0204\b\32\1")
buf.write("\2\u0204\u0205\b\32\1\2\u0205\u0206\7\25\2\2\u0206\u024d")
buf.write("\7\31\2\2\u0207\u0208\79\2\2\u0208\u0209\7\24\2\2\u0209")
buf.write("\u020a\7;\2\2\u020a\u020b\b\32\1\2\u020b\u020c\7\30\2")
buf.write("\2\u020c\u020d\5*\26\2\u020d\u020e\7\30\2\2\u020e\u020f")
buf.write("\5*\26\2\u020f\u0210\b\32\1\2\u0210\u0211\7\25\2\2\u0211")
buf.write("\u0212\7\31\2\2\u0212\u024d\3\2\2\2\u0213\u0214\7:\2\2")
buf.write("\u0214\u0215\7\24\2\2\u0215\u0216\7;\2\2\u0216\u0217\b")
buf.write("\32\1\2\u0217\u0218\7\30\2\2\u0218\u0219\5*\26\2\u0219")
buf.write("\u021a\b\32\1\2\u021a\u021b\7\25\2\2\u021b\u021c\7\31")
buf.write("\2\2\u021c\u024d\3\2\2\2\u021d\u021e\7-\2\2\u021e\u021f")
buf.write("\7\24\2\2\u021f\u0220\7;\2\2\u0220\u0221\b\32\1\2\u0221")
buf.write("\u0222\b\32\1\2\u0222\u0223\7\25\2\2\u0223\u024d\7\31")
buf.write("\2\2\u0224\u0225\7\66\2\2\u0225\u0226\7\24\2\2\u0226\u0227")
buf.write("\7;\2\2\u0227\u0228\b\32\1\2\u0228\u0229\b\32\1\2\u0229")
buf.write("\u022a\7\30\2\2\u022a\u022b\7;\2\2\u022b\u022c\b\32\1")
buf.write("\2\u022c\u022d\b\32\1\2\u022d\u022e\b\32\1\2\u022e\u022f")
buf.write("\7\25\2\2\u022f\u024d\7\31\2\2\u0230\u0231\7\66\2\2\u0231")
buf.write("\u0232\7\24\2\2\u0232\u0233\7;\2\2\u0233\u0234\b\32\1")
buf.write("\2\u0234\u0235\b\32\1\2\u0235\u0236\7\25\2\2\u0236\u024d")
buf.write("\7\31\2\2\u0237\u0238\7\67\2\2\u0238\u0239\7\24\2\2\u0239")
buf.write("\u023a\7;\2\2\u023a\u023b\b\32\1\2\u023b\u023c\b\32\1")
buf.write("\2\u023c\u023d\7\30\2\2\u023d\u023e\7;\2\2\u023e\u023f")
buf.write("\b\32\1\2\u023f\u0240\b\32\1\2\u0240\u0241\b\32\1\2\u0241")
buf.write("\u0242\7\25\2\2\u0242\u024d\7\31\2\2\u0243\u0244\78\2")
buf.write("\2\u0244\u0245\7\24\2\2\u0245\u0246\7)\2\2\u0246\u0247")
buf.write("\7\30\2\2\u0247\u0248\7)\2\2\u0248\u0249\7\30\2\2\u0249")
buf.write("\u024a\7\'\2\2\u024a\u024b\7\25\2\2\u024b\u024d\7\31\2")
buf.write("\2\u024c\u01c1\3\2\2\2\u024c\u01c8\3\2\2\2\u024c\u01cf")
buf.write("\3\2\2\2\u024c\u01d6\3\2\2\2\u024c\u01dd\3\2\2\2\u024c")
buf.write("\u01e4\3\2\2\2\u024c\u01eb\3\2\2\2\u024c\u01f2\3\2\2\2")
buf.write("\u024c\u01f9\3\2\2\2\u024c\u0200\3\2\2\2\u024c\u0207\3")
buf.write("\2\2\2\u024c\u0213\3\2\2\2\u024c\u021d\3\2\2\2\u024c\u0224")
buf.write("\3\2\2\2\u024c\u0230\3\2\2\2\u024c\u0237\3\2\2\2\u024c")
buf.write("\u0243\3\2\2\2\u024d\63\3\2\2\2(8=KS\\nx\u0080\u0085\u008a")
buf.write("\u009a\u00a5\u00ae\u00b7\u00c6\u00da\u00e0\u00f5\u0100")
buf.write("\u0107\u0110\u0117\u0127\u012d\u0135\u013c\u0145\u014c")
buf.write("\u0158\u015d\u016e\u0171\u0185\u0193\u01ab\u01ae\u01bb")
buf.write("\u024c")
return buf.getvalue()
class LilaParser ( Parser ):
grammarFileName = "Lila.g4"
atn = ATNDeserializer().deserialize(serializedATN())
decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
sharedContextCache = PredictionContextCache()
literalNames = [ "<INVALID>", "'main'", "'lila'", "'void'", "'display'",
"'while'", "'func'", "'var'", "'else'", "'if'", "'int'",
"'num'", "'text'", "'bool'", "'return'", "'getinput'",
"'['", "']'", "'('", "')'", "'{'", "'}'", "','", "';'",
"'+'", "'-'", "'*'", "'/'", "'<'", "'>'", "'!='", "'=='",
"'='", "'<='", "'>='", "'AND'", "'OR'", "<INVALID>",
"<INVALID>", "<INVALID>", "<INVALID>", "'getOutliers'",
"'removeOutliers'", "'tellMeWhatToUse'", "'printMeasures'",
"'mean'", "'median'", "'mode'", "'range'", "'min'",
"'max'", "'desEstandar'", "'quickShow'", "'pearsoneCorrelation'",
"'normalDistribution'", "'fillValue'", "'removeValue'" ]
symbolicNames = [ "<INVALID>", "MAIN", "LILA", "VOID", "DISPLAY", "WHILE",
"FUNC", "VAR", "ELSE", "IF", "INT", "NUM", "TEXT",
"BOOL", "RETURN", "GETINPUT", "OPEN_BRACKET", "CLOSE_BRACKET",
"OPEN_PARENTHESIS", "CLOSE_PARENTHESIS", "OPEN_CURLY",
"CLOSE_CURLY", "COMMA", "SEMICOLON", "PLUS", "MINUS",
"MULTIPLICATION", "DIVISION", "LESS_THAN", "GREATER_THAN",
"NOTEQUAL", "EQUALITY", "EQUAL", "LESS_THAN_EQUAL",
"GREATER_THAN_EQUAL", "AND", "OR", "CTE_INT", "CTE_STRING",
"CTE_F", "CTE_BOOL", "GETOUTLIERS", "REMOVEOUTLIERS",
"TELLMEWHATTOUSE", "PRINTMEASURES", "MEAN", "MEDIAN",
"MODE", "RANGE", "MIN", "MAX", "DESESTANDAR", "QUICKSHOW",
"PEARSONCORRELATION", "NORMALDISTRIBUTION", "FILLVALUE",
"REMOVEVALUE", "ID", "WS", "Comment" ]
RULE_programa = 0
RULE_data = 1
RULE_data2 = 2
RULE_main = 3
RULE_array = 4
RULE_tipo = 5
RULE_funciones = 6
RULE_params = 7
RULE_estatuto = 8
RULE_condicion = 9
RULE_bloque = 10
RULE_display = 11
RULE_asignacion = 12
RULE_sreturn = 13
RULE_arr = 14
RULE_expresion = 15
RULE_comparacion = 16
RULE_exp = 17
RULE_termino = 18
RULE_factor = 19
RULE_var_cte = 20
RULE_swhile = 21
RULE_invocacion = 22
RULE_getinput = 23
RULE_especiales = 24
ruleNames = [ "programa", "data", "data2", "main", "array", "tipo",
"funciones", "params", "estatuto", "condicion", "bloque",
"display", "asignacion", "sreturn", "arr", "expresion",
"comparacion", "exp", "termino", "factor", "var_cte",
"swhile", "invocacion", "getinput", "especiales" ]
EOF = Token.EOF
MAIN=1
LILA=2
VOID=3
DISPLAY=4
WHILE=5
FUNC=6
VAR=7
ELSE=8
IF=9
INT=10
NUM=11
TEXT=12
BOOL=13
RETURN=14
GETINPUT=15
OPEN_BRACKET=16
CLOSE_BRACKET=17
OPEN_PARENTHESIS=18
CLOSE_PARENTHESIS=19
OPEN_CURLY=20
CLOSE_CURLY=21
COMMA=22
SEMICOLON=23
PLUS=24
MINUS=25
MULTIPLICATION=26
DIVISION=27
LESS_THAN=28
GREATER_THAN=29
NOTEQUAL=30
EQUALITY=31
EQUAL=32
LESS_THAN_EQUAL=33
GREATER_THAN_EQUAL=34
AND=35
OR=36
CTE_INT=37
CTE_STRING=38
CTE_F=39
CTE_BOOL=40
GETOUTLIERS=41
REMOVEOUTLIERS=42
TELLMEWHATTOUSE=43
PRINTMEASURES=44
MEAN=45
MEDIAN=46
MODE=47
RANGE=48
MIN=49
MAX=50
DESESTANDAR=51
QUICKSHOW=52
PEARSONCORRELATION=53
NORMALDISTRIBUTION=54
FILLVALUE=55
REMOVEVALUE=56
ID=57
WS=58
Comment=59
def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
super().__init__(input, output)
self.checkVersion("4.7.2")
self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
self._predicates = None
class ProgramaContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def LILA(self):
return self.getToken(LilaParser.LILA, 0)
def ID(self):
return self.getToken(LilaParser.ID, 0)
def main(self):
return self.getTypedRuleContext(LilaParser.MainContext,0)
def data(self):
return self.getTypedRuleContext(LilaParser.DataContext,0)
def funciones(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(LilaParser.FuncionesContext)
else:
return self.getTypedRuleContext(LilaParser.FuncionesContext,i)
def getRuleIndex(self):
return LilaParser.RULE_programa
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPrograma" ):
listener.enterPrograma(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPrograma" ):
listener.exitPrograma(self)
def programa(self):
localctx = LilaParser.ProgramaContext(self, self._ctx, self.state)
self.enterRule(localctx, 0, self.RULE_programa)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 50
self.match(LilaParser.LILA)
self.state = 51
self.match(LilaParser.ID)
gen.goTo()
self.state = 54
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==LilaParser.VAR:
self.state = 53
self.data()
self.state = 59
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==LilaParser.FUNC:
self.state = 56
self.funciones()
self.state = 61
self._errHandler.sync(self)
_la = self._input.LA(1)
gen.conditionEnd()
self.state = 63
self.main()
gen.end()
Semantic.display_test()
gen.test_final()
return gen.getObj()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class DataContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def VAR(self):
return self.getToken(LilaParser.VAR, 0)
def data2(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(LilaParser.Data2Context)
else:
return self.getTypedRuleContext(LilaParser.Data2Context,i)
def getRuleIndex(self):
return LilaParser.RULE_data
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterData" ):
listener.enterData(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitData" ):
listener.exitData(self)
def data(self):
localctx = LilaParser.DataContext(self, self._ctx, self.state)
self.enterRule(localctx, 2, self.RULE_data)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 69
self.match(LilaParser.VAR)
self.state = 71
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 70
self.data2()
self.state = 73
self._errHandler.sync(self)
_la = self._input.LA(1)
if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << LilaParser.INT) | (1 << LilaParser.NUM) | (1 << LilaParser.TEXT) | (1 << LilaParser.BOOL))) != 0)):
break
Semantic.isGlobal = False
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Data2Context(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
self._tipo = None # TipoContext
self._ID = None # Token
def ID(self, i:int=None):
if i is None:
return self.getTokens(LilaParser.ID)
else:
return self.getToken(LilaParser.ID, i)
def SEMICOLON(self):
return self.getToken(LilaParser.SEMICOLON, 0)
def tipo(self):
return self.getTypedRuleContext(LilaParser.TipoContext,0)
def array(self):
return self.getTypedRuleContext(LilaParser.ArrayContext,0)
def COMMA(self, i:int=None):
if i is None:
return self.getTokens(LilaParser.COMMA)
else:
return self.getToken(LilaParser.COMMA, i)
def getRuleIndex(self):
return LilaParser.RULE_data2
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterData2" ):
listener.enterData2(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitData2" ):
listener.exitData2(self)
def data2(self):
localctx = LilaParser.Data2Context(self, self._ctx, self.state)
self.enterRule(localctx, 4, self.RULE_data2)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 81
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,3,self._ctx)
if la_ == 1:
self.state = 77
localctx._tipo = self.tipo()
pass
elif la_ == 2:
self.state = 78
localctx._tipo = self.tipo()
self.state = 79
self.array()
pass
self.state = 83
localctx._ID = self.match(LilaParser.ID)
Semantic.add_var(Operand((None if localctx._ID is None else localctx._ID.text),(None if localctx._tipo is None else self._input.getText((localctx._tipo.start,localctx._tipo.stop))),None))
self.state = 90
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==LilaParser.COMMA:
self.state = 85
self.match(LilaParser.COMMA)
self.state = 86
localctx._ID = self.match(LilaParser.ID)
Semantic.add_var(Operand((None if localctx._ID is None else localctx._ID.text),(None if localctx._tipo is None else self._input.getText((localctx._tipo.start,localctx._tipo.stop))),None))
self.state = 92
self._errHandler.sync(self)
_la = self._input.LA(1)
Semantic.reset_array_setup()
self.state = 94
self.match(LilaParser.SEMICOLON)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class MainContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def MAIN(self):
return self.getToken(LilaParser.MAIN, 0)
def bloque(self):
return self.getTypedRuleContext(LilaParser.BloqueContext,0)
def getRuleIndex(self):
return LilaParser.RULE_main
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterMain" ):
listener.enterMain(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitMain" ):
listener.exitMain(self)
def main(self):
localctx = LilaParser.MainContext(self, self._ctx, self.state)
self.enterRule(localctx, 6, self.RULE_main)
try:
self.enterOuterAlt(localctx, 1)
self.state = 96
self.match(LilaParser.MAIN)
gen.contextChange()
self.state = 98
self.bloque()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class ArrayContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
self._CTE_INT = None # Token
def OPEN_BRACKET(self, i:int=None):
if i is None:
return self.getTokens(LilaParser.OPEN_BRACKET)
else:
return self.getToken(LilaParser.OPEN_BRACKET, i)
def CTE_INT(self, i:int=None):
if i is None:
return self.getTokens(LilaParser.CTE_INT)
else:
return self.getToken(LilaParser.CTE_INT, i)
def CLOSE_BRACKET(self, i:int=None):
if i is None:
return self.getTokens(LilaParser.CLOSE_BRACKET)
else:
return self.getToken(LilaParser.CLOSE_BRACKET, i)
def getRuleIndex(self):
return LilaParser.RULE_array
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterArray" ):
listener.enterArray(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitArray" ):
listener.exitArray(self)
def array(self):
localctx = LilaParser.ArrayContext(self, self._ctx, self.state)
self.enterRule(localctx, 8, self.RULE_array)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
Semantic.array_declaration()
self.state = 108
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==LilaParser.OPEN_BRACKET:
self.state = 101
self.match(LilaParser.OPEN_BRACKET)
self.state = 102
localctx._CTE_INT = self.match(LilaParser.CTE_INT)
Semantic.array_dimension((None if localctx._CTE_INT is None else localctx._CTE_INT.text))
self.state = 104
self.match(LilaParser.CLOSE_BRACKET)
Semantic.array_next_dim()
self.state = 110
self._errHandler.sync(self)
_la = self._input.LA(1)
Semantic.arr_second_round()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class TipoContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def INT(self):
return self.getToken(LilaParser.INT, 0)
def NUM(self):
return self.getToken(LilaParser.NUM, 0)
def TEXT(self):
return self.getToken(LilaParser.TEXT, 0)
def BOOL(self):
return self.getToken(LilaParser.BOOL, 0)
def getRuleIndex(self):
return LilaParser.RULE_tipo
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterTipo" ):
listener.enterTipo(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitTipo" ):
listener.exitTipo(self)
def tipo(self):
localctx = LilaParser.TipoContext(self, self._ctx, self.state)
self.enterRule(localctx, 10, self.RULE_tipo)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 113
_la = self._input.LA(1)
if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << LilaParser.INT) | (1 << LilaParser.NUM) | (1 << LilaParser.TEXT) | (1 << LilaParser.BOOL))) != 0)):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class FuncionesContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
self._tipo = None # TipoContext
self._VOID = None # Token
self._ID = None # Token
def FUNC(self):
return self.getToken(LilaParser.FUNC, 0)
def ID(self):
return self.getToken(LilaParser.ID, 0)
def OPEN_PARENTHESIS(self):
return self.getToken(LilaParser.OPEN_PARENTHESIS, 0)
def CLOSE_PARENTHESIS(self):
return self.getToken(LilaParser.CLOSE_PARENTHESIS, 0)
def OPEN_CURLY(self):
return self.getToken(LilaParser.OPEN_CURLY, 0)
def CLOSE_CURLY(self):
return self.getToken(LilaParser.CLOSE_CURLY, 0)
def tipo(self):
return self.getTypedRuleContext(LilaParser.TipoContext,0)
def VOID(self):
return self.getToken(LilaParser.VOID, 0)
def params(self):
return self.getTypedRuleContext(LilaParser.ParamsContext,0)
def data(self):
return self.getTypedRuleContext(LilaParser.DataContext,0)
def estatuto(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(LilaParser.EstatutoContext)
else:
return self.getTypedRuleContext(LilaParser.EstatutoContext,i)
def getRuleIndex(self):
return LilaParser.RULE_funciones
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterFunciones" ):
listener.enterFunciones(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitFunciones" ):
listener.exitFunciones(self)
def funciones(self):
localctx = LilaParser.FuncionesContext(self, self._ctx, self.state)
self.enterRule(localctx, 12, self.RULE_funciones)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 115
self.match(LilaParser.FUNC)
self.state = 118
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [LilaParser.INT, LilaParser.NUM, LilaParser.TEXT, LilaParser.BOOL]:
self.state = 116
localctx._tipo = self.tipo()
pass
elif token in [LilaParser.VOID]:
self.state = 117
localctx._VOID = self.match(LilaParser.VOID)
pass
else:
raise NoViableAltException(self)
self.state = 120
localctx._ID = self.match(LilaParser.ID)
index = len(gen.Quadruples)
Semantic.enterFunciones((None if localctx._ID is None else localctx._ID.text),(None if localctx._tipo is None else self._input.getText((localctx._tipo.start,localctx._tipo.stop))),(None if localctx._VOID is None else localctx._VOID.text),index)
gen.contextChange()
self.state = 124
self.match(LilaParser.OPEN_PARENTHESIS)
self.state = 126
self._errHandler.sync(self)
_la = self._input.LA(1)
if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << LilaParser.INT) | (1 << LilaParser.NUM) | (1 << LilaParser.TEXT) | (1 << LilaParser.BOOL))) != 0):
self.state = 125
self.params()
self.state = 128
self.match(LilaParser.CLOSE_PARENTHESIS)
self.state = 129
self.match(LilaParser.OPEN_CURLY)
self.state = 131
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==LilaParser.VAR:
self.state = 130
self.data()
self.state = 134
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 133
self.estatuto()
self.state = 136
self._errHandler.sync(self)
_la = self._input.LA(1)
if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << LilaParser.DISPLAY) | (1 << LilaParser.WHILE) | (1 << LilaParser.IF) | (1 << LilaParser.RETURN) | (1 << LilaParser.GETINPUT) | (1 << LilaParser.GETOUTLIERS) | (1 << LilaParser.REMOVEOUTLIERS) | (1 << LilaParser.TELLMEWHATTOUSE) | (1 << LilaParser.PRINTMEASURES) | (1 << LilaParser.MEAN) | (1 << LilaParser.MEDIAN) | (1 << LilaParser.MODE) | (1 << LilaParser.RANGE) | (1 << LilaParser.MIN) | (1 << LilaParser.MAX) | (1 << LilaParser.DESESTANDAR) | (1 << LilaParser.QUICKSHOW) | (1 << LilaParser.PEARSONCORRELATION) | (1 << LilaParser.NORMALDISTRIBUTION) | (1 << LilaParser.FILLVALUE) | (1 << LilaParser.REMOVEVALUE) | (1 << LilaParser.ID))) != 0)):
break
self.state = 138
self.match(LilaParser.CLOSE_CURLY)
gen.endProc()
Semantic.end_function()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class ParamsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser