
/*  A Bison parser, made from parse.yy
 by  GNU Bison version 1.25
  */

#define YYBISON 1  /* Identify Bison output.  */

#define	NUMBER	258
#define	WEIGHT	259
#define	MINIMIZE	260
#define	MAXIMIZE	261
#define	HIDE	262
#define	FUNCTION	263
#define	FUNCSYMBOL	264
#define	IF	265
#define	NOT	266
#define	COMPUTE	267
#define	IDENTIFIER	268
#define	VARIABLE	269
#define	CONST	270
#define	STRING	271
#define	EXTERNAL	272
#define	SHOW	273
#define	LE	274
#define	GE	275
#define	EQ	276
#define	NEQ	277
#define	DOTS	278
#define	LT	279
#define	GT	280
#define	ASSIGN	281
#define	MOD	282
#define	COMMAS	283
#define	UMINUS	284

#line 21 "parse.yy"


#include "../config.h"
#include "parsetree.h"
#include "debug.h"
#include "term.h"
#include "symbol.h"
#include "global.h"
#ifndef ERROR_H
#include "error.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

extern int yylex(void);
extern ParseNode *logic_program;

// Turn YYDEBUG on while debugging
#if DEBUG & DBG_PARSE
#define YYDEBUG 1
#else
#define YYDEBUG 0
#endif

//#define YYERROR_VERBOSE

long lineno = 0;
long lval1 = 0, lval2 = 0;
int return_symbol = 0;
int return_funcsymbol = 1;

extern char *yytext;

void yyerror(char *st)
{
  sys_data.num_errors++;
  fprintf(stderr, "%s: %s", error_file_and_line(lineno), st);
  if (strlen(yytext))
    fprintf(stderr, " before '%s'", yytext);
  fprintf(stderr, "\n");
}


#line 66 "parse.yy"
typedef union {
   char *s;
   long l;
   ParseNode *pn;
} YYSTYPE;
#include <stdio.h>

#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif



#define	YYFINAL		224
#define	YYFLAG		-32768
#define	YYNTBASE	48

#define YYTRANSLATE(x) ((unsigned)(x) <= 284 ? yytranslate[x] : 78)

static const char yytranslate[] = {     0,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,    29,     2,    38,
    39,    34,    32,    41,    33,    42,    35,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,    40,    47,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    43,     2,    44,    31,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,    45,    30,    46,    37,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     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,    36
};

#if YYDEBUG != 0
static const short yyprhs[] = {     0,
     0,     2,     6,    10,    14,    15,    17,    19,    21,    24,
    27,    30,    32,    37,    41,    46,    49,    52,    54,    58,
    61,    63,    65,    66,    70,    72,    74,    78,    80,    84,
    86,    92,    98,   104,   110,   112,   116,   118,   120,   123,
   127,   132,   134,   138,   142,   144,   146,   150,   152,   157,
   159,   161,   162,   167,   173,   175,   179,   183,   185,   187,
   189,   191,   195,   197,   199,   201,   205,   209,   213,   217,
   220,   224,   228,   232,   236,   240,   244,   248,   252,   256,
   260,   264,   267,   271,   275,   279,   283,   285,   287,   289,
   293,   297,   300,   304,   308,   312,   316,   320,   324,   328,
   332,   336,   340,   344,   347,   351,   355,   359,   363,   365,
   367,   371,   373,   375,   376,   382,   387,   392,   394
};

static const short yyrhs[] = {    49,
     0,    49,    52,    42,     0,    49,    50,    42,     0,    49,
     1,    42,     0,     0,    51,     0,    75,     0,    76,     0,
     8,    13,     0,     4,    73,     0,     7,    73,     0,     7,
     0,    15,    13,    26,    71,     0,    15,    69,    71,     0,
    15,    14,    26,    71,     0,    17,    73,     0,    18,    73,
     0,    53,     0,    53,    10,    54,     0,    10,    54,     0,
    63,     0,    57,     0,     0,    56,    41,    54,     0,    55,
     0,    56,     0,    55,    41,    60,     0,    60,     0,    55,
    41,    72,     0,    72,     0,    64,    43,    55,    44,    64,
     0,    64,    45,    55,    46,    64,     0,    64,    45,    73,
    46,    64,     0,    64,    43,    73,    44,    64,     0,    58,
     0,    58,    30,    63,     0,    63,     0,    63,     0,    11,
    63,     0,    63,    40,    61,     0,    11,    63,    40,    61,
     0,    59,     0,    59,    26,    62,     0,    61,    40,    63,
     0,    63,     0,    72,     0,    61,    40,    72,     0,    71,
     0,    13,    38,    66,    39,     0,    13,     0,    71,     0,
     0,     9,    38,    67,    39,     0,    11,     9,    38,    67,
    39,     0,    67,     0,    66,    47,    67,     0,    67,    41,
    68,     0,    68,     0,    70,     0,    71,     0,    63,     0,
    63,    30,    71,     0,    13,     0,     3,     0,    16,     0,
    71,    23,    71,     0,    71,    28,    71,     0,    38,    71,
    39,     0,    30,    71,    30,     0,    33,    71,     0,    71,
    32,    71,     0,    71,    33,    71,     0,    71,    34,    71,
     0,    71,    35,    71,     0,    71,    27,    71,     0,    71,
    21,    71,     0,    71,    22,    71,     0,    71,    24,    71,
     0,    71,    19,    71,     0,    71,    25,    71,     0,    71,
    20,    71,     0,    37,    71,     0,    71,    29,    71,     0,
    71,    30,    71,     0,    71,    31,    71,     0,    14,    26,
    71,     0,    65,     0,    69,     0,    14,     0,    38,    71,
    39,     0,    30,    71,    30,     0,    33,    71,     0,    71,
    32,    71,     0,    71,    33,    71,     0,    71,    34,    71,
     0,    71,    35,    71,     0,    71,    27,    71,     0,    71,
    21,    71,     0,    71,    22,    71,     0,    71,    24,    71,
     0,    71,    19,    71,     0,    71,    25,    71,     0,    71,
    20,    71,     0,    37,    71,     0,    71,    29,    71,     0,
    71,    30,    71,     0,    71,    31,    71,     0,    14,    26,
    71,     0,    65,     0,    14,     0,    73,    41,    60,     0,
    60,     0,    73,     0,     0,    12,    77,    45,    74,    46,
     0,     6,    45,    74,    46,     0,     5,    45,    74,    46,
     0,    71,     0,     0
};

#endif

#if YYDEBUG != 0
static const short yyrline[] = { 0,
    99,   103,   105,   107,   109,   113,   115,   117,   121,   123,
   126,   128,   130,   145,   151,   163,   166,   170,   172,   174,
   178,   180,   182,   186,   188,   190,   194,   196,   198,   201,
   206,   209,   214,   217,   220,   232,   234,   239,   241,   243,
   245,   250,   252,   257,   259,   262,   265,   270,   274,   276,
   280,   296,   301,   303,   308,   310,   314,   316,   320,   322,
   332,   344,   364,   374,   377,   381,   413,   426,   428,   432,
   436,   438,   440,   442,   444,   446,   448,   450,   452,   454,
   456,   458,   463,   465,   467,   469,   474,   476,   478,   482,
   484,   487,   491,   493,   495,   497,   499,   501,   503,   505,
   507,   509,   511,   513,   518,   520,   522,   524,   529,   531,
   563,   565,   569,   571,   576,   581,   584,   589,   611
};
#endif


#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)

static const char * const yytname[] = {   "$","error","$undefined.","NUMBER",
"WEIGHT","MINIMIZE","MAXIMIZE","HIDE","FUNCTION","FUNCSYMBOL","IF","NOT","COMPUTE",
"IDENTIFIER","VARIABLE","CONST","STRING","EXTERNAL","SHOW","LE","GE","EQ","NEQ",
"DOTS","LT","GT","ASSIGN","MOD","COMMAS","'&'","'|'","'^'","'+'","'-'","'*'",
"'/'","UMINUS","'~'","'('","')'","':'","','","'.'","'['","']'","'{'","'}'","';'",
"program","rules","statement","declaration","rule","head","tail","basic_tail",
"special_tail","special_head","headlist","basic_literal","literal","condition_list",
"weight_def","atom","bound","function","arguments","arglist","term","constant",
"range","expr","nc_expr","literal_list","compute_list","compute_stmt","optimize_stmt",
"models", NULL
};
#endif

static const short yyr1[] = {     0,
    48,    49,    49,    49,    49,    50,    50,    50,    51,    51,
    51,    51,    51,    51,    51,    51,    51,    52,    52,    52,
    53,    53,    53,    54,    54,    54,    55,    55,    55,    55,
    56,    56,    57,    57,    57,    58,    58,    59,    59,    59,
    59,    60,    60,    61,    61,    61,    61,    62,    63,    63,
    64,    64,    65,    65,    66,    66,    67,    67,    68,    68,
    68,    68,    69,    69,    69,    70,    70,    71,    71,    71,
    71,    71,    71,    71,    71,    71,    71,    71,    71,    71,
    71,    71,    71,    71,    71,    71,    71,    71,    71,    72,
    72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
    72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
    73,    73,    74,    74,    75,    76,    76,    77,    77
};

static const short yyr2[] = {     0,
     1,     3,     3,     3,     0,     1,     1,     1,     2,     2,
     2,     1,     4,     3,     4,     2,     2,     1,     3,     2,
     1,     1,     0,     3,     1,     1,     3,     1,     3,     1,
     5,     5,     5,     5,     1,     3,     1,     1,     2,     3,
     4,     1,     3,     3,     1,     1,     3,     1,     4,     1,
     1,     0,     4,     5,     1,     3,     3,     1,     1,     1,
     1,     3,     1,     1,     1,     3,     3,     3,     3,     2,
     3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
     3,     2,     3,     3,     3,     3,     1,     1,     1,     3,
     3,     2,     3,     3,     3,     3,     3,     3,     3,     3,
     3,     3,     3,     2,     3,     3,     3,     3,     1,     1,
     3,     1,     1,     0,     5,     4,     4,     1,     0
};

static const short yydefact[] = {     5,
     0,     0,    64,     0,     0,     0,    12,     0,     0,    52,
     0,   119,    63,    89,     0,    65,     0,     0,     0,     0,
     0,     0,     0,     6,     0,    18,    22,    35,    21,     0,
    87,    88,    51,     7,     8,     4,     0,    50,    42,   112,
    38,    10,   114,   114,    11,     9,     0,     0,    89,     0,
     0,     0,     0,    20,    25,    26,    28,     0,    87,    51,
    30,     0,    63,   118,     0,     0,     0,    63,     0,     0,
    16,    17,     0,    70,    82,     0,     3,     2,    52,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,    39,     0,     0,     0,
   113,     0,     0,    61,     0,    58,    59,    60,     0,     0,
    70,    82,     0,     0,    52,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,   114,     0,    55,    86,     0,     0,    14,    69,
    68,    19,    36,     0,     0,    79,    81,    76,    77,    78,
    80,    75,    83,    84,    85,    71,    72,    73,    74,     0,
    43,    48,    40,    45,     0,    46,   111,   117,   116,     0,
    53,     0,     0,     0,   108,    69,    68,    27,    29,    24,
     0,     0,    79,    81,    76,    77,    78,    80,    75,   105,
   106,   107,    71,    72,    73,    74,     0,     0,    49,     0,
    13,    15,    52,    52,    41,     0,    62,    57,    66,    67,
    52,    52,    54,   115,    56,    34,    33,    44,    47,    31,
    32,     0,     0,     0
};

static const short yydefgoto[] = {   222,
     1,    23,    24,    25,    26,    54,    55,    56,    27,    28,
    39,    40,   163,   161,    41,    58,    31,   134,   105,   106,
    32,   107,   165,    61,   101,   102,    34,    35,    65
};

static const short yypact[] = {-32768,
   237,   -39,-32768,    51,   -28,   -20,    51,    22,     4,   291,
    49,   303,   246,    19,    57,-32768,    51,    51,   303,   303,
   303,   303,    21,-32768,    26,    62,-32768,    46,    50,    32,
-32768,-32768,   676,-32768,-32768,-32768,    90,    78,    84,-32768,
    93,   101,    51,    51,   101,-32768,   334,    -3,    15,   303,
   303,   303,   303,-32768,   110,   114,-32768,    36,   112,   693,
-32768,   119,-32768,   676,   115,   334,   303,   133,   135,   303,
   101,   101,   710,-32768,-32768,   440,-32768,-32768,   291,    90,
    51,    51,   303,   303,   303,   303,   303,   303,   303,   303,
   303,   303,   303,   303,   303,   303,   122,   303,   343,    51,
   101,   120,   121,   138,    70,-32768,-32768,   659,   303,   727,
   190,   269,   461,   291,   291,   291,   291,   303,   303,   303,
   303,   303,   303,   303,   303,   303,   303,   303,   303,   303,
   303,   334,    51,   -31,   124,   676,   303,   303,   676,   352,
-32768,-32768,-32768,    -8,   -15,    72,    72,    72,    72,    72,
    72,-32768,   744,   744,   744,   -22,   -22,-32768,-32768,   343,
-32768,   676,   130,-32768,   693,-32768,-32768,-32768,-32768,   303,
-32768,   334,   303,   303,   372,   181,   604,-32768,-32768,-32768,
     3,     7,   471,   492,   513,   534,   555,   576,   614,   389,
   406,   423,   -12,   597,   621,   631,    74,   128,-32768,   334,
   676,   676,   303,   303,   130,   343,   676,-32768,   676,   676,
   303,   303,-32768,-32768,   124,-32768,-32768,-32768,-32768,-32768,
-32768,   176,   182,-32768
};

static const short yypgoto[] = {-32768,
-32768,-32768,-32768,-32768,-32768,   -75,    24,-32768,-32768,-32768,
-32768,    64,    23,-32768,    97,     1,    33,-32768,   -65,    13,
   171,-32768,    -1,   -60,    20,   -37,-32768,-32768,-32768
};


#define	YYLAST		779


static const short yytable[] = {    33,
   135,    30,    36,   142,    89,    62,   103,   199,    60,    38,
    64,    95,    96,   -93,    89,   200,    43,    73,    74,    75,
    76,    95,    96,    42,    44,   100,    45,   -93,   -93,   -93,
   204,   -93,   100,   -93,    46,   203,    71,    72,   166,   180,
   109,    47,    59,   114,    67,   108,   211,   114,   110,   111,
   112,   113,   212,   179,  -110,  -110,  -110,    62,  -110,     3,
  -110,    37,    77,    38,   108,   136,   197,    78,   139,    68,
    69,    79,    16,    57,    81,    80,    82,    60,   116,   -37,
   117,   146,   147,   148,   149,   150,   151,   152,   153,   154,
   155,   156,   157,   158,   159,   198,   162,    29,    89,   166,
   144,   145,    38,    93,    94,    95,    96,   175,   171,    98,
   172,    59,   213,    60,   172,    66,   183,   184,   185,   186,
   187,   188,   189,   190,   191,   192,   193,   194,   195,   196,
   108,    59,    99,    97,   215,   201,   202,  -109,   154,   181,
   182,   100,    57,   104,    97,   219,    59,    59,    59,    59,
   114,  -109,  -109,  -109,   115,  -109,   132,  -109,   137,   133,
   138,   160,   104,   167,   172,   168,   169,   170,   207,   206,
   108,   209,   210,   214,   154,   223,   143,   178,    57,    57,
    57,   224,   205,     3,   208,    70,     0,     0,     0,     9,
     0,    11,    59,    63,    14,   164,    16,     0,   108,     0,
     0,    33,    33,   216,   217,     0,   -91,     0,     0,    33,
    33,   220,   221,    20,     0,   -92,     0,    21,    22,     0,
   -91,   -91,   -91,     0,   -91,     0,   -91,     0,   104,   -92,
   -92,   -92,     0,   -92,     0,   -92,    -1,     2,    59,     3,
     4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
    14,    15,    16,    17,    18,   -50,   164,     0,     0,     0,
     0,     0,     0,     0,     0,     0,    19,     0,   104,    20,
     0,   -50,     0,    21,    22,   -50,     0,     0,   -23,   -52,
     0,   -52,     0,    66,   -50,   -50,   -50,   -50,     0,   -50,
     0,   -50,   -50,     3,  -104,     0,   104,     0,     0,     9,
     0,    48,   218,    13,    49,     3,    16,     0,  -104,  -104,
  -104,     9,  -104,    11,  -104,    63,    14,     0,    16,     0,
    50,     0,     0,    51,     0,     0,     0,    52,    53,     0,
     0,     0,    19,     0,     0,    20,     3,     0,     0,    21,
    22,     0,     9,     0,    11,     3,    13,    14,     0,    16,
     0,     9,     0,    11,     3,    13,    49,     0,    16,     0,
     9,     0,    11,    19,    63,    14,    20,    16,     0,     0,
    21,    22,    50,     0,     0,    51,     0,     0,     0,    52,
    53,     0,     0,     0,    20,     0,     0,     0,    21,    22,
    83,    84,    85,    86,     0,    87,    88,     0,    89,     0,
    90,    91,    92,    93,    94,    95,    96,    83,    84,    85,
    86,     0,    87,    88,   -86,    89,   -86,   -83,   -83,   -83,
    93,    94,    95,    96,    83,    84,    85,    86,     0,    87,
    88,   -83,    89,   -83,   -84,   -84,   -84,    93,    94,    95,
    96,    83,    84,    85,    86,     0,    87,    88,   -84,    89,
   -84,   -85,   -85,   -85,    93,    94,    95,    96,    83,    84,
    85,    86,     0,    87,    88,   -85,    89,   -85,    90,    91,
    92,    93,    94,    95,    96,     0,     0,     0,   141,    83,
    84,    85,    86,     0,    87,    88,     0,    89,     0,    90,
    91,    92,    93,    94,    95,    96,  -101,    89,     0,   177,
     0,     0,    93,    94,    95,    96,     0,     0,     0,     0,
  -101,  -101,  -101,     0,  -101,     0,  -101,  -103,    89,     0,
     0,     0,     0,    93,    94,    95,    96,     0,     0,     0,
     0,  -103,  -103,  -103,     0,  -103,     0,  -103,   -98,    89,
     0,     0,     0,     0,    93,    94,    95,    96,     0,     0,
     0,     0,   -98,   -98,   -98,     0,   -98,     0,   -98,   -99,
    89,     0,     0,     0,     0,    93,    94,    95,    96,     0,
     0,     0,     0,   -99,   -99,   -99,     0,   -99,     0,   -99,
  -100,    89,     0,     0,     0,     0,    93,    94,    95,    96,
     0,     0,     0,     0,  -100,  -100,  -100,     0,  -100,     0,
  -100,  -102,    89,     0,     0,     0,     0,    93,    94,    95,
    96,     0,     0,     0,     0,  -102,  -102,  -102,     0,  -102,
     0,  -102,   -94,    89,     0,     0,     0,     0,     0,   -90,
    95,    96,     0,     0,     0,     0,   -94,   -94,   -94,   -97,
   -94,     0,   -94,   -90,   -90,   -90,   -95,   -90,     0,   -90,
     0,     0,     0,   -97,   -97,   -97,   -96,   -97,     0,   -97,
   -95,   -95,   -95,     0,   -95,     0,   -95,     0,     0,     0,
   -96,   -96,   -96,     0,   -96,     0,   -96,    83,    84,    85,
    86,   173,    87,    88,     0,    89,   174,    90,    91,    92,
    93,    94,    95,    96,    83,    84,    85,    86,     0,    87,
    88,     0,    89,     0,    90,    91,    92,    93,    94,    95,
    96,   118,   119,   120,   121,     0,   122,   123,     0,   124,
     0,   125,   126,   127,   128,   129,   130,   131,    83,    84,
    85,    86,     0,    87,    88,     0,    89,     0,    90,   140,
    92,    93,    94,    95,    96,    83,    84,    85,    86,     0,
    87,    88,     0,    89,     0,    90,   176,    92,    93,    94,
    95,    96,    83,    84,    85,    86,     0,    87,    88,     0,
    89,     0,     0,     0,     0,    93,    94,    95,    96
};

static const short yycheck[] = {     1,
    66,     1,    42,    79,    27,     9,    44,    39,    10,    13,
    12,    34,    35,    26,    27,    47,    45,    19,    20,    21,
    22,    34,    35,     4,    45,    41,     7,    40,    41,    42,
    46,    44,    41,    46,    13,    44,    17,    18,    99,   115,
    26,    38,    10,    41,    26,    47,    44,    41,    50,    51,
    52,    53,    46,   114,    40,    41,    42,     9,    44,     3,
    46,    11,    42,    13,    66,    67,   132,    42,    70,    13,
    14,    10,    16,    10,    43,    30,    45,    79,    43,    30,
    45,    83,    84,    85,    86,    87,    88,    89,    90,    91,
    92,    93,    94,    95,    96,   133,    98,     1,    27,   160,
    81,    82,    13,    32,    33,    34,    35,   109,    39,    26,
    41,    79,    39,   115,    41,    38,   118,   119,   120,   121,
   122,   123,   124,   125,   126,   127,   128,   129,   130,   131,
   132,    99,    40,    37,   200,   137,   138,    26,   140,   116,
   117,    41,    79,    47,    48,   206,   114,   115,   116,   117,
    41,    40,    41,    42,    41,    44,    38,    46,    26,    45,
    26,    40,    66,   100,    41,    46,    46,    30,   170,    40,
   172,   173,   174,    46,   176,     0,    80,   114,   115,   116,
   117,     0,   160,     3,   172,    15,    -1,    -1,    -1,     9,
    -1,    11,   160,    13,    14,    99,    16,    -1,   200,    -1,
    -1,   203,   204,   203,   204,    -1,    26,    -1,    -1,   211,
   212,   211,   212,    33,    -1,    26,    -1,    37,    38,    -1,
    40,    41,    42,    -1,    44,    -1,    46,    -1,   132,    40,
    41,    42,    -1,    44,    -1,    46,     0,     1,   206,     3,
     4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
    14,    15,    16,    17,    18,    10,   160,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    30,    -1,   172,    33,
    -1,    26,    -1,    37,    38,    30,    -1,    -1,    42,    43,
    -1,    45,    -1,    38,    39,    40,    41,    42,    -1,    44,
    -1,    46,    47,     3,    26,    -1,   200,    -1,    -1,     9,
    -1,    11,   206,    13,    14,     3,    16,    -1,    40,    41,
    42,     9,    44,    11,    46,    13,    14,    -1,    16,    -1,
    30,    -1,    -1,    33,    -1,    -1,    -1,    37,    38,    -1,
    -1,    -1,    30,    -1,    -1,    33,     3,    -1,    -1,    37,
    38,    -1,     9,    -1,    11,     3,    13,    14,    -1,    16,
    -1,     9,    -1,    11,     3,    13,    14,    -1,    16,    -1,
     9,    -1,    11,    30,    13,    14,    33,    16,    -1,    -1,
    37,    38,    30,    -1,    -1,    33,    -1,    -1,    -1,    37,
    38,    -1,    -1,    -1,    33,    -1,    -1,    -1,    37,    38,
    19,    20,    21,    22,    -1,    24,    25,    -1,    27,    -1,
    29,    30,    31,    32,    33,    34,    35,    19,    20,    21,
    22,    -1,    24,    25,    43,    27,    45,    29,    30,    31,
    32,    33,    34,    35,    19,    20,    21,    22,    -1,    24,
    25,    43,    27,    45,    29,    30,    31,    32,    33,    34,
    35,    19,    20,    21,    22,    -1,    24,    25,    43,    27,
    45,    29,    30,    31,    32,    33,    34,    35,    19,    20,
    21,    22,    -1,    24,    25,    43,    27,    45,    29,    30,
    31,    32,    33,    34,    35,    -1,    -1,    -1,    39,    19,
    20,    21,    22,    -1,    24,    25,    -1,    27,    -1,    29,
    30,    31,    32,    33,    34,    35,    26,    27,    -1,    39,
    -1,    -1,    32,    33,    34,    35,    -1,    -1,    -1,    -1,
    40,    41,    42,    -1,    44,    -1,    46,    26,    27,    -1,
    -1,    -1,    -1,    32,    33,    34,    35,    -1,    -1,    -1,
    -1,    40,    41,    42,    -1,    44,    -1,    46,    26,    27,
    -1,    -1,    -1,    -1,    32,    33,    34,    35,    -1,    -1,
    -1,    -1,    40,    41,    42,    -1,    44,    -1,    46,    26,
    27,    -1,    -1,    -1,    -1,    32,    33,    34,    35,    -1,
    -1,    -1,    -1,    40,    41,    42,    -1,    44,    -1,    46,
    26,    27,    -1,    -1,    -1,    -1,    32,    33,    34,    35,
    -1,    -1,    -1,    -1,    40,    41,    42,    -1,    44,    -1,
    46,    26,    27,    -1,    -1,    -1,    -1,    32,    33,    34,
    35,    -1,    -1,    -1,    -1,    40,    41,    42,    -1,    44,
    -1,    46,    26,    27,    -1,    -1,    -1,    -1,    -1,    26,
    34,    35,    -1,    -1,    -1,    -1,    40,    41,    42,    26,
    44,    -1,    46,    40,    41,    42,    26,    44,    -1,    46,
    -1,    -1,    -1,    40,    41,    42,    26,    44,    -1,    46,
    40,    41,    42,    -1,    44,    -1,    46,    -1,    -1,    -1,
    40,    41,    42,    -1,    44,    -1,    46,    19,    20,    21,
    22,    23,    24,    25,    -1,    27,    28,    29,    30,    31,
    32,    33,    34,    35,    19,    20,    21,    22,    -1,    24,
    25,    -1,    27,    -1,    29,    30,    31,    32,    33,    34,
    35,    19,    20,    21,    22,    -1,    24,    25,    -1,    27,
    -1,    29,    30,    31,    32,    33,    34,    35,    19,    20,
    21,    22,    -1,    24,    25,    -1,    27,    -1,    29,    30,
    31,    32,    33,    34,    35,    19,    20,    21,    22,    -1,
    24,    25,    -1,    27,    -1,    29,    30,    31,    32,    33,
    34,    35,    19,    20,    21,    22,    -1,    24,    25,    -1,
    27,    -1,    -1,    -1,    -1,    32,    33,    34,    35
};
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
#line 3 "/usr/share/misc/bison.simple"

/* Skeleton output parser for bison,
   Copyright (C) 1984, 1989, 1990 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 2, 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, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

/* As a special exception, when this file is copied by Bison into a
   Bison output file, you may use that output file without restriction.
   This special exception was added by the Free Software Foundation
   in version 1.24 of Bison.  */

#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C.  */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
#include <alloca.h>
#else /* not sparc */
#if defined (MSDOS) && !defined (__TURBOC__)
#include <malloc.h>
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>
 #pragma alloca
#else /* not MSDOS, __TURBOC__, or _AIX */
#ifdef __hpux
#ifdef __cplusplus
extern "C" {
void *alloca (unsigned int);
};
#else /* not __cplusplus */
void *alloca ();
#endif /* not __cplusplus */
#endif /* __hpux */
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc.  */
#endif /* not GNU C.  */
#endif /* alloca not defined.  */

/* This is the parser code that is written into each bison parser
  when the %semantic_parser declaration is not specified in the grammar.
  It was written by Richard Stallman by simplifying the hairy parser
  used when %semantic_parser is specified.  */

/* Note: there must be only one dollar sign in this file.
   It is replaced by the list of actions, each action
   as one case of the switch.  */

#define yyerrok		(yyerrstatus = 0)
#define yyclearin	(yychar = YYEMPTY)
#define YYEMPTY		-2
#define YYEOF		0
#define YYACCEPT	return(0)
#define YYABORT 	return(1)
#define YYERROR		goto yyerrlab1
/* Like YYERROR except do call yyerror.
   This remains here temporarily to ease the
   transition to the new meaning of YYERROR, for GCC.
   Once GCC version 2 has supplanted version 1, this can go.  */
#define YYFAIL		goto yyerrlab
#define YYRECOVERING()  (!!yyerrstatus)
#define YYBACKUP(token, value) \
do								\
  if (yychar == YYEMPTY && yylen == 1)				\
    { yychar = (token), yylval = (value);			\
      yychar1 = YYTRANSLATE (yychar);				\
      YYPOPSTACK;						\
      goto yybackup;						\
    }								\
  else								\
    { yyerror ("syntax error: cannot back up"); YYERROR; }	\
while (0)

#define YYTERROR	1
#define YYERRCODE	256

#ifndef YYPURE
#define YYLEX		yylex()
#endif

#ifdef YYPURE
#ifdef YYLSP_NEEDED
#ifdef YYLEX_PARAM
#define YYLEX		yylex(&yylval, &yylloc, YYLEX_PARAM)
#else
#define YYLEX		yylex(&yylval, &yylloc)
#endif
#else /* not YYLSP_NEEDED */
#ifdef YYLEX_PARAM
#define YYLEX		yylex(&yylval, YYLEX_PARAM)
#else
#define YYLEX		yylex(&yylval)
#endif
#endif /* not YYLSP_NEEDED */
#endif

/* If nonreentrant, generate the variables here */

#ifndef YYPURE

int	yychar;			/*  the lookahead symbol		*/
YYSTYPE	yylval;			/*  the semantic value of the		*/
				/*  lookahead symbol			*/

#ifdef YYLSP_NEEDED
YYLTYPE yylloc;			/*  location data for the lookahead	*/
				/*  symbol				*/
#endif

int yynerrs;			/*  number of parse errors so far       */
#endif  /* not YYPURE */

#if YYDEBUG != 0
int yydebug;			/*  nonzero means print parse trace	*/
/* Since this is uninitialized, it does not stop multiple parsers
   from coexisting.  */
#endif

/*  YYINITDEPTH indicates the initial size of the parser's stacks	*/

#ifndef	YYINITDEPTH
#define YYINITDEPTH 200
#endif

/*  YYMAXDEPTH is the maximum size the stacks can grow to
    (effective only if the built-in stack extension method is used).  */

#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif

/* Prevent warning if -Wstrict-prototypes.  */
#ifdef __GNUC__
#ifndef YYPARSE_PARAM
int yyparse (void);
#endif
#endif

#if __GNUC__ > 1		/* GNU C and GNU C++ define this.  */
#define __yy_memcpy(TO,FROM,COUNT)	__builtin_memcpy(TO,FROM,COUNT)
#else				/* not GNU C or C++ */
#ifndef __cplusplus

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__yy_memcpy (to, from, count)
     char *to;
     char *from;
     int count;
{
  register char *f = from;
  register char *t = to;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#else /* __cplusplus */

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__yy_memcpy (char *to, char *from, int count)
{
  register char *f = from;
  register char *t = to;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#endif
#endif

#line 196 "/usr/share/misc/bison.simple"

/* The user can define YYPARSE_PARAM as the name of an argument to be passed
   into yyparse.  The argument should have type void *.
   It should actually point to an object.
   Grammar actions can access the variable by casting it
   to the proper pointer type.  */

#ifdef YYPARSE_PARAM
#ifdef __cplusplus
#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
#define YYPARSE_PARAM_DECL
#else /* not __cplusplus */
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
#endif /* not __cplusplus */
#else /* not YYPARSE_PARAM */
#define YYPARSE_PARAM_ARG
#define YYPARSE_PARAM_DECL
#endif /* not YYPARSE_PARAM */

int
yyparse(YYPARSE_PARAM_ARG)
     YYPARSE_PARAM_DECL
{
  register int yystate;
  register int yyn;
  register short *yyssp;
  register YYSTYPE *yyvsp;
  int yyerrstatus;	/*  number of tokens to shift before error messages enabled */
  int yychar1 = 0;		/*  lookahead token as an internal (translated) token number */

  short	yyssa[YYINITDEPTH];	/*  the state stack			*/
  YYSTYPE yyvsa[YYINITDEPTH];	/*  the semantic value stack		*/

  short *yyss = yyssa;		/*  refer to the stacks thru separate pointers */
  YYSTYPE *yyvs = yyvsa;	/*  to allow yyoverflow to reallocate them elsewhere */

#ifdef YYLSP_NEEDED
  YYLTYPE yylsa[YYINITDEPTH];	/*  the location stack			*/
  YYLTYPE *yyls = yylsa;
  YYLTYPE *yylsp;

#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
#else
#define YYPOPSTACK   (yyvsp--, yyssp--)
#endif

  int yystacksize = YYINITDEPTH;

#ifdef YYPURE
  int yychar;
  YYSTYPE yylval;
  int yynerrs;
#ifdef YYLSP_NEEDED
  YYLTYPE yylloc;
#endif
#endif

  YYSTYPE yyval;		/*  the variable used to return		*/
				/*  semantic values from the action	*/
				/*  routines				*/

  int yylen;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Starting parse\n");
#endif

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY;		/* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */

  yyssp = yyss - 1;
  yyvsp = yyvs;
#ifdef YYLSP_NEEDED
  yylsp = yyls;
#endif

/* Push a new state, which is found in  yystate  .  */
/* In all cases, when you get here, the value and location stacks
   have just been pushed. so pushing a state here evens the stacks.  */
yynewstate:

  *++yyssp = yystate;

  if (yyssp >= yyss + yystacksize - 1)
    {
      /* Give user a chance to reallocate the stack */
      /* Use copies of these so that the &'s don't force the real ones into memory. */
      YYSTYPE *yyvs1 = yyvs;
      short *yyss1 = yyss;
#ifdef YYLSP_NEEDED
      YYLTYPE *yyls1 = yyls;
#endif

      /* Get the current used size of the three stacks, in elements.  */
      int size = yyssp - yyss + 1;

#ifdef yyoverflow
      /* Each stack pointer address is followed by the size of
	 the data in use in that stack, in bytes.  */
#ifdef YYLSP_NEEDED
      /* This used to be a conditional around just the two extra args,
	 but that might be undefined if yyoverflow is a macro.  */
      yyoverflow("parser stack overflow",
		 &yyss1, size * sizeof (*yyssp),
		 &yyvs1, size * sizeof (*yyvsp),
		 &yyls1, size * sizeof (*yylsp),
		 &yystacksize);
#else
      yyoverflow("parser stack overflow",
		 &yyss1, size * sizeof (*yyssp),
		 &yyvs1, size * sizeof (*yyvsp),
		 &yystacksize);
#endif

      yyss = yyss1; yyvs = yyvs1;
#ifdef YYLSP_NEEDED
      yyls = yyls1;
#endif
#else /* no yyoverflow */
      /* Extend the stack our own way.  */
      if (yystacksize >= YYMAXDEPTH)
	{
	  yyerror("parser stack overflow");
	  return 2;
	}
      yystacksize *= 2;
      if (yystacksize > YYMAXDEPTH)
	yystacksize = YYMAXDEPTH;
      yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
      __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
      yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
      __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
#ifdef YYLSP_NEEDED
      yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
      __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
#endif
#endif /* no yyoverflow */

      yyssp = yyss + size - 1;
      yyvsp = yyvs + size - 1;
#ifdef YYLSP_NEEDED
      yylsp = yyls + size - 1;
#endif

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Stack size increased to %d\n", yystacksize);
#endif

      if (yyssp >= yyss + yystacksize - 1)
	YYABORT;
    }

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Entering state %d\n", yystate);
#endif

  goto yybackup;
 yybackup:

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

  /* First try to decide what to do without reference to lookahead token.  */

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yydefault;

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

  /* yychar is either YYEMPTY or YYEOF
     or a valid token in external form.  */

  if (yychar == YYEMPTY)
    {
#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Reading a token: ");
#endif
      yychar = YYLEX;
    }

  /* Convert token to internal form (in yychar1) for indexing tables with */

  if (yychar <= 0)		/* This means end of input. */
    {
      yychar1 = 0;
      yychar = YYEOF;		/* Don't call YYLEX any more */

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Now at end of input.\n");
#endif
    }
  else
    {
      yychar1 = YYTRANSLATE(yychar);

#if YYDEBUG != 0
      if (yydebug)
	{
	  fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
	  /* Give the individual parser a way to print the precise meaning
	     of a token, for further debugging info.  */
#ifdef YYPRINT
	  YYPRINT (stderr, yychar, yylval);
#endif
	  fprintf (stderr, ")\n");
	}
#endif
    }

  yyn += yychar1;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
    goto yydefault;

  yyn = yytable[yyn];

  /* yyn is what to do for this token type in this state.
     Negative => reduce, -yyn is rule number.
     Positive => shift, yyn is new state.
       New state is final state => don't bother to shift,
       just return success.
     0, or most negative number => error.  */

  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrlab;

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
#endif

  /* Discard the token being shifted unless it is eof.  */
  if (yychar != YYEOF)
    yychar = YYEMPTY;

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

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

  yystate = yyn;
  goto yynewstate;

/* Do the default action for the current state.  */
yydefault:

  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;

/* Do a reduction.  yyn is the number of a rule to reduce with.  */
yyreduce:
  yylen = yyr2[yyn];
  if (yylen > 0)
    yyval = yyvsp[1-yylen]; /* implement default value of the action */

#if YYDEBUG != 0
  if (yydebug)
    {
      int i;

      fprintf (stderr, "Reducing via rule %d (line %d), ",
	       yyn, yyrline[yyn]);

      /* Print the symbols being reduced, and their result.  */
      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
	fprintf (stderr, "%s ", yytname[yyrhs[i]]);
      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
    }
#endif


  switch (yyn) {

case 1:
#line 100 "parse.yy"
{ logic_program = yyvsp[0].pn; ;
    break;}
case 2:
#line 104 "parse.yy"
{ yyval.pn = new ParseNode(PT_RULES, NULL, yyvsp[-1].pn, yyvsp[-2].pn, lineno); ;
    break;}
case 3:
#line 106 "parse.yy"
{ yyval.pn = new ParseNode(PT_RULES, NULL, yyvsp[-1].pn, yyvsp[-2].pn, lineno); ;
    break;}
case 4:
#line 108 "parse.yy"
{ yyerrok; ;
    break;}
case 5:
#line 110 "parse.yy"
{ yyval.pn = NULL; ;
    break;}
case 6:
#line 114 "parse.yy"
{ yyval.pn = yyvsp[0].pn; ;
    break;}
case 7:
#line 116 "parse.yy"
{ yyval.pn = yyvsp[0].pn; ;
    break;}
case 8:
#line 118 "parse.yy"
{ yyval.pn = yyvsp[0].pn; ;
    break;}
case 9:
#line 122 "parse.yy"
{ function_table->Insert(yyvsp[0].s); yyval.pn = NULL; free(yyvsp[0].s);;
    break;}
case 10:
#line 124 "parse.yy"
{ yyval.pn = new ParseNode(PT_DECLARATION, NULL, NULL, yyvsp[0].pn, 
	                         lineno); ;
    break;}
case 11:
#line 127 "parse.yy"
{ yyval.pn = new ParseNode(PT_HIDE, NULL, yyvsp[0].pn, NULL, lineno); ;
    break;}
case 12:
#line 129 "parse.yy"
{ yyval.pn = NULL; sys_data.hide_all = 1; ;
    break;}
case 13:
#line 131 "parse.yy"
{ numeric_constant_table->Insert(yyvsp[-2].s);
              lval1 = yyvsp[0].pn->Eval();
              if (lval1 == ERROR_NUMBER) {
                 error(USR_ERR, "%s: Invalid constant declaration: ",
                       error_file_and_line(lineno));
                 fprintf(stderr, "\t\tconst %s = ", yyvsp[-2].s);
                 yyvsp[0].pn->PrintExpression();
                 fprintf(stderr, ".\n   The expression is not a"
    	                 " valid constant expression\n");
              }	 
              numeric_constant_table->SetValue(yyvsp[-2].s, lval1);
	      free(yyvsp[-2].s);
              delete yyvsp[0].pn;
              yyval.pn = NULL; ;
    break;}
case 14:
#line 146 "parse.yy"
{ yyerror("numeric constant declarations now need a '='");
	      yyval.pn = NULL;
	      free(yyvsp[-1].pn);
              delete yyvsp[0].pn;
	    ;
    break;}
case 15:
#line 152 "parse.yy"
{
              error(USR_ERR, "%s: Invalid constant declaration: ",
                    error_file_and_line(lineno));
              fprintf(stderr, "\t\tconst %s = ", yyvsp[-2].s);
              yyvsp[0].pn->PrintExpression();
              fprintf(stderr, ".\n   The symbol '%s' is a variable, not"
	              " a constant\n", yyvsp[-2].s);
              yyval.pn = NULL;
              free(yyvsp[-2].s);
              delete yyvsp[0].pn;
            ;
    break;}
case 16:
#line 164 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXTERNAL, NULL, yyvsp[0].pn, NULL, lineno);
	    ;
    break;}
case 17:
#line 167 "parse.yy"
{ yyval.pn = new ParseNode(PT_SHOW, NULL, yyvsp[0].pn, NULL, lineno); ;
    break;}
case 18:
#line 171 "parse.yy"
{ yyval.pn = new ParseNode(PT_RULE, NULL, yyvsp[0].pn, NULL, lineno); ;
    break;}
case 19:
#line 173 "parse.yy"
{ yyval.pn = new ParseNode(PT_RULE, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno); ;
    break;}
case 20:
#line 175 "parse.yy"
{ yyval.pn = new ParseNode(PT_RULE, NULL, NULL, yyvsp[0].pn, lineno); ;
    break;}
case 21:
#line 179 "parse.yy"
{ yyval.pn = yyvsp[0].pn; ;
    break;}
case 22:
#line 181 "parse.yy"
{ yyval.pn = yyvsp[0].pn; ;
    break;}
case 23:
#line 183 "parse.yy"
{ yyval.pn = NULL; ;
    break;}
case 24:
#line 187 "parse.yy"
{ yyval.pn = new ParseNode(PT_TAIL, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno); ;
    break;}
case 25:
#line 189 "parse.yy"
{ yyval.pn = new ParseNode(PT_TAIL, NULL, yyvsp[0].pn, NULL, lineno); ;
    break;}
case 26:
#line 191 "parse.yy"
{ yyval.pn = new ParseNode(PT_TAIL, NULL, yyvsp[0].pn, NULL, lineno); ;
    break;}
case 27:
#line 195 "parse.yy"
{ yyval.pn = new ParseNode(PT_BASIC_TAIL, NULL, yyvsp[0].pn, yyvsp[-2].pn, lineno);;
    break;}
case 28:
#line 197 "parse.yy"
{ yyval.pn = new ParseNode(PT_BASIC_TAIL, NULL, yyvsp[0].pn, NULL, lineno);;
    break;}
case 29:
#line 199 "parse.yy"
{ yyval.pn = new ParseNode(PT_BASIC_TAIL, NULL, yyvsp[0].pn, yyvsp[-2].pn, lineno);
             if (yyvsp[0].pn->type == PT_CONSTANT) yyvsp[0].pn->type = PT_ATOM; ;
    break;}
case 30:
#line 202 "parse.yy"
{ yyval.pn = new ParseNode(PT_BASIC_TAIL, NULL, yyvsp[0].pn, NULL,
                                lineno); ;
    break;}
case 31:
#line 207 "parse.yy"
{ yyval.pn = new ParseNode(PT_SPECIAL_TAIL, NULL, NULL, yyvsp[-2].pn,
  	                          lineno, yyvsp[-4].l, yyvsp[0].l, 1); ;
    break;}
case 32:
#line 210 "parse.yy"
{ yyval.pn = new ParseNode(PT_SPECIAL_TAIL, NULL, NULL, yyvsp[-2].pn,
  	                          lineno, yyvsp[-4].l, yyvsp[0].l); ;
    break;}
case 33:
#line 215 "parse.yy"
{ yyval.pn = new ParseNode(PT_SPECIAL_HEAD, NULL, NULL, yyvsp[-2].pn,
  	                          lineno, yyvsp[-4].l, yyvsp[0].l); ;
    break;}
case 34:
#line 218 "parse.yy"
{ yyval.pn = new ParseNode(PT_SPECIAL_HEAD, NULL, NULL, yyvsp[-2].pn,
  	                          lineno, yyvsp[-4].l, yyvsp[0].l,1); ;
    break;}
case 35:
#line 221 "parse.yy"
{ 
	        if (!sys_data.dlp_semantics) {
                  yyval.pn = new ParseNode(PT_SPECIAL_HEAD, NULL, NULL, yyvsp[0].pn, 
  	                             lineno, 1, 1); 
                } else {
                  yyval.pn = new ParseNode(PT_SPECIAL_HEAD, NULL, NULL, yyvsp[0].pn, 
  	                             lineno, 0, ERROR_NUMBER); 
                }
             ;
    break;}
case 36:
#line 233 "parse.yy"
{ yyval.pn = new ParseNode(PT_LITERAL_LIST, NULL, yyvsp[0].pn, yyvsp[-2].pn, lineno); ;
    break;}
case 37:
#line 235 "parse.yy"
{ yyval.pn = new ParseNode(PT_LITERAL_LIST, NULL, yyvsp[0].pn, NULL,
	   lineno);  ;
    break;}
case 38:
#line 240 "parse.yy"
{ yyval.pn = yyvsp[0].pn; ;
    break;}
case 39:
#line 242 "parse.yy"
{ yyvsp[0].pn->l2.negative = 1; yyval.pn = yyvsp[0].pn; ;
    break;}
case 40:
#line 244 "parse.yy"
{ yyval.pn = new ParseNode(PT_CONDITION, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno); ;
    break;}
case 41:
#line 246 "parse.yy"
{ yyval.pn = new ParseNode(PT_CONDITION, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno);
	  yyval.pn->l2.negative = 1;;
    break;}
case 42:
#line 251 "parse.yy"
{ yyval.pn = yyvsp[0].pn; ;
    break;}
case 43:
#line 253 "parse.yy"
{ yyval.pn = yyvsp[-2].pn; if (yyvsp[-2].pn->type != PT_CONDITION) yyval.pn->left = yyvsp[0].pn;
                   else yyval.pn->left->left = yyvsp[0].pn; ;
    break;}
case 44:
#line 258 "parse.yy"
{ yyval.pn = new ParseNode(PT_LITERAL_LIST, NULL, yyvsp[0].pn, yyvsp[-2].pn, lineno); ;
    break;}
case 45:
#line 260 "parse.yy"
{ yyval.pn = new ParseNode(PT_LITERAL_LIST, NULL, yyvsp[0].pn, NULL,
	   lineno);  ;
    break;}
case 46:
#line 263 "parse.yy"
{ yyval.pn = new ParseNode(PT_LITERAL_LIST, NULL, yyvsp[0].pn, NULL,
	   lineno);  ;
    break;}
case 47:
#line 266 "parse.yy"
{ yyval.pn = new ParseNode(PT_LITERAL_LIST, NULL, yyvsp[0].pn, yyvsp[-2].pn, lineno); ;
    break;}
case 48:
#line 271 "parse.yy"
{ yyval.pn =yyvsp[0].pn; ;
    break;}
case 49:
#line 275 "parse.yy"
{ yyval.pn = new ParseNode(PT_ATOM, yyvsp[-3].s, NULL, yyvsp[-1].pn, lineno); ;
    break;}
case 50:
#line 277 "parse.yy"
{ yyval.pn = new ParseNode(PT_ATOM, yyvsp[0].s, NULL, NULL, lineno); ;
    break;}
case 51:
#line 282 "parse.yy"
{ lval1 = yyvsp[0].pn->Eval();
        if (lval1 == ERROR_NUMBER) {
            error(USR_ERR, "%s: the bound expression: ", 
	          error_file_and_line(lineno));
            fprintf(stderr, "\t\t");
            yyvsp[0].pn->PrintExpression();
            fprintf(stderr, "\n   is not a valid constant valued"
                    " expression.\n");
            fprintf(stderr, "   It is also possible that you "
                    "have accidentally used an upper case\n"
                    "   initial letter in a predicate name\n");
          }
        yyval.l = lval1; 
        delete yyvsp[0].pn;;
    break;}
case 52:
#line 297 "parse.yy"
{ yyval.l = ERROR_NUMBER; ;
    break;}
case 53:
#line 302 "parse.yy"
{ yyval.pn = new ParseNode(PT_FUNCTION, yyvsp[-3].s, NULL, yyvsp[-1].pn, lineno);;
    break;}
case 54:
#line 304 "parse.yy"
{ yyval.pn = new ParseNode(PT_FUNCTION, yyvsp[-3].s, NULL, yyvsp[-1].pn, lineno);
           yyval.pn->l2.negative = 1; ;
    break;}
case 55:
#line 309 "parse.yy"
{ yyval.pn = new ParseNode(PT_ARGUMENTS, NULL, yyvsp[0].pn, NULL, lineno);;
    break;}
case 56:
#line 311 "parse.yy"
{ yyval.pn = new ParseNode(PT_ARGUMENTS, NULL, yyvsp[0].pn, yyvsp[-2].pn, lineno); ;
    break;}
case 57:
#line 315 "parse.yy"
{ yyval.pn = new ParseNode(PT_ARGLIST, NULL, yyvsp[0].pn, yyvsp[-2].pn, lineno); ;
    break;}
case 58:
#line 317 "parse.yy"
{ yyval.pn = new ParseNode(PT_ARGLIST, NULL, yyvsp[0].pn, NULL , lineno); ;
    break;}
case 59:
#line 321 "parse.yy"
{ yyval.pn = yyvsp[0].pn; ;
    break;}
case 60:
#line 323 "parse.yy"
{ lval1 = yyvsp[0].pn->Eval();
       if (lval1 != ERROR_NUMBER) {
           yyval.pn = new ParseNode(PT_NUMBER, NULL, NULL, NULL,
                lineno,lval1);
           delete yyvsp[0].pn;
       } else {
         yyval.pn = yyvsp[0].pn;
       }
     ;
    break;}
case 61:
#line 333 "parse.yy"
{ yyval.pn = yyvsp[0].pn;
       if (yyval.pn->right == NULL) {
         lval1 = numeric_constant_table->Lookup(yyval.pn->sval);
         if (lval1 != ERROR_NUMBER) {
            yyval.pn->type = PT_NUMBER;
            yyval.pn->l1.val = lval1;
         } else {
          yyval.pn->type = PT_CONSTANT;
         }
       }
     ;
    break;}
case 62:
#line 345 "parse.yy"
{
      /* crude workaround for situations like a | 1, where 'a' is
	 actually a numeric constant */
       if ( yyvsp[-2].pn->right ) {
	error(USR_ERR, "%s: parse error before '|'\n",
              error_file_and_line(lineno));
       }
       yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_OR);
       lval1 = numeric_constant_table->Lookup(yyvsp[-2].pn->sval);
       if (lval1 != ERROR_NUMBER) {
         delete yyval.pn->left;
         yyval.pn->left = new ParseNode(PT_NUMBER, NULL, NULL, NULL, lineno,
                                  lval1);
       } else {
         yyvsp[-2].pn->type = PT_CONSTANT;
       }
     ;
    break;}
case 63:
#line 366 "parse.yy"
{ lval1 = numeric_constant_table->Lookup(yyvsp[0].s);
	  if (lval1 == ERROR_NUMBER)  
		yyval.pn = new ParseNode(PT_CONSTANT, yyvsp[0].s, NULL, NULL,
                                   lineno);
	  else {
	     yyval.pn = new ParseNode(PT_NUMBER, NULL, NULL, NULL, lineno,lval1);
             free(yyvsp[0].s); }
	;
    break;}
case 64:
#line 375 "parse.yy"
{ yyval.pn = new ParseNode(PT_NUMBER, NULL, NULL, NULL, lineno,
	 yyvsp[0].l);;
    break;}
case 65:
#line 378 "parse.yy"
{ yyval.pn = new ParseNode(PT_CONSTANT, yyvsp[0].s, NULL, NULL, lineno); ;
    break;}
case 66:
#line 382 "parse.yy"
{ lval1 = yyvsp[-2].pn->Eval();
        lval2 = yyvsp[0].pn->Eval();

	if (yyvsp[-2].pn->type != PT_NUMBER)
            lval1 = ERROR_NUMBER;
        if (yyvsp[0].pn->type != PT_NUMBER)
            lval2 = ERROR_NUMBER;	
        if ((lval1 == ERROR_NUMBER) || (lval2 == ERROR_NUMBER)) {
            error(USR_ERR, "%s: invalid range definition: ", 
                  error_file_and_line(lineno));
            fprintf(stderr, "\t");
	    yyvsp[-2].pn->PrintExpression();
            fprintf(stderr, " .. ");
            yyvsp[0].pn->PrintExpression();
            fprintf(stderr, "\n");
	    if (lval1 == ERROR_NUMBER) {
              fprintf(stderr, "   expression '");
              yyvsp[-2].pn->PrintExpression();
              fprintf(stderr, "' is not a constant valued expression.\n");
            } 
	    if (lval2 == ERROR_NUMBER) {
              fprintf(stderr, "   expression '");
              yyvsp[0].pn->PrintExpression();
              fprintf(stderr, "' is not a constant valued expression.\n");
            } 

	}
        delete yyvsp[-2].pn;
        delete yyvsp[0].pn;
  	yyval.pn = new ParseNode(PT_RANGE, NULL, NULL, NULL, lineno, lval1,
                           lval2); ;
    break;}
case 67:
#line 414 "parse.yy"
{
        yyval.pn = NULL;
	yyerror("conjunctive ranges are no longer supported, "
	        "please use conditions instead");
        /* lval1 = $1->Eval();
        lval2 = $3->Eval();
  	$$ = new ParseNode(PT_RANGE, NULL, NULL, NULL, lineno, lval1,
                           lval2, 1); */;
    break;}
case 68:
#line 427 "parse.yy"
{ yyval.pn = yyvsp[-1].pn; yyval.pn->i1.paren =1;
    break;}
case 69:
#line 429 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, NULL, yyvsp[-1].pn, lineno,
	                  FUN_ABS); yyval.pn->i1.paren = 1;;
    break;}
case 70:
#line 433 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, NULL, yyvsp[0].pn , lineno,
                          FUN_MINUS);
       yyval.pn->left = new ParseNode(PT_NUMBER, NULL, NULL, NULL, lineno, 0);;
    break;}
case 71:
#line 437 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_PLUS); ;
    break;}
case 72:
#line 439 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_MINUS); ;
    break;}
case 73:
#line 441 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_TIMES); ;
    break;}
case 74:
#line 443 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_DIV); ;
    break;}
case 75:
#line 445 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_MOD); ;
    break;}
case 76:
#line 447 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_EQ); ;
    break;}
case 77:
#line 449 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_NEQ); ;
    break;}
case 78:
#line 451 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_LT); ;
    break;}
case 79:
#line 453 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_LE); ;
    break;}
case 80:
#line 455 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_GT); ;
    break;}
case 81:
#line 457 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_GE); ;
    break;}
case 82:
#line 459 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[0].pn ,NULL , lineno,
                          FUN_NOT);
       yyval.pn->right = new ParseNode(PT_NUMBER, NULL, NULL, NULL, lineno,
                                 0);;
    break;}
case 83:
#line 464 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_AND); ;
    break;}
case 84:
#line 466 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_OR); ;
    break;}
case 85:
#line 468 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_XOR); ;
    break;}
case 86:
#line 470 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL,  NULL, yyvsp[0].pn, lineno,
                          FUN_ASSIGN);
       yyval.pn->left = new ParseNode(PT_VARIABLE, yyvsp[-2].s, NULL, NULL,
                                lineno);;
    break;}
case 87:
#line 475 "parse.yy"
{ yyval.pn = yyvsp[0].pn; ;
    break;}
case 88:
#line 477 "parse.yy"
{ yyval.pn = yyvsp[0].pn; ;
    break;}
case 89:
#line 479 "parse.yy"
{ yyval.pn = new ParseNode(PT_VARIABLE, yyvsp[0].s, NULL, NULL, lineno); ;
    break;}
case 90:
#line 483 "parse.yy"
{ yyval.pn = yyvsp[-1].pn; ;
    break;}
case 91:
#line 485 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, NULL, yyvsp[-1].pn, lineno,
	                  FUN_ABS);;
    break;}
case 92:
#line 488 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, NULL, yyvsp[0].pn , lineno,
                          FUN_MINUS);
       yyval.pn->left = new ParseNode(PT_NUMBER, NULL, NULL, NULL, lineno, 0);;
    break;}
case 93:
#line 492 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_PLUS); ;
    break;}
case 94:
#line 494 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_MINUS); ;
    break;}
case 95:
#line 496 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_TIMES); ;
    break;}
case 96:
#line 498 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_DIV); ;
    break;}
case 97:
#line 500 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_MOD); ;
    break;}
case 98:
#line 502 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_EQ); ;
    break;}
case 99:
#line 504 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_NEQ); ;
    break;}
case 100:
#line 506 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_LT); ;
    break;}
case 101:
#line 508 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_LE); ;
    break;}
case 102:
#line 510 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_GT); ;
    break;}
case 103:
#line 512 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_GE); ;
    break;}
case 104:
#line 514 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[0].pn ,NULL , lineno,
                          FUN_NOT);
       yyval.pn->right = new ParseNode(PT_NUMBER, NULL, NULL, NULL, lineno,
                                 0);;
    break;}
case 105:
#line 519 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_AND); ;
    break;}
case 106:
#line 521 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_OR); ;
    break;}
case 107:
#line 523 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL, yyvsp[-2].pn, yyvsp[0].pn, lineno, FUN_XOR); ;
    break;}
case 108:
#line 525 "parse.yy"
{ yyval.pn = new ParseNode(PT_EXPR, NULL,  NULL, yyvsp[0].pn, lineno,
                          FUN_ASSIGN);
       yyval.pn->left = new ParseNode(PT_VARIABLE, yyvsp[-2].s, NULL, NULL,
                                lineno);;
    break;}
case 109:
#line 530 "parse.yy"
{ yyval.pn = yyvsp[0].pn; ;
    break;}
case 110:
#line 532 "parse.yy"
{ yyval.pn = new ParseNode(PT_VARIABLE, yyvsp[0].s, NULL, NULL, lineno); ;
    break;}
case 111:
#line 564 "parse.yy"
{ yyval.pn = new ParseNode(PT_LITERAL_LIST, NULL, yyvsp[0].pn, yyvsp[-2].pn, lineno);;
    break;}
case 112:
#line 566 "parse.yy"
{ yyval.pn = new ParseNode(PT_LITERAL_LIST, NULL, yyvsp[0].pn, NULL, lineno);;
    break;}
case 113:
#line 570 "parse.yy"
{ yyval.pn = yyvsp[0].pn; ;
    break;}
case 114:
#line 572 "parse.yy"
{ yyval.pn = 0; ;
    break;}
case 115:
#line 577 "parse.yy"
{ yyval.pn = new ParseNode(PT_COMPUTE, NULL, NULL, yyvsp[-1].pn,
	                          lineno, yyvsp[-3].l);;
    break;}
case 116:
#line 582 "parse.yy"
{ yyval.pn = new ParseNode(PT_MAXIMIZE, NULL, NULL, yyvsp[-1].pn,
	                          lineno); ;
    break;}
case 117:
#line 585 "parse.yy"
{ yyval.pn = new ParseNode(PT_MINIMIZE, NULL, NULL, yyvsp[-1].pn,
	                          lineno); ;
    break;}
case 118:
#line 590 "parse.yy"
{
         if (yyvsp[0].pn->type == PT_CONSTANT) {
           if (!strcmp(yyvsp[0].pn->sval, "all")) {
             yyval.l = 0;
           } else {
             error(USR_ERR, "%s: invalid number of models. Use a "
                   "positive integer, a constant valued expression, "
                   "or \"all\"", 
                   error_file_and_line(lineno));
                   yyval.l = 1;
           }
         } else {
           yyval.l = yyvsp[0].pn->Eval();
           if (yyval.l == ERROR_NUMBER || yyval.l < 0) {
             error(USR_ERR, "%s: invalid number of models. Use a "
                  "positive integer, a constant valued expression, or "
	          "\"all\"", error_file_and_line(lineno));
           }
         }
         delete yyvsp[0].pn;
       ;
    break;}
case 119:
#line 612 "parse.yy"
{ yyval.l = 1; ;
    break;}
}
   /* the action file gets copied in in place of this dollarsign */
#line 498 "/usr/share/misc/bison.simple"

  yyvsp -= yylen;
  yyssp -= yylen;
#ifdef YYLSP_NEEDED
  yylsp -= yylen;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

  *++yyvsp = yyval;

#ifdef YYLSP_NEEDED
  yylsp++;
  if (yylen == 0)
    {
      yylsp->first_line = yylloc.first_line;
      yylsp->first_column = yylloc.first_column;
      yylsp->last_line = (yylsp-1)->last_line;
      yylsp->last_column = (yylsp-1)->last_column;
      yylsp->text = 0;
    }
  else
    {
      yylsp->last_line = (yylsp+yylen-1)->last_line;
      yylsp->last_column = (yylsp+yylen-1)->last_column;
    }
#endif

  /* 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.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTBASE];

  goto yynewstate;

yyerrlab:   /* here on detecting error */

  if (! yyerrstatus)
    /* If not already recovering from an error, report this error.  */
    {
      ++yynerrs;

#ifdef YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (yyn > YYFLAG && yyn < YYLAST)
	{
	  int size = 0;
	  char *msg;
	  int x, count;

	  count = 0;
	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
	  for (x = (yyn < 0 ? -yyn : 0);
	       x < (sizeof(yytname) / sizeof(char *)); x++)
	    if (yycheck[x + yyn] == x)
	      size += strlen(yytname[x]) + 15, count++;
	  msg = (char *) malloc(size + 15);
	  if (msg != 0)
	    {
	      strcpy(msg, "parse error");

	      if (count < 5)
		{
		  count = 0;
		  for (x = (yyn < 0 ? -yyn : 0);
		       x < (sizeof(yytname) / sizeof(char *)); x++)
		    if (yycheck[x + yyn] == x)
		      {
			strcat(msg, count == 0 ? ", expecting `" : " or `");
			strcat(msg, yytname[x]);
			strcat(msg, "'");
			count++;
		      }
		}
	      yyerror(msg);
	      free(msg);
	    }
	  else
	    yyerror ("parse error; also virtual memory exceeded");
	}
      else
#endif /* YYERROR_VERBOSE */
	yyerror("parse error");
    }

  goto yyerrlab1;
yyerrlab1:   /* here on error raised explicitly by an action */

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

      /* return failure if at end of input */
      if (yychar == YYEOF)
	YYABORT;

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif

      yychar = YYEMPTY;
    }

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

  yyerrstatus = 3;		/* Each real token shifted decrements this */

  goto yyerrhandle;

yyerrdefault:  /* current state does not do anything special for the error token. */

#if 0
  /* This is wrong; only states that explicitly want error tokens
     should shift them.  */
  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  if (yyn) goto yydefault;
#endif

yyerrpop:   /* pop the current state because it cannot handle the error token */

  if (yyssp == yyss) YYABORT;
  yyvsp--;
  yystate = *--yyssp;
#ifdef YYLSP_NEEDED
  yylsp--;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "Error: state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

yyerrhandle:

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yyerrdefault;

  yyn += YYTERROR;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
    goto yyerrdefault;

  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrpop;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrpop;

  if (yyn == YYFINAL)
    YYACCEPT;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting error token, ");
#endif

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  yystate = yyn;
  goto yynewstate;
}
#line 615 "parse.yy"
