Logo Search packages:      
Sourcecode: ksh version File versions

Oexparse.c

/***********************************************************************
*                                                                      *
*               This software is part of the ast package               *
*           Copyright (c) 1989-2007 AT&T Knowledge Ventures            *
*                      and is licensed under the                       *
*                  Common Public License, Version 1.0                  *
*                      by AT&T Knowledge Ventures                      *
*                                                                      *
*                A copy of the License is available at                 *
*            http://www.opensource.org/licenses/cpl1.0.txt             *
*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
*                                                                      *
*              Information and Software Systems Research               *
*                            AT&T Research                             *
*                           Florham Park NJ                            *
*                                                                      *
*                 Glenn Fowler <gsf@research.att.com>                  *
*                                                                      *
***********************************************************************/
/* : : generated by a yacc that works -- solaris take note : : */
#include "ast.h"
#ifndef lint
static char const 
exrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $";
#endif
#include <stdlib.h>
#define EXBYACC 1
#define EXMAJOR 1
#define EXMINOR 9
#define EXLEX exlex()
#define EXEMPTY -1
#define exclearin (exchar=(EXEMPTY))
#define exerrok (exerrflag=0)
#define EXRECOVERING() (exerrflag!=0)
static int exgrowstack();
#define EXPREFIX "ex"
/* #line 2 "/home/gsf/src/lib/libexpr/exparse.y" */

/*
 * Glenn Fowler
 * AT&T Research
 *
 * expression library grammar and compiler
 *
 * NOTE: procedure arguments not implemented yet
 */

#include <ast.h>

#undef      RS    /* hp.pa <signal.h> grabs this!! */

/* #line 18 "/home/gsf/src/lib/libexpr/exparse.y" */
typedef union
{
      struct Exnode_s*expr;
      double            floating;
      struct Exref_s*   reference;
      struct Exid_s*    id;
      Sflong_t    integer;
      int         op;
      char*       string;
      struct Exbuf_s*   buffer;
} EXSTYPE;
/* #line 129 "/home/gsf/src/lib/libexpr/exparse.y" */

#include "exgram.h"

/* #line 48 "y.tab.c" */
#define EXERRCODE 256
#define MINTOKEN 257
#define CHAR 258
#define INT 259
#define INTEGER 260
#define UNSIGNED 261
#define FLOATING 262
#define STRING 263
#define VOID 264
#define ADDRESS 265
#define BREAK 266
#define CALL 267
#define CASE 268
#define CONSTANT 269
#define CONTINUE 270
#define DECLARE 271
#define DEFAULT 272
#define DYNAMIC 273
#define ELSE 274
#define EXIT 275
#define FOR 276
#define FUNCTION 277
#define ITERATE 278
#define ID 279
#define IF 280
#define LABEL 281
#define MEMBER 282
#define NAME 283
#define POS 284
#define PRAGMA 285
#define PRE 286
#define PRINTF 287
#define PROCEDURE 288
#define QUERY 289
#define RETURN 290
#define SCANF 291
#define SPRINTF 292
#define SSCANF 293
#define SWITCH 294
#define WHILE 295
#define F2I 296
#define F2S 297
#define I2F 298
#define I2S 299
#define S2B 300
#define S2F 301
#define S2I 302
#define F2X 303
#define I2X 304
#define S2X 305
#define X2F 306
#define X2I 307
#define X2S 308
#define OR 309
#define AND 310
#define EQ 311
#define NE 312
#define LE 313
#define GE 314
#define LS 315
#define RS 316
#define UNARY 317
#define INC 318
#define DEC 319
#define CAST 320
#define MAXTOKEN 321
const short exlhs[] = {                                        -1,
    0,   24,   24,   26,   25,    2,    2,    1,    1,   27,
    1,    1,    1,    1,    1,   28,    1,    1,    1,    1,
   29,   29,   14,   30,   30,   31,   31,   10,   10,   32,
   11,   20,   20,    4,    4,    5,    5,    6,    6,    6,
    6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
    6,    6,    6,    6,    6,    6,    6,    6,   33,   34,
    6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
    6,    6,    6,    6,    6,    6,    6,    6,   15,   15,
   15,   15,   15,   21,   21,   21,   22,   22,    8,    8,
    8,   23,   23,   12,   12,    7,    7,    3,    3,   16,
   16,   16,   17,   17,   35,   18,   19,   19,    9,    9,
   13,   36,   37,   13,
};
const short exlen[] = {                                         2,
    2,    0,    2,    0,    4,    0,    2,    3,    2,    0,
    4,    6,    5,    9,    5,    0,    8,    3,    3,    3,
    0,    2,    2,    1,    2,    3,    2,    1,    3,    0,
    5,    1,    1,    0,    2,    0,    1,    3,    4,    3,
    3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
    3,    3,    3,    3,    3,    3,    3,    3,    0,    0,
    7,    2,    2,    2,    2,    2,    5,    4,    4,    4,
    4,    3,    2,    2,    2,    2,    2,    1,    1,    1,
    1,    1,    1,    1,    1,    1,    1,    1,    3,    2,
    1,    0,    2,    0,    3,    0,    1,    1,    3,    0,
    1,    1,    1,    3,    0,    3,    0,    4,    0,    2,
    1,    0,    0,    8,
};
const short exdefred[] = {                                      6,
    0,    0,   81,   83,   80,    0,    0,   79,    0,   10,
    0,    0,    0,    0,   91,   84,    0,   85,    0,   87,
   86,   88,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    6,    7,    0,    0,    0,   78,    0,    0,
    0,    0,    0,    0,    0,  107,    0,   90,    0,    0,
    0,    0,    0,    0,    0,   66,    0,   65,   64,   62,
   63,   74,   76,    0,    0,    0,    9,    0,   59,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,   75,   77,
   73,    0,    0,    0,    0,    0,    3,   72,   18,   19,
    0,   28,    0,    0,    0,    0,    0,    0,    0,    0,
    0,   20,    0,    0,    0,   38,    8,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,   42,   43,   44,    0,    0,    0,
    0,    0,    4,  107,   11,    0,   30,   95,   68,    0,
    0,    0,    0,   69,    0,    0,   39,    0,    0,  108,
   70,   71,    6,   29,    0,    0,    0,   13,    0,    0,
    0,   15,   60,   67,    0,    0,    0,    0,    0,   12,
   21,    0,   93,  112,  111,   31,    0,   35,    0,    0,
    0,    0,    0,    0,   17,   22,    0,   24,    0,  113,
    0,  103,   14,   82,    0,   27,    0,   25,    0,    0,
    0,   26,   33,   32,  106,    0,  105,  104,    6,    0,
  114,
};
const short exdgoto[] = {                                       1,
   34,    2,  109,  180,   35,   36,  111,   37,   91,  101,
  102,   48,  186,  196,   38,  200,  201,  202,   39,  215,
   40,   41,  177,   42,   97,  163,   46,  155,  189,  197,
  198,  166,  119,  182,  209,  191,  210,
};
const short exsindex[] = {                                      0,
    0,  179,    0,    0,    0,  -28,  -33,    0,  -33,    0,
  -78,  -10,   -2,   25,    0,    0,   56,    0,  -33,    0,
    0,    0,   65,   71, -217,  -33,  -33,  -33,  -33, -217,
 -217,  309,    0,    0,   32,  959,   58,    0, -200,   72,
   76, -197, -156,   69,   70,    0,  -33,    0,  -33,  -33,
  -33,  -33,   82,  -33,  -33,    0, -145,    0,    0,    0,
    0,    0,    0,  101,  513,   75,    0,  -33,    0,  -33,
  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,
  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,    0,    0,
    0,  122,  -78,  -33,  -33,  107,    0,    0,    0,    0,
  -27,    0, -248,  668,  752,  100,   21,  794,  124,  988,
  125,    0,  959,  806,  -33,    0,    0,  988,  -33, 1032,
 1086,  111,  206,  859,  914,  914,    8,    8,    8,    8,
  139,  139,    5,    5,    0,    0,    0,  988,  -33,  123,
  129,  136,    0,    0,    0,  -78,    0,    0,    0,  -33,
  179,  179,  -33,    0,  137,  179,    0,  905,  138,    0,
    0,    0,    0,    0,  123,   89,  126,    0,  -91,  988,
   64,    0,    0,    0,  179,   95,  -38,  -33,  179,    0,
    0,  -33,    0,    0,    0,    0,  152,    0, -121,  988,
  -74,  179, -162,  141,    0,    0, -211,    0,    0,    0,
  158,    0,    0,    0,  145,    0,  179,    0, -203,  155,
  -67,    0,    0,    0,    0,   85,    0,    0,    0,  112,
    0,
};
const short exrindex[] = {                                      0,
    0,  131,    0,    0,    0,  598,  -56,    0,  -56,    0,
  469,    0,    0,    0,    0,    0,    0,    0,  -56,    0,
    0,    0,    0,    0,  -70, -173, -173, -173, -173,  -70,
  -70, -173,    0,    0,    0,  -32,  625,    0,    0,    0,
    0,  210,    0,    0,    0,    0, -173,    0, -173,  -56,
 -173,   33,    0, -173, -173,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,  -56,    0, -173,    0, -173,
 -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,
 -173, -173, -173, -173, -173, -173, -173, -173,    0,    0,
    0,    0,  441,   33,   33,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,  948,    0,  172,   92,
    0,    0,  173,    0, -173,    0,    0,   28, -173,  -30,
  148,   51, 1440,  679, 1424, 1447, 1293, 1378, 1385, 1401,
 1247, 1270, 1099, 1141,    0,    0,    0,   44,   33,  571,
    0,    0,    0,    0,    0,  169,    0,    0,    0,  -56,
  -56,  -56, -173,    0,    0,  -56,    0,    0,    0,    0,
    0,    0,    0,    0,    0,   14,    0,    0,    1,  102,
    0,    0,    0,    0,  132,    0,  -19,  119,  -56,    0,
    0, -173,    0,    0,    0,    0,    0,    0,    0,   81,
  175,  -56,    0,    0,    0,    0,   38,    0,  -26,    0,
  177,    0,    0,    0,    0,    0,  421,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,  -56,
    0,
};
const short exgindex[] = {                                      0,
  -62,  -25,    0,    0,   17, 1540,  -75,   18,   43,    0,
   87,  -87,    0,    0,   39,    0,    0,   15,   -9,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
   36,    0,    0,    0,    0,    0,    0,
};
#define EXTABLESIZE 1757
const short extable[] = {                                      28,
   34,  184,   36,  195,   25,  140,   32,   66,   37,   26,
   57,   27,   47,   57,  101,   57,  144,   43,  141,  142,
   57,   57,   88,   44,  109,   45,   37,   57,   57,   49,
  146,  145,   57,   34,  147,   53,  103,   50,   34,  109,
   34,   87,   56,   34,   87,   34,   85,   62,   63,   85,
   83,   86,   84,   92,   86,   11,  193,   92,  165,   34,
  194,  151,   57,  159,   51,   15,  106,  107,   58,  213,
    6,   58,   92,   96,   92,    6,   92,    6,   93,  214,
    6,   88,    6,   96,  110,   58,   58,  110,  168,  169,
   67,   53,   29,  172,   53,   52,    6,    3,    4,    5,
  204,  110,  110,  107,   54,  107,    8,   28,   53,   53,
   55,   94,   25,   53,   32,   95,  188,   26,   88,   27,
   58,   61,   98,   34,   61,   34,   34,   99,  100,  203,
    2,    5,   98,   93,  103,   98,  110,  175,   61,   61,
  112,  115,   99,   53,   28,   99,  193,   87,   74,   25,
  194,   32,   85,   83,   26,   84,   27,   86,  150,   36,
    6,  139,    6,    6,  143,  154,  167,  153,  160,  161,
   77,  207,   78,   61,   53,   87,  162,  171,  174,  176,
   85,   83,  179,   84,  178,   86,  181,  183,   56,   36,
   36,   56,  192,  220,  187,  216,  199,   33,  206,  117,
   29,  211,  212,  217,   73,   56,   56,  219,  107,    1,
   56,   28,   97,   16,   94,  100,   25,  102,   32,  185,
  107,   26,  107,   27,    0,  218,    3,    4,    5,    6,
  164,  205,  208,    0,   33,    8,  221,   29,    0,   11,
   56,   12,   87,   74,    0,    0,  105,   85,   83,   15,
   84,    0,   86,   16,   17,   18,  105,   20,   21,   22,
   34,   34,   34,   34,    0,   77,   34,   78,   34,   34,
   34,   34,   34,   34,    0,   34,   34,   34,   57,   34,
   34,   34,    0,   34,   30,   31,    0,   34,   34,   34,
   34,   34,   34,   34,   34,   34,    0,    6,    6,    6,
    6,   33,    0,    6,   29,    0,    6,    6,    6,  107,
    6,  107,    6,    6,    6,    0,    6,    6,   34,   34,
    6,    0,   81,   82,    6,    6,    6,    6,    6,    6,
    6,    6,    6,    0,    3,    4,    5,    6,   89,   90,
    7,   28,    0,    8,    9,   10,   25,   11,   32,   12,
   13,   26,    0,   27,   14,    6,    6,   15,    0,   53,
   53,   16,   17,   18,   19,   20,   21,   22,   23,   24,
    0,    3,    4,    5,    6,   89,   90,    7,    0,    0,
    8,    9,   10,    0,   11,    0,   12,   13,    0,    0,
    0,   14,   30,   31,   15,  107,    0,  107,   16,   17,
   18,   19,   20,   21,   22,   23,   24,  107,  107,  107,
  107,    2,    5,    0,    0,    0,    0,    0,    0,    0,
    0,   75,   76,   79,   80,   81,   82,    0,    0,   30,
   31,    0,    0,    0,   29,    0,    0,    0,    3,    4,
    5,    6,    0,    0,    7,    0,    0,    8,    9,   10,
    0,   11,    0,   12,   13,    0,   56,   56,   14,    0,
    0,   15,    0,    0,    0,   16,   17,   18,   19,   20,
   21,   22,   23,   24,    0,    0,    0,   94,   94,   36,
    0,   94,   94,   94,   94,   94,   94,   94,    0,    0,
    0,    0,    0,    0,    0,    0,   30,   31,   94,   94,
   94,   94,   94,   94,    0,   94,   94,    0,    0,   94,
   94,   94,   94,   94,    0,   94,   75,   76,   79,   80,
   81,   82,    0,    0,    0,    0,   94,   94,   94,   94,
   94,   94,    0,   94,   94,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,   23,    0,    0,    0,   87,
   74,    0,    0,  116,   85,   83,   68,   84,    0,   86,
    0,   94,   94,    0,   94,    0,    0,    0,    3,    4,
    5,    6,   77,    0,   78,   69,    0,    8,    0,   64,
    0,   11,    0,   12,    0,    0,    0,    0,    0,    0,
    0,   15,   94,    0,    0,   16,   17,   18,    0,   20,
   21,   22,    0,    0,    0,    0,   73,   89,   89,    0,
    0,   89,   89,   89,   89,   89,    0,   89,    0,    0,
    0,    0,    0,    0,    0,    0,   30,   31,   89,   89,
   89,   89,   89,   89,   82,   82,   72,    0,   82,   82,
   82,   82,   82,    0,   82,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,   82,   82,   82,    0,   82,
   82,  109,  109,   89,   89,  109,  109,  109,  109,  109,
    0,  109,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,  109,  109,  109,    0,  109,  109,   23,    0,
   82,   82,   23,    0,   89,    0,    0,  107,    0,  107,
    0,    0,    0,    0,   87,   74,    0,    0,    0,   85,
   83,   68,   84,    0,   86,    0,   52,  109,  109,   52,
    0,   82,   52,    0,    0,    0,    0,   77,    0,   78,
   69,    0,    0,    0,    0,    0,   52,   52,    0,    0,
    0,   52,    0,    0,    0,    0,    0,    0,  109,   94,
   94,   94,   94,   94,   94,   94,   94,    0,   94,   94,
  148,   73,    0,    0,    0,    0,    0,    0,    0,    0,
    0,   52,   52,    0,    0,    0,    0,   94,   94,   94,
   94,   94,   94,   94,   94,    0,   94,   94,   87,   74,
    0,   72,  149,   85,   83,   68,   84,    0,   86,    0,
    0,    0,   52,    0,    0,    0,    0,    0,    0,    0,
    0,   77,    0,   78,   69,    0,    0,    0,    0,    0,
    0,   70,   71,   75,   76,   79,   80,   81,   82,    0,
   87,   74,    0,    0,  152,   85,   83,   68,   84,    0,
   86,    0,   87,   74,    0,   73,  156,   85,   83,   68,
   84,    0,   86,   77,    0,   78,   69,    0,    0,    0,
    0,    0,    0,    0,    0,   77,    0,   78,   69,    0,
    0,    0,    0,    0,    0,   72,    0,    0,    0,   89,
   89,   89,   89,   89,   89,   89,   89,   73,   89,   89,
    0,    0,    0,    0,    0,   87,    0,    0,    0,   73,
   85,   83,    0,   84,    0,   86,   82,   82,   82,   82,
   82,   82,   82,   82,    0,    0,    0,   72,   77,    0,
   78,    0,    0,    0,    0,    0,    0,    0,    0,   72,
    0,    0,    0,  109,  109,  109,  109,  109,  109,  109,
  109,   87,   74,    0,    0,    0,   85,   83,   68,   84,
   87,   86,    0,    0,    0,   85,   83,    0,   84,    0,
   86,    0,  173,    0,   77,    0,   78,   69,    0,    0,
    0,    0,    0,   77,    0,   78,   70,   71,   75,   76,
   79,   80,   81,   82,  109,  109,    0,   52,   52,  109,
  109,  109,  109,    0,  109,   87,   74,    0,   73,    0,
   85,   83,   68,   84,    0,   86,  109,  109,    0,  109,
  109,    0,    0,    0,    0,    0,    0,    0,   77,    0,
   78,   69,    0,    0,   87,   74,    0,    0,   72,   85,
   83,    0,   84,    0,   86,    0,    0,    0,    0,    0,
    0,  109,    0,    0,    0,    0,    0,   77,    0,   78,
   69,    0,   73,    0,    0,    0,    0,    0,    0,    0,
   70,   71,   75,   76,   79,   80,   81,   82,   87,   74,
    0,  109,    0,   85,   83,    0,   84,    0,   86,    0,
    0,   73,   72,    0,    0,    0,    0,    0,    0,    0,
    0,   77,    0,   78,    0,    0,    0,    0,    0,    0,
    0,    0,   70,   71,   75,   76,   79,   80,   81,   82,
    0,   72,    0,    0,   70,   71,   75,   76,   79,   80,
   81,   82,   87,   74,    0,   73,    0,   85,   83,    0,
   84,    0,   86,    0,    0,    0,   55,    0,    0,   55,
    0,   55,   55,   55,    0,   77,    0,   78,    0,    0,
    0,    0,    0,    0,    0,   72,   55,   55,   55,    0,
   55,   55,    0,    0,    0,    0,    0,    0,    0,   75,
   76,   79,   80,   81,   82,    0,    0,    0,   41,   73,
    0,   41,    0,   41,   41,   41,    0,    0,    0,    0,
    0,   55,   55,    0,    0,    0,    0,    0,   41,   41,
   41,    0,   41,   41,    0,    0,    0,    0,    0,   72,
    0,    0,    0,   70,   71,   75,   76,   79,   80,   81,
   82,    0,   55,    0,    0,    0,   79,   80,   81,   82,
    0,    0,    0,   41,   41,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,  109,  109,  109,  109,
  109,  109,  109,  109,   41,    0,    0,   70,   71,   75,
   76,   79,   80,   81,   82,    0,    0,    0,    0,    0,
    0,    0,    0,    0,   45,    0,    0,   45,    0,    0,
   45,    0,    0,    0,    0,    0,   70,   71,   75,   76,
   79,   80,   81,   82,   45,   45,   45,   46,   45,   45,
   46,    0,    0,   46,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,   46,   46,   46,
   40,   46,   46,   40,    0,    0,   40,    0,    0,   45,
   45,   71,   75,   76,   79,   80,   81,   82,    0,    0,
   40,   40,    0,    0,    0,   40,    0,    0,    0,    0,
    0,    0,   46,   46,    0,    0,    0,    0,    0,    0,
   45,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,   40,   40,    0,    0,    0,
    0,    0,    0,   46,    0,    0,   75,   76,   79,   80,
   81,   82,    0,    0,    0,    0,    0,   55,   55,   55,
   55,   55,   55,   55,   55,   47,   40,    0,   47,    0,
    0,   47,   48,    0,    0,   48,    0,    0,   48,    0,
    0,    0,    0,    0,    0,   47,   47,    0,   49,    0,
   47,   49,   48,   48,   49,    0,    0,   48,    0,   41,
   41,   41,   41,   41,   41,   41,   41,    0,   49,   49,
    0,   50,    0,   49,   50,    0,    0,   50,    0,    0,
   47,   47,    0,    0,    0,    0,    0,   48,   48,    0,
   54,   50,   50,   54,   51,    0,   50,   51,    0,    0,
   51,    0,    0,   49,   49,    0,    0,   54,   54,    0,
    0,   47,   54,    0,   51,   51,    0,    0,   48,   51,
    0,    0,    0,    0,    0,    0,   50,   50,    0,    0,
    0,    0,    0,    0,   49,    0,    0,    0,    0,    0,
    0,    0,   54,   54,    0,    0,    0,    0,    0,   51,
   51,    0,    0,    0,    0,    0,    0,   50,    0,    0,
    0,    0,    0,    0,    0,   45,   45,   45,   45,   45,
   45,   45,   45,   54,    0,   58,   59,   60,   61,    0,
   51,   65,    0,    0,    0,    0,    0,    0,   46,   46,
   46,   46,   46,   46,   46,   46,  104,    0,  105,    0,
  108,  110,    0,  113,  114,    0,    0,    0,    0,    0,
    0,   40,   40,   40,   40,    0,    0,  118,    0,  120,
  121,  122,  123,  124,  125,  126,  127,  128,  129,  130,
  131,  132,  133,  134,  135,  136,  137,  138,    0,    0,
    0,    0,    0,  110,  110,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,  157,    0,    0,    0,  158,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,  110,    0,
    0,    0,    0,    0,    0,    0,   47,   47,   47,   47,
    0,    0,  170,   48,   48,   48,   48,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,   49,
   49,   49,   49,    0,    0,    0,    0,    0,    0,    0,
    0,  190,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,   50,   50,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,   54,   54,
    0,    0,    0,    0,    0,   51,   51,
};
const short excheck[] = {                                      33,
    0,   40,   59,  125,   38,   93,   40,   33,   41,   43,
   41,   45,   91,   44,   41,   25,   44,   46,   94,   95,
   30,   31,   61,    7,   44,    9,   59,   58,   59,   40,
  279,   59,   63,   33,  283,   19,   46,   40,   38,   59,
   40,   37,   25,   43,   37,   45,   42,   30,   31,   42,
   43,   47,   45,   40,   47,  273,  268,   44,  146,   59,
  272,   41,   93,  139,   40,  283,   50,   50,   41,  273,
   33,   44,   59,   41,   61,   38,  277,   40,  279,  283,
   43,   61,   45,  281,   41,   58,   59,   44,  151,  152,
   59,   41,  126,  156,   44,   40,   59,  260,  261,  262,
  263,   58,   59,  277,   40,  279,  269,   33,   58,   59,
   40,   40,   38,   63,   40,   40,  179,   43,   61,   45,
   93,   41,  279,  123,   44,  125,  126,   59,   59,  192,
    0,    0,   41,  279,  144,   44,   93,  163,   58,   59,
   59,   41,   41,   93,   33,   44,  268,   37,   38,   38,
  272,   40,   42,   43,   43,   45,   45,   47,   59,   41,
  123,   40,  125,  126,   58,   41,  150,   44,   46,   41,
   60,  197,   62,   93,  124,   37,   41,   41,   41,   91,
   42,   43,  274,   45,   59,   47,  123,   93,   41,   59,
   59,   44,   41,  219,  178,   41,  271,  123,   58,  125,
  126,   44,   58,  271,   94,   58,   59,  123,  279,    0,
   63,   33,   41,   41,   46,   41,   38,   41,   40,  177,
  277,   43,  279,   45,   -1,  211,  260,  261,  262,  263,
  144,  193,  197,   -1,  123,  269,  125,  126,   -1,  273,
   93,  275,   37,   38,   -1,   -1,  273,   42,   43,  283,
   45,   -1,   47,  287,  288,  289,  283,  291,  292,  293,
  260,  261,  262,  263,   -1,   60,  266,   62,  268,  269,
  270,  271,  272,  273,   -1,  275,  276,  277,  309,  279,
  280,  281,   -1,  283,  318,  319,   -1,  287,  288,  289,
  290,  291,  292,  293,  294,  295,   -1,  260,  261,  262,
  263,  123,   -1,  266,  126,   -1,  269,  270,  271,  277,
  273,  279,  275,  276,  277,   -1,  279,  280,  318,  319,
  283,   -1,  315,  316,  287,  288,  289,  290,  291,  292,
  293,  294,  295,   -1,  260,  261,  262,  263,  318,  319,
  266,   33,   -1,  269,  270,  271,   38,  273,   40,  275,
  276,   43,   -1,   45,  280,  318,  319,  283,   -1,  309,
  310,  287,  288,  289,  290,  291,  292,  293,  294,  295,
   -1,  260,  261,  262,  263,  318,  319,  266,   -1,   -1,
  269,  270,  271,   -1,  273,   -1,  275,  276,   -1,   -1,
   -1,  280,  318,  319,  283,  277,   -1,  279,  287,  288,
  289,  290,  291,  292,  293,  294,  295,  277,  277,  279,
  279,  281,  281,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,  311,  312,  313,  314,  315,  316,   -1,   -1,  318,
  319,   -1,   -1,   -1,  126,   -1,   -1,   -1,  260,  261,
  262,  263,   -1,   -1,  266,   -1,   -1,  269,  270,  271,
   -1,  273,   -1,  275,  276,   -1,  309,  310,  280,   -1,
   -1,  283,   -1,   -1,   -1,  287,  288,  289,  290,  291,
  292,  293,  294,  295,   -1,   -1,   -1,   37,   38,   59,
   -1,   41,   42,   43,   44,   45,   46,   47,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,  318,  319,   58,   59,
   60,   61,   62,   63,   -1,   37,   38,   -1,   -1,   41,
   42,   43,   44,   45,   -1,   47,  311,  312,  313,  314,
  315,  316,   -1,   -1,   -1,   -1,   58,   59,   60,   61,
   62,   63,   -1,   93,   94,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,  125,   -1,   -1,   -1,   37,
   38,   -1,   -1,   41,   42,   43,   44,   45,   -1,   47,
   -1,   93,   94,   -1,  124,   -1,   -1,   -1,  260,  261,
  262,  263,   60,   -1,   62,   63,   -1,  269,   -1,  271,
   -1,  273,   -1,  275,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,  283,  124,   -1,   -1,  287,  288,  289,   -1,  291,
  292,  293,   -1,   -1,   -1,   -1,   94,   37,   38,   -1,
   -1,   41,   42,   43,   44,   45,   -1,   47,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,  318,  319,   58,   59,
   60,   61,   62,   63,   37,   38,  124,   -1,   41,   42,
   43,   44,   45,   -1,   47,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   58,   59,   60,   -1,   62,
   63,   37,   38,   93,   94,   41,   42,   43,   44,   45,
   -1,   47,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   58,   59,   60,   -1,   62,   63,  268,   -1,
   93,   94,  272,   -1,  124,   -1,   -1,  277,   -1,  279,
   -1,   -1,   -1,   -1,   37,   38,   -1,   -1,   -1,   42,
   43,   44,   45,   -1,   47,   -1,   38,   93,   94,   41,
   -1,  124,   44,   -1,   -1,   -1,   -1,   60,   -1,   62,
   63,   -1,   -1,   -1,   -1,   -1,   58,   59,   -1,   -1,
   -1,   63,   -1,   -1,   -1,   -1,   -1,   -1,  124,  309,
  310,  311,  312,  313,  314,  315,  316,   -1,  318,  319,
   93,   94,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   93,   94,   -1,   -1,   -1,   -1,  309,  310,  311,
  312,  313,  314,  315,  316,   -1,  318,  319,   37,   38,
   -1,  124,   41,   42,   43,   44,   45,   -1,   47,   -1,
   -1,   -1,  124,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   60,   -1,   62,   63,   -1,   -1,   -1,   -1,   -1,
   -1,  309,  310,  311,  312,  313,  314,  315,  316,   -1,
   37,   38,   -1,   -1,   41,   42,   43,   44,   45,   -1,
   47,   -1,   37,   38,   -1,   94,   41,   42,   43,   44,
   45,   -1,   47,   60,   -1,   62,   63,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   60,   -1,   62,   63,   -1,
   -1,   -1,   -1,   -1,   -1,  124,   -1,   -1,   -1,  309,
  310,  311,  312,  313,  314,  315,  316,   94,  318,  319,
   -1,   -1,   -1,   -1,   -1,   37,   -1,   -1,   -1,   94,
   42,   43,   -1,   45,   -1,   47,  309,  310,  311,  312,
  313,  314,  315,  316,   -1,   -1,   -1,  124,   60,   -1,
   62,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  124,
   -1,   -1,   -1,  309,  310,  311,  312,  313,  314,  315,
  316,   37,   38,   -1,   -1,   -1,   42,   43,   44,   45,
   37,   47,   -1,   -1,   -1,   42,   43,   -1,   45,   -1,
   47,   -1,   58,   -1,   60,   -1,   62,   63,   -1,   -1,
   -1,   -1,   -1,   60,   -1,   62,  309,  310,  311,  312,
  313,  314,  315,  316,   37,   38,   -1,  309,  310,   42,
   43,   44,   45,   -1,   47,   37,   38,   -1,   94,   -1,
   42,   43,   44,   45,   -1,   47,   59,   60,   -1,   62,
   63,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   60,   -1,
   62,   63,   -1,   -1,   37,   38,   -1,   -1,  124,   42,
   43,   -1,   45,   -1,   47,   -1,   -1,   -1,   -1,   -1,
   -1,   94,   -1,   -1,   -1,   -1,   -1,   60,   -1,   62,
   63,   -1,   94,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
  309,  310,  311,  312,  313,  314,  315,  316,   37,   38,
   -1,  124,   -1,   42,   43,   -1,   45,   -1,   47,   -1,
   -1,   94,  124,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   60,   -1,   62,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,  309,  310,  311,  312,  313,  314,  315,  316,
   -1,  124,   -1,   -1,  309,  310,  311,  312,  313,  314,
  315,  316,   37,   38,   -1,   94,   -1,   42,   43,   -1,
   45,   -1,   47,   -1,   -1,   -1,   38,   -1,   -1,   41,
   -1,   43,   44,   45,   -1,   60,   -1,   62,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,  124,   58,   59,   60,   -1,
   62,   63,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  311,
  312,  313,  314,  315,  316,   -1,   -1,   -1,   38,   94,
   -1,   41,   -1,   43,   44,   45,   -1,   -1,   -1,   -1,
   -1,   93,   94,   -1,   -1,   -1,   -1,   -1,   58,   59,
   60,   -1,   62,   63,   -1,   -1,   -1,   -1,   -1,  124,
   -1,   -1,   -1,  309,  310,  311,  312,  313,  314,  315,
  316,   -1,  124,   -1,   -1,   -1,  313,  314,  315,  316,
   -1,   -1,   -1,   93,   94,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,  309,  310,  311,  312,
  313,  314,  315,  316,  124,   -1,   -1,  309,  310,  311,
  312,  313,  314,  315,  316,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   38,   -1,   -1,   41,   -1,   -1,
   44,   -1,   -1,   -1,   -1,   -1,  309,  310,  311,  312,
  313,  314,  315,  316,   58,   59,   60,   38,   62,   63,
   41,   -1,   -1,   44,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   58,   59,   60,
   38,   62,   63,   41,   -1,   -1,   44,   -1,   -1,   93,
   94,  310,  311,  312,  313,  314,  315,  316,   -1,   -1,
   58,   59,   -1,   -1,   -1,   63,   -1,   -1,   -1,   -1,
   -1,   -1,   93,   94,   -1,   -1,   -1,   -1,   -1,   -1,
  124,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   93,   94,   -1,   -1,   -1,
   -1,   -1,   -1,  124,   -1,   -1,  311,  312,  313,  314,
  315,  316,   -1,   -1,   -1,   -1,   -1,  309,  310,  311,
  312,  313,  314,  315,  316,   38,  124,   -1,   41,   -1,
   -1,   44,   38,   -1,   -1,   41,   -1,   -1,   44,   -1,
   -1,   -1,   -1,   -1,   -1,   58,   59,   -1,   38,   -1,
   63,   41,   58,   59,   44,   -1,   -1,   63,   -1,  309,
  310,  311,  312,  313,  314,  315,  316,   -1,   58,   59,
   -1,   38,   -1,   63,   41,   -1,   -1,   44,   -1,   -1,
   93,   94,   -1,   -1,   -1,   -1,   -1,   93,   94,   -1,
   41,   58,   59,   44,   38,   -1,   63,   41,   -1,   -1,
   44,   -1,   -1,   93,   94,   -1,   -1,   58,   59,   -1,
   -1,  124,   63,   -1,   58,   59,   -1,   -1,  124,   63,
   -1,   -1,   -1,   -1,   -1,   -1,   93,   94,   -1,   -1,
   -1,   -1,   -1,   -1,  124,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   93,   94,   -1,   -1,   -1,   -1,   -1,   93,
   94,   -1,   -1,   -1,   -1,   -1,   -1,  124,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,  309,  310,  311,  312,  313,
  314,  315,  316,  124,   -1,   26,   27,   28,   29,   -1,
  124,   32,   -1,   -1,   -1,   -1,   -1,   -1,  309,  310,
  311,  312,  313,  314,  315,  316,   47,   -1,   49,   -1,
   51,   52,   -1,   54,   55,   -1,   -1,   -1,   -1,   -1,
   -1,  309,  310,  311,  312,   -1,   -1,   68,   -1,   70,
   71,   72,   73,   74,   75,   76,   77,   78,   79,   80,
   81,   82,   83,   84,   85,   86,   87,   88,   -1,   -1,
   -1,   -1,   -1,   94,   95,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,  115,   -1,   -1,   -1,  119,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  139,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,  309,  310,  311,  312,
   -1,   -1,  153,  309,  310,  311,  312,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  309,
  310,  311,  312,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,  182,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,  309,  310,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  309,  310,
   -1,   -1,   -1,   -1,   -1,  309,  310,
};
#define EXFINAL 1
#ifndef EXDEBUG
#define EXDEBUG 0
#endif
#define EXMAXTOKEN 321
#if EXDEBUG
const char * const exname[] = {
"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
"'!'",0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0,0,
0,0,0,0,0,0,0,"':'","';'","'<'","'='","'>'","'?'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,"']'","'^'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,"'{'","'|'","'}'","'~'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"MINTOKEN",
"CHAR","INT","INTEGER","UNSIGNED","FLOATING","STRING","VOID","ADDRESS","BREAK",
"CALL","CASE","CONSTANT","CONTINUE","DECLARE","DEFAULT","DYNAMIC","ELSE","EXIT",
"FOR","FUNCTION","ITERATE","ID","IF","LABEL","MEMBER","NAME","POS","PRAGMA",
"PRE","PRINTF","PROCEDURE","QUERY","RETURN","SCANF","SPRINTF","SSCANF","SWITCH",
"WHILE","F2I","F2S","I2F","I2S","S2B","S2F","S2I","F2X","I2X","S2X","X2F","X2I",
"X2S","OR","AND","EQ","NE","LE","GE","LS","RS","UNARY","INC","DEC","CAST",
"MAXTOKEN",
};
const char * const exrule[] = {
"$accept : program",
"program : statement_list action_list",
"action_list :",
"action_list : action_list action",
"$$1 :",
"action : LABEL ':' $$1 statement_list",
"statement_list :",
"statement_list : statement_list statement",
"statement : '{' statement_list '}'",
"statement : expr_opt ';'",
"$$2 :",
"statement : DECLARE $$2 dcl_list ';'",
"statement : IF '(' expr ')' statement else_opt",
"statement : FOR '(' variable ')' statement",
"statement : FOR '(' expr_opt ';' expr_opt ';' expr_opt ')' statement",
"statement : WHILE '(' expr ')' statement",
"$$3 :",
"statement : SWITCH '(' expr $$3 ')' '{' switch_list '}'",
"statement : BREAK expr_opt ';'",
"statement : CONTINUE expr_opt ';'",
"statement : RETURN expr_opt ';'",
"switch_list :",
"switch_list : switch_list switch_item",
"switch_item : case_list statement_list",
"case_list : case_item",
"case_list : case_list case_item",
"case_item : CASE constant ':'",
"case_item : DEFAULT ':'",
"dcl_list : dcl_item",
"dcl_list : dcl_list ',' dcl_item",
"$$4 :",
"dcl_item : reference NAME $$4 array initialize",
"name : NAME",
"name : DYNAMIC",
"else_opt :",
"else_opt : ELSE statement",
"expr_opt :",
"expr_opt : expr",
"expr : '(' expr ')'",
"expr : '(' DECLARE ')' expr",
"expr : expr '<' expr",
"expr : expr '-' expr",
"expr : expr '*' expr",
"expr : expr '/' expr",
"expr : expr '%' expr",
"expr : expr LS expr",
"expr : expr RS expr",
"expr : expr '>' expr",
"expr : expr LE expr",
"expr : expr GE expr",
"expr : expr EQ expr",
"expr : expr NE expr",
"expr : expr '&' expr",
"expr : expr '|' expr",
"expr : expr '^' expr",
"expr : expr '+' expr",
"expr : expr AND expr",
"expr : expr OR expr",
"expr : expr ',' expr",
"$$5 :",
"$$6 :",
"expr : expr '?' $$5 expr ':' $$6 expr",
"expr : '!' expr",
"expr : '~' expr",
"expr : '-' expr",
"expr : '+' expr",
"expr : '&' variable",
"expr : reference FUNCTION '(' args ')'",
"expr : EXIT '(' expr ')'",
"expr : PROCEDURE '(' args ')'",
"expr : print '(' args ')'",
"expr : scan '(' args ')'",
"expr : STRING '.' ID",
"expr : variable assign",
"expr : INC variable",
"expr : variable INC",
"expr : DEC variable",
"expr : variable DEC",
"expr : constant",
"constant : CONSTANT",
"constant : FLOATING",
"constant : INTEGER",
"constant : STRING",
"constant : UNSIGNED",
"print : PRINTF",
"print : QUERY",
"print : SPRINTF",
"scan : SCANF",
"scan : SSCANF",
"variable : reference ID index",
"variable : DYNAMIC index",
"variable : NAME",
"array :",
"array : '[' ']'",
"index :",
"index : '[' expr ']'",
"args :",
"args : arg_list",
"arg_list : expr",
"arg_list : arg_list ',' expr",
"formals :",
"formals : DECLARE",
"formals : formal_list",
"formal_list : formal_item",
"formal_list : formal_list ',' formal_item",
"$$7 :",
"formal_item : DECLARE $$7 name",
"reference :",
"reference : reference ID index '.'",
"assign :",
"assign : '=' expr",
"initialize : assign",
"$$8 :",
"$$9 :",
"initialize : '(' $$8 formals $$9 ')' '{' statement_list '}'",
};
#endif
#if EXDEBUG
#include <stdio.h>
#endif
#ifdef EXSTACKSIZE
#undef EXMAXDEPTH
#define EXMAXDEPTH EXSTACKSIZE
#else
#ifdef EXMAXDEPTH
#define EXSTACKSIZE EXMAXDEPTH
#else
#define EXSTACKSIZE 10000
#define EXMAXDEPTH 10000
#endif
#endif
#define EXINITSTACKSIZE 200
int exdebug;
int exnerrs;
int exerrflag;
int exchar;
short *exssp;
EXSTYPE *exvsp;
EXSTYPE exval;
EXSTYPE exlval;
short *exss;
short *exsslim;
EXSTYPE *exvs;
int exstacksize;
/* #line 1054 "/home/gsf/src/lib/libexpr/exparse.y" */

#include "exgram.h"
/* #line 758 "y.tab.c" */
/* allocate initial stack or double stack size, up to EXMAXDEPTH */
static int exgrowstack()
{
    int newsize, i;
    short *newss;
    EXSTYPE *newvs;

    if ((newsize = exstacksize) == 0)
        newsize = EXINITSTACKSIZE;
    else if (newsize >= EXMAXDEPTH)
        return -1;
    else if ((newsize *= 2) > EXMAXDEPTH)
        newsize = EXMAXDEPTH;
    i = exssp - exss;
    newss = exss ? (short *)realloc(exss, newsize * sizeof *newss) :
      (short *)malloc(newsize * sizeof *newss);
    if (newss == NULL)
        return -1;
    exss = newss;
    exssp = newss + i;
    newvs = exvs ? (EXSTYPE *)realloc(exvs, newsize * sizeof *newvs) :
      (EXSTYPE *)malloc(newsize * sizeof *newvs);
    if (newvs == NULL)
        return -1;
    exvs = newvs;
    exvsp = newvs + i;
    exstacksize = newsize;
    exsslim = exss + newsize - 1;
    return 0;
}

#define EXABORT goto exabort
#define EXREJECT goto exabort
#define EXACCEPT goto exaccept
#define EXERROR goto exerrlab

#ifndef EXPARSE_PARAM
#if defined(__cplusplus) || __STDC__
#define EXPARSE_PARAM_ARG void
#define EXPARSE_PARAM_DECL
#else /* ! ANSI-C/C++ */
#define EXPARSE_PARAM_ARG
#define EXPARSE_PARAM_DECL
#endif      /* ANSI-C/C++ */
#else /* EXPARSE_PARAM */
#ifndef EXPARSE_PARAM_TYPE
#define EXPARSE_PARAM_TYPE void *
#endif
#if defined(__cplusplus) || __STDC__
#define EXPARSE_PARAM_ARG EXPARSE_PARAM_TYPE EXPARSE_PARAM
#define EXPARSE_PARAM_DECL
#else /* ! ANSI-C/C++ */
#define EXPARSE_PARAM_ARG EXPARSE_PARAM
#define EXPARSE_PARAM_DECL EXPARSE_PARAM_TYPE EXPARSE_PARAM;
#endif      /* ANSI-C/C++ */
#endif      /* ! EXPARSE_PARAM */

int
exparse (EXPARSE_PARAM_ARG)
    EXPARSE_PARAM_DECL
{
    register int exm, exn, exstate;
#if EXDEBUG
    register const char *exs;

    if ((exs = getenv("EXDEBUG")))
    {
        exn = *exs;
        if (exn >= '0' && exn <= '9')
            exdebug = exn - '0';
    }
#endif

    exnerrs = 0;
    exerrflag = 0;
    exchar = (-1);

    if (exss == NULL && exgrowstack()) goto exoverflow;
    exssp = exss;
    exvsp = exvs;
    *exssp = exstate = 0;

exloop:
    if ((exn = exdefred[exstate])) goto exreduce;
    if (exchar < 0)
    {
        if ((exchar = exlex()) < 0) exchar = 0;
#if EXDEBUG
        if (exdebug)
        {
            exs = 0;
            if (exchar <= EXMAXTOKEN) exs = exname[exchar];
            if (!exs) exs = "illegal-symbol";
            printf("%sdebug: state %d, reading %d (%s)\n",
                    EXPREFIX, exstate, exchar, exs);
        }
#endif
    }
    if ((exn = exsindex[exstate]) && (exn += exchar) >= 0 &&
            exn <= EXTABLESIZE && excheck[exn] == exchar)
    {
#if EXDEBUG
        if (exdebug)
            printf("%sdebug: state %d, shifting to state %d\n",
                    EXPREFIX, exstate, extable[exn]);
#endif
        if (exssp >= exsslim && exgrowstack())
        {
            goto exoverflow;
        }
        *++exssp = exstate = extable[exn];
        *++exvsp = exlval;
        exchar = (-1);
        if (exerrflag > 0)  --exerrflag;
        goto exloop;
    }
    if ((exn = exrindex[exstate]) && (exn += exchar) >= 0 &&
            exn <= EXTABLESIZE && excheck[exn] == exchar)
    {
        exn = extable[exn];
        goto exreduce;
    }
    if (exerrflag) goto exinrecovery;
#if defined(lint) || defined(__GNUC__)
    goto exnewerror;
#endif
exnewerror:
    exerror("syntax error");
#if defined(lint) || defined(__GNUC__)
    goto exerrlab;
#endif
exerrlab:
    ++exnerrs;
exinrecovery:
    if (exerrflag < 3)
    {
        exerrflag = 3;
        for (;;)
        {
            if ((exn = exsindex[*exssp]) && (exn += EXERRCODE) >= 0 &&
                    exn <= EXTABLESIZE && excheck[exn] == EXERRCODE)
            {
#if EXDEBUG
                if (exdebug)
                    printf("%sdebug: state %d, error recovery shifting\
 to state %d\n", EXPREFIX, *exssp, extable[exn]);
#endif
                if (exssp >= exsslim && exgrowstack())
                {
                    goto exoverflow;
                }
                *++exssp = exstate = extable[exn];
                *++exvsp = exlval;
                goto exloop;
            }
            else
            {
#if EXDEBUG
                if (exdebug)
                    printf("%sdebug: error recovery discarding state %d\n",
                            EXPREFIX, *exssp);
#endif
                if (exssp <= exss) goto exabort;
                --exssp;
                --exvsp;
            }
        }
    }
    else
    {
        if (exchar == 0) goto exabort;
#if EXDEBUG
        if (exdebug)
        {
            exs = 0;
            if (exchar <= EXMAXTOKEN) exs = exname[exchar];
            if (!exs) exs = "illegal-symbol";
            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
                    EXPREFIX, exstate, exchar, exs);
        }
#endif
        exchar = (-1);
        goto exloop;
    }
exreduce:
#if EXDEBUG
    if (exdebug)
        printf("%sdebug: state %d, reducing by rule %d (%s)\n",
                EXPREFIX, exstate, exn, exrule[exn]);
#endif
    exm = exlen[exn];
    exval = exvsp[1-exm];
    switch (exn)
    {
case 1:
/* #line 137 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  if (exvsp[-1].expr && !(expr.program->disc->flags & EX_STRICT))
                  {
                        if (expr.program->main.value && !(expr.program->disc->flags & EX_RETAIN))
                              exfreenode(expr.program, expr.program->main.value);
                        if (exvsp[-1].expr->op == S2B)
                        {
                              Exnode_t*   x;

                              x = exvsp[-1].expr;
                              exvsp[-1].expr = x->data.operand.left;
                              x->data.operand.left = 0;
                              exfreenode(expr.program, x);
                        }
                        expr.program->main.lex = PROCEDURE;
                        expr.program->main.value = exnewnode(expr.program, PROCEDURE, 1, exvsp[-1].expr->type, NiL, exvsp[-1].expr);
                  }
            }
break;
case 4:
/* #line 161 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                        register Dtdisc_t*      disc;

                        if (expr.procedure)
                              exerror("no nested function definitions");
                        exvsp[-1].id->lex = PROCEDURE;
                        expr.procedure = exvsp[-1].id->value = exnewnode(expr.program, PROCEDURE, 1, exvsp[-1].id->type, NiL, NiL);
                        expr.procedure->type = INTEGER;
                        if (!(disc = newof(0, Dtdisc_t, 1, 0)))
                              exnospace();
                        disc->key = offsetof(Exid_t, name);
                        if (!(expr.procedure->data.procedure.frame = dtopen(disc, Dtset)) || !dtview(expr.procedure->data.procedure.frame, expr.program->symbols))
                              exnospace();
                        expr.program->symbols = expr.program->frame = expr.procedure->data.procedure.frame;
                  }
break;
case 5:
/* #line 176 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  expr.procedure = 0;
                  if (expr.program->frame)
                  {
                        expr.program->symbols = expr.program->frame->view;
                        dtview(expr.program->frame, NiL);
                  }
                  if (exvsp[0].expr && exvsp[0].expr->op == S2B)
                  {
                        Exnode_t*   x;

                        x = exvsp[0].expr;
                        exvsp[0].expr = x->data.operand.left;
                        x->data.operand.left = 0;
                        exfreenode(expr.program, x);
                  }
                  exvsp[-3].id->value->data.operand.right = excast(expr.program, exvsp[0].expr, exvsp[-3].id->type, NiL, 0);
            }
break;
case 6:
/* #line 197 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = 0;
            }
break;
case 7:
/* #line 201 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  if (!exvsp[-1].expr)
                        exval.expr = exvsp[0].expr;
                  else if (!exvsp[0].expr)
                        exval.expr = exvsp[-1].expr;
                  else if (exvsp[-1].expr->op == CONSTANT)
                  {
                        exfreenode(expr.program, exvsp[-1].expr);
                        exval.expr = exvsp[0].expr;
                  }
                  else exval.expr = exnewnode(expr.program, ';', 1, exvsp[0].expr->type, exvsp[-1].expr, exvsp[0].expr);
            }
break;
case 8:
/* #line 216 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exvsp[-1].expr;
            }
break;
case 9:
/* #line 220 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = (exvsp[-1].expr && exvsp[-1].expr->type == STRING) ? exnewnode(expr.program, S2B, 1, INTEGER, exvsp[-1].expr, NiL) : exvsp[-1].expr;
            }
break;
case 10:
/* #line 223 "/home/gsf/src/lib/libexpr/exparse.y" */
{expr.declare=exvsp[0].id->type;}
break;
case 11:
/* #line 224 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exvsp[-1].expr;
            }
break;
case 12:
/* #line 228 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  if (exvsp[-3].expr->type == STRING)
                        exvsp[-3].expr = exnewnode(expr.program, S2B, 1, INTEGER, exvsp[-3].expr, NiL);
                  else if (!INTEGRAL(exvsp[-3].expr->type))
                        exvsp[-3].expr = excast(expr.program, exvsp[-3].expr, INTEGER, NiL, 0);
                  exval.expr = exnewnode(expr.program, exvsp[-5].id->index, 1, INTEGER, exvsp[-3].expr, exnewnode(expr.program, ':', 1, exvsp[-1].expr ? exvsp[-1].expr->type : 0, exvsp[-1].expr, exvsp[0].expr));
            }
break;
case 13:
/* #line 236 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, ITERATE, 0, INTEGER, NiL, NiL);
                  exval.expr->data.generate.array = exvsp[-2].expr;
                  if (!exvsp[-2].expr->data.variable.index || exvsp[-2].expr->data.variable.index->op != DYNAMIC)
                        exerror("simple index variable expected");
                  exval.expr->data.generate.index = exvsp[-2].expr->data.variable.index->data.variable.symbol;
                  if (exvsp[-2].expr->op == ID && exval.expr->data.generate.index->type != INTEGER)
                        exerror("integer index variable expected");
                  exfreenode(expr.program, exvsp[-2].expr->data.variable.index);
                  exvsp[-2].expr->data.variable.index = 0;
                  exval.expr->data.generate.statement = exvsp[0].expr;
            }
break;
case 14:
/* #line 249 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  if (!exvsp[-4].expr)
                  {
                        exvsp[-4].expr = exnewnode(expr.program, CONSTANT, 0, INTEGER, NiL, NiL);
                        exvsp[-4].expr->data.constant.value.integer = 1;
                  }
                  else if (exvsp[-4].expr->type == STRING)
                        exvsp[-4].expr = exnewnode(expr.program, S2B, 1, INTEGER, exvsp[-4].expr, NiL);
                  else if (!INTEGRAL(exvsp[-4].expr->type))
                        exvsp[-4].expr = excast(expr.program, exvsp[-4].expr, INTEGER, NiL, 0);
                  exval.expr = exnewnode(expr.program, exvsp[-8].id->index, 1, INTEGER, exvsp[-4].expr, exnewnode(expr.program, ';', 1, 0, exvsp[-2].expr, exvsp[0].expr));
                  if (exvsp[-6].expr)
                        exval.expr = exnewnode(expr.program, ';', 1, INTEGER, exvsp[-6].expr, exval.expr);
            }
break;
case 15:
/* #line 264 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  if (exvsp[-2].expr->type == STRING)
                        exvsp[-2].expr = exnewnode(expr.program, S2B, 1, INTEGER, exvsp[-2].expr, NiL);
                  else if (!INTEGRAL(exvsp[-2].expr->type))
                        exvsp[-2].expr = excast(expr.program, exvsp[-2].expr, INTEGER, NiL, 0);
                  exval.expr = exnewnode(expr.program, exvsp[-4].id->index, 1, INTEGER, exvsp[-2].expr, exnewnode(expr.program, ';', 1, 0, NiL, exvsp[0].expr));
            }
break;
case 16:
/* #line 271 "/home/gsf/src/lib/libexpr/exparse.y" */
{expr.declare=exvsp[0].expr->type;}
break;
case 17:
/* #line 272 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  register Switch_t*      sw = expr.swstate;

                  exval.expr = exnewnode(expr.program, exvsp[-7].id->index, 1, INTEGER, exvsp[-5].expr, exnewnode(expr.program, DEFAULT, 1, 0, sw->defcase, sw->firstcase));
                  expr.swstate = expr.swstate->prev;
                  if (sw->base)
                        free(sw->base);
                  if (sw != &swstate)
                        free(sw);
            }
break;
case 18:
/* #line 283 "/home/gsf/src/lib/libexpr/exparse.y" */
{
            loopop:
                  if (!exvsp[-1].expr)
                  {
                        exvsp[-1].expr = exnewnode(expr.program, CONSTANT, 0, INTEGER, NiL, NiL);
                        exvsp[-1].expr->data.constant.value.integer = 1;
                  }
                  else if (!INTEGRAL(exvsp[-1].expr->type))
                        exvsp[-1].expr = excast(expr.program, exvsp[-1].expr, INTEGER, NiL, 0);
                  exval.expr = exnewnode(expr.program, exvsp[-2].id->index, 1, INTEGER, exvsp[-1].expr, NiL);
            }
break;
case 19:
/* #line 295 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto loopop;
            }
break;
case 20:
/* #line 299 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  if (exvsp[-1].expr)
                  {
                        if (expr.procedure && !expr.procedure->type)
                              exerror("return in void function");
                        exvsp[-1].expr = excast(expr.program, exvsp[-1].expr, expr.procedure ? expr.procedure->type : INTEGER, NiL, 0);
                  }
                  exval.expr = exnewnode(expr.program, RETURN, 1, exvsp[-1].expr ? exvsp[-1].expr->type : 0, exvsp[-1].expr, NiL);
            }
break;
case 21:
/* #line 311 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  register Switch_t*            sw;
                  int                     n;

                  if (expr.swstate)
                  {
                        if (!(sw = newof(0, Switch_t, 1, 0)))
                        {
                              exnospace();
                              sw = &swstate;
                        }
                        sw->prev = expr.swstate;
                  }
                  else sw = &swstate;
                  expr.swstate = sw;
                  sw->type = expr.declare;
                  sw->firstcase = 0;
                  sw->lastcase = 0;
                  sw->defcase = 0;
                  sw->def = 0;
                  n = 8;
                  if (!(sw->base = newof(0, Extype_t*, n, 0)))
                  {
                        exnospace();
                        n = 0;
                  }
                  sw->cur = sw->base;
                  sw->last = sw->base + n;
            }
break;
case 23:
/* #line 344 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  register Switch_t*      sw = expr.swstate;
                  int               n;

                  exval.expr = exnewnode(expr.program, CASE, 1, 0, exvsp[0].expr, NiL);
                  if (sw->cur > sw->base)
                  {
                        if (sw->lastcase)
                              sw->lastcase->data.select.next = exval.expr;
                        else sw->firstcase = exval.expr;
                        sw->lastcase = exval.expr;
                        n = sw->cur - sw->base;
                        sw->cur = sw->base;
                        exval.expr->data.select.constant = (Extype_t**)exalloc(expr.program, (n + 1) * sizeof(Extype_t*));
                        memcpy(exval.expr->data.select.constant, sw->base, n * sizeof(Extype_t*));
                        exval.expr->data.select.constant[n] = 0;
                  }
                  else exval.expr->data.select.constant = 0;
                  if (sw->def)
                  {
                        sw->def = 0;
                        if (sw->defcase)
                              exerror("duplicate default in switch");
                        else sw->defcase = exvsp[0].expr;
                  }
            }
break;
case 26:
/* #line 377 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  int   n;

                  if (expr.swstate->cur >= expr.swstate->last)
                  {
                        n = expr.swstate->cur - expr.swstate->base;
                        if (!(expr.swstate->base = newof(expr.swstate->base, Extype_t*, 2 * n, 0)))
                        {
                              exerror("too many case labels for switch");
                              n = 0;
                        }
                        expr.swstate->cur = expr.swstate->base + n;
                        expr.swstate->last = expr.swstate->base + 2 * n;
                  }
                  if (expr.swstate->cur)
                  {
                        exvsp[-1].expr = excast(expr.program, exvsp[-1].expr, expr.swstate->type, NiL, 0);
                        *expr.swstate->cur++ = &(exvsp[-1].expr->data.constant.value);
                  }
            }
break;
case 27:
/* #line 398 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  expr.swstate->def = 1;
            }
break;
case 29:
/* #line 405 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  if (exvsp[0].expr)
                        exval.expr = exvsp[-2].expr ? exnewnode(expr.program, ',', 1, exvsp[0].expr->type, exvsp[-2].expr, exvsp[0].expr) : exvsp[0].expr;
            }
break;
case 30:
/* #line 411 "/home/gsf/src/lib/libexpr/exparse.y" */
{expr.id=exvsp[0].id;}
break;
case 31:
/* #line 412 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = 0;
                  exvsp[-3].id->type = expr.declare;
                  if (exvsp[-4].reference)
                  {
                        exvsp[-3].id->index = MEMBER;
                        if (!expr.program->disc->getf || !expr.program->symbols)
                              exerror("%s: member references not supported", exvsp[-4].reference);
                        else if (exvsp[0].expr)
                              exerror("%s: member references cannot be initialized", exvsp[-3].id);
                        else if (expr.program->disc->reff)
                              (*expr.program->disc->reff)(expr.program, exval.expr, exvsp[-3].id, exvsp[-4].reference, NiL, EX_SCALAR, expr.program->disc);
                  }
                  else if (exvsp[0].expr && exvsp[0].expr->op == PROCEDURE)
                  {
                        exvsp[-3].id->lex = PROCEDURE;
                        exvsp[-3].id->value = exvsp[0].expr;
                  }
                  else
                  {
                        exvsp[-3].id->lex = DYNAMIC;
                        exvsp[-3].id->value = exnewnode(expr.program, 0, 0, 0, NiL, NiL);
                        if (exvsp[-1].integer && !exvsp[-3].id->local.pointer)
                        {
                              Dtdisc_t*   disc;

                              if (!(disc = newof(0, Dtdisc_t, 1, 0)))
                                    exnospace();
                              disc->key = offsetof(Exassoc_t, name);
                              if (!(exvsp[-3].id->local.pointer = (char*)dtopen(disc, Dtoset)))
                                    exerror("%s: cannot initialize associative array", exvsp[-3].id->name);
                        }
                        if (exvsp[0].expr)
                        {
                              if (exvsp[0].expr->type != exvsp[-3].id->type)
                              {
                                    exvsp[0].expr->type = exvsp[-3].id->type;
                                    exvsp[0].expr->data.operand.right = excast(expr.program, exvsp[0].expr->data.operand.right, exvsp[-3].id->type, NiL, 0);
                              }
                              exvsp[0].expr->data.operand.left = exnewnode(expr.program, DYNAMIC, 0, exvsp[-3].id->type, NiL, NiL);
                              exvsp[0].expr->data.operand.left->data.variable.symbol = exvsp[-3].id;
                              exval.expr = exvsp[0].expr;
                        }
                        else if (!exvsp[-1].integer)
                              exvsp[-3].id->value->data.value = exzero(exvsp[-3].id->type);
                  }
            }
break;
case 34:
/* #line 466 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = 0;
            }
break;
case 35:
/* #line 470 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exvsp[0].expr;
            }
break;
case 36:
/* #line 476 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = 0;
            }
break;
case 38:
/* #line 483 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exvsp[-1].expr;
            }
break;
case 39:
/* #line 487 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = (exvsp[0].expr->type == exvsp[-2].id->type) ? exvsp[0].expr : excast(expr.program, exvsp[0].expr, exvsp[-2].id->type, NiL, 0);
            }
break;
case 40:
/* #line 491 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  int   rel;

            relational:
                  rel = INTEGER;
                  goto coerce;
            binary:
                  rel = 0;
            coerce:
                  if (!exvsp[-2].expr->type)
                  {
                        if (!exvsp[0].expr->type)
                              exvsp[-2].expr->type = exvsp[0].expr->type = rel ? STRING : INTEGER;
                        else exvsp[-2].expr->type = exvsp[0].expr->type;
                  }
                  else if (!exvsp[0].expr->type) exvsp[0].expr->type = exvsp[-2].expr->type;
                  if (exvsp[-2].expr->type != exvsp[0].expr->type)
                  {
                        if (exvsp[-2].expr->type == STRING)
                              exvsp[-2].expr = excast(expr.program, exvsp[-2].expr, exvsp[0].expr->type, exvsp[0].expr, 0);
                        else if (exvsp[0].expr->type == STRING)
                              exvsp[0].expr = excast(expr.program, exvsp[0].expr, exvsp[-2].expr->type, exvsp[-2].expr, 0);
                        else if (exvsp[-2].expr->type == FLOATING)
                              exvsp[0].expr = excast(expr.program, exvsp[0].expr, FLOATING, exvsp[-2].expr, 0);
                        else if (exvsp[0].expr->type == FLOATING)
                              exvsp[-2].expr = excast(expr.program, exvsp[-2].expr, FLOATING, exvsp[0].expr, 0);
                  }
                  if (!rel)
                        rel = (exvsp[-2].expr->type == STRING) ? STRING : ((exvsp[-2].expr->type == UNSIGNED) ? UNSIGNED : exvsp[0].expr->type);
                  exval.expr = exnewnode(expr.program, exvsp[-1].op, 1, rel, exvsp[-2].expr, exvsp[0].expr);
                  if (!expr.program->errors && exvsp[-2].expr->op == CONSTANT && exvsp[0].expr->op == CONSTANT)
                  {
                        exval.expr->data.constant.value = exeval(expr.program, exval.expr, NiL);
                        exval.expr->binary = 0;
                        exval.expr->op = CONSTANT;
                        exfreenode(expr.program, exvsp[-2].expr);
                        exfreenode(expr.program, exvsp[0].expr);
                  }
            }
break;
case 41:
/* #line 531 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto binary;
            }
break;
case 42:
/* #line 535 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto binary;
            }
break;
case 43:
/* #line 539 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto binary;
            }
break;
case 44:
/* #line 543 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto binary;
            }
break;
case 45:
/* #line 547 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto binary;
            }
break;
case 46:
/* #line 551 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto binary;
            }
break;
case 47:
/* #line 555 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto relational;
            }
break;
case 48:
/* #line 559 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto relational;
            }
break;
case 49:
/* #line 563 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto relational;
            }
break;
case 50:
/* #line 567 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto relational;
            }
break;
case 51:
/* #line 571 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto relational;
            }
break;
case 52:
/* #line 575 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto binary;
            }
break;
case 53:
/* #line 579 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto binary;
            }
break;
case 54:
/* #line 583 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto binary;
            }
break;
case 55:
/* #line 587 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto binary;
            }
break;
case 56:
/* #line 591 "/home/gsf/src/lib/libexpr/exparse.y" */
{
            logical:
                  if (exvsp[-2].expr->type == STRING)
                        exvsp[-2].expr = exnewnode(expr.program, S2B, 1, INTEGER, exvsp[-2].expr, NiL);
                  if (exvsp[0].expr->type == STRING)
                        exvsp[0].expr = exnewnode(expr.program, S2B, 1, INTEGER, exvsp[0].expr, NiL);
                  goto binary;
            }
break;
case 57:
/* #line 600 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto logical;
            }
break;
case 58:
/* #line 604 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  if (exvsp[-2].expr->op == CONSTANT)
                  {
                        exfreenode(expr.program, exvsp[-2].expr);
                        exval.expr = exvsp[0].expr;
                  }
                  else exval.expr = exnewnode(expr.program, ',', 1, exvsp[0].expr->type, exvsp[-2].expr, exvsp[0].expr);
            }
break;
case 59:
/* #line 612 "/home/gsf/src/lib/libexpr/exparse.y" */
{expr.nolabel=1;}
break;
case 60:
/* #line 612 "/home/gsf/src/lib/libexpr/exparse.y" */
{expr.nolabel=0;}
break;
case 61:
/* #line 613 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  if (!exvsp[-3].expr->type)
                  {
                        if (!exvsp[0].expr->type)
                              exvsp[-3].expr->type = exvsp[0].expr->type = INTEGER;
                        else exvsp[-3].expr->type = exvsp[0].expr->type;
                  }
                  else if (!exvsp[0].expr->type)
                        exvsp[0].expr->type = exvsp[-3].expr->type;
                  if (exvsp[-6].expr->type == STRING)
                        exvsp[-6].expr = exnewnode(expr.program, S2B, 1, INTEGER, exvsp[-6].expr, NiL);
                  else if (!INTEGRAL(exvsp[-6].expr->type))
                        exvsp[-6].expr = excast(expr.program, exvsp[-6].expr, INTEGER, NiL, 0);
                  if (exvsp[-3].expr->type != exvsp[0].expr->type)
                  {
                        if (exvsp[-3].expr->type == STRING || exvsp[0].expr->type == STRING)
                              exerror("if statement string type mismatch");
                        else if (exvsp[-3].expr->type == FLOATING)
                              exvsp[0].expr = excast(expr.program, exvsp[0].expr, FLOATING, NiL, 0);
                        else if (exvsp[0].expr->type == FLOATING)
                              exvsp[-3].expr = excast(expr.program, exvsp[-3].expr, FLOATING, NiL, 0);
                  }
                  if (exvsp[-6].expr->op == CONSTANT)
                  {
                        if (exvsp[-6].expr->data.constant.value.integer)
                        {
                              exval.expr = exvsp[-3].expr;
                              exfreenode(expr.program, exvsp[0].expr);
                        }
                        else
                        {
                              exval.expr = exvsp[0].expr;
                              exfreenode(expr.program, exvsp[-3].expr);
                        }
                        exfreenode(expr.program, exvsp[-6].expr);
                  }
                  else exval.expr = exnewnode(expr.program, '?', 1, exvsp[-3].expr->type, exvsp[-6].expr, exnewnode(expr.program, ':', 1, exvsp[-3].expr->type, exvsp[-3].expr, exvsp[0].expr));
            }
break;
case 62:
/* #line 652 "/home/gsf/src/lib/libexpr/exparse.y" */
{
            iunary:
                  if (exvsp[0].expr->type == STRING)
                        exvsp[0].expr = exnewnode(expr.program, S2B, 1, INTEGER, exvsp[0].expr, NiL);
                  else if (!INTEGRAL(exvsp[0].expr->type))
                        exvsp[0].expr = excast(expr.program, exvsp[0].expr, INTEGER, NiL, 0);
            unary:
                  exval.expr = exnewnode(expr.program, exvsp[-1].op, 1, exvsp[0].expr->type == UNSIGNED ? INTEGER : exvsp[0].expr->type, exvsp[0].expr, NiL);
                  if (exvsp[0].expr->op == CONSTANT)
                  {
                        exval.expr->data.constant.value = exeval(expr.program, exval.expr, NiL);
                        exval.expr->binary = 0;
                        exval.expr->op = CONSTANT;
                        exfreenode(expr.program, exvsp[0].expr);
                  }
            }
break;
case 63:
/* #line 669 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto iunary;
            }
break;
case 64:
/* #line 673 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto unary;
            }
break;
case 65:
/* #line 677 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exvsp[0].expr;
            }
break;
case 66:
/* #line 681 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, ADDRESS, 0, T(exvsp[0].expr->type), exvsp[0].expr, NiL);
            }
break;
case 67:
/* #line 685 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, FUNCTION, 1, T(exvsp[-3].id->type), call(exvsp[-4].reference, exvsp[-3].id, exvsp[-1].expr), exvsp[-1].expr);
                  if (!expr.program->disc->getf)
                        exerror("%s: function references not supported", exval.expr->data.operand.left->data.variable.symbol->name);
                  else if (expr.program->disc->reff)
                        (*expr.program->disc->reff)(expr.program, exval.expr, exval.expr->data.operand.left->data.variable.symbol, exvsp[-4].reference, NiL, EX_CALL, expr.program->disc);
            }
break;
case 68:
/* #line 693 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  if (!INTEGRAL(exvsp[-1].expr->type))
                        exvsp[-1].expr = excast(expr.program, exvsp[-1].expr, INTEGER, NiL, 0);
                  exval.expr = exnewnode(expr.program, EXIT, 1, INTEGER, exvsp[-1].expr, NiL);
            }
break;
case 69:
/* #line 699 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, CALL, 1, exvsp[-3].id->type, NiL, exvsp[-1].expr);
                  exval.expr->data.call.procedure = exvsp[-3].id;
            }
break;
case 70:
/* #line 704 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, exvsp[-3].id->index, 0, exvsp[-3].id->type, NiL, NiL);
                  if (exvsp[-1].expr && exvsp[-1].expr->data.operand.left->type == INTEGER)
                  {
                        exval.expr->data.print.descriptor = exvsp[-1].expr->data.operand.left;
                        exvsp[-1].expr = exvsp[-1].expr->data.operand.right;
                  }
                  else switch (exvsp[-3].id->index)
                  {
                  case QUERY:
                        exval.expr->data.print.descriptor = exnewnode(expr.program, CONSTANT, 0, INTEGER, NiL, NiL);
                        exval.expr->data.print.descriptor->data.constant.value.integer = 2;
                        break;
                  case PRINTF:
                        exval.expr->data.print.descriptor = exnewnode(expr.program, CONSTANT, 0, INTEGER, NiL, NiL);
                        exval.expr->data.print.descriptor->data.constant.value.integer = 1;
                        break;
                  case SPRINTF:
                        exval.expr->data.print.descriptor = 0;
                        break;
                  }
                  exval.expr->data.print.args = preprint(exvsp[-1].expr);
            }
break;
case 71:
/* #line 728 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  register Exnode_t*      x;

                  exval.expr = exnewnode(expr.program, exvsp[-3].id->index, 0, exvsp[-3].id->type, NiL, NiL);
                  if (exvsp[-1].expr && exvsp[-1].expr->data.operand.left->type == INTEGER)
                  {
                        exval.expr->data.scan.descriptor = exvsp[-1].expr->data.operand.left;
                        exvsp[-1].expr = exvsp[-1].expr->data.operand.right;
                  }
                  else switch (exvsp[-3].id->index)
                  {
                  case SCANF:
                        exval.expr->data.scan.descriptor = 0;
                        break;
                  case SSCANF:
                        if (exvsp[-1].expr && exvsp[-1].expr->data.operand.left->type == STRING)
                        {
                              exval.expr->data.scan.descriptor = exvsp[-1].expr->data.operand.left;
                              exvsp[-1].expr = exvsp[-1].expr->data.operand.right;
                        }
                        else
                              exerror("%s: string argument expected", exvsp[-3].id->name);
                        break;
                  }
                  if (!exvsp[-1].expr || !exvsp[-1].expr->data.operand.left || exvsp[-1].expr->data.operand.left->type != STRING)
                        exerror("%s: format argument expected", exvsp[-3].id->name);
                  exval.expr->data.scan.format = exvsp[-1].expr->data.operand.left;
                  for (x = exval.expr->data.scan.args = exvsp[-1].expr->data.operand.right; x; x = x->data.operand.right)
                  {
                        if (x->data.operand.left->op != ADDRESS)
                              exerror("%s: address argument expected", exvsp[-3].id->name);
                        x->data.operand.left = x->data.operand.left->data.operand.left;
                  }
            }
break;
case 72:
/* #line 763 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, CONSTANT, 0, exvsp[0].id->type, NiL, NiL);
                  if (!expr.program->disc->reff)
                        exerror("%s: qualified identifier references not supported", exvsp[0].id->name);
                  else
                  {
                        exval.expr->data.constant.value = (*expr.program->disc->reff)(expr.program, exval.expr, exvsp[0].id, NiL, exvsp[-2].string, EX_SCALAR, expr.program->disc);
                        exval.expr->data.constant.reference = exvsp[0].id;
                  }
            }
break;
case 73:
/* #line 774 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  if (exvsp[0].expr)
                  {
                        if (exvsp[-1].expr->op == ID && !expr.program->disc->setf)
                              exerror("%s: variable assignment not supported", exvsp[-1].expr->data.variable.symbol->name);
                        else
                        {
                              if (!exvsp[-1].expr->type)
                                    exvsp[-1].expr->type = exvsp[0].expr->type;
#if 0
                              else if (exvsp[0].expr->type != exvsp[-1].expr->type && exvsp[-1].expr->type >= 0200)
#else
                              else if (exvsp[0].expr->type != exvsp[-1].expr->type)
#endif
                              {
                                    exvsp[0].expr->type = exvsp[-1].expr->type;
                                    exvsp[0].expr->data.operand.right = excast(expr.program, exvsp[0].expr->data.operand.right, exvsp[-1].expr->type, NiL, 0);
                              }
                              exvsp[0].expr->data.operand.left = exvsp[-1].expr;
                              exval.expr = exvsp[0].expr;
                        }
                  }
            }
break;
case 74:
/* #line 798 "/home/gsf/src/lib/libexpr/exparse.y" */
{
            pre:
                  if (exvsp[0].expr->type == STRING)
                        exerror("++ and -- invalid for string variables");
                  exval.expr = exnewnode(expr.program, exvsp[-1].op, 0, exvsp[0].expr->type, exvsp[0].expr, NiL);
                  exval.expr->subop = PRE;
            }
break;
case 75:
/* #line 806 "/home/gsf/src/lib/libexpr/exparse.y" */
{
            pos:
                  if (exvsp[-1].expr->type == STRING)
                        exerror("++ and -- invalid for string variables");
                  exval.expr = exnewnode(expr.program, exvsp[0].op, 0, exvsp[-1].expr->type, exvsp[-1].expr, NiL);
                  exval.expr->subop = POS;
            }
break;
case 76:
/* #line 814 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto pre;
            }
break;
case 77:
/* #line 818 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  goto pos;
            }
break;
case 79:
/* #line 825 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, CONSTANT, 0, exvsp[0].id->type, NiL, NiL);
                  if (!expr.program->disc->reff)
                        exerror("%s: identifier references not supported", exvsp[0].id->name);
                  else exval.expr->data.constant.value = (*expr.program->disc->reff)(expr.program, exval.expr, exvsp[0].id, NiL, NiL, EX_SCALAR, expr.program->disc);
            }
break;
case 80:
/* #line 832 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, CONSTANT, 0, FLOATING, NiL, NiL);
                  exval.expr->data.constant.value.floating = exvsp[0].floating;
            }
break;
case 81:
/* #line 837 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, CONSTANT, 0, INTEGER, NiL, NiL);
                  exval.expr->data.constant.value.integer = exvsp[0].integer;
            }
break;
case 82:
/* #line 842 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, CONSTANT, 0, STRING, NiL, NiL);
                  exval.expr->data.constant.value.string = exvsp[0].string;
            }
break;
case 83:
/* #line 847 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, CONSTANT, 0, UNSIGNED, NiL, NiL);
                  exval.expr->data.constant.value.integer = exvsp[0].integer;
            }
break;
case 89:
/* #line 863 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, ID, 0, exvsp[-1].id->type, NiL, NiL);
                  exval.expr->data.variable.symbol = QUALIFY(exvsp[-2].reference, exvsp[-1].id);
                  exval.expr->data.variable.reference = exvsp[-2].reference;
                  if (exvsp[0].expr && !INTEGRAL(exvsp[0].expr->type))
                        exvsp[0].expr = excast(expr.program, exvsp[0].expr, INTEGER, NiL, 0);
                  exval.expr->data.variable.index = exvsp[0].expr;
                  if (!expr.program->disc->getf)
                        exerror("%s: identifier references not supported", exvsp[-1].id->name);
                  else if (expr.program->disc->reff)
                        (*expr.program->disc->reff)(expr.program, exval.expr, exval.expr->data.variable.symbol, exvsp[-2].reference, NiL, exvsp[0].expr ? 0 : EX_SCALAR, expr.program->disc);
                  exval.expr->type = exval.expr->data.variable.symbol->type;
            }
break;
case 90:
/* #line 877 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, DYNAMIC, 0, exvsp[-1].id->type, NiL, NiL);
                  exval.expr->data.variable.symbol = exvsp[-1].id;
                  exval.expr->data.variable.reference = 0;
                  if (((exval.expr->data.variable.index = exvsp[0].expr) == 0) != (exvsp[-1].id->local.pointer == 0))
                        exerror("%s: is%s an array", exvsp[-1].id->name, exvsp[-1].id->local.pointer ? "" : " not");
            }
break;
case 91:
/* #line 885 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, ID, 0, 0, NiL, NiL);
                  exval.expr->data.variable.symbol = exvsp[0].id;
                  exval.expr->data.variable.reference = 0;
                  exval.expr->data.variable.index = 0;
                  if (!(expr.program->disc->flags & EX_UNDECLARED))
                        exerror("unknown identifier");
            }
break;
case 92:
/* #line 896 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.integer = 0;
            }
break;
case 93:
/* #line 900 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.integer = 1;
            }
break;
case 94:
/* #line 906 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = 0;
            }
break;
case 95:
/* #line 910 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exvsp[-1].expr;
            }
break;
case 96:
/* #line 916 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = 0;
            }
break;
case 97:
/* #line 920 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exvsp[0].expr->data.operand.left;
                  exvsp[0].expr->data.operand.left = exvsp[0].expr->data.operand.right = 0;
                  exfreenode(expr.program, exvsp[0].expr);
            }
break;
case 98:
/* #line 928 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, ';', 1, 0, exnewnode(expr.program, ';', 1, exvsp[0].expr->type, exvsp[0].expr, NiL), NiL);
                  exval.expr->data.operand.right = exval.expr->data.operand.left;
            }
break;
case 99:
/* #line 933 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exvsp[-2].expr->data.operand.right = exvsp[-2].expr->data.operand.right->data.operand.right = exnewnode(expr.program, ',', 1, exvsp[-2].expr->type, exvsp[0].expr, NiL);
            }
break;
case 100:
/* #line 939 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = 0;
            }
break;
case 101:
/* #line 943 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = 0;
                  if (exvsp[0].id->type)
                        exerror("(void) expected");
            }
break;
case 103:
/* #line 952 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, ',', 1, exvsp[0].expr->type, exvsp[0].expr, NiL);
            }
break;
case 104:
/* #line 956 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  register Exnode_t*      x;
                  register Exnode_t*      y;

                  exval.expr = exvsp[-2].expr;
                  for (x = exvsp[-2].expr; y = x->data.operand.right; x = y);
                  x->data.operand.right = exnewnode(expr.program, ',', 1, exvsp[0].expr->type, exvsp[0].expr, NiL);
            }
break;
case 105:
/* #line 966 "/home/gsf/src/lib/libexpr/exparse.y" */
{expr.declare=exvsp[0].id->type;}
break;
case 106:
/* #line 967 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, ID, 0, exvsp[0].id->type, NiL, NiL);
                  exval.expr->data.variable.symbol = exvsp[0].id;
                  exvsp[0].id->lex = DYNAMIC;
                  exvsp[0].id->value = exnewnode(expr.program, 0, 0, 0, NiL, NiL);
                  expr.procedure->data.procedure.arity++;
            }
break;
case 107:
/* #line 977 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.reference = expr.refs = expr.lastref = 0;
            }
break;
case 108:
/* #line 981 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  Exref_t*    r;

                  r = ALLOCATE(expr.program, Exref_t);
                  if (expr.lastref)
                  {
                        r->symbol = QUALIFY(expr.lastref, exvsp[-2].id);
                        expr.lastref->next = r;
                  }
                  else
                  {
                        r->symbol = exvsp[-2].id;
                        expr.refs = r;
                  }
                  expr.lastref = r;
                  r->next = 0;
                  r->index = exvsp[-1].expr;
                  exval.reference = expr.refs;
            }
break;
case 109:
/* #line 1003 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = 0;
            }
break;
case 110:
/* #line 1007 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = exnewnode(expr.program, '=', 1, exvsp[0].expr->type, NiL, exvsp[0].expr);
                  exval.expr->subop = exvsp[-1].op;
            }
break;
case 112:
/* #line 1014 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                        register Dtdisc_t*      disc;

                        if (expr.procedure)
                              exerror("no nested function definitions");
                        expr.procedure = exnewnode(expr.program, PROCEDURE, 1, expr.declare, NiL, NiL);
                        if (!(disc = newof(0, Dtdisc_t, 1, 0)))
                              exnospace();
                        disc->key = offsetof(Exid_t, name);
                        if (!(expr.procedure->data.procedure.frame = dtopen(disc, Dtset)) || !dtview(expr.procedure->data.procedure.frame, expr.program->symbols))
                              exnospace();
                        expr.program->symbols = expr.program->frame = expr.procedure->data.procedure.frame;
                        expr.program->formals = 1;
                  }
break;
case 113:
/* #line 1027 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                        expr.program->formals = 0;
                        expr.id->lex = PROCEDURE;
                        expr.id->type = expr.declare;
                  }
break;
case 114:
/* #line 1032 "/home/gsf/src/lib/libexpr/exparse.y" */
{
                  exval.expr = expr.procedure;
                  expr.procedure = 0;
                  if (expr.program->frame)
                  {
                        expr.program->symbols = expr.program->frame->view;
                        dtview(expr.program->frame, NiL);
                  }
                  exval.expr->data.operand.left = exvsp[-5].expr;
                  exval.expr->data.operand.right = excast(expr.program, exvsp[-1].expr, exval.expr->type, NiL, 0);

                  /*
                   * NOTE: procedure definition was slipped into the
                   *     declaration initializer statement production,
                   *     therefore requiring the statement terminator
                   */

                  exunlex(expr.program, ';');
            }
break;
/* #line 2007 "y.tab.c" */
    }
    exssp -= exm;
    exstate = *exssp;
    exvsp -= exm;
    exm = exlhs[exn];
    if (exstate == 0 && exm == 0)
    {
#if EXDEBUG
        if (exdebug)
            printf("%sdebug: after reduction, shifting from state 0 to\
 state %d\n", EXPREFIX, EXFINAL);
#endif
        exstate = EXFINAL;
        *++exssp = EXFINAL;
        *++exvsp = exval;
        if (exchar < 0)
        {
            if ((exchar = exlex()) < 0) exchar = 0;
#if EXDEBUG
            if (exdebug)
            {
                exs = 0;
                if (exchar <= EXMAXTOKEN) exs = exname[exchar];
                if (!exs) exs = "illegal-symbol";
                printf("%sdebug: state %d, reading %d (%s)\n",
                        EXPREFIX, EXFINAL, exchar, exs);
            }
#endif
        }
        if (exchar == 0) goto exaccept;
        goto exloop;
    }
    if ((exn = exgindex[exm]) && (exn += exstate) >= 0 &&
            exn <= EXTABLESIZE && excheck[exn] == exstate)
        exstate = extable[exn];
    else
        exstate = exdgoto[exm];
#if EXDEBUG
    if (exdebug)
        printf("%sdebug: after reduction, shifting from state %d \
to state %d\n", EXPREFIX, *exssp, exstate);
#endif
    if (exssp >= exsslim && exgrowstack())
    {
        goto exoverflow;
    }
    *++exssp = exstate;
    *++exvsp = exval;
    goto exloop;
exoverflow:
    exerror("yacc stack overflow");
exabort:
    return (1);
exaccept:
    return (0);
}

Generated by  Doxygen 1.6.0   Back to index