ftp.nice.ch/pub/next/unix/developer/pcn.2.0.s.tar.gz#/src/compiler/parser/gram.c

This is gram.c in view mode; [Download] [Up]

extern char *malloc(), *realloc();

# line 2 "../../../../../src/compiler/parser/gram.y"
 

#include "co_parse.h"

#define SyntaxError _p_co_syntax_error

static int in_quoted_block = 0;

static int block_depth = 0;
static int block_start_line[200];
# define ID 257
# define IN 258
# define DOTS 259
# define COLONCOLON 260
# define FLOATINGconstant 261
# define INTEGERconstant 262
# define CHARACTERconstant 263
# define OCTALconstant 264
# define HEXconstant 265
# define STRING 266
# define IMPLY 267
# define MATCH 268
# define LEQ 269
# define GEQ 270
# define EQ 271
# define NEQ 272
# define DEFAULT 273
# define COLONEQ 274
# define OVER 275
# define BARBAR 276
# define HIGHPREC 277
# define LOWPREC 278
# define UNARY 279
#define yyclearin yychar = -1
#define yyerrok yyerrflag = 0
extern int yychar;
extern int yyerrflag;
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 150
#endif
#ifndef YYSTYPE
#define YYSTYPE int
#endif
YYSTYPE yylval, yyval;
# define YYERRCODE 256

# line 1168 "../../../../../src/compiler/parser/gram.y"


int yyerror(s)
char *s;
{
    SyntaxError(s);
}


int yyexca[] ={
-1, 0,
	0, 3,
	-2, 6,
-1, 1,
	0, -1,
	-2, 0,
-1, 18,
	41, 13,
	44, 13,
	-2, 14,
-1, 43,
	40, 91,
	58, 91,
	-2, 146,
-1, 58,
	59, 22,
	41, 22,
	44, 22,
	-2, 15,
-1, 80,
	40, 94,
	58, 94,
	-2, 146,
-1, 103,
	40, 91,
	58, 91,
	-2, 146,
-1, 106,
	44, 38,
	125, 38,
	-2, 0,
-1, 120,
	40, 92,
	58, 92,
	-2, 90,
-1, 124,
	40, 91,
	58, 91,
	-2, 87,
-1, 132,
	257, 14,
	258, 14,
	275, 14,
	40, 91,
	58, 91,
	-2, 146,
-1, 140,
	40, 94,
	58, 94,
	-2, 146,
-1, 179,
	59, 42,
	44, 42,
	125, 42,
	94, 42,
	-2, 142,
-1, 180,
	256, 100,
	-2, 43,
-1, 194,
	267, 56,
	44, 56,
	-2, 125,
	};
# define YYNPROD 148
# define YYLAST 647
int yyact[]={

    44,   144,   171,   145,    31,    79,     7,     8,   217,    40,
    97,   243,   169,   100,   139,   138,   212,   191,   210,    44,
    83,   187,    57,    31,     9,   155,   143,   200,    40,   231,
   197,   175,   110,   112,    44,    78,   158,   159,    31,   102,
   153,   204,    28,    40,   198,   168,    65,    97,    98,   120,
   100,    63,    61,    82,    62,    36,    64,    44,    39,   199,
    46,    31,    19,   111,    39,   203,    40,    99,   198,    44,
   198,    79,    44,    46,    36,    87,    31,    39,    42,    46,
    83,    40,   223,   199,   222,   199,   209,    37,    44,    36,
    17,    69,    39,    44,    46,    59,    55,    31,    60,    56,
   107,   208,    40,   117,    14,   160,    37,   117,    74,    44,
    46,    27,    36,    31,   113,    39,   119,    46,    40,     5,
    16,    37,   109,   117,   127,   220,    65,    36,   218,    46,
    39,    63,    46,   129,   213,   112,    64,   107,   135,   136,
    14,    14,    12,    71,    37,   144,   142,   145,    46,   215,
   133,   196,   128,    46,   173,   144,   107,   145,    75,    37,
    65,    48,   122,    46,    41,    63,    61,   116,    62,    46,
    64,   178,    96,    34,    32,   131,   179,    85,    95,    30,
   195,    73,    29,    46,    70,    94,    65,   176,   176,   151,
    66,    63,    61,    26,    62,    25,    64,    24,    65,    22,
    20,   205,   193,    63,    61,    50,    62,   189,    64,   150,
   146,   147,   148,   149,   152,   170,   234,   216,   176,   219,
   188,     7,     8,   154,   242,    47,    51,    52,    53,    54,
    35,   211,   224,   156,     7,     8,   238,   190,   233,     9,
     7,     8,   174,   186,    47,    51,    52,    53,    54,    35,
     7,     8,     9,   157,   167,     7,     8,   235,     9,    47,
    51,    52,    53,    54,    35,   193,   236,   193,     9,   241,
   106,     7,     8,     9,     7,     8,   119,    86,     7,     8,
   172,   228,    47,    51,    52,    53,    54,    35,   126,     9,
     7,     8,     9,     7,     8,   125,     9,    47,    51,    52,
    53,    54,    35,   221,    84,    76,    15,     4,     9,     7,
     8,     9,     3,     2,     7,     8,     1,    13,    47,    51,
    52,    53,    54,     0,     7,     8,     0,     9,     7,     8,
     7,     8,     9,     0,    47,    51,    52,    53,    54,     0,
     0,     0,     9,     0,     7,     8,     9,   244,     9,    51,
    52,    53,    54,   150,   146,   147,   148,   149,     0,   141,
    68,     0,     9,   150,   146,   147,   148,   149,    43,     6,
    45,     0,     0,    10,    11,    38,     0,    23,     0,    65,
     0,    18,   214,   108,    63,    61,    58,    62,     0,    64,
     0,     0,    49,     0,     0,   192,     0,    38,    38,     0,
     0,     0,     0,     0,    33,     0,    65,     0,     0,    67,
    21,    63,    61,    80,    62,    81,    64,     0,    77,     0,
   164,    38,     0,     0,     0,    18,     0,    38,     0,     0,
     0,     0,    72,    72,     0,   103,   114,   105,     0,    89,
    90,    91,    92,    93,   115,     0,     0,     0,     0,     0,
     0,   121,   124,   132,     0,   105,    88,   118,     0,   104,
     0,     0,     0,     0,     0,   134,   115,   164,   137,   140,
   161,   101,    38,    38,     0,   103,   123,   105,   115,     0,
     0,     0,     0,     0,     0,   165,   166,     0,     0,   130,
     0,     0,     0,     0,     0,     0,     0,     0,     0,   104,
    58,     0,    38,    38,    38,     0,     0,   162,   163,   105,
   105,   101,     0,     0,    38,     0,     0,     0,     0,   180,
     0,   115,     0,   103,   194,   105,     0,     0,   202,   184,
     0,     0,    38,     0,     0,     0,     0,   181,   182,   183,
   105,     0,     0,   177,   177,   185,     0,   104,   206,     0,
     0,     0,   201,     0,     0,     0,     0,     0,     0,   101,
     0,     0,     0,     0,     0,     0,   103,   207,   105,     0,
     0,    38,    38,     0,   177,     0,     0,    38,   225,    38,
    38,     0,   230,     0,     0,     0,     0,   194,   105,   194,
   104,     0,   232,     0,     0,     0,     0,     0,     0,     0,
   240,     0,   101,     0,    38,     0,   226,   227,     0,     0,
   103,     0,   105,     0,     0,   239,     0,     0,   229,     0,
   245,     0,   237,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,   104,     0,     0,     0,     0,   246,
     0,     0,     0,     0,     0,     0,   101 };
int yypact[]={

    74, -1000, -1000, -1000,  -251,  -251, -1000, -1000, -1000, -1000,
   102,   101,  -251, -1000,    21,    55, -1000,  -251, -1000, -1000,
    54, -1000, -1000,   369, -1000, -1000, -1000, -1000, -1000, -1000,
 -1000,    73, -1000, -1000, -1000, -1000,    -2,   -17,   100, -1000,
    73, -1000, -1000,   -20,  -251, -1000,    17, -1000, -1000,    16,
 -1000, -1000, -1000, -1000, -1000, -1000,  -251, -1000,   -16, -1000,
    36,    73,    73,    73,    73,    73,    14,   342,    64, -1000,
   -61,    91, -1000,   -11, -1000,    71, -1000, -1000, -1000,    73,
   -20,   -47,  -251,    87,    33, -1000, -1000,    57, -1000,    89,
    89, -1000, -1000, -1000, -1000,   -30,   -30,    67,  -252,  -253,
  -251,    85, -1000,   -86,   -44, -1000,   -23, -1000, -1000,    71,
 -1000,    36,    36, -1000,   101, -1000,    17,  -251,   161, -1000,
 -1000,   -51, -1000, -1000, -1000, -1000, -1000, -1000,  -255, -1000,
   -59,  -251,   -20, -1000,   149, -1000, -1000, -1000,    52,    52,
   -20,    36,    36,    36, -1000, -1000, -1000, -1000, -1000, -1000,
 -1000,    73,    67,   -36,    14,    26,   -98, -1000, -1000,    67,
 -1000,   101,   -28, -1000, -1000,   -55, -1000, -1000, -1000,    52,
    73,    36,    42, -1000, -1000, -1000, -1000,   -43, -1000, -1000,
   369,  -240, -1000,    90,   123, -1000,    24, -1000,  -259,    84,
 -1000, -1000,    95, -1000, -1000,     0, -1000,    14, -1000, -1000,
 -1000,    22,    20, -1000, -1000, -1000,   369, -1000, -1000,  -251,
    36,    36, -1000,    -7,    73, -1000,   -36,    33,    36,    36,
 -1000, -1000, -1000, -1000, -1000,   -16, -1000, -1000, -1000,    95,
   -20,  -251,     9, -1000, -1000, -1000, -1000,   -50, -1000, -1000,
   -20,    14,    73,    36, -1000,   369, -1000 };
int yypgo[]={

     0,   316,   313,   312,   368,   305,   307,   306,   304,   295,
   120,    90,    22,   288,   280,   277,   377,    39,   270,   243,
   223,    25,   392,   105,    30,   370,    48,    31,    67,    35,
   404,   395,    26,    21,   220,   216,   207,    17,   205,    78,
   360,   200,   199,   197,   195,   193,   111,    42,   190,   185,
   184,   143,   182,   179,   174,   173,   164,   161 };
int yyr1[]={

     0,     1,     1,     1,     3,     2,     6,     6,     6,     7,
     7,     7,    10,    10,    11,    11,    13,     8,     8,    12,
    14,    14,    15,    15,    15,    17,    17,    17,    17,    18,
    20,    20,    20,    20,    21,    21,    24,    24,    23,    23,
    23,    23,    23,    23,    23,    23,    23,    23,    23,    23,
    27,    27,    27,    27,    28,    28,    26,    33,    33,    35,
    35,    35,    35,     9,     9,     9,     9,     9,    19,    19,
    34,    34,    36,    36,    37,    37,    32,    32,    32,    32,
    32,    32,    32,    25,    25,    38,    38,    38,    22,    22,
    22,    40,    40,    40,    40,     5,     5,    41,    41,    31,
    31,    42,    42,    42,    42,    48,    42,    49,    49,    46,
    47,    44,    44,    44,    50,    45,    45,    51,    51,    16,
    16,    16,    16,    16,    16,    55,    52,    52,    52,    52,
    52,    53,    54,    54,    56,    43,    39,    57,    57,    57,
    57,    30,    30,     4,     4,     4,    29,    29 };
int yyr2[]={

     0,     3,     3,     1,     7,    15,     1,     3,     5,     1,
     3,     7,     5,     3,     3,     5,     7,     1,     5,     5,
     3,     7,     1,     5,     7,     9,     9,     7,     7,     3,
     3,     3,     7,     7,     3,     7,     2,     2,     1,     5,
     7,     7,     7,     7,     7,     9,     2,     2,    15,     7,
     0,     2,     6,     6,     6,    10,     2,     1,     7,     2,
     3,     7,     7,     2,     7,     3,     7,     7,     3,     7,
     3,     3,     3,     7,     7,     3,     3,     3,     3,     3,
     3,     3,     3,     2,     2,     7,     7,     7,     9,     5,
     7,     2,     7,     9,     5,     5,     7,     3,     7,     2,
     2,     2,     2,     2,     2,     1,     7,     5,     5,     7,
     2,     5,     7,    11,     3,     7,     5,     3,     7,     2,
     2,     7,     2,     2,     2,     3,     7,     7,     7,     7,
     7,     5,     2,     2,     3,     3,     3,     2,     2,     2,
     2,     5,     7,     3,     3,     3,     1,     7 };
int yychk[]={

 -1000,    -1,    -2,    -3,    -6,    45,    -4,   257,   258,   275,
    -4,    -4,    40,    -5,    40,    -7,   -10,   -11,    -4,    41,
   -41,   -31,   -42,   -16,   -43,   -44,   -45,   -46,   -47,   -52,
   -53,    40,   -54,   -30,   -55,   266,    91,   123,   -40,    94,
    45,   -56,   -39,    -4,    36,   -25,    96,   261,   -57,   -22,
   -38,   262,   263,   264,   265,    41,    44,   -12,    -4,    41,
    44,    43,    45,    42,    47,    37,   -48,   -16,   -40,    93,
   -50,   -51,   -31,   -51,   125,    58,    -5,   -16,   -29,    91,
    -4,    -4,    36,    64,    -8,   -10,   -15,    91,   -31,   -16,
   -16,   -16,   -16,   -16,   -49,   -46,   -23,    33,   -26,   -28,
    36,   -30,   -17,    -4,   -22,   -25,   -18,   123,    41,    58,
    93,   124,    44,   125,   -40,    -4,    96,    36,   -16,   -29,
    96,    -4,   -39,   -22,    -4,    -9,   -13,   -17,   -28,   -26,
   -30,   -11,    -4,    93,   -16,   -47,   -47,   -25,   267,   267,
    -4,   274,    61,   -32,    60,    62,   269,   270,   271,   272,
   268,   275,   258,    63,   -20,   -21,   256,   276,    59,    60,
   -23,   -40,   -31,   -31,    -5,    -4,    -4,    93,    96,   267,
   274,    61,   -14,   -12,    93,   -27,   -26,   -30,   -27,   -29,
   -16,   -31,   -31,   -31,   -16,   -22,   -19,   -33,   -34,   -36,
   273,   -37,   -31,   -26,   -25,   -21,   125,   -24,    44,    59,
   125,   -22,    -4,    93,    96,   -27,   -16,   -31,    59,    44,
    61,   274,   256,    44,   259,   125,   -24,   267,    44,   -32,
   125,   -23,    62,    62,   -12,    -4,   -31,   -31,   -28,   -30,
    -4,    36,   -16,   -33,   -35,   -17,   -26,   -30,   -37,   -31,
    -4,   260,   274,    61,   -23,   -16,   -31 };
int yydef[]={

    -2,    -2,     1,     2,     0,     0,     7,   143,   144,   145,
     8,     0,     9,     4,     0,     0,    10,     0,    -2,    95,
     0,    97,    99,   100,   101,   102,   103,   104,   105,   119,
   120,     0,   122,   123,   124,   135,     0,     0,     0,   110,
     0,   132,   133,    -2,     0,   125,     0,   134,   136,    83,
    84,   137,   138,   139,   140,    17,     0,    12,    -2,    96,
     0,     0,     0,     0,     0,     0,    38,     0,     0,   111,
     0,   114,   117,     0,   116,     0,    89,   131,   141,     0,
    -2,     0,     0,     0,     0,    11,    19,     0,    98,   126,
   127,   128,   129,   130,   106,     0,     0,     0,    46,     0,
     0,     0,    47,    -2,    83,    56,    -2,    29,   121,     0,
   112,     0,     0,   115,   109,    91,     0,     0,     0,   142,
    -2,     0,    85,    86,    -2,     5,    18,    63,     0,    65,
     0,     0,    -2,    23,     0,   107,   108,    39,    50,    50,
    -2,     0,     0,     0,    76,    77,    78,    79,    80,    81,
    82,     0,     0,    57,    38,     0,     0,    30,    31,     0,
    34,     0,     0,   118,    88,     0,    94,   147,    93,    50,
     0,     0,     0,    20,    24,    40,    51,     0,    41,    -2,
    -2,     0,    44,    54,     0,    49,     0,    68,     0,    70,
    71,    72,     0,    75,    -2,     0,    27,    38,    36,    37,
    28,     0,    91,   113,    92,    64,    66,    67,    16,     0,
     0,     0,    45,     0,     0,    25,    57,     0,     0,     0,
    26,    35,    32,    33,    21,    22,    52,    53,    55,     0,
   146,     0,     0,    69,    58,    59,    60,     0,    73,    74,
   146,    38,     0,     0,    48,    61,    62 };
typedef struct { char *t_name; int t_val; } yytoktype;
#ifndef YYDEBUG
#	define YYDEBUG	0	/* don't allow debugging */
#endif

#if YYDEBUG

yytoktype yytoks[] =
{
	"ID",	257,
	"IN",	258,
	"DOTS",	259,
	"COLONCOLON",	260,
	"FLOATINGconstant",	261,
	"INTEGERconstant",	262,
	"CHARACTERconstant",	263,
	"OCTALconstant",	264,
	"HEXconstant",	265,
	"STRING",	266,
	"IMPLY",	267,
	"MATCH",	268,
	"LEQ",	269,
	"GEQ",	270,
	"EQ",	271,
	"NEQ",	272,
	"DEFAULT",	273,
	"COLONEQ",	274,
	"OVER",	275,
	"BARBAR",	276,
	"HIGHPREC",	277,
	";",	59,
	"LOWPREC",	278,
	"+",	43,
	"-",	45,
	"*",	42,
	"/",	47,
	"%",	37,
	"UNARY",	279,
	"-unknown-",	-1	/* ends search */
};

char * yyreds[] =
{
	"-no such reduction-",
	"Form : Program",
	"Form : Directive",
	"Form : /* empty */",
	"Directive : '-' Identifier Args",
	"Program : ProgDecl Identifier '(' ProgramArgList ')' DeclarationList ErrorBlockOrCall",
	"ProgDecl : /* empty */",
	"ProgDecl : Identifier",
	"ProgDecl : ProgDecl Identifier",
	"ProgramArgList : /* empty */",
	"ProgramArgList : ProgramArg",
	"ProgramArgList : ProgramArgList ',' ProgramArg",
	"ProgramArg : VarTypeList Mutable",
	"ProgramArg : Identifier",
	"VarTypeList : Identifier",
	"VarTypeList : VarTypeList Identifier",
	"Declaration : VarTypeList MutableList ';'",
	"DeclarationList : /* empty */",
	"DeclarationList : DeclarationList Declaration",
	"Mutable : Identifier Dimension",
	"MutableList : Mutable",
	"MutableList : MutableList ',' Mutable",
	"Dimension : /* empty */",
	"Dimension : '[' ']'",
	"Dimension : '[' Exp ']'",
	"Block : BlockStart '?' Implications '}'",
	"Block : BlockStart Op Blocks '}'",
	"Block : BlockStart Blocks '}'",
	"Block : BlockStart error '}'",
	"BlockStart : '{'",
	"Op : BARBAR",
	"Op : ';'",
	"Op : '<' LocalCall '>'",
	"Op : '<' Identifier '>'",
	"Blocks : Element",
	"Blocks : Blocks Separator Element",
	"Separator : ','",
	"Separator : ';'",
	"Element : /* empty */",
	"Element : '!' CallForm",
	"Element : Call IMPLY MaybeCall",
	"Element : ErrorInfixOps IMPLY MaybeCall",
	"Element : '$' Identifier Subscript",
	"Element : Var COLONEQ Exp",
	"Element : Var '=' Term",
	"Element : Var COLONEQ Term error",
	"Element : Call",
	"Element : Block",
	"Element : Identifier OVER Exp DOTS Exp COLONCOLON Element",
	"Element : LocalCall IN LocalCall",
	"MaybeCall : /* empty */",
	"MaybeCall : Call",
	"MaybeCall : Var '=' Term",
	"MaybeCall : Var COLONEQ Term",
	"ErrorInfixOps : Var InfixOp Term",
	"ErrorInfixOps : Var InfixOp Term ',' ErrorInfixOps",
	"Call : CallForm",
	"Implication : /* empty */",
	"Implication : Guard IMPLY BlockOrCall",
	"BlockOrCall : Block",
	"BlockOrCall : Call",
	"BlockOrCall : Var COLONEQ Exp",
	"BlockOrCall : Var '=' Term",
	"ErrorBlockOrCall : Block",
	"ErrorBlockOrCall : ErrorInfixOps IMPLY MaybeCall",
	"ErrorBlockOrCall : Call",
	"ErrorBlockOrCall : Var COLONEQ Exp",
	"ErrorBlockOrCall : Var '=' Term",
	"Implications : Implication",
	"Implications : Implications Separator Implication",
	"Guard : Tests",
	"Guard : DEFAULT",
	"Tests : Test",
	"Tests : Tests ',' Test",
	"Test : Term InfixOp Term",
	"Test : Call",
	"InfixOp : '<'",
	"InfixOp : '>'",
	"InfixOp : LEQ",
	"InfixOp : GEQ",
	"InfixOp : EQ",
	"InfixOp : NEQ",
	"InfixOp : MATCH",
	"CallForm : LocalCall",
	"CallForm : RemoteCall",
	"RemoteCall : LocalCall '@' Integer",
	"RemoteCall : LocalCall '@' LocalCall",
	"RemoteCall : LocalCall '@' Identifier",
	"LocalCall : QID ':' QID Args",
	"LocalCall : QID Args",
	"LocalCall : '`' Identifier '`'",
	"QID : Identifier",
	"QID : '`' Identifier '`'",
	"QID : '`' '$' Identifier '`'",
	"QID : '$' Identifier",
	"Args : '(' ')'",
	"Args : '(' ArgList ')'",
	"ArgList : Term",
	"ArgList : ArgList ',' Term",
	"Term : SymbolicExp",
	"Term : Exp",
	"SymbolicExp : String",
	"SymbolicExp : List",
	"SymbolicExp : Tuple",
	"SymbolicExp : ModProc",
	"SymbolicExp : BlockQuote",
	"SymbolicExp : BlockQuote QuotedBlock",
	"QuotedBlock : ModProc BlockQuote",
	"QuotedBlock : Element BlockQuote",
	"ModProc : QID ':' QID",
	"BlockQuote : '^'",
	"List : '[' ']'",
	"List : '[' ElementsAsList ']'",
	"List : '[' ElementsAsList '|' Term ']'",
	"ElementsAsList : Elements",
	"Tuple : '{' Elements '}'",
	"Tuple : '{' '}'",
	"Elements : Term",
	"Elements : Elements ',' Term",
	"Exp : BinaryExp",
	"Exp : UnaryExp",
	"Exp : '(' Exp ')'",
	"Exp : Number",
	"Exp : Var",
	"Exp : FunctionCall",
	"FunctionCall : CallForm",
	"BinaryExp : Exp '+' Exp",
	"BinaryExp : Exp '-' Exp",
	"BinaryExp : Exp '*' Exp",
	"BinaryExp : Exp '/' Exp",
	"BinaryExp : Exp '%' Exp",
	"UnaryExp : '-' Exp",
	"Number : Double",
	"Number : Integer",
	"Double : FLOATINGconstant",
	"String : STRING",
	"Integer : IntegerForm",
	"IntegerForm : INTEGERconstant",
	"IntegerForm : CHARACTERconstant",
	"IntegerForm : OCTALconstant",
	"IntegerForm : HEXconstant",
	"Var : Identifier Subscript",
	"Var : '$' Identifier Subscript",
	"Identifier : ID",
	"Identifier : IN",
	"Identifier : OVER",
	"Subscript : /* empty */",
	"Subscript : '[' Exp ']'",
};
#endif /* YYDEBUG */
#line 1 "/usr/lib/yaccpar"
/*	@(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10	*/

/*
** Skeleton parser driver for yacc output
*/

/*
** yacc user known macros and defines
*/
#define YYERROR		goto yyerrlab
#define YYACCEPT	{ free(yys); free(yyv); return(0); }
#define YYABORT		{ free(yys); free(yyv); return(1); }
#define YYBACKUP( newtoken, newvalue )\
{\
	if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
	{\
		yyerror( "syntax error - cannot backup" );\
		goto yyerrlab;\
	}\
	yychar = newtoken;\
	yystate = *yyps;\
	yylval = newvalue;\
	goto yynewstate;\
}
#define YYRECOVERING()	(!!yyerrflag)
#ifndef YYDEBUG
#	define YYDEBUG	1	/* make debugging available */
#endif

/*
** user known globals
*/
int yydebug;			/* set to 1 to get debugging */

/*
** driver internal defines
*/
#define YYFLAG		(-1000)

/*
** static variables used by the parser
*/
static YYSTYPE *yyv;			/* value stack */
static int *yys;			/* state stack */

static YYSTYPE *yypv;			/* top of value stack */
static int *yyps;			/* top of state stack */

static int yystate;			/* current state */
static int yytmp;			/* extra var (lasts between blocks) */

int yynerrs;			/* number of errors */

int yyerrflag;			/* error recovery flag */
int yychar;			/* current input token number */


/*
** yyparse - return 0 if worked, 1 if syntax error not recovered from
*/
int
yyparse()
{
	register YYSTYPE *yypvt;	/* top of value stack for $vars */
	unsigned yymaxdepth = YYMAXDEPTH;

	/*
	** Initialize externals - yyparse may be called more than once
	*/
	yyv = (YYSTYPE*)malloc(yymaxdepth*sizeof(YYSTYPE));
	yys = (int*)malloc(yymaxdepth*sizeof(int));
	if (!yyv || !yys)
	{
		yyerror( "out of memory" );
		return(1);
	}
	yypv = &yyv[-1];
	yyps = &yys[-1];
	yystate = 0;
	yytmp = 0;
	yynerrs = 0;
	yyerrflag = 0;
	yychar = -1;

	goto yystack;
	{
		register YYSTYPE *yy_pv;	/* top of value stack */
		register int *yy_ps;		/* top of state stack */
		register int yy_state;		/* current state */
		register int  yy_n;		/* internal state number info */

		/*
		** get globals into registers.
		** branch to here only if YYBACKUP was called.
		*/
	yynewstate:
		yy_pv = yypv;
		yy_ps = yyps;
		yy_state = yystate;
		goto yy_newstate;

		/*
		** get globals into registers.
		** either we just started, or we just finished a reduction
		*/
	yystack:
		yy_pv = yypv;
		yy_ps = yyps;
		yy_state = yystate;

		/*
		** top of for (;;) loop while no reductions done
		*/
	yy_stack:
		/*
		** put a state and value onto the stacks
		*/
#if YYDEBUG
		/*
		** if debugging, look up token value in list of value vs.
		** name pairs.  0 and negative (-1) are special values.
		** Note: linear search is used since time is not a real
		** consideration while debugging.
		*/
		if ( yydebug )
		{
			register int yy_i;

			(void)printf( "State %d, token ", yy_state );
			if ( yychar == 0 )
				(void)printf( "end-of-file\n" );
			else if ( yychar < 0 )
				(void)printf( "-none-\n" );
			else
			{
				for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
					yy_i++ )
				{
					if ( yytoks[yy_i].t_val == yychar )
						break;
				}
				(void)printf( "%s\n", yytoks[yy_i].t_name );
			}
		}
#endif /* YYDEBUG */
		if ( ++yy_ps >= &yys[ yymaxdepth ] )	/* room on stack? */
		{
			/*
			** reallocate and recover.  Note that pointers
			** have to be reset, or bad things will happen
			*/
			int yyps_index = (yy_ps - yys);
			int yypv_index = (yy_pv - yyv);
			int yypvt_index = (yypvt - yyv);
			yymaxdepth += YYMAXDEPTH;
			yyv = (YYSTYPE*)realloc((char*)yyv,
				yymaxdepth * sizeof(YYSTYPE));
			yys = (int*)realloc((char*)yys,
				yymaxdepth * sizeof(int));
			if (!yyv || !yys)
			{
				yyerror( "yacc stack overflow" );
				return(1);
			}
			yy_ps = yys + yyps_index;
			yy_pv = yyv + yypv_index;
			yypvt = yyv + yypvt_index;
		}
		*yy_ps = yy_state;
		*++yy_pv = yyval;

		/*
		** we have a new state - find out what to do
		*/
	yy_newstate:
		if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
			goto yydefault;		/* simple state */
#if YYDEBUG
		/*
		** if debugging, need to mark whether new token grabbed
		*/
		yytmp = yychar < 0;
#endif
		if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
			yychar = 0;		/* reached EOF */
#if YYDEBUG
		if ( yydebug && yytmp )
		{
			register int yy_i;

			(void)printf( "Received token " );
			if ( yychar == 0 )
				(void)printf( "end-of-file\n" );
			else if ( yychar < 0 )
				(void)printf( "-none-\n" );
			else
			{
				for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
					yy_i++ )
				{
					if ( yytoks[yy_i].t_val == yychar )
						break;
				}
				(void)printf( "%s\n", yytoks[yy_i].t_name );
			}
		}
#endif /* YYDEBUG */
		if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
			goto yydefault;
		if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )	/*valid shift*/
		{
			yychar = -1;
			yyval = yylval;
			yy_state = yy_n;
			if ( yyerrflag > 0 )
				yyerrflag--;
			goto yy_stack;
		}

	yydefault:
		if ( ( yy_n = yydef[ yy_state ] ) == -2 )
		{
#if YYDEBUG
			yytmp = yychar < 0;
#endif
			if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
				yychar = 0;		/* reached EOF */
#if YYDEBUG
			if ( yydebug && yytmp )
			{
				register int yy_i;

				(void)printf( "Received token " );
				if ( yychar == 0 )
					(void)printf( "end-of-file\n" );
				else if ( yychar < 0 )
					(void)printf( "-none-\n" );
				else
				{
					for ( yy_i = 0;
						yytoks[yy_i].t_val >= 0;
						yy_i++ )
					{
						if ( yytoks[yy_i].t_val
							== yychar )
						{
							break;
						}
					}
					(void)printf( "%s\n", yytoks[yy_i].t_name );
				}
			}
#endif /* YYDEBUG */
			/*
			** look through exception table
			*/
			{
				register int *yyxi = yyexca;

				while ( ( *yyxi != -1 ) ||
					( yyxi[1] != yy_state ) )
				{
					yyxi += 2;
				}
				while ( ( *(yyxi += 2) >= 0 ) &&
					( *yyxi != yychar ) )
					;
				if ( ( yy_n = yyxi[1] ) < 0 )
					YYACCEPT;
			}
		}

		/*
		** check for syntax error
		*/
		if ( yy_n == 0 )	/* have an error */
		{
			/* no worry about speed here! */
			switch ( yyerrflag )
			{
			case 0:		/* new error */
				yyerror( "syntax error" );
				goto skip_init;
			yyerrlab:
				/*
				** get globals into registers.
				** we have a user generated syntax type error
				*/
				yy_pv = yypv;
				yy_ps = yyps;
				yy_state = yystate;
				yynerrs++;
			skip_init:
			case 1:
			case 2:		/* incompletely recovered error */
					/* try again... */
				yyerrflag = 3;
				/*
				** find state where "error" is a legal
				** shift action
				*/
				while ( yy_ps >= yys )
				{
					yy_n = yypact[ *yy_ps ] + YYERRCODE;
					if ( yy_n >= 0 && yy_n < YYLAST &&
						yychk[yyact[yy_n]] == YYERRCODE)					{
						/*
						** simulate shift of "error"
						*/
						yy_state = yyact[ yy_n ];
						goto yy_stack;
					}
					/*
					** current state has no shift on
					** "error", pop stack
					*/
#if YYDEBUG
#	define _POP_ "Error recovery pops state %d, uncovers state %d\n"
					if ( yydebug )
						(void)printf( _POP_, *yy_ps,
							yy_ps[-1] );
#	undef _POP_
#endif
					yy_ps--;
					yy_pv--;
				}
				/*
				** there is no state on stack with "error" as
				** a valid shift.  give up.
				*/
				YYABORT;
			case 3:		/* no shift yet; eat a token */
#if YYDEBUG
				/*
				** if debugging, look up token in list of
				** pairs.  0 and negative shouldn't occur,
				** but since timing doesn't matter when
				** debugging, it doesn't hurt to leave the
				** tests here.
				*/
				if ( yydebug )
				{
					register int yy_i;

					(void)printf( "Error recovery discards " );
					if ( yychar == 0 )
						(void)printf( "token end-of-file\n" );
					else if ( yychar < 0 )
						(void)printf( "token -none-\n" );
					else
					{
						for ( yy_i = 0;
							yytoks[yy_i].t_val >= 0;
							yy_i++ )
						{
							if ( yytoks[yy_i].t_val
								== yychar )
							{
								break;
							}
						}
						(void)printf( "token %s\n",
							yytoks[yy_i].t_name );
					}
				}
#endif /* YYDEBUG */
				if ( yychar == 0 )	/* reached EOF. quit */
					YYABORT;
				yychar = -1;
				goto yy_newstate;
			}
		}/* end if ( yy_n == 0 ) */
		/*
		** reduction by production yy_n
		** put stack tops, etc. so things right after switch
		*/
#if YYDEBUG
		/*
		** if debugging, print the string that is the user's
		** specification of the reduction which is just about
		** to be done.
		*/
		if ( yydebug )
			(void)printf( "Reduce by (%d) \"%s\"\n",
				yy_n, yyreds[ yy_n ] );
#endif
		yytmp = yy_n;			/* value to switch over */
		yypvt = yy_pv;			/* $vars top of value stack */
		/*
		** Look in goto table for next state
		** Sorry about using yy_state here as temporary
		** register variable, but why not, if it works...
		** If yyr2[ yy_n ] doesn't have the low order bit
		** set, then there is no action to be done for
		** this reduction.  So, no saving & unsaving of
		** registers done.  The only difference between the
		** code just after the if and the body of the if is
		** the goto yy_stack in the body.  This way the test
		** can be made before the choice of what to do is needed.
		*/
		{
			/* length of production doubled with extra bit */
			register int yy_len = yyr2[ yy_n ];

			if ( !( yy_len & 01 ) )
			{
				yy_len >>= 1;
				yyval = ( yy_pv -= yy_len )[1];	/* $$ = $1 */
				yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
					*( yy_ps -= yy_len ) + 1;
				if ( yy_state >= YYLAST ||
					yychk[ yy_state =
					yyact[ yy_state ] ] != -yy_n )
				{
					yy_state = yyact[ yypgo[ yy_n ] ];
				}
				goto yy_stack;
			}
			yy_len >>= 1;
			yyval = ( yy_pv -= yy_len )[1];	/* $$ = $1 */
			yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
				*( yy_ps -= yy_len ) + 1;
			if ( yy_state >= YYLAST ||
				yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
			{
				yy_state = yyact[ yypgo[ yy_n ] ];
			}
		}
					/* save until reenter driver code */
		yystate = yy_state;
		yyps = yy_ps;
		yypv = yy_pv;
	}
	/*
	** code supplied by user is placed in this switch
	*/
	switch( yytmp )
	{
		
case 1:
# line 63 "../../../../../src/compiler/parser/gram.y"
{
			_p_co_parse_done_flag = 1;
			_p_co_parse_tree = yypvt[-0];
		    } break;
case 2:
# line 68 "../../../../../src/compiler/parser/gram.y"
{
			_p_co_parse_tree = yypvt[-0];
			_p_co_parse_done_flag = 1;
		    } break;
case 3:
# line 73 "../../../../../src/compiler/parser/gram.y"
{
			_p_co_parse_tree = _p_co_nil();
			_p_co_parse_completely_done_flag = 1;
		    } break;
case 4:
# line 89 "../../../../../src/compiler/parser/gram.y"
{
			datum *name, *args, *ident, *dir, *out;
			

			if (strcmp(D_SVAL(yypvt[-1]), "directive") == 0)
			{
			    /* We have a "-directive" form. Grab the
			     * first argument as the directive name.
			     */

			    name = D_CAR(D_LHEAD(yypvt[-0]));

			    if (!(D_IS_TUPLE(name) && D_NARGS(name) == 2 &&
				  D_IS_TAG(D_ARG(name, 0)) &&
				  D_IS_STRING(D_ARG(name, 1))))
			    {
				SyntaxError("Invalid -directive directive: First argument must be a string");
				name = _p_co_new_string("<invalid_name>");
			    }
			    else
			    {
				name = D_ARG(name, 1);
			    }
			    
			    D_LHEAD(yypvt[-0]) = D_CDR(D_LHEAD(yypvt[-0]));
			    args = yypvt[-0];
			}
			else
			{
			    name = yypvt[-1];
			    args = yypvt[-0];
			}

			D_NEW_TUPLE_3(ident, D_TAG_COLON,
				      _p_co_current_module,
				      name);

			D_NEW_TUPLE_2(dir, D_TAG_DIRECTIVE, args);
			D_NEW_TUPLE_3(out,
				      ident,
				      _p_co_new_integer(_p_co_l_temp_max),
				      dir);
			/* Return the output as a 1-element list */
			D_NEW_TUPLE_2(yyval, out, _p_co_nil());
		    } break;
case 5:
# line 137 "../../../../../src/compiler/parser/gram.y"
{
			datum *ident, *prog, *directive, *tail, *pair;

			D_NEW_TUPLE_3(ident, D_TAG_COLON,
				      _p_co_current_module, yypvt[-5]);


			/* If we have program annotations, pass them
			 * through as a directive _program_annotations.
			 */
			if (!D_IS_NIL(yypvt[-6]))
			{
			    datum *t1, *t2, *t3;

			    D_NEW_TUPLE_2(t1, D_TAG_DIRECTIVE,
					  _p_co_cons(yypvt[-5], UNLIST(yypvt[-6])));
			    D_NEW_TUPLE_3(t2, D_TAG_COLON,
					  _p_co_current_module,
					 _p_co_new_string("_program_annotations"));
			    D_NEW_TUPLE_2(t3, t2, t1);
			    D_NEW_TUPLE_2(tail, t3, _p_co_nil());
			}
			else
			{
			    tail = _p_co_nil();
			}

			/* We really need to walk the ProgramArgList here
			 * to find occurrences of {type, var}, replace
			 * them with just var, and add an entry to
			 * the declaration list.
			 *
			 * But for simplicity, we're doing that in a
			 * postprocessing stage.
			 */
			D_NEW_TUPLE_4(prog, D_TAG_PROGRAM,
				      UNLIST(yypvt[-3]),
				      UNLIST(yypvt[-1]),
				      yypvt[-0]);
			D_NEW_TUPLE_3(pair,
				      ident,
				      _p_co_new_integer(_p_co_l_temp_max),
				      prog);
			D_NEW_TUPLE_2(yyval, pair, tail);
		    } break;
case 6:
# line 186 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_nil();
		    } break;
case 7:
# line 190 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_list(yypvt[-0]);
		    } break;
case 8:
# line 195 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_append_list(yypvt[-1], yypvt[-0]);
		    } break;
case 9:
# line 201 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_nil();
		    } break;
case 10:
# line 205 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_list(yypvt[-0]);
		    } break;
case 11:
# line 209 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_append_list(yypvt[-2], yypvt[-0]);
		    } break;
case 12:
# line 215 "../../../../../src/compiler/parser/gram.y"
{
			D_NEW_TUPLE_2(yyval, yypvt[-1], yypvt[-0]);
		    } break;
case 13:
# line 219 "../../../../../src/compiler/parser/gram.y"
{
			D_NEW_TUPLE_3(yyval, D_TAG_VAR, yypvt[-0], _p_co_nil());
		    } break;
case 14:
# line 225 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_list(yypvt[-0]);
		    } break;
case 15:
# line 229 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_append_list(yypvt[-1], yypvt[-0]);
		    } break;
case 16:
# line 235 "../../../../../src/compiler/parser/gram.y"
{
			datum *l, *t;
			
			yyval = _p_co_nil();

			for (l = REAL_UNLIST(yypvt[-1]); D_IS_TUPLE(l); l = D_CDR(l))
			{
			    D_NEW_TUPLE_2(t, yypvt[-2], D_CAR(l));
			    yyval = _p_co_append_list(yyval, t);
			}
		    } break;
case 17:
# line 249 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_nil();
		    } break;
case 18:
# line 253 "../../../../../src/compiler/parser/gram.y"
{
			/* Perform some list surgery to do list appends
			 * without traversing the list.
			 *
			 * _p_co_append_list() doesn't work since it expects
			 * the second argument to be an element, not a list.
			 */

			if (D_IS_NIL(yypvt[-1]))
			{
			    yyval = yypvt[-0];
			}
			else if (!D_IS_LIST(yypvt[-1]))
			{
			    printf("ACK!\n");
			    _p_co_print(yypvt[-1]);
			    exit(1);
			}
			else
			{
			    /* Memory leak here, in the list datum for $2 */
			
			    *(D_LTAIL(yypvt[-1])) = D_LHEAD(yypvt[-0]);
			    D_LTAIL(yypvt[-1]) = D_LTAIL(yypvt[-0]);
			    yyval = yypvt[-1];
			}
		    } break;
case 19:
# line 283 "../../../../../src/compiler/parser/gram.y"
{
			D_NEW_TUPLE_3(yyval, D_TAG_VAR, yypvt[-1], yypvt[-0]);
		    } break;
case 20:
# line 289 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_list(yypvt[-0]);
		    } break;
case 21:
# line 293 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_append_list(yypvt[-2], yypvt[-0]);
		    } break;
case 22:
# line 299 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_nil();
		    } break;
case 23:
# line 303 "../../../../../src/compiler/parser/gram.y"
{
			datum *zero;
			
			zero = _p_co_new_tuple_2(D_TAG_INTEGER_CONST,
					       _p_co_new_string("0"));
			yyval = _p_co_new_tuple_2(D_TAG_TUPLE,
				      _p_co_new_tuple_2(zero,
					     _p_co_new_tuple_2(D_TAG_TUPLE,
							       _p_co_nil())));
		    } break;
case 24:
# line 314 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple_2(D_TAG_TUPLE,
				      _p_co_new_tuple_2(yypvt[-1],
					     _p_co_new_tuple_2(D_TAG_TUPLE,
							       _p_co_nil())));
		    } break;
case 25:
# line 323 "../../../../../src/compiler/parser/gram.y"
{
			block_depth--;
			D_NEW_TUPLE_3(yyval, D_TAG_BLOCK, 
				      D_TAG_CHOICE_COMP, UNLIST(yypvt[-1]));
		    } break;
case 26:
# line 329 "../../../../../src/compiler/parser/gram.y"
{
			block_depth--;
			D_NEW_TUPLE_3(yyval, D_TAG_BLOCK, 
				      yypvt[-2], UNLIST(yypvt[-1]));
		    } break;
case 27:
# line 335 "../../../../../src/compiler/parser/gram.y"
{
			printf("%s:%d: Warning: Implicit block operator used\n",
			       _p_co_filename,
			       block_start_line[block_depth]);
			block_depth--;
			D_NEW_TUPLE_3(yyval, D_TAG_BLOCK, 
				      D_TAG_SEQ_COMP, UNLIST(yypvt[-1]));
		    } break;
case 28:
# line 344 "../../../../../src/compiler/parser/gram.y"
{
			block_depth--;
			SyntaxError("Invalid block");
			yyval = _p_co_nil();
		    } break;
case 29:
# line 352 "../../../../../src/compiler/parser/gram.y"
{
			block_depth++;
			block_start_line[block_depth] = _p_co_lineno;
		    } break;
case 30:
# line 359 "../../../../../src/compiler/parser/gram.y"
{
			yyval = D_TAG_PAR_COMP;
		    } break;
case 31:
# line 363 "../../../../../src/compiler/parser/gram.y"
{
			yyval = D_TAG_SEQ_COMP;
		    } break;
case 32:
# line 368 "../../../../../src/compiler/parser/gram.y"
{
			D_NEW_TUPLE_2(yyval, D_TAG_USER_DEF_COMP, yypvt[-1]);
		    } break;
case 33:
# line 372 "../../../../../src/compiler/parser/gram.y"
{
			D_NEW_TUPLE_2(yyval, D_TAG_USER_DEF_COMP, yypvt[-1]);
		    } break;
case 34:
# line 378 "../../../../../src/compiler/parser/gram.y"
{
			if (yypvt[-0] == NULL)
			    yyval = _p_co_nil();
			else
			    yyval = _p_co_new_list(yypvt[-0]);
		    } break;
case 35:
# line 385 "../../../../../src/compiler/parser/gram.y"
{
			if (yypvt[-0] == NULL)
			    yyval = yypvt[-2];
			else
			    yyval = _p_co_append_list(yypvt[-2], yypvt[-0]);
		    } break;
case 38:
# line 398 "../../../../../src/compiler/parser/gram.y"
{
			_p_co_warning("Encountered empty element");
			yyval = NULL;
		    } break;
case 39:
# line 403 "../../../../../src/compiler/parser/gram.y"
{
			_p_co_warning("Capabilities are no longer supported");
			yyval = _p_co_new_tuple_2(D_TAG_CAPABILITY,
					       yypvt[-0]);
		    } break;
case 40:
# line 409 "../../../../../src/compiler/parser/gram.y"
{
			SyntaxError("Implications must be within choice blocks");
			if (block_depth > 1)
			    _p_co_push_token = ';';
			yyval = NULL;
		    } break;
case 41:
# line 422 "../../../../../src/compiler/parser/gram.y"
{
			SyntaxError("Implications must be within choice blocks");

			/*
			 * If we're not in a toplevel block, arrange
			 * for a separator to be the next token
			 * shifted by the parser. See the
			 * YY_INPUT macro in lex.l.
			 */
			if (block_depth > 1)
			    _p_co_push_token = ';';
			yyval = NULL;
		    } break;
case 42:
# line 436 "../../../../../src/compiler/parser/gram.y"
{
			if (!in_quoted_block)
			{
			    SyntaxError("Bare variables not allowed outside quoted blocks");
			    yyval = NULL;
			    YYERROR;
			}
			else
			{
			    yyval = _p_co_new_tuple_3(D_TAG_INTERP_VAR, yypvt[-1], yypvt[-0]);
			}
		    } break;
case 43:
# line 449 "../../../../../src/compiler/parser/gram.y"
{
			D_NEW_TUPLE_3(yyval, D_TAG_PRIM,
				      D_TAG_ASSIGN,
				      _p_co_cons(yypvt[-2], _p_co_cons(yypvt[-0], _p_co_nil())));
		    } break;
case 44:
# line 455 "../../../../../src/compiler/parser/gram.y"
{
			D_NEW_TUPLE_3(yyval, D_TAG_PRIM,
				      D_TAG_DEFINE,
				      _p_co_cons(yypvt[-2], _p_co_cons(yypvt[-0], _p_co_nil())));
		    } break;
case 45:
# line 461 "../../../../../src/compiler/parser/gram.y"
{
			SyntaxError("The RHS of an assignment statement must be a numeric expression");
			yyval = NULL;
		    } break;
case 48:
# line 468 "../../../../../src/compiler/parser/gram.y"
{
			datum *var;
			D_NEW_TUPLE_3(var, D_TAG_VAR, yypvt[-6], _p_co_nil());
			D_NEW_TUPLE_5(yyval,
				      D_TAG_OVER,
				      var,
				      yypvt[-4],
				      yypvt[-2],
				      yypvt[-0]);
		    } break;
case 49:
# line 479 "../../../../../src/compiler/parser/gram.y"
{
			D_NEW_TUPLE_3(yyval, D_TAG_IN, yypvt[-2], yypvt[-0]);
		    } break;
case 57:
# line 503 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_nil();
		    } break;
case 58:
# line 507 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple_3(D_TAG_IMPLIES, yypvt[-2], yypvt[-0]);
		    } break;
case 60:
# line 514 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple_3(D_TAG_BLOCK, D_TAG_PAR_COMP,
					       _p_co_new_list(yypvt[-0]));
		    } break;
case 61:
# line 519 "../../../../../src/compiler/parser/gram.y"
{
			datum *asgn;

			asgn = _p_co_new_tuple_3(D_TAG_PRIM,
						 D_TAG_ASSIGN,
						 _p_co_cons(yypvt[-2], _p_co_cons(yypvt[-0], _p_co_nil())));
			yyval = _p_co_new_tuple_3(D_TAG_BLOCK, D_TAG_PAR_COMP,
					       _p_co_new_list(asgn));
		    } break;
case 62:
# line 529 "../../../../../src/compiler/parser/gram.y"
{
			asgn = _p_co_new_tuple_3(D_TAG_PRIM,
						 D_TAG_DEFINE,
						 _p_co_cons(yypvt[-2], _p_co_cons(yypvt[-0], _p_co_nil())));
			yyval = _p_co_new_tuple_3(D_TAG_BLOCK, D_TAG_PAR_COMP,
					       _p_co_new_list(asgn));
		    } break;
case 64:
# line 546 "../../../../../src/compiler/parser/gram.y"
{
			SyntaxError("Implications must be within choice blocks");
			/*
			 * If we're not in a toplevel block, arrange
			 * for a separator to be the next token
			 * shifted by the parser. See the
			 * YY_INPUT macro in lex.l.
			 */
			if (block_depth > 1)
			    _p_co_push_token = ';';
			yyval = NULL;
		    } break;
case 65:
# line 559 "../../../../../src/compiler/parser/gram.y"
{
			SyntaxError("Bare calls are not allowed");
			yyval = _p_co_new_tuple_3(D_TAG_BLOCK, D_TAG_SEQ_COMP,
					       _p_co_new_list(yypvt[-0]));
		    } break;
case 66:
# line 565 "../../../../../src/compiler/parser/gram.y"
{
			SyntaxError("Bare calls are not allowed");
			yyval = _p_co_new_tuple_3(D_TAG_BLOCK, D_TAG_SEQ_COMP,
					       _p_co_new_list(yypvt[-2]));
		    } break;
case 67:
# line 571 "../../../../../src/compiler/parser/gram.y"
{
			SyntaxError("Bare calls are not allowed");
			yyval = _p_co_new_tuple_3(D_TAG_BLOCK, D_TAG_SEQ_COMP,
					       _p_co_new_list(yypvt[-2]));
		    } break;
case 68:
# line 579 "../../../../../src/compiler/parser/gram.y"
{
			if (D_IS_NIL(yypvt[-0]))
			    yyval = yypvt[-0];
			else
			    yyval = _p_co_new_list(yypvt[-0]);
		    } break;
case 69:
# line 586 "../../../../../src/compiler/parser/gram.y"
{
			if (D_IS_NIL(yypvt[-0]))
			    yyval = yypvt[-2];
			else
			    yyval = _p_co_append_list(yypvt[-2], yypvt[-0]);
		    } break;
case 70:
# line 595 "../../../../../src/compiler/parser/gram.y"
{
			yyval = UNLIST(yypvt[-0]);
		    } break;
case 71:
# line 599 "../../../../../src/compiler/parser/gram.y"
{
			yyval = D_TAG_DEFAULT;
		    } break;
case 72:
# line 605 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_list(yypvt[-0]);
		    } break;
case 73:
# line 609 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_append_list(yypvt[-2], yypvt[-0]);
		    } break;
case 74:
# line 615 "../../../../../src/compiler/parser/gram.y"
{
			D_NEW_TUPLE_4(yyval, D_TAG_GUARD_INFIX_OP, yypvt[-1], yypvt[-2], yypvt[-0]);
		    } break;
case 75:
# line 619 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple_2(D_TAG_GUARD_CALL, yypvt[-0]);
		    } break;
case 76:
# line 625 "../../../../../src/compiler/parser/gram.y"
{
			yyval = D_TAG_LESS_THAN;
		    } break;
case 77:
# line 629 "../../../../../src/compiler/parser/gram.y"
{
			yyval = D_TAG_GREATER_THAN;
		    } break;
case 78:
# line 633 "../../../../../src/compiler/parser/gram.y"
{
			yyval = D_TAG_LESS_EQUAL;
		    } break;
case 79:
# line 637 "../../../../../src/compiler/parser/gram.y"
{
			yyval = D_TAG_GREATER_EQUAL;
		    } break;
case 80:
# line 641 "../../../../../src/compiler/parser/gram.y"
{
			yyval = D_TAG_EQUAL;
		    } break;
case 81:
# line 645 "../../../../../src/compiler/parser/gram.y"
{
			yyval = D_TAG_NOT_EQUAL;
		    } break;
case 82:
# line 649 "../../../../../src/compiler/parser/gram.y"
{
			yyval = D_TAG_MATCH;
		    } break;
case 85:
# line 659 "../../../../../src/compiler/parser/gram.y"
{
			yyval = yypvt[-2];
			_p_co_set_arg(yyval, 3, yypvt[-0]);
		    } break;
case 86:
# line 664 "../../../../../src/compiler/parser/gram.y"
{
			yyval = yypvt[-2];
			_p_co_set_arg(yyval, 3, yypvt[-0]);
		    } break;
case 87:
# line 669 "../../../../../src/compiler/parser/gram.y"
{
			yyval = yypvt[-2];
			_p_co_set_arg(yyval, 3, _p_co_new_tuple_4(D_TAG_CALL, yypvt[-0],
						       _p_co_nil(), _p_co_nil()));
		    } break;
case 88:
# line 677 "../../../../../src/compiler/parser/gram.y"
{
			datum *ident = _p_co_new_tuple_3(D_TAG_COLON, yypvt[-3], yypvt[-1]);
			yyval = _p_co_new_tuple_4(D_TAG_CALL, ident, yypvt[-0], _p_co_nil());
		    } break;
case 89:
# line 682 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple_4(D_TAG_CALL, yypvt[-1], yypvt[-0], _p_co_nil());
		    } break;
case 90:
# line 686 "../../../../../src/compiler/parser/gram.y"
{
			/* This parses as
			 *    {CALL, {COLON, "_metacall", var}, [], []}
			 */
			
			yyval = _p_co_new_tuple_4(D_TAG_CALL,
			       _p_co_new_tuple_3(D_TAG_COLON,
						 _p_co_new_string("_metacall"),
						 _p_co_new_tuple_3(D_TAG_VAR, yypvt[-1], _p_co_nil())),
					       _p_co_nil(), _p_co_nil());
		    } break;
case 92:
# line 701 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple_3(D_TAG_VAR, yypvt[-1], _p_co_nil());
		    } break;
case 93:
# line 705 "../../../../../src/compiler/parser/gram.y"
{
			if (in_quoted_block)
			    yyval = _p_co_new_tuple_3(D_TAG_VAR, _p_co_new_tuple_3(D_TAG_INTERP_VAR, yypvt[-1], _p_co_nil()), _p_co_nil());
			else
			{
			    SyntaxError("$-quoted procedure calls not allowed outside quoted blocks");
			    yyval = _p_co_nil();
			    YYERROR;
			}
		    } break;
case 94:
# line 716 "../../../../../src/compiler/parser/gram.y"
{
			if (in_quoted_block)
			    yyval = _p_co_new_tuple_3(D_TAG_INTERP_VAR, yypvt[-0], _p_co_nil());
			else
			{
			    SyntaxError("$-quoted procedure calls not allowed outside quoted blocks");
			    yyval = _p_co_nil();
			    YYERROR;
			}
		    } break;
case 95:
# line 729 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_nil();
		    } break;
case 96:
# line 733 "../../../../../src/compiler/parser/gram.y"
{
			yyval = UNLIST(yypvt[-1]);
		    } break;
case 97:
# line 739 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_list(yypvt[-0]);
		    } break;
case 98:
# line 743 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_append_list(yypvt[-2], yypvt[-0]);
		    } break;
case 105:
# line 756 "../../../../../src/compiler/parser/gram.y"
{ in_quoted_block = 1; } break;
case 106:
# line 757 "../../../../../src/compiler/parser/gram.y"
{ yyval = yypvt[-0]; in_quoted_block = 0; } break;
case 107:
# line 761 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_quoted_block(yypvt[-1]);
		    } break;
case 108:
# line 765 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_quoted_block(yypvt[-1]);
		    } break;
case 109:
# line 771 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple(3);
			_p_co_set_arg(yyval, 0, D_TAG_COLON);
			_p_co_set_arg(yyval, 1, yypvt[-2]);
			_p_co_set_arg(yyval, 2, yypvt[-0]);
		    } break;
case 111:
# line 784 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple(2);
			_p_co_set_arg(yyval, 0, D_TAG_TUPLE);
			_p_co_set_arg(yyval, 1, _p_co_nil());
		    } break;
case 112:
# line 790 "../../../../../src/compiler/parser/gram.y"
{
			yyval = D_LHEAD(yypvt[-1]);
		    } break;
case 113:
# line 794 "../../../../../src/compiler/parser/gram.y"
{
			*(D_LTAIL(yypvt[-3])) = yypvt[-1];
			yyval = D_LHEAD(yypvt[-3]);
		    } break;
case 114:
# line 801 "../../../../../src/compiler/parser/gram.y"
{
			int len, i;
			datum *d, **tail, *new, *new2;
			datum *head;

			tail = &head;

			for (d = REAL_UNLIST(yypvt[-0]); !D_IS_NIL(d); d = D_CDR(d))
			{
			    new2 = _p_co_new_tuple(2);
			    new = _p_co_new_tuple_2(D_TAG_TUPLE,
						    new2);
			    
			    *tail = new;
			    
			    _p_co_set_arg(new2, 0, D_CAR(d));

			    tail = &D_CDR(new2);
			}
			*tail = _p_co_new_tuple_2(D_TAG_TUPLE, _p_co_nil());

			yyval = _p_co_new_list_0();
			D_LHEAD(yyval) = head;
			D_LTAIL(yyval) = tail;
		    } break;
case 115:
# line 830 "../../../../../src/compiler/parser/gram.y"
{
			int len, i;
			datum *d, *tup;


			len = 0;
			for (d = REAL_UNLIST(yypvt[-1]); !D_IS_NIL(d); d = D_CDR(d))
			    len++;

			tup = _p_co_new_tuple(len);

			i = 0;
			for (d = REAL_UNLIST(yypvt[-1]); !D_IS_NIL(d); d = D_CDR(d))
			{
			    _p_co_set_arg(tup, i, D_CAR(d));
			    i++;
			}
			
			yyval = _p_co_new_tuple(2);
			_p_co_set_arg(yyval, 0, D_TAG_TUPLE);
			_p_co_set_arg(yyval, 1, tup);
		    } break;
case 116:
# line 853 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple(2);
			_p_co_set_arg(yyval, 0, D_TAG_TUPLE);
			_p_co_set_arg(yyval, 1, _p_co_nil());
		    } break;
case 117:
# line 861 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_list(yypvt[-0]);
		    } break;
case 118:
# line 865 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_append_list(yypvt[-2], yypvt[-0]);
		    } break;
case 121:
# line 873 "../../../../../src/compiler/parser/gram.y"
{
			yyval = yypvt[-1];
		    } break;
case 125:
# line 882 "../../../../../src/compiler/parser/gram.y"
{
			if (!_p_co_backward_compatibility_flag)
			{
			    yyval = yypvt[-0];
			}
			else
			{
			    /*
			     * We have {CALL, ident, arglist, anno}
			     *
			     * and we want to create {"name", arg1, arg2, ...}
			     * or {":", "mod", {"name", arg1, arg2, ...}}
			     *
			     */
			    
			    datum *tup, *d, *result;
			    datum *ident, *args;
			    int len, i;
			    int have_length = 0;

			    ident = D_ARG(yypvt[-0], 1);
			    args = D_ARG(yypvt[-0], 2);

			    len = 0;
			    for (d = REAL_UNLIST(args);
				 !D_IS_NIL(d); d = D_CDR(d))
				len++;

			    /*
			     * len is the length of the argument list
			     */
			    
			    tup = _p_co_new_tuple(len + 1);

			    /* We are creating the {"name", arg1, arg2, ...} tuple in
			     * tup.
			     *
			     * Result is the tuple that will be returned (wrapped in
			     * a TAG_TUPLE). Depending on whether we have p() or
			     * m:p(), we set result to either tup or mp.
			     */

			    if (D_IS_STRING(ident))
			    {
				/* We check for occurrences of the length() primitive
				 * here, since it gets real tough later on
				 * (since {"length", f} is exactly the same as
				 * length(f).
				 */
				D_ARG(tup, 0) = _p_co_new_tuple_2(D_TAG_STRING_CONST,
								  ident);
				    
				if (strcmp(D_SVAL(ident), "length") == 0 &&
				    len == 1)
				{
				    args = REAL_UNLIST(args);
				    
				    /* Rewrite the length call as an expression. */
				    yyval = _p_co_new_tuple_3(D_TAG_EXP,
							   D_TAG_LENGTH,
							   _p_co_cons(D_ARG(args, 0),
								      _p_co_nil()));
				    have_length = 1;
				}
				else
				{
				    /* We return tup */
				    result = tup;
				}
			    }
			    else if (D_IS_TUPLE(ident) &&
				     D_NARGS(ident) == 3 &&
				     D_IS_TAG(D_ARG(ident, 0)) &&
				     D_IVAL(D_ARG(ident, 0)) == TAG_COLON)
			    {
				datum *mp = _p_co_new_tuple(3);

				/*
				 * Create mp to be the tuple
				 * {":", "mod", tup}
				 */

				D_ARG(mp, 0) = _p_co_new_tuple_2(D_TAG_STRING_CONST,
							      _p_co_new_string(":"));
				D_ARG(mp, 1) = _p_co_new_tuple_2(D_TAG_STRING_CONST,
							      D_ARG(ident,1));
				D_ARG(mp, 2) = _p_co_new_tuple_2(D_TAG_TUPLE,
								 tup);

				/*
				 * and fill in tup[0] with "name"
				 */

				D_ARG(tup, 0) = _p_co_new_tuple_2(D_TAG_STRING_CONST,
								  D_ARG(ident,2));

				/* We return mp */
				result = mp;
			    }

			    if (!have_length)
			    {
				
				/*
				 * Fill in the arguments of tup
				 */
				
				i = 0;
				for (d = REAL_UNLIST(args);
				     !D_IS_NIL(d); d = D_CDR(d))
				{
				    _p_co_set_arg(tup, i+1, D_CAR(d));
				    i++;
				}
				yyval = _p_co_new_tuple_2(D_TAG_TUPLE,
						       result);
			    }
			}
		    } break;
case 126:
# line 1004 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple_3(D_TAG_EXP,
					      D_TAG_PLUS,
					      _p_co_cons(yypvt[-2],
							 _p_co_cons(yypvt[-0], _p_co_nil())));
		    } break;
case 127:
# line 1011 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple_3(D_TAG_EXP,
					       D_TAG_MINUS,
					       _p_co_cons(yypvt[-2],
							  _p_co_cons(yypvt[-0], _p_co_nil())));
		    } break;
case 128:
# line 1018 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple_3(D_TAG_EXP,
					       D_TAG_TIMES,
					       _p_co_cons(yypvt[-2],
							  _p_co_cons(yypvt[-0], _p_co_nil())));
		    } break;
case 129:
# line 1025 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple_3(D_TAG_EXP,
					       D_TAG_DIV,
					       _p_co_cons(yypvt[-2],
							  _p_co_cons(yypvt[-0], _p_co_nil())));
		    } break;
case 130:
# line 1032 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple_3(D_TAG_EXP,
					       D_TAG_MODULO,
					       _p_co_cons(yypvt[-2],
							  _p_co_cons(yypvt[-0], _p_co_nil())));
		    } break;
case 131:
# line 1041 "../../../../../src/compiler/parser/gram.y"
{
			datum *zero;
			datum *a0, *a1;

			a0 = D_ARG(yypvt[-0], 0);
			a1 = D_ARG(yypvt[-0], 1);

			if (D_IS_TAG(a0) &&
			    (D_IVAL(a0) == TAG_INTEGER_CONST ||
			     D_IVAL(a0) == TAG_DOUBLE_CONST) &&
			    D_IS_STRING(a1))
			{
			    /*
			     * We have a negated constant. Stash a
			     * '-' at the beginning of the string.
			     */
			    
			    char *str, *new;

			    str = D_SVAL(a1);
			    new = (char *) malloc(strlen(str) + 2);
			    strcpy(new, "-");
			    strcat(new, str);
			    D_SVAL(a1) = new;
			    free(str);
			    yyval = yypvt[-0];
			}
			else
			{
			    zero = _p_co_new_tuple_2(D_TAG_INTEGER_CONST,
						     _p_co_new_string("0"));
			    yyval = _p_co_new_tuple_3(D_TAG_EXP,
						   D_TAG_MINUS,
						   _p_co_cons(zero,
							      _p_co_cons(yypvt[-0], _p_co_nil())));
			}
		    } break;
case 134:
# line 1085 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple(2);
			_p_co_set_arg(yyval, 0, D_TAG_DOUBLE_CONST);
			_p_co_set_arg(yyval, 1,  yypvt[-0]);
		    } break;
case 135:
# line 1094 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple(2);
			_p_co_set_arg(yyval, 0, D_TAG_STRING_CONST);
			_p_co_set_arg(yyval, 1,  yypvt[-0]);
		    } break;
case 136:
# line 1101 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple(2);
			_p_co_set_arg(yyval, 0, D_TAG_INTEGER_CONST);
			_p_co_set_arg(yyval, 1,  yypvt[-0]);
		    } break;
case 141:
# line 1114 "../../../../../src/compiler/parser/gram.y"
{
			D_NEW_TUPLE_3(yyval, D_TAG_VAR,
				      yypvt[-1], yypvt[-0]);
			_p_co_check_var_for_temp_max(yypvt[-1]);
		    } break;
case 142:
# line 1120 "../../../../../src/compiler/parser/gram.y"
{
			if (in_quoted_block)
			{
			    D_NEW_TUPLE_3(yyval, D_TAG_INTERP_VAR,
					  yypvt[-1], yypvt[-0]);
			}
			else
			{
			    SyntaxError("$vars not allowed outside quoted blocks");
			    yyval = _p_co_nil();
			    YYERROR;
			}
			_p_co_check_var_for_temp_max(yypvt[-1]);
		    } break;
case 143:
# line 1141 "../../../../../src/compiler/parser/gram.y"
{
			yyval = yypvt[-0];
		    } break;
case 144:
# line 1145 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_string("in"); 

		    } break;
case 145:
# line 1150 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_string("over"); 
		    } break;
case 146:
# line 1156 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_nil();
		    } break;
case 147:
# line 1160 "../../../../../src/compiler/parser/gram.y"
{
			yyval = _p_co_new_tuple_2(D_TAG_TUPLE,
				   _p_co_new_tuple_2(yypvt[-1],
					      _p_co_new_tuple_2(D_TAG_TUPLE,
								_p_co_nil())));
		    } break;
	}
	goto yystack;		/* reset registers in driver code */
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.