/* A Bison parser, made by GNU Bison 3.8.2.  */

/* Bison implementation for Yacc-like parsers in C

   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 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 <https://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 LALR(1) parser skeleton written by Richard Stallman, by
   simplifying the original so-called "semantic" parser.  */

/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
   especially those whose name start with YY_ or yy_.  They are
   private implementation details that can be changed or removed.  */

/* All symbols defined below should begin with yy or YY, to avoid
   infringing on user name space.  This should be done even for local
   variables, as they might otherwise be expanded by user macros.
   There are some unavoidable exceptions within include files to
   define necessary library symbols; they are noted "INFRINGES ON
   USER NAME SPACE" below.  */

/* Identify Bison output, and Bison version.  */
#define YYBISON 30802

/* Bison version string.  */
#define YYBISON_VERSION "3.8.2"

/* Skeleton name.  */
#define YYSKELETON_NAME "yacc.c"

/* Pure parsers.  */
#define YYPURE 1

/* Push parsers.  */
#define YYPUSH 0

/* Pull parsers.  */
#define YYPULL 1

/* Substitute the type names.  */
#define YYSTYPE         MTSTYPE
/* Substitute the variable and function names.  */
#define yyparse         mtparse
#define yylex           mtlex
#define yyerror         mterror
#define yydebug         mtdebug
#define yynerrs         mtnerrs

/* First part of user prologue.  */
#line 30 "mtgrammar.y"


# include "bison.reset"
# include "splintMacros.nf"
# include "basic.h"

# ifndef S_SPLINT_S
extern ctype mtscanner_lookupType (mttok p_tok) /*@modifies p_tok@*/ ;
# endif

# define YYDEBUG 1

# include "bison.head"


#line 93 "mtgrammar.c"

# ifndef YY_CAST
#  ifdef __cplusplus
#   define YY_CAST(Type, Val) static_cast<Type> (Val)
#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
#  else
#   define YY_CAST(Type, Val) ((Type) (Val))
#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
#  endif
# endif
# ifndef YY_NULLPTR
#  if defined __cplusplus
#   if 201103L <= __cplusplus
#    define YY_NULLPTR nullptr
#   else
#    define YY_NULLPTR 0
#   endif
#  else
#   define YY_NULLPTR ((void*)0)
#  endif
# endif

/* Use api.header.include to #include this header
   instead of duplicating it here.  */
#ifndef YY_MT_MTGRAMMAR_H_INCLUDED
# define YY_MT_MTGRAMMAR_H_INCLUDED
/* Debug traces.  */
#ifndef MTDEBUG
# if defined YYDEBUG
#if YYDEBUG
#   define MTDEBUG 1
#  else
#   define MTDEBUG 0
#  endif
# else /* ! defined YYDEBUG */
#  define MTDEBUG 0
# endif /* ! defined YYDEBUG */
#endif  /* ! defined MTDEBUG */
#if MTDEBUG
extern int mtdebug;
#endif

/* Token kinds.  */
#ifndef MTTOKENTYPE
# define MTTOKENTYPE
  enum mttokentype
  {
    MTEMPTY = -2,
    MTEOF = 0,                     /* "end of file"  */
    MTerror = 256,                 /* error  */
    MTUNDEF = 257,                 /* "invalid token"  */
    MT_BADTOK = 258,               /* MT_BADTOK  */
    MT_END = 259,                  /* MT_END  */
    MT_STATE = 260,                /* MT_STATE  */
    MT_GLOBAL = 261,               /* MT_GLOBAL  */
    MT_CONTEXT = 262,              /* MT_CONTEXT  */
    MT_ONEOF = 263,                /* MT_ONEOF  */
    MT_DEFAULTS = 264,             /* MT_DEFAULTS  */
    MT_DEFAULT = 265,              /* MT_DEFAULT  */
    MT_REFERENCE = 266,            /* MT_REFERENCE  */
    MT_PARAMETER = 267,            /* MT_PARAMETER  */
    MT_RESULT = 268,               /* MT_RESULT  */
    MT_CLAUSE = 269,               /* MT_CLAUSE  */
    MT_LITERAL = 270,              /* MT_LITERAL  */
    MT_NULL = 271,                 /* MT_NULL  */
    MT_ANNOTATIONS = 272,          /* MT_ANNOTATIONS  */
    MT_ARROW = 273,                /* MT_ARROW  */
    MT_MERGE = 274,                /* MT_MERGE  */
    MT_TRANSFERS = 275,            /* MT_TRANSFERS  */
    MT_PRECONDITIONS = 276,        /* MT_PRECONDITIONS  */
    MT_POSTCONDITIONS = 277,       /* MT_POSTCONDITIONS  */
    MT_LOSEREFERENCE = 278,        /* MT_LOSEREFERENCE  */
    MT_AS = 279,                   /* MT_AS  */
    MT_ERROR = 280,                /* MT_ERROR  */
    MT_PLUS = 281,                 /* MT_PLUS  */
    MT_STAR = 282,                 /* MT_STAR  */
    MT_BAR = 283,                  /* MT_BAR  */
    MT_LPAREN = 284,               /* MT_LPAREN  */
    MT_RPAREN = 285,               /* MT_RPAREN  */
    MT_LBRACKET = 286,             /* MT_LBRACKET  */
    MT_RBRACKET = 287,             /* MT_RBRACKET  */
    MT_LBRACE = 288,               /* MT_LBRACE  */
    MT_RBRACE = 289,               /* MT_RBRACE  */
    MT_COMMA = 290,                /* MT_COMMA  */
    MT_CHAR = 291,                 /* MT_CHAR  */
    MT_INT = 292,                  /* MT_INT  */
    MT_FLOAT = 293,                /* MT_FLOAT  */
    MT_DOUBLE = 294,               /* MT_DOUBLE  */
    MT_VOID = 295,                 /* MT_VOID  */
    MT_ANYTYPE = 296,              /* MT_ANYTYPE  */
    MT_INTEGRALTYPE = 297,         /* MT_INTEGRALTYPE  */
    MT_UNSIGNEDINTEGRALTYPE = 298, /* MT_UNSIGNEDINTEGRALTYPE  */
    MT_SIGNEDINTEGRALTYPE = 299,   /* MT_SIGNEDINTEGRALTYPE  */
    MT_CONST = 300,                /* MT_CONST  */
    MT_VOLATILE = 301,             /* MT_VOLATILE  */
    MT_RESTRICT = 302,             /* MT_RESTRICT  */
    MT_STRINGLIT = 303,            /* MT_STRINGLIT  */
    MT_IDENT = 304                 /* MT_IDENT  */
  };
  typedef enum mttokentype mttoken_kind_t;
#endif
/* Token kinds.  */
#define MTEMPTY -2
#define MTEOF 0
#define MTerror 256
#define MTUNDEF 257
#define MT_BADTOK 258
#define MT_END 259
#define MT_STATE 260
#define MT_GLOBAL 261
#define MT_CONTEXT 262
#define MT_ONEOF 263
#define MT_DEFAULTS 264
#define MT_DEFAULT 265
#define MT_REFERENCE 266
#define MT_PARAMETER 267
#define MT_RESULT 268
#define MT_CLAUSE 269
#define MT_LITERAL 270
#define MT_NULL 271
#define MT_ANNOTATIONS 272
#define MT_ARROW 273
#define MT_MERGE 274
#define MT_TRANSFERS 275
#define MT_PRECONDITIONS 276
#define MT_POSTCONDITIONS 277
#define MT_LOSEREFERENCE 278
#define MT_AS 279
#define MT_ERROR 280
#define MT_PLUS 281
#define MT_STAR 282
#define MT_BAR 283
#define MT_LPAREN 284
#define MT_RPAREN 285
#define MT_LBRACKET 286
#define MT_RBRACKET 287
#define MT_LBRACE 288
#define MT_RBRACE 289
#define MT_COMMA 290
#define MT_CHAR 291
#define MT_INT 292
#define MT_FLOAT 293
#define MT_DOUBLE 294
#define MT_VOID 295
#define MT_ANYTYPE 296
#define MT_INTEGRALTYPE 297
#define MT_UNSIGNEDINTEGRALTYPE 298
#define MT_SIGNEDINTEGRALTYPE 299
#define MT_CONST 300
#define MT_VOLATILE 301
#define MT_RESTRICT 302
#define MT_STRINGLIT 303
#define MT_IDENT 304

/* Value type.  */
#if ! defined MTSTYPE && ! defined MTSTYPE_IS_DECLARED
union MTSTYPE
{
#line 50 "mtgrammar.y"

  mttok tok; 
  mtDeclarationNode mtdecl;
  mtDeclarationPiece mtpiece;
  mtDeclarationPieces mtpieces;
  mtContextNode mtcontext;
  mtValuesNode mtvalues;
  mtDefaultsNode mtdefaults;
  mtDefaultsDeclList mtdeflist;
  mtAnnotationsNode mtannotations;
  mtAnnotationList mtannotlist;
  mtAnnotationDecl mtannotdecl;
  mtMergeNode mtmerge;
  mtMergeItem mtmergeitem;
  mtMergeClauseList mtmergeclauselist;
  mtMergeClause mtmergeclause;
  mtTransferClauseList mttransferclauselist;
  mtTransferClause mttransferclause;
  mtTransferAction mttransferaction;
  mtLoseReferenceList mtlosereferencelist;
  mtLoseReference mtlosereference;
  pointers pointers;
  /*@only@*/ cstringList cstringlist;
  ctype ctyp;
  /*@only@*/ qtype qtyp;
  qual qual;
  qualList quals;

#line 281 "mtgrammar.c"

};
typedef union MTSTYPE MTSTYPE;
# define MTSTYPE_IS_TRIVIAL 1
# define MTSTYPE_IS_DECLARED 1
#endif




int mtparse (void);


#endif /* !YY_MT_MTGRAMMAR_H_INCLUDED  */
/* Symbol kind.  */
enum yysymbol_kind_t
{
  YYSYMBOL_YYEMPTY = -2,
  YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
  YYSYMBOL_YYerror = 1,                    /* error  */
  YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
  YYSYMBOL_MT_BADTOK = 3,                  /* MT_BADTOK  */
  YYSYMBOL_MT_END = 4,                     /* MT_END  */
  YYSYMBOL_MT_STATE = 5,                   /* MT_STATE  */
  YYSYMBOL_MT_GLOBAL = 6,                  /* MT_GLOBAL  */
  YYSYMBOL_MT_CONTEXT = 7,                 /* MT_CONTEXT  */
  YYSYMBOL_MT_ONEOF = 8,                   /* MT_ONEOF  */
  YYSYMBOL_MT_DEFAULTS = 9,                /* MT_DEFAULTS  */
  YYSYMBOL_MT_DEFAULT = 10,                /* MT_DEFAULT  */
  YYSYMBOL_MT_REFERENCE = 11,              /* MT_REFERENCE  */
  YYSYMBOL_MT_PARAMETER = 12,              /* MT_PARAMETER  */
  YYSYMBOL_MT_RESULT = 13,                 /* MT_RESULT  */
  YYSYMBOL_MT_CLAUSE = 14,                 /* MT_CLAUSE  */
  YYSYMBOL_MT_LITERAL = 15,                /* MT_LITERAL  */
  YYSYMBOL_MT_NULL = 16,                   /* MT_NULL  */
  YYSYMBOL_MT_ANNOTATIONS = 17,            /* MT_ANNOTATIONS  */
  YYSYMBOL_MT_ARROW = 18,                  /* MT_ARROW  */
  YYSYMBOL_MT_MERGE = 19,                  /* MT_MERGE  */
  YYSYMBOL_MT_TRANSFERS = 20,              /* MT_TRANSFERS  */
  YYSYMBOL_MT_PRECONDITIONS = 21,          /* MT_PRECONDITIONS  */
  YYSYMBOL_MT_POSTCONDITIONS = 22,         /* MT_POSTCONDITIONS  */
  YYSYMBOL_MT_LOSEREFERENCE = 23,          /* MT_LOSEREFERENCE  */
  YYSYMBOL_MT_AS = 24,                     /* MT_AS  */
  YYSYMBOL_MT_ERROR = 25,                  /* MT_ERROR  */
  YYSYMBOL_MT_PLUS = 26,                   /* MT_PLUS  */
  YYSYMBOL_MT_STAR = 27,                   /* MT_STAR  */
  YYSYMBOL_MT_BAR = 28,                    /* MT_BAR  */
  YYSYMBOL_MT_LPAREN = 29,                 /* MT_LPAREN  */
  YYSYMBOL_MT_RPAREN = 30,                 /* MT_RPAREN  */
  YYSYMBOL_MT_LBRACKET = 31,               /* MT_LBRACKET  */
  YYSYMBOL_MT_RBRACKET = 32,               /* MT_RBRACKET  */
  YYSYMBOL_MT_LBRACE = 33,                 /* MT_LBRACE  */
  YYSYMBOL_MT_RBRACE = 34,                 /* MT_RBRACE  */
  YYSYMBOL_MT_COMMA = 35,                  /* MT_COMMA  */
  YYSYMBOL_MT_CHAR = 36,                   /* MT_CHAR  */
  YYSYMBOL_MT_INT = 37,                    /* MT_INT  */
  YYSYMBOL_MT_FLOAT = 38,                  /* MT_FLOAT  */
  YYSYMBOL_MT_DOUBLE = 39,                 /* MT_DOUBLE  */
  YYSYMBOL_MT_VOID = 40,                   /* MT_VOID  */
  YYSYMBOL_MT_ANYTYPE = 41,                /* MT_ANYTYPE  */
  YYSYMBOL_MT_INTEGRALTYPE = 42,           /* MT_INTEGRALTYPE  */
  YYSYMBOL_MT_UNSIGNEDINTEGRALTYPE = 43,   /* MT_UNSIGNEDINTEGRALTYPE  */
  YYSYMBOL_MT_SIGNEDINTEGRALTYPE = 44,     /* MT_SIGNEDINTEGRALTYPE  */
  YYSYMBOL_MT_CONST = 45,                  /* MT_CONST  */
  YYSYMBOL_MT_VOLATILE = 46,               /* MT_VOLATILE  */
  YYSYMBOL_MT_RESTRICT = 47,               /* MT_RESTRICT  */
  YYSYMBOL_MT_STRINGLIT = 48,              /* MT_STRINGLIT  */
  YYSYMBOL_MT_IDENT = 49,                  /* MT_IDENT  */
  YYSYMBOL_YYACCEPT = 50,                  /* $accept  */
  YYSYMBOL_file = 51,                      /* file  */
  YYSYMBOL_mtsDeclaration = 52,            /* mtsDeclaration  */
  YYSYMBOL_declarationNode = 53,           /* declarationNode  */
  YYSYMBOL_declarationPieces = 54,         /* declarationPieces  */
  YYSYMBOL_declarationPiece = 55,          /* declarationPiece  */
  YYSYMBOL_contextDeclaration = 56,        /* contextDeclaration  */
  YYSYMBOL_optContextSelection = 57,       /* optContextSelection  */
  YYSYMBOL_contextSelection = 58,          /* contextSelection  */
  YYSYMBOL_optType = 59,                   /* optType  */
  YYSYMBOL_typeExpression = 60,            /* typeExpression  */
  YYSYMBOL_completeType = 61,              /* completeType  */
  YYSYMBOL_completeTypeAux = 62,           /* completeTypeAux  */
  YYSYMBOL_optCompleteType = 63,           /* optCompleteType  */
  YYSYMBOL_abstractDecl = 64,              /* abstractDecl  */
  YYSYMBOL_pointers = 65,                  /* pointers  */
  YYSYMBOL_innerMods = 66,                 /* innerMods  */
  YYSYMBOL_innerModsList = 67,             /* innerModsList  */
  YYSYMBOL_abstractDeclBase = 68,          /* abstractDeclBase  */
  YYSYMBOL_typeSpecifier = 69,             /* typeSpecifier  */
  YYSYMBOL_typeName = 70,                  /* typeName  */
  YYSYMBOL_valuesDeclaration = 71,         /* valuesDeclaration  */
  YYSYMBOL_valuesList = 72,                /* valuesList  */
  YYSYMBOL_defaultNode = 73,               /* defaultNode  */
  YYSYMBOL_defaultsDeclaration = 74,       /* defaultsDeclaration  */
  YYSYMBOL_defaultDeclarationList = 75,    /* defaultDeclarationList  */
  YYSYMBOL_annotationsDeclaration = 76,    /* annotationsDeclaration  */
  YYSYMBOL_annotationsDeclarationList = 77, /* annotationsDeclarationList  */
  YYSYMBOL_annotationDeclaration = 78,     /* annotationDeclaration  */
  YYSYMBOL_mergeDeclaration = 79,          /* mergeDeclaration  */
  YYSYMBOL_mergeClauses = 80,              /* mergeClauses  */
  YYSYMBOL_mergeClause = 81,               /* mergeClause  */
  YYSYMBOL_mergeItem = 82,                 /* mergeItem  */
  YYSYMBOL_preconditionsDeclaration = 83,  /* preconditionsDeclaration  */
  YYSYMBOL_postconditionsDeclaration = 84, /* postconditionsDeclaration  */
  YYSYMBOL_transfersDeclaration = 85,      /* transfersDeclaration  */
  YYSYMBOL_loseReferenceDeclaration = 86,  /* loseReferenceDeclaration  */
  YYSYMBOL_lostClauses = 87,               /* lostClauses  */
  YYSYMBOL_lostClause = 88,                /* lostClause  */
  YYSYMBOL_transferClauses = 89,           /* transferClauses  */
  YYSYMBOL_transferClause = 90,            /* transferClause  */
  YYSYMBOL_transferAction = 91,            /* transferAction  */
  YYSYMBOL_errorAction = 92,               /* errorAction  */
  YYSYMBOL_valueChoice = 93                /* valueChoice  */
};
typedef enum yysymbol_kind_t yysymbol_kind_t;


/* Second part of user prologue.  */
#line 79 "mtgrammar.y"

extern int mtlex (MTSTYPE *p_mtlval) /*@modifies internalState, p_mtlval@*/ ;

static /*@noreturn@*/ void mterror (char *);
static void mtprint (FILE *file, int type, MTSTYPE value);
# define YYPRINT(file, type, value) mtprint (file, type, value)

#line 407 "mtgrammar.c"


#ifdef short
# undef short
#endif

/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
   <limits.h> and (if available) <stdint.h> are included
   so that the code can choose integer types of a good width.  */

#ifndef __PTRDIFF_MAX__
# include <limits.h> /* INFRINGES ON USER NAME SPACE */
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
#  define YY_STDINT_H
# endif
#endif

/* Narrow types that promote to a signed type and that can represent a
   signed or unsigned integer of at least N bits.  In tables they can
   save space and decrease cache pressure.  Promoting to a signed type
   helps avoid bugs in integer arithmetic.  */

#ifdef __INT_LEAST8_MAX__
typedef __INT_LEAST8_TYPE__ yytype_int8;
#elif defined YY_STDINT_H
typedef int_least8_t yytype_int8;
#else
typedef signed char yytype_int8;
#endif

#ifdef __INT_LEAST16_MAX__
typedef __INT_LEAST16_TYPE__ yytype_int16;
#elif defined YY_STDINT_H
typedef int_least16_t yytype_int16;
#else
typedef short yytype_int16;
#endif

/* Work around bug in HP-UX 11.23, which defines these macros
   incorrectly for preprocessor constants.  This workaround can likely
   be removed in 2023, as HPE has promised support for HP-UX 11.23
   (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
   <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>.  */
#ifdef __hpux
# undef UINT_LEAST8_MAX
# undef UINT_LEAST16_MAX
# define UINT_LEAST8_MAX 255
# define UINT_LEAST16_MAX 65535
#endif

#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
       && UINT_LEAST8_MAX <= INT_MAX)
typedef uint_least8_t yytype_uint8;
#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
typedef unsigned char yytype_uint8;
#else
typedef short yytype_uint8;
#endif

#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
typedef __UINT_LEAST16_TYPE__ yytype_uint16;
#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
       && UINT_LEAST16_MAX <= INT_MAX)
typedef uint_least16_t yytype_uint16;
#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
typedef unsigned short yytype_uint16;
#else
typedef int yytype_uint16;
#endif

#ifndef YYPTRDIFF_T
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
#  define YYPTRDIFF_T __PTRDIFF_TYPE__
#  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
# elif defined PTRDIFF_MAX
#  ifndef ptrdiff_t
#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  endif
#  define YYPTRDIFF_T ptrdiff_t
#  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
# else
#  define YYPTRDIFF_T long
#  define YYPTRDIFF_MAXIMUM LONG_MAX
# endif
#endif

#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
#  define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
#  define YYSIZE_T size_t
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# else
#  define YYSIZE_T unsigned
# endif
#endif

#define YYSIZE_MAXIMUM                                  \
  YY_CAST (YYPTRDIFF_T,                                 \
           (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
            ? YYPTRDIFF_MAXIMUM                         \
            : YY_CAST (YYSIZE_T, -1)))

#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))


/* Stored state numbers (used for stacks). */
typedef yytype_uint8 yy_state_t;

/* State numbers in computations.  */
typedef int yy_state_fast_t;

#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 YY_ATTRIBUTE_PURE
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
# else
#  define YY_ATTRIBUTE_PURE
# endif
#endif

#ifndef YY_ATTRIBUTE_UNUSED
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
# else
#  define YY_ATTRIBUTE_UNUSED
# endif
#endif

/* Suppress unused-variable warnings by "using" E.  */
#if ! defined lint || defined __GNUC__
# define YY_USE(E) ((void) (E))
#else
# define YY_USE(E) /* empty */
#endif

/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
    _Pragma ("GCC diagnostic push")                                     \
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
# else
#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
    _Pragma ("GCC diagnostic push")                                     \
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# endif
# 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

#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
# define YY_IGNORE_USELESS_CAST_BEGIN                          \
    _Pragma ("GCC diagnostic push")                            \
    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
# define YY_IGNORE_USELESS_CAST_END            \
    _Pragma ("GCC diagnostic pop")
#endif
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
# define YY_IGNORE_USELESS_CAST_BEGIN
# define YY_IGNORE_USELESS_CAST_END
#endif


#define YY_ASSERT(E) ((void) (0 && (E)))

#if !defined yyoverflow

/* The parser invokes alloca or malloc; define the necessary symbols.  */

# ifdef YYSTACK_USE_ALLOCA
#  if YYSTACK_USE_ALLOCA
#   ifdef __GNUC__
#    define YYSTACK_ALLOC __builtin_alloca
#   elif defined __BUILTIN_VA_ARG_INCR
#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
#   elif defined _AIX
#    define YYSTACK_ALLOC __alloca
#   elif defined _MSC_VER
#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
#    define alloca _alloca
#   else
#    define YYSTACK_ALLOC alloca
#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
#     ifndef EXIT_SUCCESS
#      define EXIT_SUCCESS 0
#     endif
#    endif
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's 'empty if-body' warning.  */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
#  ifndef YYSTACK_ALLOC_MAXIMUM
    /* The OS might guarantee only one guard page at the bottom of the stack,
       and a page size can be as small as 4096 bytes.  So we cannot safely
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
       to allow for a few compiler-allocated temporary stack slots.  */
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
#  endif
# else
#  define YYSTACK_ALLOC YYMALLOC
#  define YYSTACK_FREE YYFREE
#  ifndef YYSTACK_ALLOC_MAXIMUM
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
#  endif
#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
       && ! ((defined YYMALLOC || defined malloc) \
             && (defined YYFREE || defined free)))
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#   ifndef EXIT_SUCCESS
#    define EXIT_SUCCESS 0
#   endif
#  endif
#  ifndef YYMALLOC
#   define YYMALLOC malloc
#   if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
#  ifndef YYFREE
#   define YYFREE free
#   if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
# endif
#endif /* !defined yyoverflow */

#if (! defined yyoverflow \
     && (! defined __cplusplus \
         || (defined MTSTYPE_IS_TRIVIAL && MTSTYPE_IS_TRIVIAL)))

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  yy_state_t yyss_alloc;
  YYSTYPE yyvs_alloc;
};

/* The size of the maximum gap between one aligned stack and the next.  */
# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)

/* The size of an array large to enough to hold all stacks, each with
   N elements.  */
# define YYSTACK_BYTES(N) \
     ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
      + YYSTACK_GAP_MAXIMUM)

# define YYCOPY_NEEDED 1

/* Relocate STACK from its old location to the new one.  The
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
   elements in the stack, and YYPTR gives the new location of the
   stack.  Advance YYPTR to a properly aligned location for the next
   stack.  */
# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
    do                                                                  \
      {                                                                 \
        YYPTRDIFF_T yynewbytes;                                         \
        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
        Stack = &yyptr->Stack_alloc;                                    \
        yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
        yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
      }                                                                 \
    while (0)

#endif

#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from SRC to DST.  The source and destination do
   not overlap.  */
# ifndef YYCOPY
#  if defined __GNUC__ && 1 < __GNUC__
#   define YYCOPY(Dst, Src, Count) \
      __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
#  else
#   define YYCOPY(Dst, Src, Count)              \
      do                                        \
        {                                       \
          YYPTRDIFF_T yyi;                      \
          for (yyi = 0; yyi < (Count); yyi++)   \
            (Dst)[yyi] = (Src)[yyi];            \
        }                                       \
      while (0)
#  endif
# endif
#endif /* !YYCOPY_NEEDED */

/* YYFINAL -- State number of the termination state.  */
#define YYFINAL  8
/* YYLAST -- Last index in YYTABLE.  */
#define YYLAST   114

/* YYNTOKENS -- Number of terminals.  */
#define YYNTOKENS  50
/* YYNNTS -- Number of nonterminals.  */
#define YYNNTS  44
/* YYNRULES -- Number of rules.  */
#define YYNRULES  94
/* YYNSTATES -- Number of states.  */
#define YYNSTATES  136

/* YYMAXUTOK -- Last valid token kind.  */
#define YYMAXUTOK   304


/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
   as returned by yylex, with out-of-bounds checking.  */
#define YYTRANSLATE(YYX)                                \
  (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
   ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
   : YYSYMBOL_YYUNDEF)

/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
   as returned by yylex.  */
static const yytype_int8 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,    42,    43,    44,
      45,    46,    47,    48,    49
};

#if MTDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
static const yytype_int16 yyrline[] =
{
       0,   156,   156,   157,   161,   163,   168,   173,   174,   179,
     180,   181,   182,   183,   184,   185,   186,   187,   188,   192,
     197,   198,   202,   203,   204,   205,   206,   207,   215,   216,
     220,   221,   225,   226,   231,   235,   236,   240,   241,   242,
     246,   247,   248,   249,   253,   254,   255,   259,   260,   264,
     265,   266,   274,   275,   276,   277,   278,   279,   280,   281,
     282,   283,   290,   294,   298,   299,   304,   308,   312,   314,
     319,   323,   324,   329,   334,   338,   339,   343,   348,   349,
     353,   357,   361,   365,   369,   370,   374,   378,   379,   383,
     388,   389,   393,   394,   398
};
#endif

/** Accessing symbol of state STATE.  */
#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])

#if MTDEBUG || 0
/* The user-facing name of the symbol whose (internal) number is
   YYSYMBOL.  No bounds checking.  */
static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;

/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
static const char *const yytname[] =
{
  "\"end of file\"", "error", "\"invalid token\"", "MT_BADTOK", "MT_END",
  "MT_STATE", "MT_GLOBAL", "MT_CONTEXT", "MT_ONEOF", "MT_DEFAULTS",
  "MT_DEFAULT", "MT_REFERENCE", "MT_PARAMETER", "MT_RESULT", "MT_CLAUSE",
  "MT_LITERAL", "MT_NULL", "MT_ANNOTATIONS", "MT_ARROW", "MT_MERGE",
  "MT_TRANSFERS", "MT_PRECONDITIONS", "MT_POSTCONDITIONS",
  "MT_LOSEREFERENCE", "MT_AS", "MT_ERROR", "MT_PLUS", "MT_STAR", "MT_BAR",
  "MT_LPAREN", "MT_RPAREN", "MT_LBRACKET", "MT_RBRACKET", "MT_LBRACE",
  "MT_RBRACE", "MT_COMMA", "MT_CHAR", "MT_INT", "MT_FLOAT", "MT_DOUBLE",
  "MT_VOID", "MT_ANYTYPE", "MT_INTEGRALTYPE", "MT_UNSIGNEDINTEGRALTYPE",
  "MT_SIGNEDINTEGRALTYPE", "MT_CONST", "MT_VOLATILE", "MT_RESTRICT",
  "MT_STRINGLIT", "MT_IDENT", "$accept", "file", "mtsDeclaration",
  "declarationNode", "declarationPieces", "declarationPiece",
  "contextDeclaration", "optContextSelection", "contextSelection",
  "optType", "typeExpression", "completeType", "completeTypeAux",
  "optCompleteType", "abstractDecl", "pointers", "innerMods",
  "innerModsList", "abstractDeclBase", "typeSpecifier", "typeName",
  "valuesDeclaration", "valuesList", "defaultNode", "defaultsDeclaration",
  "defaultDeclarationList", "annotationsDeclaration",
  "annotationsDeclarationList", "annotationDeclaration",
  "mergeDeclaration", "mergeClauses", "mergeClause", "mergeItem",
  "preconditionsDeclaration", "postconditionsDeclaration",
  "transfersDeclaration", "loseReferenceDeclaration", "lostClauses",
  "lostClause", "transferClauses", "transferClause", "transferAction",
  "errorAction", "valueChoice", YY_NULLPTR
};

static const char *
yysymbol_name (yysymbol_kind_t yysymbol)
{
  return yytname[yysymbol];
}
#endif

#define YYPACT_NINF (-90)

#define yypact_value_is_default(Yyn) \
  ((Yyn) == YYPACT_NINF)

#define YYTABLE_NINF (-1)

#define yytable_value_is_error(Yyn) \
  0

/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
   STATE-NUM.  */
static const yytype_int8 yypact[] =
{
      21,   -35,    10,    35,   -90,     2,    33,   -35,   -90,    52,
      -9,    52,    11,    12,   -19,    11,    11,    11,    11,   -90,
       2,   -90,   -90,   -90,   -90,   -90,   -90,   -90,   -90,   -90,
     -90,   -90,    37,    13,    13,    13,    13,    13,    13,   -90,
      23,   -90,    41,   -90,   -90,   -90,    52,   -90,    12,   -90,
     -90,   -19,    44,   -90,   -90,    11,    48,   -90,   -90,   -90,
      11,    57,   -90,   -90,   -90,   -90,   -90,   -90,   -90,   -90,
     -90,   -90,   -90,   -90,   -90,   -90,   -11,   -90,    13,   -90,
     -90,   -90,   -90,   -90,   -90,    -9,    11,    58,   -90,   -90,
     -90,   -19,   -90,    11,   -90,    53,   -14,    13,    42,    45,
     -90,     5,    49,    54,   -90,   -90,    52,    11,    65,    66,
      38,   -90,   -90,   -90,   -90,   -90,   -90,   -14,   -90,    55,
     -90,    49,    56,   -90,   -90,   -20,   -20,   -90,   -90,   -90,
     -90,   -90,   -90,   -90,   -90,   -90
};

/* 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 yytype_int8 yydefact[] =
{
       2,     0,     0,     0,     3,     7,     0,     0,     1,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     6,
       7,     9,    10,    12,    11,    13,    14,    16,    17,    15,
      18,     4,     0,    28,    28,    28,    28,    28,    28,    19,
      64,    63,     0,    67,    94,    66,    20,    70,    71,    79,
      74,    75,     0,    78,    82,    87,     0,    80,    81,    83,
      84,     0,     8,     5,    52,    53,    54,    55,    56,    57,
      58,    59,    60,    62,    23,    29,    30,    32,    35,    61,
      22,    24,    25,    26,    27,     0,     0,     0,    21,    72,
      76,     0,    88,     0,    85,     0,    40,     0,     0,     0,
      31,    37,    38,    36,    34,    65,    68,     0,     0,     0,
      92,    86,    44,    45,    46,    42,    47,    41,    33,     0,
      50,    39,     0,    69,    73,     0,     0,    93,    43,    48,
      49,    51,    77,    91,    90,    89
};

/* YYPGOTO[NTERM-NUM].  */
static const yytype_int8 yypgoto[] =
{
     -90,   -90,   -90,    80,    69,   -90,   -90,   -90,    -8,     9,
      -7,    14,   -90,   -90,    -5,   -89,   -26,   -90,    -4,   -90,
     -90,   -90,    15,   -90,   -90,   -10,   -90,    46,   -90,   -90,
      47,   -90,     8,   -90,   -90,   -90,   -90,    43,   -90,   -13,
     -90,   -25,     7,   -12
};

/* YYDEFGOTO[NTERM-NUM].  */
static const yytype_uint8 yydefgoto[] =
{
       0,     3,     4,     6,    19,    20,    21,    87,    42,    74,
      75,    76,    77,   104,   100,   101,   116,   117,   102,    78,
      79,    22,    41,    23,    24,    43,    25,    47,    48,    26,
      50,    51,    52,    27,    28,    29,    30,    59,    60,    54,
      55,   132,   133,    56
};

/* 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 yytype_uint8 yytable[] =
{
      45,    39,    53,    57,    58,   110,    61,   115,    49,     9,
      10,    11,    12,    96,     5,     7,    96,    97,    98,    13,
      99,    14,    15,    16,    17,    18,     1,     2,   128,    44,
      44,   112,   113,   114,    98,     8,    99,    31,    88,    53,
      40,    63,    92,    80,    81,    82,    83,    84,    61,    64,
      65,    66,    67,    68,    69,    70,    71,    72,    85,    86,
      44,    46,    73,    33,    34,    35,    36,    37,    38,    96,
      91,    98,    93,    99,   106,    95,   107,   120,   110,    53,
     122,   109,    97,   125,   126,   130,   127,    32,   131,    62,
     118,   129,   103,   119,    89,   124,   123,   121,    90,   108,
     105,   135,   111,    94,     0,     0,     0,     0,     0,     0,
       0,     0,     0,   134,   134
};

static const yytype_int8 yycheck[] =
{
      12,     9,    14,    16,    17,    25,    18,    96,    27,     7,
       8,     9,    10,    27,    49,     5,    27,    28,    29,    17,
      31,    19,    20,    21,    22,    23,     5,     6,   117,    49,
      49,    45,    46,    47,    29,     0,    31,     4,    46,    51,
      49,     4,    55,    34,    35,    36,    37,    38,    60,    36,
      37,    38,    39,    40,    41,    42,    43,    44,    35,    18,
      49,    49,    49,    11,    12,    13,    14,    15,    16,    27,
      26,    29,    24,    31,    86,    18,    18,    32,    25,    91,
      31,    93,    28,    18,    18,    30,    48,     7,    32,    20,
      97,   117,    78,    98,    48,   107,   106,   101,    51,    91,
      85,   126,    95,    60,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,   125,   126
};

/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
   state STATE-NUM.  */
static const yytype_int8 yystos[] =
{
       0,     5,     6,    51,    52,    49,    53,     5,     0,     7,
       8,     9,    10,    17,    19,    20,    21,    22,    23,    54,
      55,    56,    71,    73,    74,    76,    79,    83,    84,    85,
      86,     4,    53,    11,    12,    13,    14,    15,    16,    58,
      49,    72,    58,    75,    49,    93,    49,    77,    78,    27,
      80,    81,    82,    93,    89,    90,    93,    89,    89,    87,
      88,    93,    54,     4,    36,    37,    38,    39,    40,    41,
      42,    43,    44,    49,    59,    60,    61,    62,    69,    70,
      59,    59,    59,    59,    59,    35,    18,    57,    58,    77,
      80,    26,    89,    24,    87,    18,    27,    28,    29,    31,
      64,    65,    68,    61,    63,    72,    93,    18,    82,    93,
      25,    92,    45,    46,    47,    65,    66,    67,    60,    64,
      32,    68,    31,    75,    93,    18,    18,    48,    65,    66,
      30,    32,    91,    92,    93,    91
};

/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.  */
static const yytype_int8 yyr1[] =
{
       0,    50,    51,    51,    52,    52,    53,    54,    54,    55,
      55,    55,    55,    55,    55,    55,    55,    55,    55,    56,
      57,    57,    58,    58,    58,    58,    58,    58,    59,    59,
      60,    60,    61,    61,    62,    63,    63,    64,    64,    64,
      65,    65,    65,    65,    66,    66,    66,    67,    67,    68,
      68,    68,    69,    69,    69,    69,    69,    69,    69,    69,
      69,    69,    70,    71,    72,    72,    73,    74,    75,    75,
      76,    77,    77,    78,    79,    80,    80,    81,    82,    82,
      83,    84,    85,    86,    87,    87,    88,    89,    89,    90,
      91,    91,    92,    92,    93
};

/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.  */
static const yytype_int8 yyr2[] =
{
       0,     2,     0,     1,     3,     4,     2,     0,     2,     1,
       1,     1,     1,     1,     1,     1,     1,     1,     1,     2,
       0,     1,     2,     2,     2,     2,     2,     2,     0,     1,
       1,     2,     1,     3,     2,     0,     1,     1,     1,     2,
       1,     2,     2,     3,     1,     1,     1,     1,     2,     3,
       2,     3,     1,     1,     1,     1,     1,     1,     1,     1,
       1,     1,     1,     2,     1,     3,     2,     2,     3,     4,
       2,     1,     2,     4,     2,     1,     2,     5,     1,     1,
       2,     2,     2,     2,     1,     2,     3,     1,     2,     5,
       1,     1,     1,     2,     1
};


enum { YYENOMEM = -2 };

#define yyerrok         (yyerrstatus = 0)
#define yyclearin       (yychar = MTEMPTY)

#define YYACCEPT        goto yyacceptlab
#define YYABORT         goto yyabortlab
#define YYERROR         goto yyerrorlab
#define YYNOMEM         goto yyexhaustedlab


#define YYRECOVERING()  (!!yyerrstatus)

#define YYBACKUP(Token, Value)                                    \
  do                                                              \
    if (yychar == MTEMPTY)                                        \
      {                                                           \
        yychar = (Token);                                         \
        yylval = (Value);                                         \
        YYPOPSTACK (yylen);                                       \
        yystate = *yyssp;                                         \
        goto yybackup;                                            \
      }                                                           \
    else                                                          \
      {                                                           \
        yyerror (YY_("syntax error: cannot back up")); \
        YYERROR;                                                  \
      }                                                           \
  while (0)

/* Backward compatibility with an undocumented macro.
   Use MTerror or MTUNDEF. */
#define YYERRCODE MTUNDEF


/* Enable debugging if requested.  */
#if MTDEBUG

# ifndef YYFPRINTF
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
#  define YYFPRINTF fprintf
# endif

# define YYDPRINTF(Args)                        \
do {                                            \
  if (yydebug)                                  \
    YYFPRINTF Args;                             \
} while (0)




# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
do {                                                                      \
  if (yydebug)                                                            \
    {                                                                     \
      YYFPRINTF (stderr, "%s ", Title);                                   \
      yy_symbol_print (stderr,                                            \
                  Kind, Value); \
      YYFPRINTF (stderr, "\n");                                           \
    }                                                                     \
} while (0)


/*-----------------------------------.
| Print this symbol's value on YYO.  |
`-----------------------------------*/

static void
yy_symbol_value_print (FILE *yyo,
                       yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
{
  FILE *yyoutput = yyo;
  YY_USE (yyoutput);
  if (!yyvaluep)
    return;
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  YY_USE (yykind);
  YY_IGNORE_MAYBE_UNINITIALIZED_END
}


/*---------------------------.
| Print this symbol on YYO.  |
`---------------------------*/

static void
yy_symbol_print (FILE *yyo,
                 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
{
  YYFPRINTF (yyo, "%s %s (",
             yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));

  yy_symbol_value_print (yyo, yykind, yyvaluep);
  YYFPRINTF (yyo, ")");
}

/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included).                                                   |
`------------------------------------------------------------------*/

static void
yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
{
  YYFPRINTF (stderr, "Stack now");
  for (; yybottom <= yytop; yybottom++)
    {
      int yybot = *yybottom;
      YYFPRINTF (stderr, " %d", yybot);
    }
  YYFPRINTF (stderr, "\n");
}

# define YY_STACK_PRINT(Bottom, Top)                            \
do {                                                            \
  if (yydebug)                                                  \
    yy_stack_print ((Bottom), (Top));                           \
} while (0)


/*------------------------------------------------.
| Report that the YYRULE is going to be reduced.  |
`------------------------------------------------*/

static void
yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
                 int yyrule)
{
  int yylno = yyrline[yyrule];
  int yynrhs = yyr2[yyrule];
  int yyi;
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
             yyrule - 1, yylno);
  /* The symbols being reduced.  */
  for (yyi = 0; yyi < yynrhs; yyi++)
    {
      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
      yy_symbol_print (stderr,
                       YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
                       &yyvsp[(yyi + 1) - (yynrhs)]);
      YYFPRINTF (stderr, "\n");
    }
}

# define YY_REDUCE_PRINT(Rule)          \
do {                                    \
  if (yydebug)                          \
    yy_reduce_print (yyssp, yyvsp, Rule); \
} while (0)

/* Nonzero means print parse trace.  It is left uninitialized so that
   multiple parsers can coexist.  */
int yydebug;
#else /* !MTDEBUG */
# define YYDPRINTF(Args) ((void) 0)
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !MTDEBUG */


/* 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
   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
   evaluated with infinite-precision integer arithmetic.  */

#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif






/*-----------------------------------------------.
| Release the memory associated to this symbol.  |
`-----------------------------------------------*/

static void
yydestruct (const char *yymsg,
            yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
{
  YY_USE (yyvaluep);
  if (!yymsg)
    yymsg = "Deleting";
  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);

  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  YY_USE (yykind);
  YY_IGNORE_MAYBE_UNINITIALIZED_END
}






/*----------.
| yyparse.  |
`----------*/

int
yyparse (void)
{
/* Lookahead token kind.  */
int yychar;


/* The semantic value of the lookahead symbol.  */
/* Default value used for initialization, for pacifying older GCCs
   or non-GCC compilers.  */
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);

    /* Number of syntax errors so far.  */
    int yynerrs = 0;

    yy_state_fast_t yystate = 0;
    /* Number of tokens to shift before error messages enabled.  */
    int yyerrstatus = 0;

    /* Refer to the stacks through separate pointers, to allow yyoverflow
       to reallocate them elsewhere.  */

    /* Their size.  */
    YYPTRDIFF_T yystacksize = YYINITDEPTH;

    /* The state stack: array, bottom, top.  */
    yy_state_t yyssa[YYINITDEPTH];
    yy_state_t *yyss = yyssa;
    yy_state_t *yyssp = yyss;

    /* The semantic value stack: array, bottom, top.  */
    YYSTYPE yyvsa[YYINITDEPTH];
    YYSTYPE *yyvs = yyvsa;
    YYSTYPE *yyvsp = yyvs;

  int yyn;
  /* The return value of yyparse.  */
  int yyresult;
  /* Lookahead symbol kind.  */
  yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;



#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))

  /* The number of symbols on the RHS of the reduced rule.
     Keep to zero when no symbol should be popped.  */
  int yylen = 0;

  YYDPRINTF ((stderr, "Starting parse\n"));

  yychar = MTEMPTY; /* Cause a token to be read.  */

  goto yysetstate;


/*------------------------------------------------------------.
| yynewstate -- push a new state, which is found in yystate.  |
`------------------------------------------------------------*/
yynewstate:
  /* In all cases, when you get here, the value and location stacks
     have just been pushed.  So pushing a state here evens the stacks.  */
  yyssp++;


/*--------------------------------------------------------------------.
| yysetstate -- set current state (the top of the stack) to yystate.  |
`--------------------------------------------------------------------*/
yysetstate:
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
  YY_IGNORE_USELESS_CAST_BEGIN
  *yyssp = YY_CAST (yy_state_t, yystate);
  YY_IGNORE_USELESS_CAST_END
  YY_STACK_PRINT (yyss, yyssp);

  if (yyss + yystacksize - 1 <= yyssp)
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
    YYNOMEM;
#else
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYPTRDIFF_T yysize = yyssp - yyss + 1;

# if defined yyoverflow
      {
        /* Give user a chance to reallocate the stack.  Use copies of
           these so that the &'s don't force the real ones into
           memory.  */
        yy_state_t *yyss1 = yyss;
        YYSTYPE *yyvs1 = yyvs;

        /* Each stack pointer address is followed by the size of the
           data in use in that stack, in bytes.  This used to be a
           conditional around just the two extra args, but that might
           be undefined if yyoverflow is a macro.  */
        yyoverflow (YY_("memory exhausted"),
                    &yyss1, yysize * YYSIZEOF (*yyssp),
                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
                    &yystacksize);
        yyss = yyss1;
        yyvs = yyvs1;
      }
# else /* defined YYSTACK_RELOCATE */
      /* Extend the stack our own way.  */
      if (YYMAXDEPTH <= yystacksize)
        YYNOMEM;
      yystacksize *= 2;
      if (YYMAXDEPTH < yystacksize)
        yystacksize = YYMAXDEPTH;

      {
        yy_state_t *yyss1 = yyss;
        union yyalloc *yyptr =
          YY_CAST (union yyalloc *,
                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
        if (! yyptr)
          YYNOMEM;
        YYSTACK_RELOCATE (yyss_alloc, yyss);
        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
#  undef YYSTACK_RELOCATE
        if (yyss1 != yyssa)
          YYSTACK_FREE (yyss1);
      }
# endif

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;

      YY_IGNORE_USELESS_CAST_BEGIN
      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
                  YY_CAST (long, yystacksize)));
      YY_IGNORE_USELESS_CAST_END

      if (yyss + yystacksize - 1 <= yyssp)
        YYABORT;
    }
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */


  if (yystate == YYFINAL)
    YYACCEPT;

  goto yybackup;


/*-----------.
| yybackup.  |
`-----------*/
yybackup:
  /* Do appropriate processing given the current state.  Read a
     lookahead token if we need one and don't already have one.  */

  /* First try to decide what to do without reference to lookahead token.  */
  yyn = yypact[yystate];
  if (yypact_value_is_default (yyn))
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
  if (yychar == MTEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token\n"));
      yychar = yylex (&yylval);
    }

  if (yychar <= MTEOF)
    {
      yychar = MTEOF;
      yytoken = YYSYMBOL_YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else if (yychar == MTerror)
    {
      /* The scanner already issued an error message, process directly
         to error recovery.  But do not keep the error token as
         lookahead, it is too special and may lead us to an endless
         loop in error recovery. */
      yychar = MTUNDEF;
      yytoken = YYSYMBOL_YYerror;
      goto yyerrlab1;
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
    }

  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yytable_value_is_error (yyn))
        goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;

  /* Shift the lookahead token.  */
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  yystate = yyn;
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  *++yyvsp = yylval;
  YY_IGNORE_MAYBE_UNINITIALIZED_END

  /* Discard the shifted token.  */
  yychar = MTEMPTY;
  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     '$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];


  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
  case 2: /* file: %empty  */
#line 156 "mtgrammar.y"
  {}
#line 1477 "mtgrammar.c"
    break;

  case 3: /* file: mtsDeclaration  */
#line 157 "mtgrammar.y"
                 {}
#line 1483 "mtgrammar.c"
    break;

  case 4: /* mtsDeclaration: MT_STATE declarationNode MT_END  */
#line 162 "mtgrammar.y"
  { mtreader_processDeclaration ((yyvsp[-1].mtdecl)); }
#line 1489 "mtgrammar.c"
    break;

  case 5: /* mtsDeclaration: MT_GLOBAL MT_STATE declarationNode MT_END  */
#line 164 "mtgrammar.y"
  { mtreader_processGlobalDeclaration ((yyvsp[-1].mtdecl)); }
#line 1495 "mtgrammar.c"
    break;

  case 6: /* declarationNode: MT_IDENT declarationPieces  */
#line 169 "mtgrammar.y"
  { (yyval.mtdecl) = mtDeclarationNode_create ((yyvsp[-1].tok), (yyvsp[0].mtpieces)); }
#line 1501 "mtgrammar.c"
    break;

  case 7: /* declarationPieces: %empty  */
#line 173 "mtgrammar.y"
  { (yyval.mtpieces) = mtDeclarationPieces_create (); }
#line 1507 "mtgrammar.c"
    break;

  case 8: /* declarationPieces: declarationPiece declarationPieces  */
#line 175 "mtgrammar.y"
  { (yyval.mtpieces) = mtDeclarationPieces_append ((yyvsp[0].mtpieces), (yyvsp[-1].mtpiece)); }
#line 1513 "mtgrammar.c"
    break;

  case 9: /* declarationPiece: contextDeclaration  */
#line 179 "mtgrammar.y"
                     { (yyval.mtpiece) = mtDeclarationPiece_createContext ((yyvsp[0].mtcontext)); }
#line 1519 "mtgrammar.c"
    break;

  case 10: /* declarationPiece: valuesDeclaration  */
#line 180 "mtgrammar.y"
                    { (yyval.mtpiece) = mtDeclarationPiece_createValues ((yyvsp[0].mtvalues)); }
#line 1525 "mtgrammar.c"
    break;

  case 11: /* declarationPiece: defaultsDeclaration  */
#line 181 "mtgrammar.y"
                      { (yyval.mtpiece) = mtDeclarationPiece_createDefaults ((yyvsp[0].mtdefaults)); }
#line 1531 "mtgrammar.c"
    break;

  case 12: /* declarationPiece: defaultNode  */
#line 182 "mtgrammar.y"
              { (yyval.mtpiece) = mtDeclarationPiece_createValueDefault ((yyvsp[0].tok)); }
#line 1537 "mtgrammar.c"
    break;

  case 13: /* declarationPiece: annotationsDeclaration  */
#line 183 "mtgrammar.y"
                         { (yyval.mtpiece) = mtDeclarationPiece_createAnnotations ((yyvsp[0].mtannotations)); }
#line 1543 "mtgrammar.c"
    break;

  case 14: /* declarationPiece: mergeDeclaration  */
#line 184 "mtgrammar.y"
                   { (yyval.mtpiece) = mtDeclarationPiece_createMerge ((yyvsp[0].mtmerge)); }
#line 1549 "mtgrammar.c"
    break;

  case 15: /* declarationPiece: transfersDeclaration  */
#line 185 "mtgrammar.y"
                       { (yyval.mtpiece) = mtDeclarationPiece_createTransfers ((yyvsp[0].mttransferclauselist)); }
#line 1555 "mtgrammar.c"
    break;

  case 16: /* declarationPiece: preconditionsDeclaration  */
#line 186 "mtgrammar.y"
                           { (yyval.mtpiece) = mtDeclarationPiece_createPreconditions ((yyvsp[0].mttransferclauselist)); }
#line 1561 "mtgrammar.c"
    break;

  case 17: /* declarationPiece: postconditionsDeclaration  */
#line 187 "mtgrammar.y"
                            { (yyval.mtpiece) = mtDeclarationPiece_createPostconditions ((yyvsp[0].mttransferclauselist)); }
#line 1567 "mtgrammar.c"
    break;

  case 18: /* declarationPiece: loseReferenceDeclaration  */
#line 188 "mtgrammar.y"
                           { (yyval.mtpiece) = mtDeclarationPiece_createLosers ((yyvsp[0].mtlosereferencelist)); }
#line 1573 "mtgrammar.c"
    break;

  case 19: /* contextDeclaration: MT_CONTEXT contextSelection  */
#line 192 "mtgrammar.y"
                              { (yyval.mtcontext) = (yyvsp[0].mtcontext); }
#line 1579 "mtgrammar.c"
    break;

  case 20: /* optContextSelection: %empty  */
#line 197 "mtgrammar.y"
              { (yyval.mtcontext) = mtContextNode_createAny (); }
#line 1585 "mtgrammar.c"
    break;

  case 22: /* contextSelection: MT_PARAMETER optType  */
#line 202 "mtgrammar.y"
                       { (yyval.mtcontext) = mtContextNode_createParameter ((yyvsp[0].ctyp)); }
#line 1591 "mtgrammar.c"
    break;

  case 23: /* contextSelection: MT_REFERENCE optType  */
#line 203 "mtgrammar.y"
                       { (yyval.mtcontext) = mtContextNode_createReference ((yyvsp[0].ctyp)); }
#line 1597 "mtgrammar.c"
    break;

  case 24: /* contextSelection: MT_RESULT optType  */
#line 204 "mtgrammar.y"
                       { (yyval.mtcontext) = mtContextNode_createResult ((yyvsp[0].ctyp)); }
#line 1603 "mtgrammar.c"
    break;

  case 25: /* contextSelection: MT_CLAUSE optType  */
#line 205 "mtgrammar.y"
                       { (yyval.mtcontext) = mtContextNode_createClause ((yyvsp[0].ctyp)); }
#line 1609 "mtgrammar.c"
    break;

  case 26: /* contextSelection: MT_LITERAL optType  */
#line 206 "mtgrammar.y"
                       { (yyval.mtcontext) = mtContextNode_createLiteral ((yyvsp[0].ctyp)); }
#line 1615 "mtgrammar.c"
    break;

  case 27: /* contextSelection: MT_NULL optType  */
#line 207 "mtgrammar.y"
                       { (yyval.mtcontext) = mtContextNode_createNull ((yyvsp[0].ctyp)); }
#line 1621 "mtgrammar.c"
    break;

  case 28: /* optType: %empty  */
#line 215 "mtgrammar.y"
              { (yyval.ctyp) = ctype_unknown; }
#line 1627 "mtgrammar.c"
    break;

  case 29: /* optType: typeExpression  */
#line 216 "mtgrammar.y"
                 { DPRINTF (("Type: %s", qtype_unparse ((yyvsp[0].qtyp)))); (yyval.ctyp) = qtype_getType ((yyvsp[0].qtyp)); }
#line 1633 "mtgrammar.c"
    break;

  case 31: /* typeExpression: completeType abstractDecl  */
#line 221 "mtgrammar.y"
                             { (yyval.qtyp) = qtype_newBase ((yyvsp[-1].qtyp), (yyvsp[0].ctyp)); }
#line 1639 "mtgrammar.c"
    break;

  case 32: /* completeType: completeTypeAux  */
#line 225 "mtgrammar.y"
                  { (yyval.qtyp) = (yyvsp[0].qtyp); }
#line 1645 "mtgrammar.c"
    break;

  case 33: /* completeType: completeType MT_BAR typeExpression  */
#line 227 "mtgrammar.y"
  { (yyval.qtyp) = qtype_mergeAlt ((yyvsp[-2].qtyp), (yyvsp[0].qtyp)); }
#line 1651 "mtgrammar.c"
    break;

  case 34: /* completeTypeAux: typeSpecifier optCompleteType  */
#line 231 "mtgrammar.y"
                                { (yyval.qtyp) = qtype_combine ((yyvsp[0].qtyp), (yyvsp[-1].ctyp)); }
#line 1657 "mtgrammar.c"
    break;

  case 35: /* optCompleteType: %empty  */
#line 235 "mtgrammar.y"
              { (yyval.qtyp) = qtype_unknown (); }
#line 1663 "mtgrammar.c"
    break;

  case 36: /* optCompleteType: completeType  */
#line 236 "mtgrammar.y"
               { (yyval.qtyp) = (yyvsp[0].qtyp); }
#line 1669 "mtgrammar.c"
    break;

  case 37: /* abstractDecl: pointers  */
#line 240 "mtgrammar.y"
            { (yyval.ctyp) = ctype_adjustPointers ((yyvsp[0].pointers), ctype_unknown); }
#line 1675 "mtgrammar.c"
    break;

  case 39: /* abstractDecl: pointers abstractDeclBase  */
#line 242 "mtgrammar.y"
                             { (yyval.ctyp) = ctype_adjustPointers ((yyvsp[-1].pointers), (yyvsp[0].ctyp)); }
#line 1681 "mtgrammar.c"
    break;

  case 40: /* pointers: MT_STAR  */
#line 246 "mtgrammar.y"
           { (yyval.pointers) = pointers_createMt ((yyvsp[0].tok)); }
#line 1687 "mtgrammar.c"
    break;

  case 41: /* pointers: MT_STAR innerModsList  */
#line 247 "mtgrammar.y"
                         { (yyval.pointers) = pointers_createModsMt ((yyvsp[-1].tok), (yyvsp[0].quals)); }
#line 1693 "mtgrammar.c"
    break;

  case 42: /* pointers: MT_STAR pointers  */
#line 248 "mtgrammar.y"
                    { (yyval.pointers) = pointers_extend (pointers_createMt ((yyvsp[-1].tok)), (yyvsp[0].pointers)); }
#line 1699 "mtgrammar.c"
    break;

  case 43: /* pointers: MT_STAR innerModsList pointers  */
#line 249 "mtgrammar.y"
                                  { (yyval.pointers) = pointers_extend (pointers_createModsMt ((yyvsp[-2].tok), (yyvsp[-1].quals)), (yyvsp[0].pointers)); }
#line 1705 "mtgrammar.c"
    break;

  case 44: /* innerMods: MT_CONST  */
#line 253 "mtgrammar.y"
               { (yyval.qual) = qual_createConst (); }
#line 1711 "mtgrammar.c"
    break;

  case 45: /* innerMods: MT_VOLATILE  */
#line 254 "mtgrammar.y"
               { (yyval.qual) = qual_createVolatile (); }
#line 1717 "mtgrammar.c"
    break;

  case 46: /* innerMods: MT_RESTRICT  */
#line 255 "mtgrammar.y"
               { (yyval.qual) = qual_createRestrict (); }
#line 1723 "mtgrammar.c"
    break;

  case 47: /* innerModsList: innerMods  */
#line 259 "mtgrammar.y"
             { (yyval.quals) = qualList_single ((yyvsp[0].qual)); }
#line 1729 "mtgrammar.c"
    break;

  case 48: /* innerModsList: innerModsList innerMods  */
#line 260 "mtgrammar.y"
                           { (yyval.quals) = qualList_add ((yyvsp[-1].quals), (yyvsp[0].qual)); }
#line 1735 "mtgrammar.c"
    break;

  case 49: /* abstractDeclBase: MT_LPAREN abstractDecl MT_RPAREN  */
#line 264 "mtgrammar.y"
                                    { (yyval.ctyp) = ctype_expectFunction ((yyvsp[-1].ctyp)); }
#line 1741 "mtgrammar.c"
    break;

  case 50: /* abstractDeclBase: MT_LBRACKET MT_RBRACKET  */
#line 265 "mtgrammar.y"
                           { (yyval.ctyp) = ctype_makeArray (ctype_unknown); }
#line 1747 "mtgrammar.c"
    break;

  case 51: /* abstractDeclBase: abstractDeclBase MT_LBRACKET MT_RBRACKET  */
#line 266 "mtgrammar.y"
                                            { (yyval.ctyp) = ctype_makeArray ((yyvsp[-2].ctyp)); }
#line 1753 "mtgrammar.c"
    break;

  case 52: /* typeSpecifier: MT_CHAR  */
#line 274 "mtgrammar.y"
          { (yyval.ctyp) = ctype_char; }
#line 1759 "mtgrammar.c"
    break;

  case 53: /* typeSpecifier: MT_INT  */
#line 275 "mtgrammar.y"
         { (yyval.ctyp) = ctype_int; }
#line 1765 "mtgrammar.c"
    break;

  case 54: /* typeSpecifier: MT_FLOAT  */
#line 276 "mtgrammar.y"
           { (yyval.ctyp) = ctype_float; }
#line 1771 "mtgrammar.c"
    break;

  case 55: /* typeSpecifier: MT_DOUBLE  */
#line 277 "mtgrammar.y"
            { (yyval.ctyp) = ctype_double; }
#line 1777 "mtgrammar.c"
    break;

  case 56: /* typeSpecifier: MT_VOID  */
#line 278 "mtgrammar.y"
          { (yyval.ctyp) = ctype_void; }
#line 1783 "mtgrammar.c"
    break;

  case 57: /* typeSpecifier: MT_ANYTYPE  */
#line 279 "mtgrammar.y"
             { (yyval.ctyp) = ctype_unknown; }
#line 1789 "mtgrammar.c"
    break;

  case 58: /* typeSpecifier: MT_INTEGRALTYPE  */
#line 280 "mtgrammar.y"
                  { (yyval.ctyp) = ctype_anyintegral; }
#line 1795 "mtgrammar.c"
    break;

  case 59: /* typeSpecifier: MT_UNSIGNEDINTEGRALTYPE  */
#line 281 "mtgrammar.y"
                          { (yyval.ctyp) = ctype_unsignedintegral; }
#line 1801 "mtgrammar.c"
    break;

  case 60: /* typeSpecifier: MT_SIGNEDINTEGRALTYPE  */
#line 282 "mtgrammar.y"
                        { (yyval.ctyp) = ctype_signedintegral; }
#line 1807 "mtgrammar.c"
    break;

  case 62: /* typeName: MT_IDENT  */
#line 290 "mtgrammar.y"
            { (yyval.ctyp) = mtscanner_lookupType ((yyvsp[0].tok)); }
#line 1813 "mtgrammar.c"
    break;

  case 63: /* valuesDeclaration: MT_ONEOF valuesList  */
#line 294 "mtgrammar.y"
                      { (yyval.mtvalues) = mtValuesNode_create ((yyvsp[0].cstringlist)); }
#line 1819 "mtgrammar.c"
    break;

  case 64: /* valuesList: MT_IDENT  */
#line 298 "mtgrammar.y"
           { (yyval.cstringlist) = cstringList_single (mttok_getText ((yyvsp[0].tok))); }
#line 1825 "mtgrammar.c"
    break;

  case 65: /* valuesList: MT_IDENT MT_COMMA valuesList  */
#line 300 "mtgrammar.y"
  { (yyval.cstringlist) = cstringList_prepend ((yyvsp[0].cstringlist), mttok_getText ((yyvsp[-2].tok))); }
#line 1831 "mtgrammar.c"
    break;

  case 66: /* defaultNode: MT_DEFAULT valueChoice  */
#line 304 "mtgrammar.y"
                         { (yyval.tok) = (yyvsp[0].tok); }
#line 1837 "mtgrammar.c"
    break;

  case 67: /* defaultsDeclaration: MT_DEFAULTS defaultDeclarationList  */
#line 308 "mtgrammar.y"
                                     { (yyval.mtdefaults) = mtDefaultsNode_create ((yyvsp[-1].tok), (yyvsp[0].mtdeflist)); }
#line 1843 "mtgrammar.c"
    break;

  case 68: /* defaultDeclarationList: contextSelection MT_ARROW valueChoice  */
#line 313 "mtgrammar.y"
{ (yyval.mtdeflist) = mtDefaultsDeclList_single (mtDefaultsDecl_create ((yyvsp[-2].mtcontext), (yyvsp[0].tok))); }
#line 1849 "mtgrammar.c"
    break;

  case 69: /* defaultDeclarationList: contextSelection MT_ARROW valueChoice defaultDeclarationList  */
#line 315 "mtgrammar.y"
{ (yyval.mtdeflist) = mtDefaultsDeclList_prepend ((yyvsp[0].mtdeflist), mtDefaultsDecl_create ((yyvsp[-3].mtcontext), (yyvsp[-1].tok))); }
#line 1855 "mtgrammar.c"
    break;

  case 70: /* annotationsDeclaration: MT_ANNOTATIONS annotationsDeclarationList  */
#line 319 "mtgrammar.y"
                                            { (yyval.mtannotations) = mtAnnotationsNode_create ((yyvsp[0].mtannotlist)); }
#line 1861 "mtgrammar.c"
    break;

  case 71: /* annotationsDeclarationList: annotationDeclaration  */
#line 323 "mtgrammar.y"
                        { (yyval.mtannotlist) = mtAnnotationList_single ((yyvsp[0].mtannotdecl)); }
#line 1867 "mtgrammar.c"
    break;

  case 72: /* annotationsDeclarationList: annotationDeclaration annotationsDeclarationList  */
#line 325 "mtgrammar.y"
  { (yyval.mtannotlist) = mtAnnotationList_prepend ((yyvsp[0].mtannotlist), (yyvsp[-1].mtannotdecl)); }
#line 1873 "mtgrammar.c"
    break;

  case 73: /* annotationDeclaration: MT_IDENT optContextSelection MT_ARROW valueChoice  */
#line 330 "mtgrammar.y"
  { (yyval.mtannotdecl) = mtAnnotationDecl_create ((yyvsp[-3].tok), (yyvsp[-2].mtcontext), (yyvsp[0].tok)); }
#line 1879 "mtgrammar.c"
    break;

  case 74: /* mergeDeclaration: MT_MERGE mergeClauses  */
#line 334 "mtgrammar.y"
                        { (yyval.mtmerge) = mtMergeNode_create ((yyvsp[0].mtmergeclauselist)); }
#line 1885 "mtgrammar.c"
    break;

  case 75: /* mergeClauses: mergeClause  */
#line 338 "mtgrammar.y"
              { (yyval.mtmergeclauselist) = mtMergeClauseList_single ((yyvsp[0].mtmergeclause)); }
#line 1891 "mtgrammar.c"
    break;

  case 76: /* mergeClauses: mergeClause mergeClauses  */
#line 339 "mtgrammar.y"
                           { (yyval.mtmergeclauselist) = mtMergeClauseList_prepend ((yyvsp[0].mtmergeclauselist), (yyvsp[-1].mtmergeclause)); }
#line 1897 "mtgrammar.c"
    break;

  case 77: /* mergeClause: mergeItem MT_PLUS mergeItem MT_ARROW transferAction  */
#line 344 "mtgrammar.y"
  { (yyval.mtmergeclause) = mtMergeClause_create ((yyvsp[-4].mtmergeitem), (yyvsp[-2].mtmergeitem), (yyvsp[0].mttransferaction)); }
#line 1903 "mtgrammar.c"
    break;

  case 78: /* mergeItem: valueChoice  */
#line 348 "mtgrammar.y"
              { (yyval.mtmergeitem) = mtMergeItem_createValue ((yyvsp[0].tok)); }
#line 1909 "mtgrammar.c"
    break;

  case 79: /* mergeItem: MT_STAR  */
#line 349 "mtgrammar.y"
          { (yyval.mtmergeitem) = mtMergeItem_createStar ((yyvsp[0].tok)); }
#line 1915 "mtgrammar.c"
    break;

  case 80: /* preconditionsDeclaration: MT_PRECONDITIONS transferClauses  */
#line 353 "mtgrammar.y"
                                   { (yyval.mttransferclauselist) = (yyvsp[0].mttransferclauselist); }
#line 1921 "mtgrammar.c"
    break;

  case 81: /* postconditionsDeclaration: MT_POSTCONDITIONS transferClauses  */
#line 357 "mtgrammar.y"
                                    { (yyval.mttransferclauselist) = (yyvsp[0].mttransferclauselist); }
#line 1927 "mtgrammar.c"
    break;

  case 82: /* transfersDeclaration: MT_TRANSFERS transferClauses  */
#line 361 "mtgrammar.y"
                               { (yyval.mttransferclauselist) = (yyvsp[0].mttransferclauselist); }
#line 1933 "mtgrammar.c"
    break;

  case 83: /* loseReferenceDeclaration: MT_LOSEREFERENCE lostClauses  */
#line 365 "mtgrammar.y"
                               { (yyval.mtlosereferencelist) = (yyvsp[0].mtlosereferencelist); }
#line 1939 "mtgrammar.c"
    break;

  case 84: /* lostClauses: lostClause  */
#line 369 "mtgrammar.y"
             { (yyval.mtlosereferencelist) = mtLoseReferenceList_single ((yyvsp[0].mtlosereference)); }
#line 1945 "mtgrammar.c"
    break;

  case 85: /* lostClauses: lostClause lostClauses  */
#line 370 "mtgrammar.y"
                         { (yyval.mtlosereferencelist) = mtLoseReferenceList_prepend ((yyvsp[0].mtlosereferencelist), (yyvsp[-1].mtlosereference)); }
#line 1951 "mtgrammar.c"
    break;

  case 86: /* lostClause: valueChoice MT_ARROW errorAction  */
#line 374 "mtgrammar.y"
                                   { (yyval.mtlosereference) = mtLoseReference_create ((yyvsp[-2].tok), (yyvsp[0].mttransferaction)); }
#line 1957 "mtgrammar.c"
    break;

  case 87: /* transferClauses: transferClause  */
#line 378 "mtgrammar.y"
                 { (yyval.mttransferclauselist) = mtTransferClauseList_single ((yyvsp[0].mttransferclause)); }
#line 1963 "mtgrammar.c"
    break;

  case 88: /* transferClauses: transferClause transferClauses  */
#line 379 "mtgrammar.y"
                                 { (yyval.mttransferclauselist) = mtTransferClauseList_prepend ((yyvsp[0].mttransferclauselist), (yyvsp[-1].mttransferclause)); }
#line 1969 "mtgrammar.c"
    break;

  case 89: /* transferClause: valueChoice MT_AS valueChoice MT_ARROW transferAction  */
#line 384 "mtgrammar.y"
  { (yyval.mttransferclause) = mtTransferClause_create ((yyvsp[-4].tok), (yyvsp[-2].tok), (yyvsp[0].mttransferaction)); }
#line 1975 "mtgrammar.c"
    break;

  case 90: /* transferAction: valueChoice  */
#line 388 "mtgrammar.y"
              { (yyval.mttransferaction) = mtTransferAction_createValue ((yyvsp[0].tok)); }
#line 1981 "mtgrammar.c"
    break;

  case 91: /* transferAction: errorAction  */
#line 389 "mtgrammar.y"
              { (yyval.mttransferaction) = (yyvsp[0].mttransferaction); }
#line 1987 "mtgrammar.c"
    break;

  case 92: /* errorAction: MT_ERROR  */
#line 393 "mtgrammar.y"
           { (yyval.mttransferaction) = mtTransferAction_createError ((yyvsp[0].tok)); }
#line 1993 "mtgrammar.c"
    break;

  case 93: /* errorAction: MT_ERROR MT_STRINGLIT  */
#line 394 "mtgrammar.y"
                        { (yyval.mttransferaction) = mtTransferAction_createErrorMessage ((yyvsp[0].tok)); }
#line 1999 "mtgrammar.c"
    break;


#line 2003 "mtgrammar.c"

      default: break;
    }
  /* User semantic actions sometimes alter yychar, and that requires
     that yytoken be updated with the new translation.  We take the
     approach of translating immediately before every use of yytoken.
     One alternative is translating here after every semantic action,
     but that translation would be missed if the semantic action invokes
     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
     incorrect destructor might then be invoked immediately.  In the
     case of YYERROR or YYBACKUP, subsequent parser actions might lead
     to an incorrect destructor call or verbose syntax error message
     before the lookahead is translated.  */
  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);

  YYPOPSTACK (yylen);
  yylen = 0;

  *++yyvsp = yyval;

  /* Now 'shift' the result of the reduction.  Determine what state
     that goes to, based on the state we popped back to and the rule
     number reduced by.  */
  {
    const int yylhs = yyr1[yyn] - YYNTOKENS;
    const int yyi = yypgoto[yylhs] + *yyssp;
    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
               ? yytable[yyi]
               : yydefgoto[yylhs]);
  }

  goto yynewstate;


/*--------------------------------------.
| yyerrlab -- here on detecting error.  |
`--------------------------------------*/
yyerrlab:
  /* Make sure we have latest lookahead translation.  See comments at
     user semantic actions for why this is necessary.  */
  yytoken = yychar == MTEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
      yyerror (YY_("syntax error"));
    }

  if (yyerrstatus == 3)
    {
      /* If just tried and failed to reuse lookahead token after an
         error, discard it.  */

      if (yychar <= MTEOF)
        {
          /* Return failure if at end of input.  */
          if (yychar == MTEOF)
            YYABORT;
        }
      else
        {
          yydestruct ("Error: discarding",
                      yytoken, &yylval);
          yychar = MTEMPTY;
        }
    }

  /* Else will try to reuse lookahead token after shifting the error
     token.  */
  goto yyerrlab1;


/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:
  /* Pacify compilers when the user code never invokes YYERROR and the
     label yyerrorlab therefore never appears in user code.  */
  if (0)
    YYERROR;
  ++yynerrs;

  /* Do not reclaim the symbols of the rule whose action triggered
     this YYERROR.  */
  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);
  yystate = *yyssp;
  goto yyerrlab1;


/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
`-------------------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */

  /* Pop stack until we find a state that shifts the error token.  */
  for (;;)
    {
      yyn = yypact[yystate];
      if (!yypact_value_is_default (yyn))
        {
          yyn += YYSYMBOL_YYerror;
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
            {
              yyn = yytable[yyn];
              if (0 < yyn)
                break;
            }
        }

      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
        YYABORT;


      yydestruct ("Error: popping",
                  YY_ACCESSING_SYMBOL (yystate), yyvsp);
      YYPOPSTACK (1);
      yystate = *yyssp;
      YY_STACK_PRINT (yyss, yyssp);
    }

  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  *++yyvsp = yylval;
  YY_IGNORE_MAYBE_UNINITIALIZED_END


  /* Shift the error token.  */
  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);

  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturnlab;


/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturnlab;


/*-----------------------------------------------------------.
| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
`-----------------------------------------------------------*/
yyexhaustedlab:
  yyerror (YY_("memory exhausted"));
  yyresult = 2;
  goto yyreturnlab;


/*----------------------------------------------------------.
| yyreturnlab -- parsing is finished, clean up and return.  |
`----------------------------------------------------------*/
yyreturnlab:
  if (yychar != MTEMPTY)
    {
      /* Make sure we have latest lookahead translation.  See comments at
         user semantic actions for why this is necessary.  */
      yytoken = YYTRANSLATE (yychar);
      yydestruct ("Cleanup: discarding lookahead",
                  yytoken, &yylval);
    }
  /* Do not reclaim the symbols of the rule whose action triggered
     this YYABORT or YYACCEPT.  */
  YYPOPSTACK (yylen);
  YY_STACK_PRINT (yyss, yyssp);
  while (yyssp != yyss)
    {
      yydestruct ("Cleanup: popping",
                  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
      YYPOPSTACK (1);
    }
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif

  return yyresult;
}

#line 401 "mtgrammar.y"


# include "bison.reset"

extern char *yytext;

static void
mterror (char *s) 
{
  
  if (s != NULL)
    {
      llparseerror
	(message ("Parse error in meta-state file: %s", cstring_fromChars (s)));
    }
  else
    {
      llparseerror
	(message ("Parse error in meta-state file"));
    }

}

static void
mtprint (FILE *file, int type, MTSTYPE value)
{
  cstring tname = mttok_unparse (value.tok);
  fprintf (file, " (%s)", cstring_toCharsSafe (tname));
  cstring_free (tname);
}

