52#define YYBISON_VERSION "3.8.2"
55#define YYSKELETON_NAME "yacc.c"
76#include "factory/factoryconf.h"
78#if defined(WINNT) && ! defined(__GNUC__)
81# define alloca _alloca
93# define ISTREAM std::istream
94# define CERR std::cerr
95#elif defined(HAVE_IOSTREAM_H)
97# define ISTREAM istream
111# define YYSTYPE ParseUtil
113# define YY_parse_USE_GOTO 1
114# define YY_parse_STYPE ParseUtil
133# define YY_CAST(Type, Val) static_cast<Type> (Val)
134# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
136# define YY_CAST(Type, Val) ((Type) (Val))
137# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
141# if defined __cplusplus
142# if 201103L <= __cplusplus
143# define YY_NULLPTR nullptr
148# define YY_NULLPTR ((void*)0)
184#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
186# define YYSTYPE_IS_TRIVIAL 1
187# define YYSTYPE_IS_DECLARED 1
233#ifndef __PTRDIFF_MAX__
235# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
246#ifdef __INT_LEAST8_MAX__
248#elif defined YY_STDINT_H
254#ifdef __INT_LEAST16_MAX__
256#elif defined YY_STDINT_H
268# undef UINT_LEAST8_MAX
269# undef UINT_LEAST16_MAX
270# define UINT_LEAST8_MAX 255
271# define UINT_LEAST16_MAX 65535
274#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
276#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
277 && UINT_LEAST8_MAX <= INT_MAX)
279#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
285#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
287#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
288 && UINT_LEAST16_MAX <= INT_MAX)
290#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
297# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
298# define YYPTRDIFF_T __PTRDIFF_TYPE__
299# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
300# elif defined PTRDIFF_MAX
304# define YYPTRDIFF_T ptrdiff_t
305# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
307# define YYPTRDIFF_T long
308# define YYPTRDIFF_MAXIMUM LONG_MAX
314# define YYSIZE_T __SIZE_TYPE__
316# define YYSIZE_T size_t
317# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
319# define YYSIZE_T size_t
321# define YYSIZE_T unsigned
325#define YYSIZE_MAXIMUM \
326 YY_CAST (YYPTRDIFF_T, \
327 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
328 ? YYPTRDIFF_MAXIMUM \
329 : YY_CAST (YYSIZE_T, -1)))
331#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
341# if defined YYENABLE_NLS && YYENABLE_NLS
344# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
348# define YY_(Msgid) Msgid
353#ifndef YY_ATTRIBUTE_PURE
354# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
355# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
357# define YY_ATTRIBUTE_PURE
361#ifndef YY_ATTRIBUTE_UNUSED
362# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
363# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
365# define YY_ATTRIBUTE_UNUSED
370#if ! defined lint || defined __GNUC__
371# define YY_USE(E) ((void) (E))
377#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
378# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
379# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
380 _Pragma ("GCC diagnostic push") \
381 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
383# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
384 _Pragma ("GCC diagnostic push") \
385 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
386 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
388# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
389 _Pragma ("GCC diagnostic pop")
391# define YY_INITIAL_VALUE(Value) Value
393#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
394# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
395# define YY_IGNORE_MAYBE_UNINITIALIZED_END
397#ifndef YY_INITIAL_VALUE
398# define YY_INITIAL_VALUE(Value)
401#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
402# define YY_IGNORE_USELESS_CAST_BEGIN \
403 _Pragma ("GCC diagnostic push") \
404 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
405# define YY_IGNORE_USELESS_CAST_END \
406 _Pragma ("GCC diagnostic pop")
408#ifndef YY_IGNORE_USELESS_CAST_BEGIN
409# define YY_IGNORE_USELESS_CAST_BEGIN
410# define YY_IGNORE_USELESS_CAST_END
414#define YY_ASSERT(E) ((void) (0 && (E)))
416#if !defined yyoverflow
420# ifdef YYSTACK_USE_ALLOCA
421# if YYSTACK_USE_ALLOCA
423# define YYSTACK_ALLOC __builtin_alloca
424# elif defined __BUILTIN_VA_ARG_INCR
427# define YYSTACK_ALLOC __alloca
428# elif defined _MSC_VER
430# define alloca _alloca
432# define YYSTACK_ALLOC alloca
433# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
437# define EXIT_SUCCESS 0
446# define YYSTACK_FREE(Ptr) do { ; } while (0)
447# ifndef YYSTACK_ALLOC_MAXIMUM
452# define YYSTACK_ALLOC_MAXIMUM 4032
455# define YYSTACK_ALLOC YYMALLOC
456# define YYSTACK_FREE YYFREE
457# ifndef YYSTACK_ALLOC_MAXIMUM
458# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
460# if (defined __cplusplus && ! defined EXIT_SUCCESS \
461 && ! ((defined YYMALLOC || defined malloc) \
462 && (defined YYFREE || defined free)))
465# define EXIT_SUCCESS 0
469# define YYMALLOC malloc
470# if ! defined malloc && ! defined EXIT_SUCCESS
476# if ! defined free && ! defined EXIT_SUCCESS
483#if (! defined yyoverflow \
484 && (! defined __cplusplus \
485 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
495# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
499# define YYSTACK_BYTES(N) \
500 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
501 + YYSTACK_GAP_MAXIMUM)
503# define YYCOPY_NEEDED 1
510# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
513 YYPTRDIFF_T yynewbytes; \
514 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
515 Stack = &yyptr->Stack_alloc; \
516 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
517 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
523#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
527# if defined __GNUC__ && 1 < __GNUC__
528# define YYCOPY(Dst, Src, Count) \
529 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
531# define YYCOPY(Dst, Src, Count) \
535 for (yyi = 0; yyi < (Count); yyi++) \
536 (Dst)[yyi] = (Src)[yyi]; \
563#define YYTRANSLATE(YYX) \
564 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
565 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
572 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 11, 12, 6, 5, 2, 4, 2, 7, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 10,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 9, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
594 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
595 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
596 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
597 2, 2, 2, 2, 2, 2, 1, 2, 3, 8
604 0, 73, 73, 74, 77, 78, 81, 82, 83, 84,
610#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
619static const char *
const yytname[] =
621 "\"end of file\"",
"error",
"\"invalid token\"",
"NUM",
"'-'",
"'+'",
622 "'*'",
"'/'",
"NEG",
"'^'",
"';'",
"'('",
"')'",
"$accept",
"input",
633#define YYPACT_NINF (-8)
635#define yypact_value_is_default(Yyn) \
636 ((Yyn) == YYPACT_NINF)
638#define YYTABLE_NINF (-1)
640#define yytable_value_is_error(Yyn) \
647 -8, 13, -8, -8, 3, 3, -8, 3, -8, 30,
648 -7, -7, 21, 3, 3, 3, 3, 1, -8, -8,
657 2, 0, 1, 6, 0, 0, 4, 0, 3, 0,
658 11, 12, 0, 0, 0, 0, 0, 0, 5, 14,
679 10, 11, 17, 12, 24, 0, 3, 4, 5, 20,
680 21, 22, 23, 2, 7, 0, 3, 4, 5, 0,
681 0, 0, 0, 6, 7, 13, 14, 15, 16, 0,
682 17, 0, 0, 19, 13, 14, 15, 16, 0, 17,
688 4, 5, 9, 7, 3, -1, 3, 4, 5, 13,
689 14, 15, 16, 0, 11, -1, 3, 4, 5, -1,
690 -1, -1, -1, 10, 11, 4, 5, 6, 7, -1,
691 9, -1, -1, 12, 4, 5, 6, 7, -1, 9,
699 0, 14, 0, 3, 4, 5, 10, 11, 15, 16,
700 16, 16, 16, 4, 5, 6, 7, 9, 10, 12,
707 0, 13, 14, 14, 15, 15, 16, 16, 16, 16,
714 0, 2, 0, 2, 1, 2, 1, 3, 3, 3,
721#define yyerrok (yyerrstatus = 0)
722#define yyclearin (yychar = YYEMPTY)
724#define YYACCEPT goto yyacceptlab
725#define YYABORT goto yyabortlab
726#define YYERROR goto yyerrorlab
727#define YYNOMEM goto yyexhaustedlab
730#define YYRECOVERING() (!!yyerrstatus)
732#define YYBACKUP(Token, Value) \
734 if (yychar == YYEMPTY) \
738 YYPOPSTACK (yylen); \
744 yyerror (YY_("syntax error: cannot back up")); \
751#define YYERRCODE YYUNDEF
759# define YYFPRINTF fprintf
762# define YYDPRINTF(Args) \
771# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
775 YYFPRINTF (stderr, "%s ", Title); \
776 yy_symbol_print (stderr, \
778 YYFPRINTF (stderr, "\n"); \
791 FILE *yyoutput = yyo;
810 yykind <
YYNTOKENS ?
"token" :
"nterm", yysymbol_name (yykind));
825 for (; yybottom <= yytop; yybottom++)
827 int yybot = *yybottom;
833# define YY_STACK_PRINT(Bottom, Top) \
836 yy_stack_print ((Bottom), (Top)); \
849 int yynrhs =
yyr2[yyrule];
851 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %d):\n",
854 for (yyi = 0; yyi < yynrhs; yyi++)
859 &yyvsp[(yyi + 1) - (yynrhs)]);
864# define YY_REDUCE_PRINT(Rule) \
867 yy_reduce_print (yyssp, yyvsp, Rule); \
874# define YYDPRINTF(Args) ((void) 0)
875# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
876# define YY_STACK_PRINT(Bottom, Top)
877# define YY_REDUCE_PRINT(Rule)
883# define YYINITDEPTH 200
894# define YYMAXDEPTH 10000
970#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
976 YYDPRINTF ((stderr,
"Starting parse\n"));
996 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1003 if (yyss + yystacksize - 1 <= yyssp)
1004#if !defined yyoverflow && !defined YYSTACK_RELOCATE
1011# if defined yyoverflow
1023 yyoverflow (
YY_(
"memory exhausted"),
1024 &yyss1, yysize *
YYSIZEOF (*yyssp),
1025 &yyvs1, yysize *
YYSIZEOF (*yyvsp),
1040 union yyalloc *yyptr =
1045 YYSTACK_RELOCATE (yyss_alloc, yyss);
1046 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1047# undef YYSTACK_RELOCATE
1053 yyssp = yyss + yysize - 1;
1054 yyvsp = yyvs + yysize - 1;
1057 YYDPRINTF ((stderr,
"Stack size increased to %ld\n",
1058 YY_CAST (
long, yystacksize)));
1061 if (yyss + yystacksize - 1 <= yyssp)
1090 YYDPRINTF ((stderr,
"Reading a token\n"));
1098 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1172 yyval = yyvsp[1-yylen];
1181#line 1182 "readcf.cc"
1186 { yyval = yyvsp[0]; }
1187#line 1188 "readcf.cc"
1192 { yyval = yyvsp[-2].getval() + yyvsp[0].getval(); }
1193#line 1194 "readcf.cc"
1198 { yyval = yyvsp[-2].getval() - yyvsp[0].getval(); }
1199#line 1200 "readcf.cc"
1204 { yyval = yyvsp[-2].getval() * yyvsp[0].getval(); }
1205#line 1206 "readcf.cc"
1210 { yyval = yyvsp[-2].getval() / yyvsp[0].getval(); }
1211#line 1212 "readcf.cc"
1216 { yyval = -yyvsp[0].getval(); }
1217#line 1218 "readcf.cc"
1222 { yyval = yyvsp[0].getval(); }
1223#line 1224 "readcf.cc"
1228 { yyval =
power( yyvsp[-2].getval(), yyvsp[0].getintval() ); }
1229#line 1230 "readcf.cc"
1234 { yyval = yyvsp[-1].getval(); }
1235#line 1236 "readcf.cc"
1239#line 1240 "readcf.cc"
1266 const int yyi =
yypgoto[yylhs] + *yyssp;
1267 yystate = (0 <= yyi && yyi <=
YYLAST &&
yycheck[yyi] == *yyssp
1289 if (yyerrstatus == 3)
1418 while (yyssp != yyss)
1452 while ((c =
defaultin->get()) ==
' ' || c ==
'\t' || c ==
'\n' ) ;
1453 if ( isdigit( c ) ) {
1458 else if ( isalpha( c ) ) {
1481 this->yylval =
Variable( (
char)c );
1489 this->yylval =
Variable( (
char)c );
1504 YY_parse_CLASS my_parser;
1506 if ( my_parser.yyparse() == 0 ) {
1531 static char * buffer = 0;
1532 static int bufsize = 0;
1534 if ( buffer == 0 ) {
1536 buffer =
new char[bufsize];
1538 int i = 0, c, goon = 1;
1540 while ( isdigit( c =
s.get() ) &&
i < bufsize - 2 ) {
1544 if ( isdigit( c ) ) {
1546 char * newbuffer = (
char*)memcpy(
new char[bufsize], buffer, bufsize - 1000 );
factory's class for variables
const CanonicalForm int s
Operations in GF, where GF is a finite field of size less than 2^16 represented by a root of Conway p...
static void yy_stack_print(yytype_int16 *yybottom, yytype_int16 *yytop)
static void yy_reduce_print(YYSTYPE *yyvsp, int yyrule)
static const yytype_uint16 yyrline[]
static void yy_symbol_value_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep)
static void yy_symbol_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep)
static const char *const yytname[]
void * malloc(size_t size)
static int index(p_Length length, p_Ord ord)
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
static const yytype_int8 yytranslate[]
static ISTREAM * defaultin
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
static const yytype_int8 yydefact[]
#define YY_IGNORE_USELESS_CAST_END
static const yytype_int8 yycheck[]
#define YY_REDUCE_PRINT(Rule)
#define YY_CAST(Type, Val)
static void yydestruct(const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
static const yytype_int8 yypact[]
#define YY_ACCESSING_SYMBOL(State)
Accessing symbol of state STATE.
#define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
unsigned char yytype_uint8
#define YY_STACK_PRINT(Bottom, Top)
#define YY_IGNORE_USELESS_CAST_BEGIN
static const yytype_int8 yyr2[]
static const yytype_int8 yytable[]
#define yytable_value_is_error(Yyn)
static char * readString(ISTREAM &)
static const yytype_int8 yystos[]
#define YY_ATTRIBUTE_UNUSED
static const yytype_int8 yypgoto[]
CanonicalForm readCF(ISTREAM &str)
static const yytype_int8 yyr1[]
enum yytokentype yytoken_kind_t
unsigned short yytype_uint16
static const yytype_int8 yydefgoto[]
static CanonicalForm * retvalue
#define yypact_value_is_default(Yyn)