/* original parser id follows */
/* yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93" */
/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */

#define YYBYACC 1
#define YYMAJOR 1
#define YYMINOR 9
#define YYPATCH 20150711

#define YYEMPTY        (-1)
#define yyclearin      (yychar = YYEMPTY)
#define yyerrok        (yyerrflag = 0)
#define YYRECOVERING() (yyerrflag != 0)
#define YYENOMEM       (-2)
#define YYEOF          0
#define YYPREFIX "yy"

#define YYPURE 0

#line 64 "grammar.y"
#   define YYDEBUG 1

#define CAND 256
#define CHARACTERS 257
#define CONSTANTS 258
#define COR 259
#define DO 260
#define ELSE 261
#define ELSIF 262
#define END 263
#define ENUM 264
#define EXPORT 265
#define FI 266
#define FIELD 267
#define FUNC 268
#define H 269
#define HIDE 270
#define IF 271
#define IN 272
#define EXTEND 273
#define LET 274
#define NI 275
#define OD 276
#define READONLY 277
#define RECORD 278
#define THEN 279
#define TYPE 280
#define UNION 281
#define USE 282
#define VAL 283
#define VAR 284
#define WITH 285
#define RIGHT_ARROW 286
#define EQUALS_EQUALS 287
#define EQUALS_EQUALS_EQUALS 288
#define COLON 289
#define WORDID 290
#define OPID 291
#define PROD 292
#define QSTRING 293
#define UQSTRING 294
#define LEFT_ANGLE_BRACKET 295
#define RIGHT_ANGLE_BRACKET 296
#define EXTERN 297
#define SIGNATURE 298
#define INSERTIONCHAR 299
#define YYERRCODE 255




#   include "../../proto.h"

#   include <stdio.h>
#   include "../../parm.h"
#   include "../applinfer/precedence.h"
#   include "../../stree/ststructs.mh"
#   include "rcs.h"    /* bit vectors defining RUSSELL character set */
#   include "../stt/sttdefs.h"
#   include "../../pass4/sigs.h"
#   include <a.out.h>
  /* #   include "tokens.h"*/
/* The following should really be handled with %union, 	*/
/* but that would be lots of work to fix.							*/
typedef NODE * NodeStar;
#   define YYSTYPE NodeStar

#   define maxskip 8 /* maximum number of tokens to be skipped in error */
                     /* recovery, other than in denotation sequences    */

#   ifdef BAD
        extern boolean BADflag;
#   endif

#   ifdef DEBUG
	int yydebug;
#   endif

#   define LIST_END 0x7fff
    int paramstop []   /* stop symbols for parameter error recovery */
    =   { ';',
          ']',
          '{',
          VAR,
          VAL,
          FUNC,
	  TYPE,
	  SIGNATURE,
	  EOF,
	  LIST_END     };
    int denseqstop []   /* stop symbols for statement list error recovery */
    =   { ';',
	  '#',
	  ELSIF,
	  ELSE,
          FI,
          OD,
          ')',
          NI,
          '}',
          IF,
          DO,
          LET,
          FUNC,
          '(',
          WITH,
          IN,
	  EOF,
	  LIST_END       };
    int condstop []     /* stop symbols for error recovery in various       */
                        /* conditional constructs                           */
    =   {  OD,
           FI,
           RIGHT_ARROW,
           '#',
           ';',
           LET,
           DO,
	   IF,
	   THEN,
	   ELSE,
           '(',
	   EOF,
	   LIST_END       };
    int declstop []     /* stop symbols for error recovery in declarations  */
    =   { EQUALS_EQUALS,
	  EQUALS_EQUALS_EQUALS,
          ';',
          '}',
          IN,
          NI,
          IF,
          DO,
          LET,
          '(',
	  EOF,
	  LIST_END        };

    NODE * sig_in();    /* Read signature info from object file */

    extern boolean initflag;    /* This is a compiler initialization run */
    extern boolean OOflag;      /* Save info for intermediate code optimizer */
    NODE * insrtptr = NIL;  /* pointer to dummy BLOCKDENOTATION vertex into */
			    /* which the syntax tree is to be inserted.     */
			    /* Set up by a previous initialization run of   */
			    /* compiler.                                    */
    extern NODE * id_Boolean;  /* LETTERID node in which the parameter node  */
                               /* for Boolean must be inserted.              */
    extern NODE * id_Void;     /* Analogous node for Void                    */
    extern NODE * id_Integer;  /* Analogous node for Integer                 */
    extern NODE * id_Null;     /* Analogous for Null                         */
    extern NODE * appl_Null;   /* Node corresponding to application of Null  */
    extern sttrelptr indx_Boolean; /* string table index of 'Boolean' */
    extern sttrelptr indx_Integer;
    extern sttrelptr indx_Void;
    extern sttrelptr indx_simple;
    extern sttrelptr indx_standard;
    extern sttrelptr indx_inline;

    extern sttrelptr indx_put;
    extern sttrelptr indx_Callcc;
    extern sttrelptr indx_Array;
    extern sttrelptr indx_Null;

    NODE * stxtree = NIL; /* pointer to root of syntax tree */

    unsigned i; /* temporary */
    extern sttrelptr     /* indices in string table of type components with   */
			 /* predefined signatures.                            */
	indx_assign,
	indx_passign,
	indx_massign,
        indx_equals,   
        indx_less,
        indx_greater,
        indx_le,
        indx_ge,
        indx_ne,
	indx_New,
	indx_ptr_New,
	indx_init_New,
	indx_ValueOf,
	indx_sconc,
	indx_pconc;

    NODE * sig_assign, /* pointers to trees representing predefined */
         * sig_equals, /* signatures.                               */
         * sig_less,
         * sig_greater,
         * sig_New,
         * sig_const,
	 * sig_ValueOf,
	 * sig_sconc,
	 * sig_pconc,
	 * sig_Signature;

extern char * (getname());

extern NODE * mkappl();

extern char * (* inline_cnvt)();

boolean has_externs; /* Mentions separately compiled Russell programs */

/* Defines to establish and test the presence of an optional element */
#   define PRESENT ((NodeStar)1)
#   define NOTPRESENT 0
#   define is_present(x)  ((x) == PRESENT)
#line 230 "y.tab.c"

#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
/* Default: YYSTYPE is the semantic value type. */
typedef int YYSTYPE;
# define YYSTYPE_IS_DECLARED 1
#endif

/* compatibility with bison */
#ifdef YYPARSE_PARAM
/* compatibility with FreeBSD */
# ifdef YYPARSE_PARAM_TYPE
#  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
# else
#  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
# endif
#else
# define YYPARSE_DECL() yyparse(void)
#endif

/* Parameters sent to lex. */
#ifdef YYLEX_PARAM
# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
# define YYLEX yylex(YYLEX_PARAM)
#else
# define YYLEX_DECL() yylex(void)
# define YYLEX yylex()
#endif

/* Parameters sent to yyerror. */
#ifndef YYERROR_DECL
#define YYERROR_DECL() yyerror(const char *s)
#endif
#ifndef YYERROR_CALL
#define YYERROR_CALL(msg) yyerror(msg)
#endif

extern int YYPARSE_DECL();

#define CAND 257
#define CHARACTERS 258
#define CONSTANTS 259
#define COR 260
#define DO 261
#define ELSE 262
#define ELSIF 263
#define END 264
#define ENUM 265
#define EXPORT 266
#define FI 267
#define FIELD 268
#define FUNC 269
#define HIDE 270
#define IF 271
#define IN 272
#define EXTEND 273
#define LET 274
#define NI 275
#define OD 276
#define READONLY 277
#define RECORD 278
#define THEN 279
#define TYPE 280
#define UNION 281
#define USE 282
#define VAL 283
#define VAR 284
#define WITH 285
#define RIGHT_ARROW 286
#define EQUALS_EQUALS 287
#define EQUALS_EQUALS_EQUALS 288
#define COLON 289
#define WORDID 290
#define OPID 291
#define PROD 292
#define QSTRING 293
#define UQSTRING 294
#define LEFT_ANGLE_BRACKET 295
#define RIGHT_ANGLE_BRACKET 296
#define EXTERN 297
#define SIGNATURE 298
#define YYERRCODE 256
typedef short YYINT;
static const YYINT yylhs[] = {                           -1,
    2,    0,    0,    4,    0,    5,    5,    5,    7,    7,
    9,    9,   10,   10,    6,    6,    8,    8,   12,   12,
   12,   12,   12,   12,   12,   12,   12,   12,   15,   15,
   18,   18,   19,   14,   14,   20,   20,   17,   17,   16,
   16,   21,   21,   21,   21,   21,   22,   22,    1,    1,
   13,   13,   23,   23,   23,   23,   24,   24,   24,   24,
   24,   24,   24,   24,   24,   24,   24,   24,    3,    3,
    3,   33,   33,   26,   26,   34,   34,   34,   27,   27,
   27,   27,   28,   28,   28,   28,   28,   42,   42,   42,
   25,   32,   32,   32,   31,   31,   43,   43,   43,   43,
   44,   44,   37,   39,   40,   40,   38,   38,   41,   41,
   45,   45,   46,   46,   47,   29,   29,   48,   48,   49,
   49,   49,   50,   50,   51,   51,   51,   52,   52,   52,
   53,   53,   35,   35,   54,   54,   55,   55,   30,   30,
   30,   30,   56,   11,   11,   36,   36,
};
static const YYINT yylen[] = {                            2,
    0,    2,    1,    0,    3,    3,    1,    1,    1,    0,
    1,    0,    1,    3,    1,    3,    1,    1,    1,    2,
    2,    1,   14,   13,   12,   10,    8,    5,    1,    0,
    4,    0,    5,    7,    6,    1,    0,    1,    3,    1,
    0,    3,    5,    1,    1,    1,    1,    0,    1,    1,
    1,    1,    1,    1,    2,    2,    1,    1,    1,    1,
    1,    2,    3,    3,    3,    5,    5,    4,    3,    1,
    1,    1,    0,    4,    5,    1,    6,    5,    4,    3,
    2,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    3,    1,    3,    0,    1,    3,    4,    4,    0,    1,
    2,    0,    4,    4,    5,    2,    4,    2,    5,    2,
    1,    3,    1,    0,    3,    1,    1,    5,    2,    5,
    2,    2,    1,    1,    1,    3,    0,    3,    1,    1,
    1,    0,    3,    0,    1,    0,    2,    5,    1,    3,
    4,    1,    3,    1,    1,    1,    1,
};
static const YYINT yydefred[] = {                         0,
    0,    0,    0,    0,   59,   60,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,  144,  145,
    0,  146,  147,    0,   19,    0,    0,   52,    2,    0,
   49,   50,    0,    0,    0,   54,   57,   58,   61,    0,
   82,   83,   84,   85,   86,   87,   71,   70,    0,    0,
   89,    0,    0,    0,  139,    0,    0,    0,    0,    0,
    0,  100,    0,   15,    0,   95,  108,    0,    0,   40,
    0,  110,    0,    0,    0,   21,   76,   20,  106,    0,
    0,    0,    0,    0,   81,    0,   56,    0,    0,    0,
    0,   62,  116,  117,    0,    0,    0,    0,   65,    0,
    0,    0,    0,    0,    0,    0,   64,    0,    9,    0,
    0,    0,    0,    0,    0,    0,  111,  113,   29,    0,
    0,    0,    0,    0,    0,    0,   63,   91,    0,    0,
   17,   18,   22,  121,  122,  119,    0,    0,   80,    0,
    0,    0,   72,   69,    0,   90,   88,  140,    0,  103,
    0,    0,    8,   11,    0,    7,   13,    0,    0,    0,
    0,  104,   16,  101,    0,    0,    0,   96,    0,    0,
  107,    0,    0,   46,   45,    0,    0,    0,   38,   36,
    0,   93,    0,    0,   68,    0,    0,  133,    0,   79,
    0,    0,   74,    0,    0,  141,  135,   31,    0,    0,
    0,    0,    0,   97,   98,   66,  115,  112,    0,    0,
    0,    0,   28,  109,   67,  105,    0,    0,    0,  130,
  129,    0,    0,    0,   75,    0,    0,   33,    6,   14,
   35,    0,    0,    0,    0,   47,   42,    0,   39,    0,
    0,  118,    0,  120,    0,    0,   34,    0,    0,    0,
    0,    0,    0,  131,  128,  126,    0,    0,    0,    0,
   27,   43,    0,  138,    0,    0,    0,    0,    0,    0,
    0,   26,    0,    0,    0,    0,    0,   25,    0,   24,
   23,
};
static const YYINT yydgoto[] = {                          2,
   48,    3,   49,    4,  154,  155,  111,  156,  157,  158,
   30,   31,   32,   33,  120,   71,  178,   58,   59,  179,
  180,  238,   34,   35,   36,   37,   38,   39,   92,   53,
   65,   75,  144,   40,   85,   41,   42,   43,   44,   45,
   46,   54,   66,  112,  116,  117,  118,   93,   94,   95,
  223,  224,  255,  196,  197,   55,
};
static const YYINT yysindex[] = {                      -221,
    0,    0,  421,  302,    0,    0,  159,  -67,   39,  159,
  -46, -196,  -89,  -23,  -80,  421,  567,  567,    0,    0,
  155,    0,    0,  -20,    0,  302,  421,    0,    0, -245,
    0,    0,    0,  901,  114,    0,    0,    0,    0,   23,
    0,    0,    0,    0,    0,    0,    0,    0,   15,    0,
    0, -191,   -3, -177,    0, -162, -162,   30,   85,  -31,
  421,    0,  -38,    0,  -40,    0,    0, -162, -162,    0,
   25,    0,   54,   88, -108,    0,    0,    0,    0,   58,
 -125,    6,   97,  519,    0,  114,    0,  -62,  -58,  208,
  -78,    0,    0,    0, -162,  356,  421,  302,    0,  198,
  302,  -14,  175,  237, -162,  117,    0,   89,    0, -162,
  519, -103,  302, -196,  -38,  -11,    0,    0,    0,  -29,
 -111,  237,  421,  302,  237,  100,    0,    0,   39,  -77,
    0,    0,    0,    0,    0,    0,   99, -245,    0,  104,
  -97,   -8,    0,    0,  -39,    0,    0,    0,   15,    0,
  187,  -18,    0,    0,  -38,    0,    0,   -2,    0,   24,
  237,    0,    0,    0,  421,  421,  -49,    0,  421, -162,
    0,   27, -162,    0,    0,  -38,    0,   -5,    0,    0,
   -1,    0,  -44,    5,    0,  144,   85,    0, -196,    0,
  -73,  163,    0,  302,  421,    0,    0,    0,  267,  519,
  237,  519,    8,    0,    0,    0,    0,    0,  -34,  200,
  263, -111,    0,    0,    0,    0,  237,  233,    9,    0,
    0, -245,  204,  285,    0,   15,   67,    0,    0,    0,
    0,  519,   55, -162, -111,    0,    0,   87,    0,   12,
  237,    0, -181,    0,  -73,  302,    0,  -41,  238,   10,
  567,  519,   51,    0,    0,    0,  -39,  -33, -162, -111,
    0,    0,  519,    0,  321, -162,  240,   11, -162,  244,
 -111,    0,  259, -111,   13, -111,   14,    0,   34,    0,
    0,
};
static const YYINT yyrindex[] = {                       460,
    1,    0,    0,    0,    0,    0,    0,    0,  295,    0,
    0,  -28,    0,  277,  277,  129,    0,    0,    0,    0,
  277,    0,    0,    0,    0,    0,  312,    0,    0,   40,
    0,    0,  785,  763,   78,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,  414,    4,
    0,  131,    0,    0,    0,    0,    0,    0,  295,    0,
    0,    0,  376,    0,    0,    0,    0,   37,  -19,    0,
    0,    0,    0,  -75,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,  116,    0, -102,  -85,  277,
    0,    0,    0,    0,  277,    0,    2,    0,    0,    0,
    0,    0,    0,   94,    0,    0,    0,    0,    0,    0,
    0,    0,    0,  -43,  499,    0,    0,    0,    0,    0,
   41,   45,  -70,    0,   45,    0,    0,    0,  295,    0,
    0,    0,    0,    0,    0,    0,    0,   40,    0,    0,
    0,    0,    0,    0,  -30,    0,    0,    0,  -24,    0,
    0,    0,    0,    0,  585,    0,    0,    0,  807,    0,
   94,    0,    0,    0,    0,    0,    0,    0,    0,   37,
    0,    0,  277,    0,    0,  246,  -35,    0,    0,    0,
    0,    0,    0,    0,    0,    0,  295,    0,   47,    0,
  293,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  -10,  299,    0,    0,    0,    0,    0,    0,    0,    0,
  157,   41,    0,    0,    0,    0,   94,    0,    0,    0,
    0,  161,    0,  301,    0,   20,    0,    0,    0,    0,
    0,  306,    0,  277,   41,    0,    0,    0,    0,    0,
   94,    0,   49,    0,  293,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,  -30,    0,  277,   41,
    0,    0,    0,    0,    0,  277,    0,    0,  277,    0,
   41,    0,    0,   41,    0,   41,    0,    0,    0,    0,
    0,
};
static const YYINT yygindex[] = {                         0,
   26,    0,  409,    0,    0,  806,  -69,  420,  235,  -63,
  883,  -59,   -4, 1028,    0,  711,  242,  -32,  305,  226,
    0,    0,    0,  410,  436,    0,    0,    0,    0,  438,
  284,   17,    0,    0, -110,  383,    0,    0,    0,    0,
    0,    0,  361,    0,    0,  313,    0,    0,  241,    0,
  249,    0,    0,  228,    0,  386,
};
#define YYTABLESIZE 1291
static const YYINT yytable[] = {                        259,
    3,   73,    4,  100,  136,  110,  234,  266,   15,   97,
  143,  173,   76,   78,   97,   99,   69,   92,  114,   97,
  123,   30,   94,   44,  132,   81,  106,  190,   29,  110,
   99,  100,   52,   68,    1,   52,   73,  124,  142,  134,
    4,   74,   73,   83,  132,  169,  127,  170,   12,   84,
   97,  132,   74,  212,  137,   56,  201,  201,  181,   62,
   73,  184,  132,  201,   97,  132,  201,  114,  212,  212,
  201,  212,  212,   97,  134,  134,   61,   53,   57,  134,
  134,   99,   12,  134,   88,  200,  108,   98,   89,   44,
  202,    4,  212,   19,   20,  114,  186,  203,  134,   37,
  232,  132,   81,   12,  252,   99,  211,  132,  101,  201,
  150,  243,   53,  171,   12,   55,  193,   53,   53,  213,
  104,   53,  143,  214,  105,  147,   73,   19,   20,  216,
  134,  123,  134,  242,  261,  272,   53,  278,  280,  182,
  132,  132,  132,  263,  174,   96,  175,  121,   74,   91,
   55,  132,   12,  240,  218,   55,   55,  132,  281,   55,
   28,  114,  134,  124,  134,   37,   67,  126,   53,   12,
   53,   99,  132,  132,   55,   72,  122,  253,   19,   20,
  125,  132,  220,  165,  166,  221,   12,  123,  123,  128,
  204,  205,  132,  134,  207,  192,   92,  135,   26,   28,
   53,   94,   53,  132,  124,  124,   55,  161,   55,   19,
   20,   19,   20,  162,   22,   23,   19,   20,  188,  134,
  227,  189,  194,  195,  185,  206,  191,  198,   99,  172,
  215,  113,   15,   15,  217,  107,  136,   26,   55,   30,
   55,   15,  143,   99,   15,  136,  262,   15,   15,   27,
  109,  143,  258,   15,   15,   15,    4,    4,  233,  265,
    4,    4,   15,   73,   73,    4,   19,   20,   73,    4,
  142,    4,   99,    4,    4,  199,   73,   73,    4,  142,
    4,    4,    4,    4,    4,  134,  137,  225,   27,   90,
    4,    4,    4,    4,    4,  137,  134,    4,    4,  134,
  134,  134,  134,   28,  134,  134,  134,  228,  134,  134,
  134,  134,  134,  134,  134,  134,  151,  134,  134,  209,
  134,  134,  235,  241,  134,  134,  134,  134,  244,  134,
  134,  134,  134,  134,   53,  134,  134,   53,   53,   53,
   53,   26,   53,  245,   53,  246,   53,  248,   53,   53,
   53,   53,   53,   53,  251,   53,   53,   28,   53,   53,
  260,  269,  271,   53,   53,   53,  274,   53,   53,   53,
   53,   53,   55,   53,   53,   55,   55,   55,   55,   88,
   55,  276,   55,   89,   55,   32,   55,   55,   55,   55,
   55,   55,   27,   55,   55,   26,   55,   55,   90,   41,
   94,   55,   55,   55,   94,   55,   55,   55,   55,   55,
   79,   55,   55,    5,   50,    5,   88,  127,    6,    7,
   51,   78,   28,    8,   48,  125,  134,    9,   77,   10,
  134,   11,   12,  187,   82,  230,   13,  239,   14,   15,
   16,   17,   18,   86,   19,   20,   27,   60,   19,   20,
   21,   22,   23,  146,    5,   24,   25,    6,    7,   51,
   26,    1,    8,  136,   19,   20,    9,  151,   10,   87,
   11,   12,  219,  139,  168,   13,  250,   14,   15,   16,
   17,   18,  208,  254,  264,  148,    0,   19,   20,   21,
   22,   23,  153,  256,   24,   25,    0,   19,   20,    1,
   10,  268,    0,  130,  142,  129,  145,    0,    0,  149,
    0,   27,  275,   10,   10,  277,   14,  279,    0,   17,
   18,  167,   10,    0,    0,   10,   19,   20,   10,   10,
  164,  129,  183,    0,   25,   10,   10,    0,   10,  236,
    0,    0,   14,   10,    0,   17,   18,    0,    0,    0,
    1,    0,   19,   20,    0,    0,    0,   47,    5,    0,
   25,    6,    7,    0,    0,    0,    8,    0,   28,    0,
    9,    0,   10,    0,   11,   12,    0,    0,    0,   13,
    0,   14,   15,   16,   17,   18,    0,    0,    0,   10,
    0,   19,   20,   21,   22,   23,    0,    0,   24,   25,
    0,    0,  226,    0,    0,    0,   26,    0,    0,    0,
    0,   47,    5,    0,    0,    6,    7,    0,    0,  229,
    8,  231,    0,    0,    9,    0,   10,    0,   11,   12,
  237,    0,    0,   13,    0,   14,   15,   16,   17,   18,
    0,    0,    0,    0,   10,   19,   20,   21,   22,   23,
    0,  247,  141,   25,  257,   10,    0,   27,   10,   10,
    0,    0,  102,  102,    0,   10,   10,    0,    0,    0,
    0,  231,    0,   10,    0,    0,    0,    5,    0,    0,
    6,    7,  247,    0,    0,    8,    0,    0,    0,    9,
    0,   10,    0,   11,   12,    0,    0,    0,   13,    0,
   14,   15,   16,   17,   18,    0,    0,    0,    0,    0,
   19,   20,   21,   22,   23,    0,    1,   24,   25,    1,
    1,    0,    0,    0,    1,   73,    0,    0,    1,    0,
    1,   80,    1,    1,    0,    0,    0,    1,    0,    1,
    1,    1,    1,    1,    0,    0,    0,    0,    0,    1,
    1,    1,    1,    1,    0,   10,    1,    1,   10,   10,
    0,    0,   51,   10,    0,    0,    0,   10,    0,   10,
    0,   10,   10,    0,    0,    0,   10,    0,   10,   10,
   10,   10,   10,    0,   22,    0,    0,  129,   10,   10,
   10,   10,   10,    0,    0,   10,   10,   51,   14,    0,
  137,   17,   18,   51,    0,  140,   51,    0,   19,   20,
    0,    0,    0,    0,    0,    0,   25,   63,    0,   22,
    0,   51,    0,    5,    0,   22,    6,    7,   22,    0,
    0,    8,    0,    0,    0,    9,    0,   10,    0,   11,
   12,    0,    0,   22,   13,    0,    0,   15,   16,    0,
   15,    0,    0,   10,    0,   51,   19,   20,   21,   22,
   23,  102,    0,   24,   10,   17,    0,   10,   10,    0,
    0,    0,    0,  115,   10,   10,    0,   22,    0,    0,
    0,    0,   10,  210,    0,   51,    0,   51,    0,    0,
    0,    0,    0,    0,   64,    0,   70,   70,    0,   17,
    0,    0,    0,   70,    0,    0,    0,   76,    0,   22,
    0,    0,    0,    0,    0,    0,    0,    0,    0,   63,
    0,    0,    0,    0,    0,    0,  176,    0,    0,    0,
    0,   17,    0,    0,    0,    0,    0,    0,   64,  103,
   26,    0,    0,    0,  249,    0,    0,    0,    0,    0,
   64,  119,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,  131,    0,    0,  267,
    0,    0,   70,  138,    0,  115,  270,   70,    0,  273,
    0,    0,    0,    0,    0,  152,  159,  160,    0,    0,
    0,   27,  163,  131,   63,    0,   64,    0,    0,    0,
    0,    0,    0,  177,  159,    0,    0,  159,    0,    0,
    0,    0,    0,    0,    0,    0,    0,  176,    0,    0,
    0,    0,    0,    0,   51,   51,    0,    0,    0,   51,
    0,    0,    0,    0,   51,    0,    0,   51,   51,    0,
  176,   51,    0,  159,   77,   77,   22,   22,   51,   51,
   51,   22,   64,    0,    0,   70,   22,    0,   51,   22,
   22,   77,    0,   22,    0,  176,    0,    0,    0,    0,
   22,   64,    0,  222,    0,   15,  176,    0,    0,  176,
    0,  176,  131,  159,  131,    0,   15,    0,    0,   15,
   15,    0,    0,  131,  177,   15,   15,   15,    0,  159,
    0,    0,    0,    0,   15,    0,    0,    0,    0,    0,
    0,  133,    0,    0,  131,    0,   70,  177,    0,    0,
    0,    0,    0,  159,    0,    0,    0,  222,    0,    0,
    0,  133,    0,    0,  131,    0,    0,    0,  133,    0,
    0,   70,  177,    0,    0,  131,    0,    0,   70,  133,
    0,   70,  133,  177,    0,    0,  177,    5,  177,    0,
    6,    7,    0,    0,    0,    8,    0,    0,    0,    9,
    0,   10,    0,   11,   12,    0,    0,    0,   13,    0,
    0,   15,   16,    0,    0,    0,    0,    0,  133,    0,
   19,   20,   21,   22,   23,    0,    0,   24,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,  133,  133,  133,
    0,    0,    0,    0,    0,    0,    0,    0,  133,    0,
    0,    0,    0,    0,  133,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,  133,
    0,    0,    0,    0,    0,    0,    0,    0,  133,    0,
    0,    0,    0,    0,    0,    0,    0,    0,   77,  133,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  133,
};
static const YYINT yycheck[] = {                         41,
    0,    0,    2,   35,   35,   44,   41,   41,   44,   59,
   35,   41,   17,   18,   59,   59,   40,   93,   59,   59,
  123,   41,   93,   59,   84,  123,   59,  138,    3,   44,
   59,   35,    7,  123,  256,   10,   35,  123,   35,    0,
   40,   16,   41,   27,  104,  115,   41,   59,   59,  295,
   59,  111,   27,   59,   35,  123,   59,   59,  122,  256,
   59,  125,  122,   59,   59,  125,   59,   59,   59,   59,
   59,   59,   59,   59,   35,   36,  123,    0,   40,   40,
   41,  125,   93,   44,  266,  155,   61,  279,  270,  125,
   93,   91,   59,  290,  291,   59,  129,  161,   59,   59,
   93,  161,  123,   59,   93,   59,  176,   59,  286,   59,
  125,  222,   35,  125,  125,    0,  125,   40,   41,  125,
   91,   44,   97,  125,   40,  100,  125,  290,  291,  125,
   91,   44,   93,  125,  125,  125,   59,  125,  125,  123,
  200,  201,  202,   93,  256,  123,  258,  123,  123,   36,
   35,  211,   59,  217,  187,   40,   41,  217,  125,   44,
    2,  125,  123,  272,  125,  125,  256,  293,   91,  125,
   93,  125,  232,  125,   59,  256,  123,  241,  290,  291,
  123,  241,  256,  287,  288,  259,   93,  290,  291,   93,
  165,  166,  252,  256,  169,  293,  272,  256,   40,    2,
  123,  272,  125,  263,  290,  291,   91,   91,   93,  290,
  291,  290,  291,  125,  293,  294,  290,  291,  296,   59,
  195,  123,  262,  263,  125,  275,  123,   41,  272,  259,
  275,  272,  268,  269,   91,  267,  267,   40,  123,  259,
  125,  277,  267,  272,  280,  276,  251,  283,  284,   91,
  289,  276,  294,  289,  290,  291,  256,  257,  293,  293,
  260,  261,  298,  262,  263,  265,  290,  291,  267,  269,
  267,  271,  276,  273,  274,  294,  275,  276,  278,  276,
  280,  281,  282,  283,  284,  125,  267,  125,   91,  286,
  290,  291,  292,  293,  294,  276,  257,  297,  298,  260,
  261,  262,  263,    2,  265,  266,  267,   41,  269,  270,
  271,  272,  273,  274,  275,  276,  293,  278,  279,  293,
  281,  282,  123,   91,  285,  286,  287,  288,  125,  290,
  291,  292,  293,  294,  257,  296,  297,  260,  261,  262,
  263,   40,  265,   59,  267,  279,  269,  293,  271,  272,
  273,  274,  275,  276,  268,  278,  279,    2,  281,  282,
  123,   41,  123,  286,  287,  288,  123,  290,  291,  292,
  293,  294,  257,  296,  297,  260,  261,  262,  263,  266,
  265,  123,  267,  270,  269,   91,  271,  272,  273,  274,
  275,  276,   91,  278,  279,   40,  281,  282,  285,  123,
  272,  286,  287,  288,   93,  290,  291,  292,  293,  294,
  256,  296,  297,    0,  256,  257,  286,  125,  260,  261,
  262,  123,    2,  265,  268,  125,  266,  269,  123,  271,
  270,  273,  274,  129,   26,  201,  278,  212,  280,  281,
  282,  283,  284,   34,  290,  291,   91,   10,  290,  291,
  292,  293,  294,  256,  257,  297,  298,  260,  261,  262,
   40,    2,  265,  256,  290,  291,  269,  293,  271,   34,
  273,  274,  189,   91,  114,  278,  235,  280,  281,  282,
  283,  284,  170,  243,  257,  100,   -1,  290,  291,  292,
  293,  294,  256,  245,  297,  298,   -1,  290,  291,   40,
    2,  260,   -1,   84,   96,  269,   98,   -1,   -1,  101,
   -1,   91,  271,  268,  269,  274,  280,  276,   -1,  283,
  284,  113,  277,   -1,   -1,  280,  290,  291,  283,  284,
  111,  269,  124,   -1,  298,  290,  291,   -1,   40,  277,
   -1,   -1,  280,  298,   -1,  283,  284,   -1,   -1,   -1,
   91,   -1,  290,  291,   -1,   -1,   -1,  256,  257,   -1,
  298,  260,  261,   -1,   -1,   -1,  265,   -1,    2,   -1,
  269,   -1,  271,   -1,  273,  274,   -1,   -1,   -1,  278,
   -1,  280,  281,  282,  283,  284,   -1,   -1,   -1,   91,
   -1,  290,  291,  292,  293,  294,   -1,   -1,  297,  298,
   -1,   -1,  194,   -1,   -1,   -1,   40,   -1,   -1,   -1,
   -1,  256,  257,   -1,   -1,  260,  261,   -1,   -1,  200,
  265,  202,   -1,   -1,  269,   -1,  271,   -1,  273,  274,
  211,   -1,   -1,  278,   -1,  280,  281,  282,  283,  284,
   -1,   -1,   -1,   -1,  269,  290,  291,  292,  293,  294,
   -1,  232,  297,  298,  246,  280,   -1,   91,  283,  284,
   -1,   -1,  287,  288,   -1,  290,  291,   -1,   -1,   -1,
   -1,  252,   -1,  298,   -1,   -1,   -1,  257,   -1,   -1,
  260,  261,  263,   -1,   -1,  265,   -1,   -1,   -1,  269,
   -1,  271,   -1,  273,  274,   -1,   -1,   -1,  278,   -1,
  280,  281,  282,  283,  284,   -1,   -1,   -1,   -1,   -1,
  290,  291,  292,  293,  294,   -1,  257,  297,  298,  260,
  261,   -1,   -1,   -1,  265,   15,   -1,   -1,  269,   -1,
  271,   21,  273,  274,   -1,   -1,   -1,  278,   -1,  280,
  281,  282,  283,  284,   -1,   -1,   -1,   -1,   -1,  290,
  291,  292,  293,  294,   -1,  257,  297,  298,  260,  261,
   -1,   -1,    0,  265,   -1,   -1,   -1,  269,   -1,  271,
   -1,  273,  274,   -1,   -1,   -1,  278,   -1,  280,  281,
  282,  283,  284,   -1,    0,   -1,   -1,  269,  290,  291,
  292,  293,  294,   -1,   -1,  297,  298,   35,  280,   -1,
   90,  283,  284,   41,   -1,   95,   44,   -1,  290,  291,
   -1,   -1,   -1,   -1,   -1,   -1,  298,   12,   -1,   35,
   -1,   59,   -1,  257,   -1,   41,  260,  261,   44,   -1,
   -1,  265,   -1,   -1,   -1,  269,   -1,  271,   -1,  273,
  274,   -1,   -1,   59,  278,   -1,   -1,  281,  282,   -1,
   44,   -1,   -1,  269,   -1,   93,  290,  291,  292,  293,
  294,   56,   -1,  297,  280,   59,   -1,  283,  284,   -1,
   -1,   -1,   -1,   68,  290,  291,   -1,   93,   -1,   -1,
   -1,   -1,  298,  173,   -1,  123,   -1,  125,   -1,   -1,
   -1,   -1,   -1,   -1,   12,   -1,   14,   15,   -1,   93,
   -1,   -1,   -1,   21,   -1,   -1,   -1,  123,   -1,  125,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  114,
   -1,   -1,   -1,   -1,   -1,   -1,  121,   -1,   -1,   -1,
   -1,  125,   -1,   -1,   -1,   -1,   -1,   -1,   56,   57,
   40,   -1,   -1,   -1,  234,   -1,   -1,   -1,   -1,   -1,
   68,   69,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   84,   -1,   -1,  259,
   -1,   -1,   90,   91,   -1,  170,  266,   95,   -1,  269,
   -1,   -1,   -1,   -1,   -1,  103,  104,  105,   -1,   -1,
   -1,   91,  110,  111,  189,   -1,  114,   -1,   -1,   -1,
   -1,   -1,   -1,  121,  122,   -1,   -1,  125,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,  212,   -1,   -1,
   -1,   -1,   -1,   -1,  262,  263,   -1,   -1,   -1,  267,
   -1,   -1,   -1,   -1,  272,   -1,   -1,  275,  276,   -1,
  235,  279,   -1,  161,   17,   18,  262,  263,  286,  287,
  288,  267,  170,   -1,   -1,  173,  272,   -1,  296,  275,
  276,   34,   -1,  279,   -1,  260,   -1,   -1,   -1,   -1,
  286,  189,   -1,  191,   -1,  269,  271,   -1,   -1,  274,
   -1,  276,  200,  201,  202,   -1,  280,   -1,   -1,  283,
  284,   -1,   -1,  211,  212,  289,  290,  291,   -1,  217,
   -1,   -1,   -1,   -1,  298,   -1,   -1,   -1,   -1,   -1,
   -1,   84,   -1,   -1,  232,   -1,  234,  235,   -1,   -1,
   -1,   -1,   -1,  241,   -1,   -1,   -1,  245,   -1,   -1,
   -1,  104,   -1,   -1,  252,   -1,   -1,   -1,  111,   -1,
   -1,  259,  260,   -1,   -1,  263,   -1,   -1,  266,  122,
   -1,  269,  125,  271,   -1,   -1,  274,  257,  276,   -1,
  260,  261,   -1,   -1,   -1,  265,   -1,   -1,   -1,  269,
   -1,  271,   -1,  273,  274,   -1,   -1,   -1,  278,   -1,
   -1,  281,  282,   -1,   -1,   -1,   -1,   -1,  161,   -1,
  290,  291,  292,  293,  294,   -1,   -1,  297,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,  200,  201,  202,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  211,   -1,
   -1,   -1,   -1,   -1,  217,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  232,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  241,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  251,  252,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
  263,
};
#define YYFINAL 2
#ifndef YYDEBUG
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 298
#define YYUNDFTOKEN 357
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
#if YYDEBUG
static const char *const yyname[] = {

"end-of-file",0,"'\\002'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,"'#'","'$'",0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,
"';'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,
"']'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'",0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,"CAND","CHARACTERS","CONSTANTS","COR","DO","ELSE","ELSIF",
"END","ENUM","EXPORT","FI","FIELD","FUNC","HIDE","IF","IN","EXTEND","LET","NI",
"OD","READONLY","RECORD","THEN","TYPE","UNION","USE","VAL","VAR","WITH",
"RIGHT_ARROW","EQUALS_EQUALS","EQUALS_EQUALS_EQUALS","COLON","WORDID","OPID",
"PROD","QSTRING","UQSTRING","LEFT_ANGLE_BRACKET","RIGHT_ANGLE_BRACKET","EXTERN",
"SIGNATURE",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"illegal-symbol",
};
static const char *const yyrule[] = {
"$accept : Program",
"$$1 :",
"Program : $$1 Denotation",
"Program : error",
"$$2 :",
"Program : error $$2 Denotation.seq",
"Parameters : Id.list Opt.Colon Signature",
"Parameters : Signature",
"Parameters : error",
"Opt.Colon : COLON",
"Opt.Colon :",
"Opt.Parameters : Parameters",
"Opt.Parameters :",
"Opt.Parameter.list : Opt.Parameters",
"Opt.Parameter.list : Opt.Parameter.list ';' Opt.Parameters",
"Id.list : ID",
"Id.list : Id.list ',' ID",
"Signature : ID",
"Signature : ManifestSignature",
"ManifestSignature : SIGNATURE",
"ManifestSignature : VAR BasicDenotation",
"ManifestSignature : VAL BasicDenotation",
"ManifestSignature : FuncSignature",
"ManifestSignature : TYPE '(' Opt.Simple CONSTANTS QSTRING QSTRING QSTRING UQSTRING QSTRING ')' Opt.Id '{' Opt.TypeSignatureComponent.list '}'",
"ManifestSignature : TYPE '(' Opt.Simple CONSTANTS QSTRING QSTRING QSTRING UQSTRING ')' Opt.Id '{' Opt.TypeSignatureComponent.list '}'",
"ManifestSignature : TYPE '(' Opt.Simple CONSTANTS QSTRING QSTRING QSTRING ')' Opt.Id '{' Opt.TypeSignatureComponent.list '}'",
"ManifestSignature : TYPE '(' Opt.Simple CONSTANTS QSTRING ')' Opt.Id '{' Opt.TypeSignatureComponent.list '}'",
"ManifestSignature : TYPE '(' Opt.Simple ')' Opt.Id '{' Opt.TypeSignatureComponent.list '}'",
"ManifestSignature : TYPE Opt.Id '{' Opt.TypeSignatureComponent.list '}'",
"Opt.Simple : ID",
"Opt.Simple :",
"Opt.InLine : '(' ID QSTRING ')'",
"Opt.InLine :",
"Special : '(' ID ID UQSTRING ')'",
"FuncSignature : FUNC Special Opt.InLine '[' Opt.Parameter.list ']' Signature",
"FuncSignature : FUNC Opt.InLine '[' Opt.Parameter.list ']' Signature",
"Opt.TypeSignatureComponents : TypeSignatureComponents",
"Opt.TypeSignatureComponents :",
"Opt.TypeSignatureComponent.list : Opt.TypeSignatureComponents",
"Opt.TypeSignatureComponent.list : Opt.TypeSignatureComponent.list ';' Opt.TypeSignatureComponents",
"Opt.Id : ID",
"Opt.Id :",
"TypeSignatureComponents : Id.list Opt.Colon Signature",
"TypeSignatureComponents : Id.list Opt.Colon Opt.Readonly FIELD BasicDenotation",
"TypeSignatureComponents : ID",
"TypeSignatureComponents : CHARACTERS",
"TypeSignatureComponents : error",
"Opt.Readonly : READONLY",
"Opt.Readonly :",
"Denotation : ManifestSignature",
"Denotation : BasicDenotation",
"BasicDenotation : Primary.list",
"BasicDenotation : '\\002'",
"Primary.list : Primary",
"Primary.list : ArgList",
"Primary.list : Primary.list Primary",
"Primary.list : Primary.list ArgList",
"Primary : FuncConstruction",
"Primary : Selection",
"Primary : CAND",
"Primary : COR",
"Primary : TypeConstruction",
"Primary : Primary TypeModifier",
"Primary : '(' Denotation.seq ')'",
"Primary : IF GuardedDenotation.list FI",
"Primary : DO GuardedDenotation.list OD",
"Primary : LET Opt.Declaration.list IN Denotation.seq NI",
"Primary : USE Opt.Denotation.list IN Denotation.seq NI",
"Primary : EXTERN '{' QSTRING '}'",
"Denotation.seq : Denotation.seq ';' Opt.Denotation",
"Denotation.seq : Denotation",
"Denotation.seq : error",
"Opt.Denotation : Denotation",
"Opt.Denotation :",
"FuncConstruction : IncompleteFuncSignature '{' Denotation.seq '}'",
"FuncConstruction : IncompleteFuncSignature '{' EXTERN QSTRING '}'",
"IncompleteFuncSignature : FuncSignature",
"IncompleteFuncSignature : FUNC Special Opt.InLine '[' Opt.Parameter.list ']'",
"IncompleteFuncSignature : FUNC Opt.InLine '[' Opt.Parameter.list ']'",
"Selection : Primary '$' ID Opt.SigClause",
"Selection : Primary '$' STRING",
"Selection : ID Opt.SigClause",
"Selection : STRING",
"TypeConstruction : Enumeration",
"TypeConstruction : Record",
"TypeConstruction : Extension",
"TypeConstruction : Product",
"TypeConstruction : Union",
"Guard : Denotation",
"Guard : ELSE",
"Guard : error",
"ArgList : '[' Opt.Denotation.list ']'",
"Opt.Denotation.list : Denotation",
"Opt.Denotation.list : Denotation ',' Opt.Denotation.list",
"Opt.Denotation.list :",
"Opt.Declaration.list : Opt.Declarations",
"Opt.Declaration.list : Opt.Declaration.list ';' Opt.Declarations",
"Opt.Declarations : Id.list Opt.ColonSignature EQUALS_EQUALS Denotation",
"Opt.Declarations : Id.list Opt.ColonSignature EQUALS_EQUALS_EQUALS Denotation",
"Opt.Declarations :",
"Opt.Declarations : error",
"Opt.ColonSignature : Opt.Colon Signature",
"Opt.ColonSignature :",
"Enumeration : ENUM '{' Id.list '}'",
"Extension : EXTEND '{' Denotation '}'",
"Product : PROD Opt.Id '{' Opt.Parameter.list '}'",
"Product : PROD error",
"Record : RECORD '{' Opt.RecordElement.list '}'",
"Record : RECORD error",
"Union : UNION Opt.Id '{' Opt.Parameter.list '}'",
"Union : UNION error",
"Opt.RecordElement.list : Opt.RecordElements",
"Opt.RecordElement.list : Opt.RecordElement.list ';' Opt.RecordElements",
"Opt.RecordElements : RecordElements",
"Opt.RecordElements :",
"RecordElements : Id.list Opt.Colon Denotation",
"TypeModifier : WithList",
"TypeModifier : ExportList",
"WithList : WITH Opt.Id '{' Opt.Declaration.list '}'",
"WithList : WITH error",
"ExportList : Start.ExportList Opt.Id '{' ExportElement.list '}'",
"ExportList : EXPORT error",
"ExportList : HIDE error",
"Start.ExportList : EXPORT",
"Start.ExportList : HIDE",
"ExportElement.list : ExportElement",
"ExportElement.list : ExportElement ';' ExportElement.list",
"ExportElement.list :",
"ExportElement : ID Opt.SigClause Opt.ExportList",
"ExportElement : CONSTANTS",
"ExportElement : error",
"Opt.ExportList : ExportList",
"Opt.ExportList :",
"Opt.SigClause : LEFT_ANGLE_BRACKET Signature RIGHT_ANGLE_BRACKET",
"Opt.SigClause :",
"Opt.ElseList : ElseList",
"Opt.ElseList :",
"ElseList : ELSE Denotation.seq",
"ElseList : ELSIF Denotation THEN Denotation.seq Opt.ElseList",
"GuardedDenotation.list : GuardedDenotation",
"GuardedDenotation.list : GuardedDenotation.list '#' GuardedDenotation",
"GuardedDenotation.list : Denotation THEN Denotation.seq Opt.ElseList",
"GuardedDenotation.list : error",
"GuardedDenotation : Guard RIGHT_ARROW Denotation.seq",
"ID : WORDID",
"ID : OPID",
"STRING : QSTRING",
"STRING : UQSTRING",

};
#endif

int      yydebug;
int      yynerrs;

int      yyerrflag;
int      yychar;
YYSTYPE  yyval;
YYSTYPE  yylval;

/* define the initial stack-sizes */
#ifdef YYSTACKSIZE
#undef YYMAXDEPTH
#define YYMAXDEPTH  YYSTACKSIZE
#else
#ifdef YYMAXDEPTH
#define YYSTACKSIZE YYMAXDEPTH
#else
#define YYSTACKSIZE 10000
#define YYMAXDEPTH  10000
#endif
#endif

#define YYINITSTACKSIZE 200

typedef struct {
    unsigned stacksize;
    YYINT    *s_base;
    YYINT    *s_mark;
    YYINT    *s_last;
    YYSTYPE  *l_base;
    YYSTYPE  *l_mark;
} YYSTACKDATA;
/* variables for the parser stack */
static YYSTACKDATA yystack;
#line 1258 "grammar.y"
 
in(element,list)
int element;
int list[];
{   int i;
    i = 0;
    while (element != list[i] && list[i] != LIST_END) ++i;
    return (element == list[i]);
}
 

# ifdef DEBUG
    rec_on(c)
    int c;
    {
        if ( c < 0400 ) {
            dbgmsg ( "recovery attempted on %c\n", c);
        }
        else {
            dbgmsg ( "recovery attempted on token number %d\n", c);
        }
    }
# endif

#line 957 "y.tab.c"

#if YYDEBUG
#include <stdio.h>		/* needed for printf */
#endif

#include <stdlib.h>	/* needed for malloc, etc */
#include <string.h>	/* needed for memset */

/* allocate initial stack or double stack size, up to YYMAXDEPTH */
static int yygrowstack(YYSTACKDATA *data)
{
    int i;
    unsigned newsize;
    YYINT *newss;
    YYSTYPE *newvs;

    if ((newsize = data->stacksize) == 0)
        newsize = YYINITSTACKSIZE;
    else if (newsize >= YYMAXDEPTH)
        return YYENOMEM;
    else if ((newsize *= 2) > YYMAXDEPTH)
        newsize = YYMAXDEPTH;

    i = (int) (data->s_mark - data->s_base);
    newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
    if (newss == 0)
        return YYENOMEM;

    data->s_base = newss;
    data->s_mark = newss + i;

    newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
    if (newvs == 0)
        return YYENOMEM;

    data->l_base = newvs;
    data->l_mark = newvs + i;

    data->stacksize = newsize;
    data->s_last = data->s_base + newsize - 1;
    return 0;
}

#if YYPURE || defined(YY_NO_LEAKS)
static void yyfreestack(YYSTACKDATA *data)
{
    free(data->s_base);
    free(data->l_base);
    memset(data, 0, sizeof(*data));
}
#else
#define yyfreestack(data) /* nothing */
#endif

#define YYABORT  goto yyabort
#define YYREJECT goto yyabort
#define YYACCEPT goto yyaccept
#define YYERROR  goto yyerrlab

int
YYPARSE_DECL()
{
    int yym, yyn, yystate;
#if YYDEBUG
    const char *yys;

    if ((yys = getenv("YYDEBUG")) != 0)
    {
        yyn = *yys;
        if (yyn >= '0' && yyn <= '9')
            yydebug = yyn - '0';
    }
#endif

    yynerrs = 0;
    yyerrflag = 0;
    yychar = YYEMPTY;
    yystate = 0;

#if YYPURE
    memset(&yystack, 0, sizeof(yystack));
#endif

    if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
    yystack.s_mark = yystack.s_base;
    yystack.l_mark = yystack.l_base;
    yystate = 0;
    *yystack.s_mark = 0;

yyloop:
    if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
    if (yychar < 0)
    {
        if ((yychar = YYLEX) < 0) yychar = YYEOF;
#if YYDEBUG
        if (yydebug)
        {
            yys = yyname[YYTRANSLATE(yychar)];
            printf("%sdebug: state %d, reading %d (%s)\n",
                    YYPREFIX, yystate, yychar, yys);
        }
#endif
    }
    if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
    {
#if YYDEBUG
        if (yydebug)
            printf("%sdebug: state %d, shifting to state %d\n",
                    YYPREFIX, yystate, yytable[yyn]);
#endif
        if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
        {
            goto yyoverflow;
        }
        yystate = yytable[yyn];
        *++yystack.s_mark = yytable[yyn];
        *++yystack.l_mark = yylval;
        yychar = YYEMPTY;
        if (yyerrflag > 0)  --yyerrflag;
        goto yyloop;
    }
    if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
    {
        yyn = yytable[yyn];
        goto yyreduce;
    }
    if (yyerrflag) goto yyinrecovery;

    YYERROR_CALL("syntax error");

    goto yyerrlab;

yyerrlab:
    ++yynerrs;

yyinrecovery:
    if (yyerrflag < 3)
    {
        yyerrflag = 3;
        for (;;)
        {
            if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
            {
#if YYDEBUG
                if (yydebug)
                    printf("%sdebug: state %d, error recovery shifting\
 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
#endif
                if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
                {
                    goto yyoverflow;
                }
                yystate = yytable[yyn];
                *++yystack.s_mark = yytable[yyn];
                *++yystack.l_mark = yylval;
                goto yyloop;
            }
            else
            {
#if YYDEBUG
                if (yydebug)
                    printf("%sdebug: error recovery discarding state %d\n",
                            YYPREFIX, *yystack.s_mark);
#endif
                if (yystack.s_mark <= yystack.s_base) goto yyabort;
                --yystack.s_mark;
                --yystack.l_mark;
            }
        }
    }
    else
    {
        if (yychar == YYEOF) goto yyabort;
#if YYDEBUG
        if (yydebug)
        {
            yys = yyname[YYTRANSLATE(yychar)];
            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
                    YYPREFIX, yystate, yychar, yys);
        }
#endif
        yychar = YYEMPTY;
        goto yyloop;
    }

yyreduce:
#if YYDEBUG
    if (yydebug)
        printf("%sdebug: state %d, reducing by rule %d (%s)\n",
                YYPREFIX, yystate, yyn, yyrule[yyn]);
#endif
    yym = yylen[yyn];
    if (yym)
        yyval = yystack.l_mark[1-yym];
    else
        memset(&yyval, 0, sizeof yyval);
    switch (yyn)
    {
case 1:
#line 276 "grammar.y"
	{ yyval = insrtptr; /* Remember original value */ }
break;
case 2:
#line 277 "grammar.y"

        { if (stxtree != NIL) {
            /* insert new syntax tree in standard prologue */
		if (yystack.l_mark[-1] != NIL)
		    chgfld(&(yystack.l_mark[-1] -> bld_den_seq),mklist(yystack.l_mark[0], -1));
                else
		    yyperror("No insertion marker in standard prologue");
          } else {
	    stxtree = lock(yystack.l_mark[0]);
          }
        }
break;
case 3:
#line 289 "grammar.y"
	{  yyperror("Syntax error");  }
break;
case 4:
#line 291 "grammar.y"
	{  yyperror("Syntax error");  }
break;
case 6:
#line 295 "grammar.y"

	{ 
	    NODE *p;

	    if (!yystack.l_mark[-1]) {
		yyperror("Missing colon in parameter specification");
	    }
            lock(yystack.l_mark[-2]); lock(yystack.l_mark[0]);
            if (first(yystack.l_mark[-2]) -> id_str_table_index == indx_Boolean 
                && (id_Boolean -> id_last_definition == NIL)) {
                    yyval = p = split(PARAMETER, yystack.l_mark[-2], yystack.l_mark[0]);
		    chgfld ( &(id_Boolean -> id_last_definition), first(p) );
		    /* this is the actual definition */
                    id_Boolean -> id_def_found = TRUE;
                    if (!initflag) {
                        yywarn ("No builtin type Boolean");
                    }
            } else if (first(yystack.l_mark[-2]) -> id_str_table_index == indx_Void 
                && (id_Void -> id_last_definition == NIL)) {
                    yyval = p = split(PARAMETER, yystack.l_mark[-2], yystack.l_mark[0]);
                    chgfld ( &(id_Void -> id_last_definition), first(p) );
                    id_Void -> id_def_found = TRUE;
                    if (!initflag) {
                        yywarn ("No builtin type Void");
                    }
            } else if (first(yystack.l_mark[-2]) -> id_str_table_index == indx_Integer 
                && (id_Integer -> id_last_definition == NIL)) {
                    yyval = p = split(PARAMETER, yystack.l_mark[-2], yystack.l_mark[0]);
                    chgfld ( &(id_Integer -> id_last_definition), first(p) );
                    id_Integer -> id_def_found = TRUE;
                    if (!initflag) {
                        yywarn ("No builtin type Integer");
                    }
	    } else if (first(yystack.l_mark[-2]) -> id_str_table_index == indx_Null 
		&& (id_Null -> id_last_definition == NIL)) {
                    yyval = p = split(PARAMETER, yystack.l_mark[-2], yystack.l_mark[0]);
		    chgfld ( &(id_Null -> id_last_definition), first(p) );
		    id_Null -> id_def_found = TRUE;
                    if (!initflag) {
			yywarn ("No builtin constant Null");
                    }
            } else {
                yyval = split(PARAMETER, yystack.l_mark[-2], yystack.l_mark[0]);
            }
            vfree(unlock(yystack.l_mark[-2]));  vfree(unlock(yystack.l_mark[0]));
        }
break;
case 7:
#line 341 "grammar.y"

        {  yyval = mklist( mknode(PARAMETER,NIL,yystack.l_mark[0]), -1 ); }
break;
case 8:
#line 344 "grammar.y"
	{ int i = 0;
                int c;

		yyperror("Error in Parameter Specification");
                for ( c = yychar; !in(c, paramstop); c = yylex() )
                    if ( ++i > maxskip ) break;
		yyclearin;
		switch (c) {
                    case VAL:
                    case VAR:
                    case FUNC:
                        yyunlex(c); yyunlex(';'); break;
                    case '{':
                        yyunlex(c); yyunlex(WORDID); yyunlex(VAL);
                        yyunlex(']'); break;
                    case ';':
                    case ']':
			yyunlex(c); break;
		    case EOF:
			exit(1);
                    default: /* recover at outer level */
                        yyunlex(c); yyunlex(']'); 
                }
#               ifdef DEBUG
                    if ( yydebug ) rec_on(c);
#               endif
		yyval = emptylist();
	      }
break;
case 9:
#line 376 "grammar.y"
	{ yyval = (NodeStar)TRUE; }
break;
case 10:
#line 378 "grammar.y"
	{ yyval = (NodeStar)FALSE; }
break;
case 11:
#line 381 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 12:
#line 383 "grammar.y"

        { yyval = emptylist(); }
break;
case 13:
#line 387 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 14:
#line 389 "grammar.y"

        { yyval = conc(yystack.l_mark[-2],yystack.l_mark[0]); }
break;
case 15:
#line 393 "grammar.y"

        { yyval = mklist(yystack.l_mark[0], -1); }
break;
case 16:
#line 395 "grammar.y"

        { yyval = addright(yystack.l_mark[-2],yystack.l_mark[0]); }
break;
case 17:
#line 400 "grammar.y"
	{ yyval = yystack.l_mark[0]; }
break;
case 18:
#line 402 "grammar.y"
	{ yyval = yystack.l_mark[0]; }
break;
case 19:
#line 406 "grammar.y"
	{
	  yyval = sig_Signature;
	}
break;
case 20:
#line 409 "grammar.y"
 
	{
	  yyval = mknode(VARSIGNATURE,yystack.l_mark[0]);
	}
break;
case 21:
#line 413 "grammar.y"

	{
	  yyval = mknode(VALSIGNATURE,yystack.l_mark[0]);
	}
break;
case 22:
#line 417 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 23:
#line 420 "grammar.y"

	{ 
	  if (!initflag) {
	    yywarn("Compiler directive outside initialization");
	  }
	  yyval = mknode(TYPESIGNATURE,yystack.l_mark[-3],yystack.l_mark[-1],yystack.l_mark[-9],yystack.l_mark[-8],yystack.l_mark[-7],yystack.l_mark[-5]);
	  yyval -> ts_string_max = atoi(yystack.l_mark[-6]);
	  yyval -> ts_simple_type = (int)yystack.l_mark[-11];
	}
break;
case 24:
#line 430 "grammar.y"

	{ 
	  if (!initflag) {
	    yywarn("Compiler directive outside initialization");
	  }
	  yyval = mknode(TYPESIGNATURE,yystack.l_mark[-3],yystack.l_mark[-1],yystack.l_mark[-8],yystack.l_mark[-7],yystack.l_mark[-6],NIL);
	  yyval -> ts_string_max = atoi(yystack.l_mark[-5]);
	  yyval -> ts_simple_type = (int)yystack.l_mark[-10];
	}
break;
case 25:
#line 440 "grammar.y"

	{ 
	  if (!initflag) {
	    yywarn("Compiler directive outside initialization");
	  }
	  yyval = mknode(TYPESIGNATURE,yystack.l_mark[-3],yystack.l_mark[-1],yystack.l_mark[-7],yystack.l_mark[-6],yystack.l_mark[-5],NIL);
	  yyval -> ts_string_max = -1;
	  yyval -> ts_simple_type = (int)yystack.l_mark[-9];
	}
break;
case 26:
#line 450 "grammar.y"

	{ 
	  if (!initflag) {
	    yywarn("Compiler directive outside initialization");
	  }
	  yyval = mknode(TYPESIGNATURE,yystack.l_mark[-3],yystack.l_mark[-1],yystack.l_mark[-5],NIL,NIL,NIL);
	  yyval -> ts_string_max = -1;
	  yyval -> ts_simple_type = (int)yystack.l_mark[-7];
	}
break;
case 27:
#line 460 "grammar.y"

	{ 
	  if (!initflag) {
	    yywarn("Compiler directive outside initialization");
	  }
	  yyval = mknode(TYPESIGNATURE,yystack.l_mark[-3],yystack.l_mark[-1],NIL,NIL,NIL,NIL);
	  yyval -> ts_string_max = -1;
	  yyval -> ts_simple_type = (int)yystack.l_mark[-5];
	}
break;
case 28:
#line 469 "grammar.y"

	{ 
	  yyval = mknode(TYPESIGNATURE,yystack.l_mark[-3],yystack.l_mark[-1],NIL,NIL,NIL,NIL);
	  yyval -> ts_string_max = -1;
	  yyval -> ts_simple_type = FALSE;
	}
break;
case 29:
#line 477 "grammar.y"

	{
	  if (yystack.l_mark[0] -> id_str_table_index == indx_simple) {
	    yyval = (NodeStar)TRUE;  /* simple type, no pointers to activation records */
	  } else {
	    yywarn("Compiler directive not understood");
	    yyval = (NodeStar)FALSE;
	  }
	  vfree(yystack.l_mark[0]);
	}
break;
case 30:
#line 487 "grammar.y"

	{ yyval = FALSE; }
break;
case 31:
#line 492 "grammar.y"
	{
	  if (!initflag) {
	    yywarn("Compiler directive outside initialization");
	  }
	  if (yystack.l_mark[-2] -> id_str_table_index == indx_inline) {
	    yyval = (NodeStar)((*inline_cnvt)(yystack.l_mark[-1]));
	  } else {
	    yywarn("Compiler directive not understood");
	    yyval = NIL;
	  }
	  vfree(yystack.l_mark[-2]);
	}
break;
case 32:
#line 504 "grammar.y"

	{ yyval = NIL; }
break;
case 33:
#line 509 "grammar.y"
	{
	  if (!initflag) {
	    yywarn("Compiler directive outside initialization");
	  }
	  if (yystack.l_mark[-3] -> id_str_table_index == indx_standard) {
	    int num_arg = atoi(yystack.l_mark[-1]);

	    if (yystack.l_mark[-2] -> id_str_table_index == indx_New) {
		yyval = (NodeStar)special(STD_NEW, num_arg);
	    } else if (yystack.l_mark[-2] -> id_str_table_index == indx_ptr_New) {
		yyval = (NodeStar)special(PTR_NEW, num_arg);
	    } else if (yystack.l_mark[-2] -> id_str_table_index == indx_init_New) {
		yyval = (NodeStar)special(INIT_NEW, num_arg);
	    } else if (yystack.l_mark[-2] -> id_str_table_index == indx_ValueOf) {
		yyval = (NodeStar)special(STD_VALUEOF, num_arg);
	    } else if (yystack.l_mark[-2] -> id_str_table_index == indx_assign) {
		yyval = (NodeStar)special(STD_ASSIGN, num_arg);
	    } else if (yystack.l_mark[-2] -> id_str_table_index == indx_put) {
		yyval = (NodeStar)special(STD_PUT, num_arg);
	    } else if (yystack.l_mark[-2] -> id_str_table_index == indx_Callcc) {
		yyval = (NodeStar)special(STD_CALLCC, num_arg);
	    } else if (yystack.l_mark[-2] -> id_str_table_index == indx_Array) {
		yyval = (NodeStar)special(STD_ARRAY, num_arg);
	    } else if (yystack.l_mark[-2] -> id_str_table_index == indx_passign) {
		yyval = (NodeStar)special(STD_PASSIGN, num_arg);
	    } else if (yystack.l_mark[-2] -> id_str_table_index == indx_massign) {
		yyval = (NodeStar)special(STD_MASSIGN, num_arg);
	    } else {
		yywarn("Bad standard directive");
		yyval = 0;
	    }
	  } else {
	    yywarn("Compiler directive not understood");
	    yyval = NIL;
	  }
	  vfree(yystack.l_mark[-3]); vfree(yystack.l_mark[-2]);
	}
break;
case 34:
#line 548 "grammar.y"

	{
	  yyval = mknode(FUNCSIGNATURE,yystack.l_mark[-4],yystack.l_mark[-2],yystack.l_mark[0]);
	  yyval -> fsig_special = (int)yystack.l_mark[-5];
	}
break;
case 35:
#line 553 "grammar.y"

	{
	  yyval = mknode(FUNCSIGNATURE,yystack.l_mark[-4],yystack.l_mark[-2],yystack.l_mark[0]);
	  if (yystack.l_mark[-4] != NIL) {
	    /* Remember that this is a primitive other than put or callcc */
	    yyval -> fsig_special = special(OTHER_BUILTIN, 0);
	  }
	}
break;
case 36:
#line 563 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 37:
#line 565 "grammar.y"

        { yyval = emptylist(); }
break;
case 38:
#line 569 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 39:
#line 571 "grammar.y"

        { yyval = conc(yystack.l_mark[-2],yystack.l_mark[0]); }
break;
case 40:
#line 575 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 41:
#line 577 "grammar.y"

        { yyval = NIL; }
break;
case 42:
#line 581 "grammar.y"

        { 
	    if (!yystack.l_mark[-1]) {
		yyperror("Missing colon in type component");
	    }
	  lock(yystack.l_mark[-2]); lock(yystack.l_mark[0]);
	  if (yystack.l_mark[0] -> kind == VARSIGNATURE) {
	    yyperror("Variable as type signature component");
	  }
          yyval = split(TSCOMPONENT, yystack.l_mark[-2], yystack.l_mark[0]);
          vfree(unlock(yystack.l_mark[-2])); vfree(unlock(yystack.l_mark[0]));
        }
break;
case 43:
#line 593 "grammar.y"

        {
          NODE * vl_field_sig;
          NODE * vr_field_sig;

	  if (!yystack.l_mark[-3]) {
	      yyperror("Missing colon in field specification");
	  }
          vl_field_sig = mknode(FUNCSIGNATURE,
                                NIL,  /* in-line code */
                                mklist(mknode(PARAMETER,
                                              NIL,
                                              mknode(VALSIGNATURE,
                                                     mknode(LETTERID,-1))),
                                       -1),
                                mknode(VALSIGNATURE, yystack.l_mark[0]));
          lock(yystack.l_mark[-4]); lock(yystack.l_mark[0]);
          if ( is_present(yystack.l_mark[-2]) ) {
            yyval = split(TSCOMPONENT,yystack.l_mark[-4],vl_field_sig);
          } else {
            vr_field_sig = mknode(FUNCSIGNATURE,
                                  NIL,  /* in-line code */
                                  mklist(mknode(PARAMETER,
                                                NIL,
                                                mknode(VARSIGNATURE,
                                                       mknode(LETTERID,-1))),
                                         -1),
                                  mknode(VARSIGNATURE, yystack.l_mark[0]));
            yyval = conc(split(TSCOMPONENT,yystack.l_mark[-4],vl_field_sig),
                      split(TSCOMPONENT,yystack.l_mark[-4],vr_field_sig));
          }
          vfree(unlock(yystack.l_mark[-4])); vfree(unlock(yystack.l_mark[0]));
        }
break;
case 44:
#line 626 "grammar.y"

        { 
            NODE * result;
            switch (yystack.l_mark[0] -> kind) {
                case OPRID:
                    i = yystack.l_mark[0] -> id_str_table_index;
                    if ( i == indx_assign )
                        result = mknode(TSCOMPONENT,yystack.l_mark[0],sig_assign);
                    else if (i == indx_less || i == indx_le )
                        result = mknode(TSCOMPONENT,yystack.l_mark[0],sig_less);
                    else if ( i == indx_greater || i == indx_ge )
                        result = mknode(TSCOMPONENT,yystack.l_mark[0],sig_greater);
                    else if ( i == indx_equals || i == indx_ne )
			result = mknode(TSCOMPONENT,yystack.l_mark[0],sig_equals);
		    else if ( i == indx_sconc )
			result = mknode(TSCOMPONENT,yystack.l_mark[0],sig_sconc);
		    else if ( i == indx_pconc )
			result = mknode(TSCOMPONENT,yystack.l_mark[0],sig_pconc);
                    else 
			yyperror("Missing signature");
                    break;

                case LETTERID:
                    i = yystack.l_mark[0] -> id_str_table_index;
                    if ( i == indx_New )
                        result = mknode(TSCOMPONENT,yystack.l_mark[0],sig_New);
                    else if ( i == indx_ValueOf )
                        result = mknode(TSCOMPONENT,yystack.l_mark[0],sig_ValueOf);
                    else if ( *(getname(i)) == '\'' ) /* quoted id */
                        result = mknode(TSCOMPONENT,yystack.l_mark[0],sig_const);
                    else
			yyperror("Missing signature");
                    break;

#             ifdef DEBUG
                default:
                        dbgmsg("parser: incorrect id structure");
#             endif
            }
            yyval = mklist(result,-1);
        }
break;
case 45:
#line 667 "grammar.y"

        {
            /* return a singleton list containing a DEFCHARSIGS node with */
            /* all bits corresponding to valid RUSSELL characters set. */
            /* Note machine dependence. */
		yyval = mklist(mknode(DEFCHARSIGS, RCS0, RCS1, RCS2, RCS3), -1);
	}
break;
case 46:
#line 675 "grammar.y"
	{
	    yyperror("Error in type signature component");
	    yyval = emptylist();
	}
break;
case 47:
#line 681 "grammar.y"

        { yyval = PRESENT; }
break;
case 48:
#line 683 "grammar.y"

        { yyval = NOTPRESENT; }
break;
case 49:
#line 688 "grammar.y"
	{ yyval = yystack.l_mark[0]; }
break;
case 51:
#line 692 "grammar.y"

        {
#           ifdef BAD
                if (BADflag)
                    flcheck(0,0);
                else
                    flcheck(0,1);
#           endif
            lock(yystack.l_mark[0]);
            yyval = mkappl(yystack.l_mark[0]);
            lock(yyval);
            vfree(unlock(yystack.l_mark[0]));
            unlock(yyval);
#           ifdef BAD
                if (BADflag)
                    flcheck(0,0);
                else
                    flcheck(0,1);
#           endif
        }
break;
case 52:
#line 713 "grammar.y"

        {
            if (!initflag) {
		yyperror("use of insertion character in non-initialization run");
            } else {
		yyval = insrtptr = mknode(BLOCKDENOTATION,emptylist(),NIL);
		insrtptr -> bld_precedence = INFINITE;
            }
        }
break;
case 53:
#line 724 "grammar.y"

        { yyval = mklist(yystack.l_mark[0], -1); }
break;
case 54:
#line 727 "grammar.y"
	{ yyval = mklist(yystack.l_mark[0], -1); }
break;
case 55:
#line 729 "grammar.y"
	{ yyval = addright(yystack.l_mark[-1],yystack.l_mark[0]); }
break;
case 56:
#line 731 "grammar.y"
	{ yyval = addright(yystack.l_mark[-1],yystack.l_mark[0]); }
break;
case 57:
#line 735 "grammar.y"
	{ yyval = yystack.l_mark[0]; }
break;
case 58:
#line 737 "grammar.y"
	{ yyval = yystack.l_mark[0]; }
break;
case 59:
#line 739 "grammar.y"
	{ yyval = mknode(WORDCAND); }
break;
case 60:
#line 741 "grammar.y"
	{ yyval = mknode(WORDCOR); }
break;
case 61:
#line 743 "grammar.y"
	{ yyval = yystack.l_mark[0]; }
break;
case 62:
#line 745 "grammar.y"
	{ yyval = mknode(MODPRIMARY,yystack.l_mark[-1],yystack.l_mark[0],NIL); }
break;
case 63:
#line 747 "grammar.y"
	{ int prec;
	  NODE *p;
#         ifdef DEBUG
            if ( is_empty(yystack.l_mark[-1]) ) {
                dbgmsg("parser: empty denotation seq\n");
                abort();
            }
#         endif
          if (first(yystack.l_mark[-1]) == last(yystack.l_mark[-1])) {
              /* just return the single denotation in the sequence */
                yyval = p = last(yystack.l_mark[-1]);
                lock(p);
                vfree(yystack.l_mark[-1]);
                unlock(p);
          }
          else {
              prec = precedence( last(yystack.l_mark[-1]) );
	      yyval = p = mknode(BLOCKDENOTATION,emptylist(),yystack.l_mark[-1]);
	      p -> bld_precedence = prec;
          }
        }
break;
case 64:
#line 768 "grammar.y"

        { yyval = mknode(GUARDEDLIST,yystack.l_mark[-1]); }
break;
case 65:
#line 770 "grammar.y"

        { yyval = mknode(LOOPDENOTATION,yystack.l_mark[-1]); }
break;
case 66:
#line 772 "grammar.y"

        { int prec;  NODE *p;
	  prec = precedence( last(yystack.l_mark[-1]) );
	  yyval = p = mknode(BLOCKDENOTATION,yystack.l_mark[-3],yystack.l_mark[-1]);
	  p -> bld_precedence = prec;
	}
break;
case 67:
#line 778 "grammar.y"

        { int prec;  NODE *p;
	  prec = precedence( last(yystack.l_mark[-1]) );
	  yyval = p = mknode(USELIST,yystack.l_mark[-3],yystack.l_mark[-1]);
	  p -> usl_precedence = prec;
        }
break;
case 68:
#line 784 "grammar.y"

	{
	  has_externs = TRUE;
	  yyval = mknode(REXTERNDEF, read_signature(yystack.l_mark[-1]), yystack.l_mark[-1]);
	  yyval -> sig_done = SIG_DONE;
	}
break;
case 69:
#line 792 "grammar.y"

        { yyval = addright(yystack.l_mark[-2],yystack.l_mark[0]); }
break;
case 70:
#line 794 "grammar.y"

        { yyval = mklist(yystack.l_mark[0], -1); }
break;
case 71:
#line 797 "grammar.y"
	{    int c;

		    yyperror("Error in Expression Sequence");
                    for (c = yychar; !in(c, denseqstop); c = yylex());
		    yyclearin;
		    switch(c)  {
                        case ';':
                        case '#':
			case FI:
			case ELSIF:
			case ELSE:
                        case OD:
                        case ')':
                        case 'NI':
                        case '}':
                            yyunlex(c);
                            break;
                        case IF:
                        case DO:
                        case LET:
                        case FUNC:
                        case '(':
                            yyunlex(c);
                            yyunlex(';');
                            break;
                        case WITH:
                            yyunlex(c);
                            yyunlex(WORDID);
                            yyunlex(';');
                            break;
                        case IN:
                            yyunlex(c);
                            yyunlex(LET);
                            yyunlex(';');
			    break;
			case EOF:
			    exit(1);
                        default:
                            yyunlex(c);
                    }
#                   ifdef DEBUG
                        if (yydebug) rec_on(c);
#                   endif
		    yyval = mklist(id_Integer, -1);  /* fake it */
	       }
break;
case 72:
#line 844 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 73:
#line 846 "grammar.y"

        { yyval = NIL; }
break;
case 74:
#line 850 "grammar.y"

	{ 
	  if (length(yystack.l_mark[-1]) == 1) {
	      yyval = mknode(FUNCCONSTR,yystack.l_mark[-3],first(yystack.l_mark[-1]));
	  } else {
	      yyval = mknode(FUNCCONSTR,yystack.l_mark[-3],
			      mknode(BLOCKDENOTATION,emptylist(),yystack.l_mark[-1]));
	      yyval->fc_body->bld_precedence = INFINITE; /* doesn't matter */
	  }
	  yystack.l_mark[-3] -> fsig_construction = yyval;
	  if (initflag) {
	    /* Make sure that global functions receive the same name */
	    /* in all compilations.                                  */
	    char * name = (char *)malloc(15);
	    static int global_fn_count;
	    sprintf(name, "fn_global_%d", ++ global_fn_count);
	    yyval -> fc_code_label = name;
	  }
	}
break;
case 75:
#line 869 "grammar.y"

	{
	  if (yystack.l_mark[-4] -> fsig_result_sig == NIL) {
	    yyperror("Must specify result signature for extern");
	  }
	  yyval = mknode(FUNCCONSTR, yystack.l_mark[-4], mknode(EXTERNDEF, yystack.l_mark[-1]));
	}
break;
case 76:
#line 878 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 77:
#line 880 "grammar.y"

	{ 
	  yyval = mknode(FUNCSIGNATURE, yystack.l_mark[-3], yystack.l_mark[-1], NIL);
	  yyval -> fsig_special = (int)yystack.l_mark[-4];
	}
break;
case 78:
#line 885 "grammar.y"

	{ yyval = mknode(FUNCSIGNATURE, yystack.l_mark[-3], yystack.l_mark[-1], NIL); }
break;
case 79:
#line 889 "grammar.y"

        { 
            initfld(&(yystack.l_mark[-1]->sel_type), yystack.l_mark[-3]);
            initfld(&(yystack.l_mark[-1]->signature), yystack.l_mark[0]);
            yyval = yystack.l_mark[-1];
        }
break;
case 80:
#line 895 "grammar.y"

        {
            initfld(&(yystack.l_mark[0]->sel_type), yystack.l_mark[-2]);
            yyval = yystack.l_mark[0];
        }
break;
case 81:
#line 900 "grammar.y"

        { 
            initfld(&(yystack.l_mark[-1]->signature), yystack.l_mark[0]);
            yyval = yystack.l_mark[-1];
        }
break;
case 82:
#line 905 "grammar.y"

        {
            yyval = yystack.l_mark[0];
        }
break;
case 83:
#line 911 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 84:
#line 913 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 85:
#line 915 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 86:
#line 917 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 87:
#line 919 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 88:
#line 923 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 89:
#line 925 "grammar.y"

        { yyval = mknode(WORDELSE); }
break;
case 90:
#line 928 "grammar.y"
	{ yyperror("Error while trying to parse guard"); }
break;
case 91:
#line 931 "grammar.y"

        { yyval = yystack.l_mark[-1]; }
break;
case 92:
#line 935 "grammar.y"

        { yyval = mklist(yystack.l_mark[0], -1); }
break;
case 93:
#line 937 "grammar.y"

        { yyval = addleft(yystack.l_mark[0],yystack.l_mark[-2]); }
break;
case 94:
#line 939 "grammar.y"

        { yyval = emptylist(); }
break;
case 95:
#line 943 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 96:
#line 945 "grammar.y"

        { yyval = conc(yystack.l_mark[-2],yystack.l_mark[0]); }
break;
case 97:
#line 949 "grammar.y"

        { 
            lock(yystack.l_mark[-3]); lock(yystack.l_mark[-2]); lock(yystack.l_mark[0]);
            yyval = split(DECLARATION,yystack.l_mark[-3],yystack.l_mark[0],yystack.l_mark[-2]);
            vfree(unlock(yystack.l_mark[-3])); vfree(unlock(yystack.l_mark[-2])); vfree(unlock(yystack.l_mark[0]));
        }
break;
case 98:
#line 955 "grammar.y"

        { 
	    NODE *q;
            lock(yystack.l_mark[-3]); lock(yystack.l_mark[-2]); lock(yystack.l_mark[0]);
	    yyval = q = split(DECLARATION,yystack.l_mark[-3],yystack.l_mark[0],yystack.l_mark[-2]);
	    maplist(p, q, {
		p -> decl_sig_transp = TRUE;
	    });
            vfree(unlock(yystack.l_mark[-3])); vfree(unlock(yystack.l_mark[-2])); vfree(unlock(yystack.l_mark[0]));
        }
break;
case 99:
#line 965 "grammar.y"

        { yyval = emptylist(); }
break;
case 100:
#line 967 "grammar.y"
	{ int c;
		int i = 0;

		yyperror("Error in declaration");
                for ( c = yychar; !in(c, declstop); c = yylex() )
                    if ( ++i > maxskip ) break;
                yyclearin;
                switch (c)  {
                    case EQUALS_EQUALS:
                        yyunlex(c);
                        yyunlex(WORDID);
                        yyunlex(';');
                        break;
                    case ';' :
                    case '}' :
                    case IN:
                        yyunlex(c);
                        break;
                    case NI:
                        yyunlex(c);
                        yyunlex(WORDID);
                        yyunlex(IN);
                        break;
                    case IF:
                    case DO:
                    case LET:
                    case '(':
                        yyunlex(c);
                        yyunlex(EQUALS_EQUALS);
                        yyunlex(WORDID);
			break;
		    case EOF:
			exit(1);
                    default :
                        yyunlex(c);
                        yyunlex(NI);
                        yyunlex(IN);
                }
#               ifdef DEBUG
                    if (yydebug) rec_on(c);
#               endif
		yyval = emptylist();
	      }
break;
case 101:
#line 1012 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 102:
#line 1014 "grammar.y"

        { yyval = NIL; }
break;
case 103:
#line 1018 "grammar.y"

        { yyval = mknode(ENUMERATION,yystack.l_mark[-1]); }
break;
case 104:
#line 1022 "grammar.y"

        { yyval = mknode(EXTENSION,yystack.l_mark[-1]); }
break;
case 105:
#line 1026 "grammar.y"

        { 
          maplist (s, yystack.l_mark[-1], {
            if (s -> par_id == NIL) {
		yyperror("Anonymous fields not allowed in product");
            }
          });
	  yyval = mknode(PRODCONSTRUCTION,yystack.l_mark[-3],yystack.l_mark[-1]); 
	}
break;
case 106:
#line 1036 "grammar.y"
	{ yyperror("Error in product construction"); }
break;
case 107:
#line 1039 "grammar.y"

        { yyval = mknode(RECORDCONSTRUCTION,yystack.l_mark[-1]); }
break;
case 108:
#line 1042 "grammar.y"
	{ yyperror("Error in record construction"); }
break;
case 109:
#line 1045 "grammar.y"

        {
          maplist (s, yystack.l_mark[-1], {
            if (s -> par_id == NIL) {
		yyperror("Anonymous fields not allowed in union");
            }
          });
          yyval = mknode(UNIONCONSTRUCTION,yystack.l_mark[-3],yystack.l_mark[-1]);
        }
break;
case 110:
#line 1055 "grammar.y"
	{ yyperror("Error in union construction"); }
break;
case 111:
#line 1058 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 112:
#line 1060 "grammar.y"

        { yyval = conc(yystack.l_mark[-2],yystack.l_mark[0]); }
break;
case 113:
#line 1064 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 114:
#line 1066 "grammar.y"

        { yyval = emptylist(); }
break;
case 115:
#line 1070 "grammar.y"

        { 
	    if (!yystack.l_mark[-1]) {
		yyperror("Missing colon in record element specification");
	    }
            lock(yystack.l_mark[-2]); lock(yystack.l_mark[0]);
            yyval = split(RECORDELEMENT,yystack.l_mark[-2],yystack.l_mark[0]);
            vfree(unlock(yystack.l_mark[-2])); vfree(unlock(yystack.l_mark[0]));
        }
break;
case 116:
#line 1081 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 117:
#line 1083 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 118:
#line 1087 "grammar.y"

	{ yyval = mknode(WITHLIST,yystack.l_mark[-3],yystack.l_mark[-1]); }
break;
case 119:
#line 1090 "grammar.y"
	{ yyperror("Error in \"with\" type modification"); }
break;
case 120:
#line 1093 "grammar.y"

	{ yyval = mknode(yystack.l_mark[-4],yystack.l_mark[-3],yystack.l_mark[-1]);  }
break;
case 121:
#line 1096 "grammar.y"
	{ yyperror("Error in \"export\" type modification"); }
break;
case 122:
#line 1098 "grammar.y"
	{ yyperror("Error in \"hide\" type modification"); }
break;
case 123:
#line 1101 "grammar.y"

        { yyval = (NODE *)EXPORTLIST; }
break;
case 124:
#line 1103 "grammar.y"

        { yyval = (NODE *)HIDELIST; }
break;
case 125:
#line 1107 "grammar.y"

        { yyval = mklist(yystack.l_mark[0], -1); }
break;
case 126:
#line 1109 "grammar.y"

        { yyval = addleft(yystack.l_mark[0],yystack.l_mark[-2]); }
break;
case 127:
#line 1111 "grammar.y"

        { yyval = emptylist(); }
break;
case 128:
#line 1115 "grammar.y"

        { yyval = mknode(EXPORTELEMENT,yystack.l_mark[-2],yystack.l_mark[-1],yystack.l_mark[0]); }
break;
case 129:
#line 1117 "grammar.y"

        { yyval = mknode(ALLCONSTANTS); }
break;
case 130:
#line 1120 "grammar.y"
	{ yyperror("Error in \"export\"ed or hidden element specification"); }
break;
case 131:
#line 1123 "grammar.y"

        { yyval = yystack.l_mark[0]; }
break;
case 132:
#line 1125 "grammar.y"

        { yyval = NIL; }
break;
case 133:
#line 1129 "grammar.y"

        { yyval = yystack.l_mark[-1]; }
break;
case 134:
#line 1131 "grammar.y"

        { yyval = NIL; }
break;
case 135:
#line 1136 "grammar.y"
	{ yyval = yystack.l_mark[0]; }
break;
case 136:
#line 1138 "grammar.y"
	{
	    extern NODE * appl_Null;
	    yyval = appl_Null;
	}
break;
case 137:
#line 1145 "grammar.y"
	{
	    if (length(yystack.l_mark[0]) == 1) {
		yyval = first(yystack.l_mark[0]);
	    } else {
		NODE *p = mknode(BLOCKDENOTATION, emptylist(), yystack.l_mark[0]);
		yyval = p;
		p -> bld_precedence = INFINITE; /* doesnt matter */
	    }
	}
break;
case 138:
#line 1155 "grammar.y"
	{
	    NODE * ge1;  /* First guarded element */
	    NODE * ge2;  /* Second guarded element */

	    if (length(yystack.l_mark[-1]) == 1) {
		ge1 = mknode(GUARDEDELEMENT,yystack.l_mark[-3],first(yystack.l_mark[-1]));
	    } else {
		ge1 = mknode(GUARDEDELEMENT,yystack.l_mark[-3],
			    mknode(BLOCKDENOTATION,emptylist(),yystack.l_mark[-1]));
		ge1->ge_element->bld_precedence = INFINITE; /* doesn't matter */
	    }
	    /* $5 is a denotation to be executed if orignal */
	    /* guard does not apply                         */
	    ge2 = mknode(GUARDEDELEMENT, mknode(WORDELSE), yystack.l_mark[0]);
	    yyval = mknode(GUARDEDLIST, mklist(ge1, ge2, -1));
	}
break;
case 139:
#line 1173 "grammar.y"

        { yyval = mklist(yystack.l_mark[0], -1); }
break;
case 140:
#line 1175 "grammar.y"

	{ yyval = addright(yystack.l_mark[-2],yystack.l_mark[0]); }
break;
case 141:
#line 1178 "grammar.y"
	{
	    NODE * ge1;  /* First guarded element */
	    NODE * ge2;  /* Second guarded element */

	    if (length(yystack.l_mark[-1]) == 1) {
		ge1 = mknode(GUARDEDELEMENT,yystack.l_mark[-3],first(yystack.l_mark[-1]));
	    } else {
		ge1 = mknode(GUARDEDELEMENT,yystack.l_mark[-3],
			    mknode(BLOCKDENOTATION,emptylist(),yystack.l_mark[-1]));
		ge1->ge_element->bld_precedence = INFINITE; /* doesn't matter */
	    }
	    /* $4 is a denotation to be executed if orignal */
	    /* guard does not apply                         */
	    ge2 = mknode(GUARDEDELEMENT, mknode(WORDELSE), yystack.l_mark[0]);
	    yyval = mklist(ge1, ge2, -1);
	}
break;
case 142:
#line 1195 "grammar.y"
	{   
	  int i = 0;
          int c;

	  yyperror("Error in Loop or If");
          for (c = yychar; !in(c,condstop); c = yylex() )
              if ( ++i > maxskip ) break;
          yyclearin;
          switch(c) {
              case '#' :
              case FI :
              case OD :
                  yyunlex(c); break;
	      case RIGHT_ARROW :
	      case ELSE :
	      case THEN :
              case ';' :
		  yyunlex(RIGHT_ARROW); yyunlex(WORDID); yyunlex('#'); break;
              case LET :
              case '(' :
              case DO :
              case IF :
                  yyunlex(c);
                  yyunlex(RIGHT_ARROW);
                  yyunlex(WORDID);
                  yyunlex('#');
		  break;
	      case EOF:
		  exit(1);
              default :
                  yyunlex(c); yyunlex(END);
          }
#         ifdef DEBUG
              if (yydebug) rec_on(c);
#         endif
	  yyval = emptylist();
        }
break;
case 143:
#line 1234 "grammar.y"

	{   if (length(yystack.l_mark[0]) == 1) {
		yyval = mknode(GUARDEDELEMENT,yystack.l_mark[-2],first(yystack.l_mark[0]));
	    } else {
		NODE *p = mknode(GUARDEDELEMENT,yystack.l_mark[-2],
				mknode(BLOCKDENOTATION,emptylist(),yystack.l_mark[0]));
		yyval= p;
		p->ge_element->bld_precedence = INFINITE; /* doesn't matter */
	    }
	}
break;
case 144:
#line 1246 "grammar.y"

        { yyval = mknode(LETTERID,yystack.l_mark[0]); }
break;
case 145:
#line 1248 "grammar.y"

        { yyval = mknode(OPRID,yystack.l_mark[0]); }
break;
case 146:
#line 1252 "grammar.y"

        { yyval = mknode(QSTR,yystack.l_mark[0]); }
break;
case 147:
#line 1254 "grammar.y"

        { yyval = mknode(UQSTR,yystack.l_mark[0]); }
break;
#line 2420 "y.tab.c"
    }
    yystack.s_mark -= yym;
    yystate = *yystack.s_mark;
    yystack.l_mark -= yym;
    yym = yylhs[yyn];
    if (yystate == 0 && yym == 0)
    {
#if YYDEBUG
        if (yydebug)
            printf("%sdebug: after reduction, shifting from state 0 to\
 state %d\n", YYPREFIX, YYFINAL);
#endif
        yystate = YYFINAL;
        *++yystack.s_mark = YYFINAL;
        *++yystack.l_mark = yyval;
        if (yychar < 0)
        {
            if ((yychar = YYLEX) < 0) yychar = YYEOF;
#if YYDEBUG
            if (yydebug)
            {
                yys = yyname[YYTRANSLATE(yychar)];
                printf("%sdebug: state %d, reading %d (%s)\n",
                        YYPREFIX, YYFINAL, yychar, yys);
            }
#endif
        }
        if (yychar == YYEOF) goto yyaccept;
        goto yyloop;
    }
    if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
        yystate = yytable[yyn];
    else
        yystate = yydgoto[yym];
#if YYDEBUG
    if (yydebug)
        printf("%sdebug: after reduction, shifting from state %d \
to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
#endif
    if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
    {
        goto yyoverflow;
    }
    *++yystack.s_mark = (YYINT) yystate;
    *++yystack.l_mark = yyval;
    goto yyloop;

yyoverflow:
    YYERROR_CALL("yacc stack overflow");

yyabort:
    yyfreestack(&yystack);
    return (1);

yyaccept:
    yyfreestack(&yystack);
    return (0);
}
