-
Notifications
You must be signed in to change notification settings - Fork 0
/
parser.tab.cc
3135 lines (2792 loc) · 110 KB
/
parser.tab.cc
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
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Skeleton implementation for Bison GLR parsers in C
Copyright (C) 2002-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* C GLR parser skeleton written by Paul Hilfinger. */
/* Identify Bison output. */
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "3.0.4"
/* Skeleton name. */
#define YYSKELETON_NAME "glr.c"
/* Pure parsers. */
#define YYPURE 0
/* First part of user declarations. */
#line 2 "parser.yy" /* glr.c:240 */
#include<cstdio>
#include "ast.hh"
#include<vector>
#include<iostream>
extern "C" int yylex();
void yyerror(const char * s ){printf("ERROR: %s\n",s);
abort();}
ASTProgram* MAIN;
#line 65 "parser.tab.cc" /* glr.c:240 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULLPTR nullptr
# else
# define YY_NULLPTR 0
# endif
# endif
#include "parser.tab.hh"
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif
/* Default (constant) value used for initialization for null
right-hand sides. Unlike the standard yacc.c template, here we set
the default value of $$ to a zeroed-out value. Since the default
value is undefined, this behavior is technically correct. */
static YYSTYPE yyval_default;
/* Copy the second part of user declarations. */
#line 93 "parser.tab.cc" /* glr.c:263 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif
# endif
# ifndef YY_
# define YY_(Msgid) Msgid
# endif
#endif
#ifndef YYFREE
# define YYFREE free
#endif
#ifndef YYMALLOC
# define YYMALLOC malloc
#endif
#ifndef YYREALLOC
# define YYREALLOC realloc
#endif
#define YYSIZEMAX ((size_t) -1)
#ifdef __cplusplus
typedef bool yybool;
#else
typedef unsigned char yybool;
#endif
#define yytrue 1
#define yyfalse 0
#ifndef YYSETJMP
# include <setjmp.h>
# define YYJMP_BUF jmp_buf
# define YYSETJMP(Env) setjmp (Env)
/* Pacify clang. */
# define YYLONGJMP(Env, Val) (longjmp (Env, Val), YYASSERT (0))
#endif
#ifndef YY_ATTRIBUTE
# if (defined __GNUC__ \
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
# else
# define YY_ATTRIBUTE(Spec) /* empty */
# endif
#endif
#ifndef YY_ATTRIBUTE_PURE
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
#endif
#ifndef YY_ATTRIBUTE_UNUSED
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
#if !defined _Noreturn \
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
# if defined _MSC_VER && 1200 <= _MSC_VER
# define _Noreturn __declspec (noreturn)
# else
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
#else
# define YYUSE(E) /* empty */
#endif
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
#ifndef YYASSERT
# define YYASSERT(Condition) ((void) ((Condition) || (abort (), 0)))
#endif
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 4
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 217
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 42
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 23
/* YYNRULES -- Number of rules. */
#define YYNRULES 67
/* YYNRULES -- Number of states. */
#define YYNSTATES 138
/* YYMAXRHS -- Maximum number of symbols on right-hand side of rule. */
#define YYMAXRHS 7
/* YYMAXLEFT -- Maximum number of symbols to the left of a handle
accessed by $0, $-1, etc., in any rule. */
#define YYMAXLEFT 0
/* YYTRANSLATE(X) -- Bison symbol number corresponding to X. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 296
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
static const unsigned char yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 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
};
#if YYDEBUG
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const unsigned short int yyrline[] =
{
0, 102, 102, 109, 110, 114, 120, 130, 134, 139,
143, 148, 152, 157, 158, 167, 173, 181, 182, 187,
188, 193, 195, 200, 206, 207, 208, 209, 210, 216,
217, 218, 219, 222, 226, 231, 236, 237, 240, 243,
248, 250, 252, 255, 257, 259, 261, 263, 265, 267,
269, 271, 273, 275, 277, 280, 281, 282, 287, 288,
290, 291, 296, 303, 304, 305, 308, 310
};
#endif
#if YYDEBUG || YYERROR_VERBOSE || 0
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
"$end", "error", "$undefined", "NOT", "MULTIPLY", "DIVIDE", "REMAINDER",
"ADD", "MINUS", "ROP", "EOP", "ANDAND", "OROR", "CLASS", "PROGRAM", "LC",
"RC", "LP", "RP", "LS", "RS", "WHILE", "FOR", "IF", "ELSE", "BREAK",
"CONTINUE", "COMMA", "SEMICOLON", "RETURN", "CALLOUT", "EQUAL",
"CHARACTER", "STRINGIT", "ID", "BOOLIT", "TYPE", "VOID", "MINUSEQUAL",
"PLUSEQUAL", "HEXIT", "NUMBER", "$accept", "program", "fieldmore",
"field", "variables", "variable", "method", "method_arguments", "block",
"var_declmore", "statementmore", "var_decl", "mvariables", "statement",
"method_call", "callout_argmore", "location", "expr",
"method_call_arguments", "callout_arg", "literal", "asop", "int_literal", YY_NULLPTR
};
#endif
#define YYPACT_NINF -47
#define YYTABLE_NINF -1
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
static const short int yypact[] =
{
23, 7, 44, 40, -47, 27, 25, 35, 61, 27,
27, 20, 52, -47, 68, -47, -47, -47, 57, 59,
67, -47, 57, 70, -3, 82, 114, -47, 1, -47,
91, 104, -47, 91, 107, -47, 102, -47, 110, 112,
107, -47, -47, 55, 129, 128, 146, 147, 26, 159,
51, 162, 112, 149, 34, -47, 155, -47, 160, 73,
-47, -47, 73, 73, 73, -47, -47, -47, -47, -47,
-47, -47, -1, -47, -47, 157, 73, 73, -47, -47,
-47, -47, -47, -47, 73, -47, 73, 161, 203, 100,
176, 73, 73, 73, 73, 73, 73, 73, 73, 73,
-47, 5, 203, 8, 144, 111, 120, 91, -47, 150,
150, 150, 100, 100, 10, 80, -47, -47, -47, 54,
-47, 73, -47, -47, 73, 168, -47, 15, 203, -47,
203, 191, 91, -47, 54, -47, -47, -47
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
Performed when YYTABLE does not specify something else to do. Zero
means the default is an error. */
static const unsigned char yydefact[] =
{
0, 0, 0, 0, 1, 3, 0, 0, 0, 3,
3, 9, 0, 7, 0, 2, 4, 5, 13, 0,
0, 6, 13, 0, 0, 0, 9, 8, 0, 14,
0, 0, 10, 0, 17, 12, 0, 11, 0, 19,
17, 15, 22, 0, 0, 0, 0, 0, 0, 0,
38, 0, 19, 0, 0, 18, 0, 21, 0, 0,
31, 32, 0, 0, 0, 30, 61, 62, 67, 66,
41, 40, 0, 42, 60, 0, 55, 0, 16, 20,
25, 63, 65, 64, 0, 23, 0, 0, 44, 43,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
29, 0, 56, 0, 0, 0, 0, 0, 45, 48,
49, 50, 46, 47, 51, 52, 53, 54, 34, 0,
33, 0, 39, 24, 0, 26, 59, 0, 58, 36,
57, 0, 0, 35, 0, 28, 27, 37
};
/* YYPGOTO[NTERM-NUM]. */
static const short int yypgoto[] =
{
-47, -47, 87, -47, -47, 173, -47, 182, -33, 165,
164, -47, -47, -47, -38, -47, -27, -46, -47, 83,
-47, -47, -47
};
/* YYDEFGOTO[NTERM-NUM]. */
static const short int yydefgoto[] =
{
-1, 2, 8, 9, 12, 13, 10, 24, 35, 39,
51, 40, 43, 52, 70, 127, 71, 128, 103, 129,
73, 84, 74
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule whose
number is the opposite. If YYTABLE_NINF, syntax error. */
static const unsigned char yytable[] =
{
37, 53, 72, 91, 92, 93, 94, 95, 96, 97,
98, 99, 54, 87, 53, 30, 88, 89, 90, 33,
97, 98, 99, 118, 31, 54, 120, 100, 31, 62,
102, 104, 119, 133, 63, 121, 1, 18, 105, 19,
106, 3, 134, 64, 4, 109, 110, 111, 112, 113,
114, 115, 116, 117, 65, 5, 49, 62, 66, 11,
50, 67, 63, 6, 7, 81, 68, 69, 76, 14,
77, 64, 82, 83, 125, 130, 62, 15, 131, 20,
21, 63, 56, 57, 49, 22, 66, 126, 50, 67,
64, 98, 99, 23, 68, 69, 16, 17, 135, 136,
25, 26, 32, 49, 29, 66, 34, 50, 67, 96,
97, 98, 99, 68, 69, 91, 92, 93, 94, 95,
96, 97, 98, 99, 91, 92, 93, 94, 95, 96,
97, 98, 99, 19, 44, 45, 41, 46, 47, 123,
36, 48, 49, 38, 42, 59, 50, 124, 91, 92,
93, 94, 95, 96, 97, 98, 99, 94, 95, 96,
97, 98, 99, 58, 122, 91, 92, 93, 94, 95,
96, 97, 98, 99, 60, 61, 75, 80, 78, 107,
91, 92, 93, 94, 95, 96, 97, 98, 99, 85,
101, 86, 132, 27, 108, 91, 92, 93, 94, 95,
96, 97, 98, 99, 28, 55, 34, 91, 92, 93,
94, 95, 96, 97, 98, 99, 79, 137
};
static const unsigned char yycheck[] =
{
33, 39, 48, 4, 5, 6, 7, 8, 9, 10,
11, 12, 39, 59, 52, 18, 62, 63, 64, 18,
10, 11, 12, 18, 27, 52, 18, 28, 27, 3,
76, 77, 27, 18, 8, 27, 13, 17, 84, 19,
86, 34, 27, 17, 0, 91, 92, 93, 94, 95,
96, 97, 98, 99, 28, 15, 30, 3, 32, 34,
34, 35, 8, 36, 37, 31, 40, 41, 17, 34,
19, 17, 38, 39, 107, 121, 3, 16, 124, 27,
28, 8, 27, 28, 30, 17, 32, 33, 34, 35,
17, 11, 12, 36, 40, 41, 9, 10, 131, 132,
41, 34, 20, 30, 34, 32, 15, 34, 35, 9,
10, 11, 12, 40, 41, 4, 5, 6, 7, 8,
9, 10, 11, 12, 4, 5, 6, 7, 8, 9,
10, 11, 12, 19, 22, 23, 34, 25, 26, 28,
36, 29, 30, 36, 34, 17, 34, 27, 4, 5,
6, 7, 8, 9, 10, 11, 12, 7, 8, 9,
10, 11, 12, 34, 20, 4, 5, 6, 7, 8,
9, 10, 11, 12, 28, 28, 17, 28, 16, 18,
4, 5, 6, 7, 8, 9, 10, 11, 12, 34,
33, 31, 24, 20, 18, 4, 5, 6, 7, 8,
9, 10, 11, 12, 22, 40, 15, 4, 5, 6,
7, 8, 9, 10, 11, 12, 52, 134
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const unsigned char yystos[] =
{
0, 13, 43, 34, 0, 15, 36, 37, 44, 45,
48, 34, 46, 47, 34, 16, 44, 44, 17, 19,
27, 28, 17, 36, 49, 41, 34, 47, 49, 34,
18, 27, 20, 18, 15, 50, 36, 50, 36, 51,
53, 34, 34, 54, 22, 23, 25, 26, 29, 30,
34, 52, 55, 56, 58, 51, 27, 28, 34, 17,
28, 28, 3, 8, 17, 28, 32, 35, 40, 41,
56, 58, 59, 62, 64, 17, 17, 19, 16, 52,
28, 31, 38, 39, 63, 34, 31, 59, 59, 59,
59, 4, 5, 6, 7, 8, 9, 10, 11, 12,
28, 33, 59, 60, 59, 59, 59, 18, 18, 59,
59, 59, 59, 59, 59, 59, 59, 59, 18, 27,
18, 27, 20, 28, 27, 50, 33, 57, 59, 61,
59, 59, 24, 18, 27, 50, 50, 61
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const unsigned char yyr1[] =
{
0, 42, 43, 44, 44, 44, 45, 46, 46, 47,
47, 48, 48, 49, 49, 49, 50, 51, 51, 52,
52, 53, 54, 54, 55, 55, 55, 55, 55, 55,
55, 55, 55, 56, 56, 56, 57, 57, 58, 58,
59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
59, 59, 59, 59, 59, 60, 60, 60, 61, 61,
62, 62, 62, 63, 63, 63, 64, 64
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const unsigned char yyr2[] =
{
0, 2, 5, 0, 2, 2, 3, 1, 3, 1,
4, 6, 6, 0, 2, 4, 4, 0, 2, 0,
2, 3, 1, 3, 4, 2, 5, 7, 7, 3,
2, 2, 2, 4, 4, 6, 1, 3, 1, 4,
1, 1, 1, 2, 2, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 0, 1, 3, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1
};
/* YYDPREC[RULE-NUM] -- Dynamic precedence of rule #RULE-NUM (0 if none). */
static const unsigned char yydprec[] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
/* YYMERGER[RULE-NUM] -- Index of merging function for rule #RULE-NUM. */
static const unsigned char yymerger[] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
/* YYIMMEDIATE[RULE-NUM] -- True iff rule #RULE-NUM is not to be deferred, as
in the case of predicates. */
static const yybool yyimmediate[] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
/* YYCONFLP[YYPACT[STATE-NUM]] -- Pointer into YYCONFL of start of
list of conflicting reductions corresponding to action entry for
state STATE-NUM in yytable. 0 means no conflicts. The list in
yyconfl is terminated by a rule number of 0. */
static const unsigned char yyconflp[] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
/* YYCONFL[I] -- lists of conflicting rule numbers, each terminated by
0, pointed into by YYCONFLP. */
static const short int yyconfl[] =
{
0
};
/* Error token number */
#define YYTERROR 1
YYSTYPE yylval;
int yynerrs;
int yychar;
static const int YYEOF = 0;
static const int YYEMPTY = -2;
typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
#define YYCHK(YYE) \
do { \
YYRESULTTAG yychk_flag = YYE; \
if (yychk_flag != yyok) \
return yychk_flag; \
} while (0)
#if YYDEBUG
# ifndef YYFPRINTF
# define YYFPRINTF fprintf
# endif
/* This macro is provided for backward compatibility. */
#ifndef YY_LOCATION_PRINT
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
#endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
/*----------------------------------------.
| Print this symbol's value on YYOUTPUT. |
`----------------------------------------*/
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
{
FILE *yyo = yyoutput;
YYUSE (yyo);
if (!yyvaluep)
return;
YYUSE (yytype);
}
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
{
YYFPRINTF (yyoutput, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
YYFPRINTF (yyoutput, ")");
}
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, Type, Value); \
YYFPRINTF (stderr, "\n"); \
} \
} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
struct yyGLRStack;
static void yypstack (struct yyGLRStack* yystackp, size_t yyk)
YY_ATTRIBUTE_UNUSED;
static void yypdumpstack (struct yyGLRStack* yystackp)
YY_ATTRIBUTE_UNUSED;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
#endif /* !YYDEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if
SIZE_MAX < YYMAXDEPTH * sizeof (GLRStackItem)
evaluated with infinite-precision integer arithmetic. */
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
/* Minimum number of free items on the stack allowed after an
allocation. This is to allow allocation and initialization
to be completed by functions that call yyexpandGLRStack before the
stack is expanded, thus insuring that all necessary pointers get
properly redirected to new data. */
#define YYHEADROOM 2
#ifndef YYSTACKEXPANDABLE
# define YYSTACKEXPANDABLE 1
#endif
#if YYSTACKEXPANDABLE
# define YY_RESERVE_GLRSTACK(Yystack) \
do { \
if (Yystack->yyspaceLeft < YYHEADROOM) \
yyexpandGLRStack (Yystack); \
} while (0)
#else
# define YY_RESERVE_GLRSTACK(Yystack) \
do { \
if (Yystack->yyspaceLeft < YYHEADROOM) \
yyMemoryExhausted (Yystack); \
} while (0)
#endif
#if YYERROR_VERBOSE
# ifndef yystpcpy
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
# define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
static char *
yystpcpy (char *yydest, const char *yysrc)
{
char *yyd = yydest;
const char *yys = yysrc;
while ((*yyd++ = *yys++) != '\0')
continue;
return yyd - 1;
}
# endif
# endif
# ifndef yytnamerr
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
quotes and backslashes, so that it's suitable for yyerror. The
heuristic is that double-quoting is unnecessary unless the string
contains an apostrophe, a comma, or backslash (other than
backslash-backslash). YYSTR is taken from yytname. If YYRES is
null, do not copy; instead, return the length of what the result
would have been. */
static size_t
yytnamerr (char *yyres, const char *yystr)
{
if (*yystr == '"')
{
size_t yyn = 0;
char const *yyp = yystr;
for (;;)
switch (*++yyp)
{
case '\'':
case ',':
goto do_not_strip_quotes;
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
/* Fall through. */
default:
if (yyres)
yyres[yyn] = *yyp;
yyn++;
break;
case '"':
if (yyres)
yyres[yyn] = '\0';
return yyn;
}
do_not_strip_quotes: ;
}
if (! yyres)
return strlen (yystr);
return yystpcpy (yyres, yystr) - yyres;
}
# endif
#endif /* !YYERROR_VERBOSE */
/** State numbers, as in LALR(1) machine */
typedef int yyStateNum;
/** Rule numbers, as in LALR(1) machine */
typedef int yyRuleNum;
/** Grammar symbol */
typedef int yySymbol;
/** Item references, as in LALR(1) machine */
typedef short int yyItemNum;
typedef struct yyGLRState yyGLRState;
typedef struct yyGLRStateSet yyGLRStateSet;
typedef struct yySemanticOption yySemanticOption;
typedef union yyGLRStackItem yyGLRStackItem;
typedef struct yyGLRStack yyGLRStack;
struct yyGLRState {
/** Type tag: always true. */
yybool yyisState;
/** Type tag for yysemantics. If true, yysval applies, otherwise
* yyfirstVal applies. */
yybool yyresolved;
/** Number of corresponding LALR(1) machine state. */
yyStateNum yylrState;
/** Preceding state in this stack */
yyGLRState* yypred;
/** Source position of the last token produced by my symbol */
size_t yyposn;
union {
/** First in a chain of alternative reductions producing the
* non-terminal corresponding to this state, threaded through
* yynext. */
yySemanticOption* yyfirstVal;
/** Semantic value for this state. */
YYSTYPE yysval;
} yysemantics;
};
struct yyGLRStateSet {
yyGLRState** yystates;
/** During nondeterministic operation, yylookaheadNeeds tracks which
* stacks have actually needed the current lookahead. During deterministic
* operation, yylookaheadNeeds[0] is not maintained since it would merely
* duplicate yychar != YYEMPTY. */
yybool* yylookaheadNeeds;
size_t yysize, yycapacity;
};
struct yySemanticOption {
/** Type tag: always false. */
yybool yyisState;
/** Rule number for this reduction */
yyRuleNum yyrule;
/** The last RHS state in the list of states to be reduced. */
yyGLRState* yystate;
/** The lookahead for this reduction. */
int yyrawchar;
YYSTYPE yyval;
/** Next sibling in chain of options. To facilitate merging,
* options are chained in decreasing order by address. */
yySemanticOption* yynext;
};
/** Type of the items in the GLR stack. The yyisState field
* indicates which item of the union is valid. */
union yyGLRStackItem {
yyGLRState yystate;
yySemanticOption yyoption;
};
struct yyGLRStack {
int yyerrState;
YYJMP_BUF yyexception_buffer;
yyGLRStackItem* yyitems;
yyGLRStackItem* yynextFree;
size_t yyspaceLeft;
yyGLRState* yysplitPoint;
yyGLRState* yylastDeleted;
yyGLRStateSet yytops;
};
#if YYSTACKEXPANDABLE
static void yyexpandGLRStack (yyGLRStack* yystackp);
#endif
static _Noreturn void
yyFail (yyGLRStack* yystackp, const char* yymsg)
{
if (yymsg != YY_NULLPTR)
yyerror (yymsg);
YYLONGJMP (yystackp->yyexception_buffer, 1);
}
static _Noreturn void
yyMemoryExhausted (yyGLRStack* yystackp)
{
YYLONGJMP (yystackp->yyexception_buffer, 2);
}
#if YYDEBUG || YYERROR_VERBOSE
/** A printable representation of TOKEN. */
static inline const char*
yytokenName (yySymbol yytoken)
{
if (yytoken == YYEMPTY)
return "";
return yytname[yytoken];
}
#endif
/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
* at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
* containing the pointer to the next state in the chain. */
static void yyfillin (yyGLRStackItem *, int, int) YY_ATTRIBUTE_UNUSED;
static void
yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
{
int i;
yyGLRState *s = yyvsp[yylow0].yystate.yypred;
for (i = yylow0-1; i >= yylow1; i -= 1)
{
#if YYDEBUG
yyvsp[i].yystate.yylrState = s->yylrState;
#endif
yyvsp[i].yystate.yyresolved = s->yyresolved;
if (s->yyresolved)
yyvsp[i].yystate.yysemantics.yysval = s->yysemantics.yysval;
else
/* The effect of using yysval or yyloc (in an immediate rule) is
* undefined. */
yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULLPTR;
s = yyvsp[i].yystate.yypred = s->yypred;
}
}
/* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in
* YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
* For convenience, always return YYLOW1. */
static inline int yyfill (yyGLRStackItem *, int *, int, yybool)
YY_ATTRIBUTE_UNUSED;
static inline int
yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
{
if (!yynormal && yylow1 < *yylow)
{
yyfillin (yyvsp, *yylow, yylow1);
*yylow = yylow1;
}
return yylow1;
}
/** Perform user action for rule number YYN, with RHS length YYRHSLEN,
* and top stack item YYVSP. YYLVALP points to place to put semantic
* value ($$), and yylocp points to place for location information
* (@$). Returns yyok for normal return, yyaccept for YYACCEPT,
* yyerr for YYERROR, yyabort for YYABORT. */
static YYRESULTTAG
yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
yyGLRStack* yystackp,
YYSTYPE* yyvalp)
{
yybool yynormal YY_ATTRIBUTE_UNUSED = (yystackp->yysplitPoint == YY_NULLPTR);
int yylow;
YYUSE (yyvalp);
YYUSE (yyrhslen);
# undef yyerrok
# define yyerrok (yystackp->yyerrState = 0)
# undef YYACCEPT
# define YYACCEPT return yyaccept
# undef YYABORT
# define YYABORT return yyabort
# undef YYERROR
# define YYERROR return yyerrok, yyerr
# undef YYRECOVERING
# define YYRECOVERING() (yystackp->yyerrState != 0)
# undef yyclearin
# define yyclearin (yychar = YYEMPTY)
# undef YYFILL
# define YYFILL(N) yyfill (yyvsp, &yylow, N, yynormal)
# undef YYBACKUP
# define YYBACKUP(Token, Value) \
return yyerror (YY_("syntax error: cannot back up")), \
yyerrok, yyerr
yylow = 1;
if (yyrhslen == 0)
*yyvalp = yyval_default;
else
*yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;
switch (yyn)
{
case 2:
#line 102 "parser.yy" /* glr.c:816 */
{
Identifier * id = new Identifier((((yyGLRStackItem const *)yyvsp)[YYFILL (-3)].yystate.yysemantics.yysval. string ));
reverse((((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval.fiemeth_list_)->begin(), (((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval.fiemeth_list_)->end());
MAIN = new ASTProgram(id, (((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval.fiemeth_list_));
}
#line 938 "parser.tab.cc" /* glr.c:816 */
break;
case 3:
#line 109 "parser.yy" /* glr.c:816 */
{((*yyvalp).fiemeth_list_) = new vector< Fiemeth* >; }
#line 944 "parser.tab.cc" /* glr.c:816 */
break;
case 4:
#line 110 "parser.yy" /* glr.c:816 */
{
((*yyvalp).fiemeth_list_) = (((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.fiemeth_list_);
((*yyvalp).fiemeth_list_)->push_back((((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval.fiemeth_));
}
#line 953 "parser.tab.cc" /* glr.c:816 */
break;
case 5:
#line 114 "parser.yy" /* glr.c:816 */
{
((*yyvalp).fiemeth_list_) = (((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.fiemeth_list_);
((*yyvalp).fiemeth_list_)->push_back((((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval.fiemeth_));
}
#line 962 "parser.tab.cc" /* glr.c:816 */
break;
case 6:
#line 120 "parser.yy" /* glr.c:816 */
{
// cout << "\n\n\nPARSER\n\n\n";
// cout << $1 << endl;
// cout << "\n\n\nPARSER\n\n\n";
((*yyvalp).fiemeth_) = new Field((((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval. string ), (((yyGLRStackItem const *)yyvsp)[YYFILL (-1)].yystate.yysemantics.yysval.variable_list_));
printf("%s\n",(((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval. string ));
}
#line 975 "parser.tab.cc" /* glr.c:816 */
break;
case 7:
#line 130 "parser.yy" /* glr.c:816 */
{
((*yyvalp).variable_list_) = new vector<Variable*>;
((*yyvalp).variable_list_)->push_back((((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.var_));
}
#line 984 "parser.tab.cc" /* glr.c:816 */
break;
case 8:
#line 134 "parser.yy" /* glr.c:816 */
{
((*yyvalp).variable_list_) = (((yyGLRStackItem const *)yyvsp)[YYFILL (-2)].yystate.yysemantics.yysval.variable_list_);
((*yyvalp).variable_list_)->push_back((((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval.var_));
}
#line 993 "parser.tab.cc" /* glr.c:816 */
break;
case 9:
#line 139 "parser.yy" /* glr.c:816 */
{
//id = new Identifier(yylval.string)
((*yyvalp).var_) = new Identifier((((yyGLRStackItem const *)yyvsp)[YYFILL (0)].yystate.yysemantics.yysval. string ));
}