home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gdb-4.9 / gdb / m2-exp.tab.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-12  |  52.3 KB  |  1,874 lines

  1.  
  2. # line 40 "./m2-exp.y"
  3.  
  4. #include "defs.h"
  5. #include "expression.h"
  6. #include "language.h"
  7. #include "value.h"
  8. #include "parser-defs.h"
  9. #include "m2-lang.h"
  10.  
  11. /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
  12.    as well as gratuitiously global symbol names, so we can have multiple
  13.    yacc generated parsers in gdb.  Note that these are only the variables
  14.    produced by yacc.  If other parser generators (bison, byacc, etc) produce
  15.    additional global names that conflict at link time, then those parser
  16.    generators need to be fixed instead of adding those names to this list. */
  17.  
  18. #define    yymaxdepth m2_maxdepth
  19. #define    yyparse    m2_parse
  20. #define    yylex    m2_lex
  21. #define    yyerror    m2_error
  22. #define    yylval    m2_lval
  23. #define    yychar    m2_char
  24. #define    yydebug    m2_debug
  25. #define    yypact    m2_pact
  26. #define    yyr1    m2_r1
  27. #define    yyr2    m2_r2
  28. #define    yydef    m2_def
  29. #define    yychk    m2_chk
  30. #define    yypgo    m2_pgo
  31. #define    yyact    m2_act
  32. #define    yyexca    m2_exca
  33. #define yyerrflag m2_errflag
  34. #define yynerrs    m2_nerrs
  35. #define    yyps    m2_ps
  36. #define    yypv    m2_pv
  37. #define    yys    m2_s
  38. #define    yy_yys    m2_yys
  39. #define    yystate    m2_state
  40. #define    yytmp    m2_tmp
  41. #define    yyv    m2_v
  42. #define    yy_yyv    m2_yyv
  43. #define    yyval    m2_val
  44. #define    yylloc    m2_lloc
  45. #define yyreds    m2_reds        /* With YYDEBUG defined */
  46. #define yytoks    m2_toks        /* With YYDEBUG defined */
  47.  
  48. #ifndef YYDEBUG
  49. #define    YYDEBUG    0        /* Default to no yydebug support */
  50. #endif
  51.  
  52. int
  53. yyparse PARAMS ((void));
  54.  
  55. static int
  56. yylex PARAMS ((void));
  57.  
  58. void
  59. yyerror PARAMS ((char *));
  60.  
  61. #if 0
  62. static char *
  63. make_qualname PARAMS ((char *, char *));
  64. #endif
  65.  
  66. static int
  67. parse_number PARAMS ((int));
  68.  
  69. /* The sign of the number being parsed. */
  70. static int number_sign = 1;
  71.  
  72. /* The block that the module specified by the qualifer on an identifer is
  73.    contained in, */
  74. #if 0
  75. static struct block *modblock=0;
  76. #endif
  77.  
  78.  
  79. # line 121 "./m2-exp.y"
  80. typedef union 
  81.   {
  82.     LONGEST lval;
  83.     unsigned LONGEST ulval;
  84.     double dval;
  85.     struct symbol *sym;
  86.     struct type *tval;
  87.     struct stoken sval;
  88.     int voidval;
  89.     struct block *bval;
  90.     enum exp_opcode opcode;
  91.     struct internalvar *ivar;
  92.  
  93.     struct type **tvec;
  94.     int *ivec;
  95.   } YYSTYPE;
  96. # define INT 257
  97. # define HEX 258
  98. # define ERROR 259
  99. # define UINT 260
  100. # define M2_TRUE 261
  101. # define M2_FALSE 262
  102. # define CHAR 263
  103. # define FLOAT 264
  104. # define STRING 265
  105. # define NAME 266
  106. # define BLOCKNAME 267
  107. # define IDENT 268
  108. # define VARNAME 269
  109. # define TYPENAME 270
  110. # define SIZE 271
  111. # define CAP 272
  112. # define ORD 273
  113. # define HIGH 274
  114. # define ABS 275
  115. # define MIN_FUNC 276
  116. # define MAX_FUNC 277
  117. # define FLOAT_FUNC 278
  118. # define VAL 279
  119. # define CHR 280
  120. # define ODD 281
  121. # define TRUNC 282
  122. # define INC 283
  123. # define DEC 284
  124. # define INCL 285
  125. # define EXCL 286
  126. # define COLONCOLON 287
  127. # define LAST 288
  128. # define REGNAME 289
  129. # define INTERNAL_VAR 290
  130. # define ABOVE_COMMA 291
  131. # define ASSIGN 292
  132. # define LEQ 293
  133. # define GEQ 294
  134. # define NOTEQUAL 295
  135. # define IN 296
  136. # define OROR 297
  137. # define LOGICAL_AND 298
  138. # define DIV 299
  139. # define MOD 300
  140. # define UNARY 301
  141. # define DOT 302
  142. # define NOT 303
  143. # define QID 304
  144. #define yyclearin yychar = -1
  145. #define yyerrok yyerrflag = 0
  146. extern int yychar;
  147. extern int yyerrflag;
  148. #ifndef YYMAXDEPTH
  149. #define YYMAXDEPTH 150
  150. #endif
  151. YYSTYPE yylval, yyval;
  152. # define YYERRCODE 256
  153.  
  154. # line 668 "./m2-exp.y"
  155.  
  156.  
  157. #if 0  /* FIXME! */
  158. int
  159. overflow(a,b)
  160.    long a,b;
  161. {
  162.    return (MAX_OF_TYPE(builtin_type_m2_int) - b) < a;
  163. }
  164.  
  165. int
  166. uoverflow(a,b)
  167.    unsigned long a,b;
  168. {
  169.    return (MAX_OF_TYPE(builtin_type_m2_card) - b) < a;
  170. }
  171. #endif /* FIXME */
  172.  
  173. /* Take care of parsing a number (anything that starts with a digit).
  174.    Set yylval and return the token type; update lexptr.
  175.    LEN is the number of characters in it.  */
  176.  
  177. /*** Needs some error checking for the float case ***/
  178.  
  179. static int
  180. parse_number (olen)
  181.      int olen;
  182. {
  183.   register char *p = lexptr;
  184.   register LONGEST n = 0;
  185.   register LONGEST prevn = 0;
  186.   register int c,i,ischar=0;
  187.   register int base = input_radix;
  188.   register int len = olen;
  189.   int unsigned_p = number_sign == 1 ? 1 : 0;
  190.  
  191.   if(p[len-1] == 'H')
  192.   {
  193.      base = 16;
  194.      len--;
  195.   }
  196.   else if(p[len-1] == 'C' || p[len-1] == 'B')
  197.   {
  198.      base = 8;
  199.      ischar = p[len-1] == 'C';
  200.      len--;
  201.   }
  202.  
  203.   /* Scan the number */
  204.   for (c = 0; c < len; c++)
  205.   {
  206.     if (p[c] == '.' && base == 10)
  207.       {
  208.     /* It's a float since it contains a point.  */
  209.     yylval.dval = atof (p);
  210.     lexptr += len;
  211.     return FLOAT;
  212.       }
  213.     if (p[c] == '.' && base != 10)
  214.        error("Floating point numbers must be base 10.");
  215.     if (base == 10 && (p[c] < '0' || p[c] > '9'))
  216.        error("Invalid digit \'%c\' in number.",p[c]);
  217.  }
  218.  
  219.   while (len-- > 0)
  220.     {
  221.       c = *p++;
  222.       n *= base;
  223.       if( base == 8 && (c == '8' || c == '9'))
  224.      error("Invalid digit \'%c\' in octal number.",c);
  225.       if (c >= '0' && c <= '9')
  226.     i = c - '0';
  227.       else
  228.     {
  229.       if (base == 16 && c >= 'A' && c <= 'F')
  230.         i = c - 'A' + 10;
  231.       else
  232.          return ERROR;
  233.     }
  234.       n+=i;
  235.       if(i >= base)
  236.      return ERROR;
  237.       if(!unsigned_p && number_sign == 1 && (prevn >= n))
  238.      unsigned_p=1;        /* Try something unsigned */
  239.       /* Don't do the range check if n==i and i==0, since that special
  240.      case will give an overflow error. */
  241.       if(RANGE_CHECK && n!=i && i)
  242.       {
  243.      if((unsigned_p && (unsigned)prevn >= (unsigned)n) ||
  244.         ((!unsigned_p && number_sign==-1) && -prevn <= -n))
  245.         range_error("Overflow on numeric constant.");
  246.       }
  247.      prevn=n;
  248.     }
  249.  
  250.   lexptr = p;
  251.   if(*p == 'B' || *p == 'C' || *p == 'H')
  252.      lexptr++;            /* Advance past B,C or H */
  253.  
  254.   if (ischar)
  255.   {
  256.      yylval.ulval = n;
  257.      return CHAR;
  258.   }
  259.   else if ( unsigned_p && number_sign == 1)
  260.   {
  261.      yylval.ulval = n;
  262.      return UINT;
  263.   }
  264.   else if((unsigned_p && (n<0))) {
  265.      range_error("Overflow on numeric constant -- number too large.");
  266.      /* But, this can return if range_check == range_warn.  */
  267.   }
  268.   yylval.lval = n;
  269.   return INT;
  270. }
  271.  
  272.  
  273. /* Some tokens */
  274.  
  275. static struct
  276. {
  277.    char name[2];
  278.    int token;
  279. } tokentab2[] =
  280. {
  281.     { {'<', '>'},    NOTEQUAL     },
  282.     { {':', '='},    ASSIGN    },
  283.     { {'<', '='},    LEQ    },
  284.     { {'>', '='},    GEQ    },
  285.     { {':', ':'},    COLONCOLON },
  286.  
  287. };
  288.  
  289. /* Some specific keywords */
  290.  
  291. struct keyword {
  292.    char keyw[10];
  293.    int token;
  294. };
  295.  
  296. static struct keyword keytab[] =
  297. {
  298.     {"OR" ,   OROR     },
  299.     {"IN",    IN         },/* Note space after IN */
  300.     {"AND",   LOGICAL_AND},
  301.     {"ABS",   ABS     },
  302.     {"CHR",   CHR     },
  303.     {"DEC",   DEC     },
  304.     {"NOT",   NOT     },
  305.     {"DIV",   DIV         },
  306.     {"INC",   INC     },
  307.     {"MAX",   MAX_FUNC     },
  308.     {"MIN",   MIN_FUNC     },
  309.     {"MOD",   MOD     },
  310.     {"ODD",   ODD     },
  311.     {"CAP",   CAP     },
  312.     {"ORD",   ORD     },
  313.     {"VAL",   VAL     },
  314.     {"EXCL",  EXCL     },
  315.     {"HIGH",  HIGH       },
  316.     {"INCL",  INCL     },
  317.     {"SIZE",  SIZE       },
  318.     {"FLOAT", FLOAT_FUNC },
  319.     {"TRUNC", TRUNC     },
  320. };
  321.  
  322.  
  323. /* Read one token, getting characters through lexptr.  */
  324.  
  325. /* This is where we will check to make sure that the language and the operators used are
  326.    compatible  */
  327.  
  328. static int
  329. yylex ()
  330. {
  331.   register int c;
  332.   register int namelen;
  333.   register int i;
  334.   register char *tokstart;
  335.   register char quote;
  336.  
  337.  retry:
  338.  
  339.   tokstart = lexptr;
  340.  
  341.  
  342.   /* See if it is a special token of length 2 */
  343.   for( i = 0 ; i < sizeof tokentab2 / sizeof tokentab2[0] ; i++)
  344.      if(STREQN(tokentab2[i].name, tokstart, 2))
  345.      {
  346.     lexptr += 2;
  347.     return tokentab2[i].token;
  348.      }
  349.  
  350.   switch (c = *tokstart)
  351.     {
  352.     case 0:
  353.       return 0;
  354.  
  355.     case ' ':
  356.     case '\t':
  357.     case '\n':
  358.       lexptr++;
  359.       goto retry;
  360.  
  361.     case '(':
  362.       paren_depth++;
  363.       lexptr++;
  364.       return c;
  365.  
  366.     case ')':
  367.       if (paren_depth == 0)
  368.     return 0;
  369.       paren_depth--;
  370.       lexptr++;
  371.       return c;
  372.  
  373.     case ',':
  374.       if (comma_terminates && paren_depth == 0)
  375.     return 0;
  376.       lexptr++;
  377.       return c;
  378.  
  379.     case '.':
  380.       /* Might be a floating point number.  */
  381.       if (lexptr[1] >= '0' && lexptr[1] <= '9')
  382.     break;            /* Falls into number code.  */
  383.       else
  384.       {
  385.      lexptr++;
  386.      return DOT;
  387.       }
  388.  
  389. /* These are character tokens that appear as-is in the YACC grammar */
  390.     case '+':
  391.     case '-':
  392.     case '*':
  393.     case '/':
  394.     case '^':
  395.     case '<':
  396.     case '>':
  397.     case '[':
  398.     case ']':
  399.     case '=':
  400.     case '{':
  401.     case '}':
  402.     case '#':
  403.     case '@':
  404.     case '~':
  405.     case '&':
  406.       lexptr++;
  407.       return c;
  408.  
  409.     case '\'' :
  410.     case '"':
  411.       quote = c;
  412.       for (namelen = 1; (c = tokstart[namelen]) != quote && c != '\0'; namelen++)
  413.     if (c == '\\')
  414.       {
  415.         c = tokstart[++namelen];
  416.         if (c >= '0' && c <= '9')
  417.           {
  418.         c = tokstart[++namelen];
  419.         if (c >= '0' && c <= '9')
  420.           c = tokstart[++namelen];
  421.           }
  422.       }
  423.       if(c != quote)
  424.      error("Unterminated string or character constant.");
  425.       yylval.sval.ptr = tokstart + 1;
  426.       yylval.sval.length = namelen - 1;
  427.       lexptr += namelen + 1;
  428.  
  429.       if(namelen == 2)      /* Single character */
  430.       {
  431.        yylval.ulval = tokstart[1];
  432.        return CHAR;
  433.       }
  434.       else
  435.      return STRING;
  436.     }
  437.  
  438.   /* Is it a number?  */
  439.   /* Note:  We have already dealt with the case of the token '.'.
  440.      See case '.' above.  */
  441.   if ((c >= '0' && c <= '9'))
  442.     {
  443.       /* It's a number.  */
  444.       int got_dot = 0, got_e = 0;
  445.       register char *p = tokstart;
  446.       int toktype;
  447.  
  448.       for (++p ;; ++p)
  449.     {
  450.       if (!got_e && (*p == 'e' || *p == 'E'))
  451.         got_dot = got_e = 1;
  452.       else if (!got_dot && *p == '.')
  453.         got_dot = 1;
  454.       else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
  455.            && (*p == '-' || *p == '+'))
  456.         /* This is the sign of the exponent, not the end of the
  457.            number.  */
  458.         continue;
  459.       else if ((*p < '0' || *p > '9') &&
  460.            (*p < 'A' || *p > 'F') &&
  461.            (*p != 'H'))  /* Modula-2 hexadecimal number */
  462.         break;
  463.     }
  464.     toktype = parse_number (p - tokstart);
  465.         if (toktype == ERROR)
  466.       {
  467.         char *err_copy = (char *) alloca (p - tokstart + 1);
  468.  
  469.         memcpy (err_copy, tokstart, p - tokstart);
  470.         err_copy[p - tokstart] = 0;
  471.         error ("Invalid number \"%s\".", err_copy);
  472.       }
  473.     lexptr = p;
  474.     return toktype;
  475.     }
  476.  
  477.   if (!(c == '_' || c == '$'
  478.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
  479.     /* We must have come across a bad character (e.g. ';').  */
  480.     error ("Invalid character '%c' in expression.", c);
  481.  
  482.   /* It's a name.  See how long it is.  */
  483.   namelen = 0;
  484.   for (c = tokstart[namelen];
  485.        (c == '_' || c == '$' || (c >= '0' && c <= '9')
  486.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
  487.        c = tokstart[++namelen])
  488.     ;
  489.  
  490.   /* The token "if" terminates the expression and is NOT
  491.      removed from the input stream.  */
  492.   if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
  493.     {
  494.       return 0;
  495.     }
  496.  
  497.   lexptr += namelen;
  498.  
  499.   /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
  500.      and $$digits (equivalent to $<-digits> if you could type that).
  501.      Make token type LAST, and put the number (the digits) in yylval.  */
  502.  
  503.   if (*tokstart == '$')
  504.     {
  505.       register int negate = 0;
  506.       c = 1;
  507.       /* Double dollar means negate the number and add -1 as well.
  508.      Thus $$ alone means -1.  */
  509.       if (namelen >= 2 && tokstart[1] == '$')
  510.     {
  511.       negate = 1;
  512.       c = 2;
  513.     }
  514.       if (c == namelen)
  515.     {
  516.       /* Just dollars (one or two) */
  517.       yylval.lval = - negate;
  518.       return LAST;
  519.     }
  520.       /* Is the rest of the token digits?  */
  521.       for (; c < namelen; c++)
  522.     if (!(tokstart[c] >= '0' && tokstart[c] <= '9'))
  523.       break;
  524.       if (c == namelen)
  525.     {
  526.       yylval.lval = atoi (tokstart + 1 + negate);
  527.       if (negate)
  528.         yylval.lval = - yylval.lval;
  529.       return LAST;
  530.     }
  531.     }
  532.  
  533.   /* Handle tokens that refer to machine registers:
  534.      $ followed by a register name.  */
  535.  
  536.   if (*tokstart == '$') {
  537.     for (c = 0; c < NUM_REGS; c++)
  538.       if (namelen - 1 == strlen (reg_names[c])
  539.       && STREQN (tokstart + 1, reg_names[c], namelen - 1))
  540.     {
  541.       yylval.lval = c;
  542.       return REGNAME;
  543.     }
  544.     for (c = 0; c < num_std_regs; c++)
  545.      if (namelen - 1 == strlen (std_regs[c].name)
  546.      && STREQN (tokstart + 1, std_regs[c].name, namelen - 1))
  547.        {
  548.      yylval.lval = std_regs[c].regnum;
  549.      return REGNAME;
  550.        }
  551.   }
  552.  
  553.  
  554.   /*  Lookup special keywords */
  555.   for(i = 0 ; i < sizeof(keytab) / sizeof(keytab[0]) ; i++)
  556.      if(namelen == strlen(keytab[i].keyw) && STREQN(tokstart,keytab[i].keyw,namelen))
  557.        return keytab[i].token;
  558.  
  559.   yylval.sval.ptr = tokstart;
  560.   yylval.sval.length = namelen;
  561.  
  562.   /* Any other names starting in $ are debugger internal variables.  */
  563.  
  564.   if (*tokstart == '$')
  565.     {
  566.       yylval.ivar = (struct internalvar *) lookup_internalvar (copy_name (yylval.sval) + 1);
  567.       return INTERNAL_VAR;
  568.     }
  569.  
  570.  
  571.   /* Use token-type BLOCKNAME for symbols that happen to be defined as
  572.      functions.  If this is not so, then ...
  573.      Use token-type TYPENAME for symbols that happen to be defined
  574.      currently as names of types; NAME for other symbols.
  575.      The caller is not constrained to care about the distinction.  */
  576.  {
  577.  
  578.  
  579.     char *tmp = copy_name (yylval.sval);
  580.     struct symbol *sym;
  581.  
  582.     if (lookup_partial_symtab (tmp))
  583.       return BLOCKNAME;
  584.     sym = lookup_symbol (tmp, expression_context_block,
  585.              VAR_NAMESPACE, 0, NULL);
  586.     if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
  587.       return BLOCKNAME;
  588.     if (lookup_typename (copy_name (yylval.sval), expression_context_block, 1))
  589.       return TYPENAME;
  590.  
  591.     if(sym)
  592.     {
  593.        switch(sym->class)
  594.        {
  595.        case LOC_STATIC:
  596.        case LOC_REGISTER:
  597.        case LOC_ARG:
  598.        case LOC_REF_ARG:
  599.        case LOC_REGPARM:
  600.        case LOC_LOCAL:
  601.        case LOC_LOCAL_ARG:
  602.        case LOC_CONST:
  603.        case LOC_CONST_BYTES:
  604.       return NAME;
  605.  
  606.        case LOC_TYPEDEF:
  607.       return TYPENAME;
  608.  
  609.        case LOC_BLOCK:
  610.       return BLOCKNAME;
  611.  
  612.        case LOC_UNDEF:
  613.       error("internal:  Undefined class in m2lex()");
  614.  
  615.        case LOC_LABEL:
  616.       error("internal:  Unforseen case in m2lex()");
  617.        }
  618.     }
  619.     else
  620.     {
  621.        /* Built-in BOOLEAN type.  This is sort of a hack. */
  622.        if(STREQN(tokstart,"TRUE",4))
  623.        {
  624.       yylval.ulval = 1;
  625.       return M2_TRUE;
  626.        }
  627.        else if(STREQN(tokstart,"FALSE",5))
  628.        {
  629.       yylval.ulval = 0;
  630.       return M2_FALSE;
  631.        }
  632.     }
  633.  
  634.     /* Must be another type of name... */
  635.     return NAME;
  636.  }
  637. }
  638.  
  639. #if 0        /* Unused */
  640. static char *
  641. make_qualname(mod,ident)
  642.    char *mod, *ident;
  643. {
  644.    char *new = xmalloc(strlen(mod)+strlen(ident)+2);
  645.  
  646.    strcpy(new,mod);
  647.    strcat(new,".");
  648.    strcat(new,ident);
  649.    return new;
  650. }
  651. #endif  /* 0 */
  652.  
  653. void
  654. yyerror(msg)
  655.      char *msg;    /* unused */
  656. {
  657.    printf("Parsing:  %s\n",lexptr);
  658.    if (yychar < 256)
  659.      error("Invalid syntax in expression near character '%c'.",yychar);
  660.    else
  661.      error("Invalid syntax in expression");
  662. }
  663.  
  664. int yyexca[] ={
  665. -1, 1,
  666.     0, -1,
  667.     -2, 0,
  668. -1, 40,
  669.     287, 74,
  670.     -2, 77,
  671. -1, 117,
  672.     292, 0,
  673.     -2, 62,
  674.     };
  675. # define YYNPROD 82
  676. # define YYLAST 1355
  677. int yyact[]={
  678.  
  679.     26,    94,    97,     5,    39,     4,   142,   141,    95,    92,
  680.    136,    91,   136,    88,   169,   153,    92,   157,    92,   100,
  681.    170,    21,   151,   136,   150,    87,    86,    85,    84,    81,
  682.     80,    79,    78,    49,    83,    51,    55,     5,    56,     4,
  683.     52,    59,    77,    76,    75,    74,    49,   160,    51,    55,
  684.    161,    56,    59,    52,    73,    72,    49,    49,   158,    51,
  685.     55,   159,    56,   168,    52,    71,    62,    57,    63,    96,
  686.     50,   143,    99,     6,    67,    40,    42,    62,    57,    63,
  687.     33,    50,     1,    24,    48,     3,    38,    45,     0,     0,
  688.      0,   166,    91,   135,   137,     0,    49,    48,    51,    91,
  689.     45,    91,     0,    52,     0,   138,     0,    48,    48,     0,
  690.     45,    45,     0,     0,   145,     0,    59,    24,     0,     0,
  691.     38,    49,   181,    51,    55,     0,    56,    59,    52,     0,
  692.      0,     0,    49,   180,    51,    55,     0,    56,     0,    52,
  693.      0,    62,    57,    63,     0,    50,     0,    48,     0,    39,
  694.     45,     0,    62,    57,    63,    59,    50,     0,     0,     0,
  695.     49,   179,    51,    55,     0,    56,     0,    52,     0,     0,
  696.      0,     0,    48,     0,     0,    45,     0,     0,     0,     0,
  697.     62,    57,    63,    48,    50,     0,    45,     0,     0,     0,
  698.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  699.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  700.      0,    48,     0,     0,    45,     0,     0,    29,     0,     0,
  701.     30,    27,    28,    31,    32,    36,    43,    44,     0,     0,
  702.     39,    18,     7,     8,    10,     9,    11,    12,    13,    14,
  703.     15,    16,    17,    19,    20,    22,    23,     0,    34,    35,
  704.     41,    29,     0,     0,    30,    27,    28,    31,    32,    36,
  705.     43,    44,     0,    37,    39,    18,     7,     8,    10,     9,
  706.     11,    12,    13,    14,    15,    16,    17,    19,    20,    22,
  707.     23,     0,    34,    35,    41,     0,     0,     0,     0,     0,
  708.      0,     0,    53,    54,     0,    46,     0,    37,    66,    60,
  709.     61,    58,    47,    65,    64,    53,    54,     0,    46,    66,
  710.     60,    61,    58,    47,    65,    64,    53,    54,    46,    46,
  711.      0,     0,     0,    69,    25,     0,     0,     0,     0,     0,
  712.      0,     0,     0,     0,     0,     0,     0,    59,     0,     0,
  713.      0,     0,    49,   178,    51,    55,     0,    56,    89,    52,
  714.      0,     0,     0,     0,     0,    53,    54,     0,    46,     0,
  715.      0,     0,    62,    57,    63,     0,    50,     0,     0,     0,
  716.      0,    98,     0,    66,    60,    61,    58,    47,    65,    64,
  717.     53,    54,     0,    46,    66,    60,    61,    58,    47,    65,
  718.     64,    53,    54,    48,    46,     0,    45,     0,    59,   123,
  719.    124,     0,   126,    49,   177,    51,    55,   130,    56,     0,
  720.     52,     0,    66,    60,    61,    58,    47,    65,    64,    53,
  721.     54,     0,    46,    62,    57,    63,    59,    50,     0,     0,
  722.      0,    49,   167,    51,    55,     0,    56,    59,    52,     0,
  723.      0,     0,    49,     0,    51,    55,   163,    56,     0,    52,
  724.      0,    62,    57,    63,    48,    50,     0,    45,     0,     0,
  725.      0,     0,    62,    57,    63,    59,    50,     0,     0,     0,
  726.     49,     0,    51,    55,   162,    56,     0,    52,     0,     0,
  727.      0,     0,    48,     0,     0,    45,     0,     0,     0,     0,
  728.     62,    57,    63,    48,    50,     0,    45,     0,     0,     0,
  729.     59,     0,     0,     0,     0,    49,   156,    51,    55,     0,
  730.     56,     0,    52,     0,     0,     0,     0,     0,     0,     0,
  731.      0,    48,     0,     0,    45,    62,    57,    63,    59,    50,
  732.      0,     0,     0,    49,   155,    51,    55,     0,    56,     0,
  733.     52,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  734.      0,     0,     0,    62,    57,    63,    48,    50,     0,    45,
  735.      0,     0,     0,    59,     0,     0,     0,     0,    49,   154,
  736.     51,    55,     0,    56,     0,    52,     0,     0,     0,     0,
  737.      0,     0,     0,     0,    48,     0,     0,    45,    62,    57,
  738.     63,     0,    50,     0,    66,    60,    61,    58,    47,    65,
  739.     64,    53,    54,     0,    46,     0,     0,     0,    59,     0,
  740.      0,     0,     0,    49,   152,    51,    55,     0,    56,    48,
  741.     52,     0,    45,     0,     0,     0,     0,     0,     0,     0,
  742.      0,     0,     0,    62,    57,    63,     0,    50,     0,     0,
  743.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  744.      0,     0,     0,     0,     0,    66,    60,    61,    58,    47,
  745.     65,    64,    53,    54,    48,    46,     0,    45,     0,     0,
  746.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  747.      0,     0,     0,    66,    60,    61,    58,    47,    65,    64,
  748.     53,    54,     0,    46,    66,    60,    61,    58,    47,    65,
  749.     64,    53,    54,     0,    46,     0,     0,     0,     0,     0,
  750.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  751.      0,     0,    66,    60,    61,    58,    47,    65,    64,    53,
  752.     54,     0,    46,     0,     0,     0,     0,     0,     0,     0,
  753.      0,     0,     0,    59,     0,     0,     0,     0,    49,   149,
  754.     51,    55,     0,    56,     0,    52,     0,    66,    60,    61,
  755.     58,    47,    65,    64,    53,    54,     0,    46,    62,    57,
  756.     63,     0,    50,     0,     0,     0,     0,     0,     0,     0,
  757.      0,     0,     0,     0,     0,    66,    60,    61,    58,    47,
  758.     65,    64,    53,    54,     0,    46,     0,     0,     0,    48,
  759.      0,     0,    45,     0,     0,     0,     0,     0,    49,     0,
  760.     51,    55,     0,    56,     0,    52,     0,     0,     0,     0,
  761.     66,    60,    61,    58,    47,    65,    64,    53,    54,    59,
  762.     46,     0,    50,     0,    49,   148,    51,    55,     0,    56,
  763.     49,    52,    51,    55,     0,    56,     0,    52,     0,     0,
  764.      0,     0,     0,     0,    62,    57,    63,     0,    50,    48,
  765.      0,     0,    45,     0,    50,    66,    60,    61,    58,    47,
  766.     65,    64,    53,    54,    59,    46,     0,     0,     0,    49,
  767.    147,    51,    55,     0,    56,    48,    52,     0,    45,     0,
  768.      0,    48,     0,     0,    45,     0,     0,     0,     0,    62,
  769.     57,    63,    59,    50,     0,     0,     0,    49,   146,    51,
  770.     55,     0,    56,    59,    52,     0,     0,     0,    49,   140,
  771.     51,    55,     0,    56,     0,    52,     0,    62,    57,    63,
  772.     48,    50,     0,    45,     0,     0,     0,     0,    62,    57,
  773.     63,     0,    50,     0,     0,     0,     0,     0,     0,     0,
  774.      0,     0,     0,     0,     0,    59,     0,     0,    48,     0,
  775.     49,    45,    51,    55,     0,    56,    59,    52,     0,    48,
  776.      0,    49,    45,    51,    55,     0,    56,     0,    52,     0,
  777.     62,    57,    63,     0,    50,     0,     0,     0,     0,     0,
  778.      0,    62,    57,    63,     0,    50,     0,     0,     0,     0,
  779.     66,    60,    61,    58,    47,    65,    64,    53,    54,     0,
  780.     46,    48,     0,     0,    45,     0,     0,     0,     0,     0,
  781.      0,    49,    48,    51,    55,    45,    56,     0,    52,     0,
  782.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  783.      0,     0,     0,     0,     0,    50,     0,     0,     0,     0,
  784.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  785.      0,     0,     0,     0,     0,    65,    64,    53,    54,     0,
  786.     46,     0,    48,     0,     0,    45,     0,     0,     0,     0,
  787.      0,     0,     0,     0,     0,     0,    66,    60,    61,    58,
  788.     47,    65,    64,    53,    54,     0,    46,     0,    64,    53,
  789.     54,     0,    46,     0,     0,     0,     0,     0,     0,     0,
  790.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  791.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  792.      0,    66,    60,    61,    58,    47,    65,    64,    53,    54,
  793.      0,    46,     0,     0,     0,     0,     0,     0,     0,     0,
  794.      0,     0,     0,     0,     0,     0,     0,     0,     0,    66,
  795.     60,    61,    58,    47,    65,    64,    53,    54,     0,    46,
  796.     66,    60,    61,    58,    47,    65,    64,    53,    54,     0,
  797.     46,     0,     0,     0,    90,     2,     0,     0,     0,     0,
  798.     68,    70,     0,     0,     0,     0,     0,     0,     0,     0,
  799.      0,     0,     0,    82,     0,     0,     0,     0,     0,     0,
  800.      0,    93,    66,    60,    61,    58,    47,    65,    64,    53,
  801.     54,     0,    46,     0,    60,    61,    58,    47,    65,    64,
  802.     53,    54,     0,    46,     0,   101,   102,   103,   104,   105,
  803.    106,   107,   108,   109,   110,   111,   112,   113,   114,   115,
  804.    116,   117,   118,     0,     0,     0,   119,   120,   121,   122,
  805.      0,     0,   125,     0,   127,   128,   129,     0,    93,   131,
  806.    132,   133,   134,     0,     0,     0,     0,   139,     0,     0,
  807.     53,    54,     0,    46,   144,     0,     0,     0,     0,     0,
  808.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  809.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  810.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  811.      0,   164,   165,     0,     0,     0,     0,     0,     0,     0,
  812.      0,     0,     0,     0,     0,     0,     0,     0,   171,     0,
  813.      0,     0,     0,     0,   172,     0,   173,   174,   175,     0,
  814.      0,     0,     0,     0,   176 };
  815. int yypact[]={
  816.  
  817.    -40, -1000,   920, -1000, -1000,   -40,   -40,    25,    15,    14,
  818.      5,     4,     3,     2,    -8,    -9,   -10,   -11,    -6,   -12,
  819.    -13, -1000,   -14,   -15,   -40,   -22,   -40, -1000, -1000, -1000,
  820.  -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
  821.  -1000, -1000,  -286, -1000, -1000, -1000,  -258,  -121, -1000, -1000,
  822.    -40,   -40,   -40,   -40,   -40,   -40,   -40,   -40,   -40,   -40,
  823.    -40,   -40,   -40,   -40,   -40,   -40,   -40,   -40,    16,   -22,
  824.     16,   -40,   -40,   -40,   -40,  -266,  -266,   -40,  -266,   -40,
  825.    -40,   -40,    16,   -40,   -40,   -40,   -40,   -40,   -32,   -31,
  826.    920,   -40,   -40,   878,  -260, -1000, -1000,   -40,  -112,   -40,
  827.    -40,    -7,    16,    16,    16,    16,    56,    56,   768,   768,
  828.    768,   768,   768,   768,   768,   981,   800,   931,    16,   867,
  829.    839,   794,   708,   -17,   -19,   573,   -29,   528,   493,   465,
  830.    -24,    17,     6,   430,   402, -1000,   -40,   -40,   -34,   391,
  831.  -1000, -1000, -1000,   -30,   920,   -21, -1000, -1000, -1000, -1000,
  832.  -1000, -1000, -1000,   -40, -1000, -1000, -1000, -1000, -1000,   -40,
  833.  -1000,   -40,   -40,   -40,   920,    16, -1000, -1000, -1000,   -40,
  834.  -1000,   363,   302,   120,    92,    81,   920, -1000, -1000, -1000,
  835.  -1000, -1000 };
  836. int yypgo[]={
  837.  
  838.      0,  1184,    85,    82,    21,    80,   323,    76,    75,    74,
  839.     73,    13,    72,    71,    19 };
  840. int yyr1[]={
  841.  
  842.      0,     3,     3,     2,     1,     9,     1,     1,     1,    10,
  843.     10,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  844.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  845.      1,     1,     4,     4,    12,     1,    14,     1,    11,    11,
  846.     11,    13,    13,     1,     1,     1,     1,     1,     1,     1,
  847.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  848.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  849.      1,     1,     1,     1,     7,     8,     8,     5,     5,     5,
  850.      5,     6 };
  851. int yyr2[]={
  852.  
  853.      0,     2,     2,     3,     5,     1,     7,     5,     5,     2,
  854.      2,     9,     9,     9,     9,     9,     9,     9,    13,     9,
  855.      9,     9,     5,     9,    13,     9,    13,     7,     2,     7,
  856.     13,    13,     7,     9,     1,    11,     1,    11,     0,     3,
  857.      7,     3,     7,     9,     9,     7,     7,     7,     7,     7,
  858.      7,     7,     7,     7,     7,     7,     7,     7,     7,     7,
  859.      7,     7,     7,     3,     3,     3,     3,     3,     3,     2,
  860.      3,     3,     9,     3,     3,     3,     7,     3,     3,     7,
  861.      3,     3 };
  862. int yychk[]={
  863.  
  864.  -1000,    -3,    -1,    -2,    45,    43,   -10,   272,   273,   275,
  865.    274,   276,   277,   278,   279,   280,   281,   282,   271,   283,
  866.    284,    -4,   285,   286,   123,    -6,    40,   261,   262,   257,
  867.    260,   263,   264,    -5,   288,   289,   265,   303,   126,   270,
  868.     -8,   290,    -7,   266,   267,    94,   302,   296,    91,    40,
  869.     64,    42,    47,   299,   300,    43,    45,    61,   295,    35,
  870.    293,   294,    60,    62,   298,   297,   292,    -9,    -1,    -6,
  871.     -1,    40,    40,    40,    40,    40,    40,    40,    40,    40,
  872.     40,    40,    -1,    40,    40,    40,    40,    40,   -11,    -6,
  873.     -1,   123,    40,    -1,   287,   266,    -4,   123,    -6,   -12,
  874.    -14,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  875.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  876.     -1,    -1,    -1,    -6,    -6,    -1,    -6,    -1,    -1,    -1,
  877.     -6,    -1,    -1,    -1,    -1,   125,    44,   125,   -11,    -1,
  878.     41,   267,   266,   -13,    -1,   -11,    41,    41,    41,    41,
  879.     41,    41,    41,    44,    41,    41,    41,    41,    41,    44,
  880.     41,    44,    44,    44,    -1,    -1,   125,    41,    93,    44,
  881.     41,    -1,    -1,    -1,    -1,    -1,    -1,    41,    41,    41,
  882.     41,    41 };
  883. int yydef[]={
  884.  
  885.      0,    -2,     1,     2,     5,     0,     0,     0,     0,     0,
  886.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  887.      0,    28,     0,     0,    38,     3,     0,    63,    64,    65,
  888.     66,    67,    68,    69,    70,    71,    73,     9,    10,    81,
  889.     -2,    78,     0,    80,    75,     4,     0,     0,    34,    36,
  890.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  891.      0,     0,     0,     0,     0,     0,     0,     0,     7,     0,
  892.      8,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  893.      0,     0,    22,     0,     0,     0,     0,     0,     0,     0,
  894.     39,    38,     0,     0,     0,    27,    29,    38,     0,     0,
  895.     38,    46,    47,    48,    49,    50,    51,    52,    53,    54,
  896.     55,    56,    57,    58,    59,    60,    61,    -2,     6,     0,
  897.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  898.      0,     0,     0,     0,     0,    32,     0,     0,     0,     0,
  899.     45,    76,    79,     0,    41,     0,    11,    12,    13,    14,
  900.     15,    16,    17,     0,    19,    20,    21,    72,    23,     0,
  901.     25,     0,     0,     0,    40,    43,    33,    44,    35,     0,
  902.     37,     0,     0,     0,     0,     0,    42,    18,    24,    26,
  903.     30,    31 };
  904. typedef struct { char *t_name; int t_val; } yytoktype;
  905. #ifndef YYDEBUG
  906. #    define YYDEBUG    0    /* don't allow debugging */
  907. #endif
  908.  
  909. #if YYDEBUG
  910.  
  911. yytoktype yytoks[] =
  912. {
  913.     "INT",    257,
  914.     "HEX",    258,
  915.     "ERROR",    259,
  916.     "UINT",    260,
  917.     "M2_TRUE",    261,
  918.     "M2_FALSE",    262,
  919.     "CHAR",    263,
  920.     "FLOAT",    264,
  921.     "STRING",    265,
  922.     "NAME",    266,
  923.     "BLOCKNAME",    267,
  924.     "IDENT",    268,
  925.     "VARNAME",    269,
  926.     "TYPENAME",    270,
  927.     "SIZE",    271,
  928.     "CAP",    272,
  929.     "ORD",    273,
  930.     "HIGH",    274,
  931.     "ABS",    275,
  932.     "MIN_FUNC",    276,
  933.     "MAX_FUNC",    277,
  934.     "FLOAT_FUNC",    278,
  935.     "VAL",    279,
  936.     "CHR",    280,
  937.     "ODD",    281,
  938.     "TRUNC",    282,
  939.     "INC",    283,
  940.     "DEC",    284,
  941.     "INCL",    285,
  942.     "EXCL",    286,
  943.     "COLONCOLON",    287,
  944.     "LAST",    288,
  945.     "REGNAME",    289,
  946.     "INTERNAL_VAR",    290,
  947.     ",",    44,
  948.     "ABOVE_COMMA",    291,
  949.     "ASSIGN",    292,
  950.     "<",    60,
  951.     ">",    62,
  952.     "LEQ",    293,
  953.     "GEQ",    294,
  954.     "=",    61,
  955.     "NOTEQUAL",    295,
  956.     "#",    35,
  957.     "IN",    296,
  958.     "OROR",    297,
  959.     "LOGICAL_AND",    298,
  960.     "&",    38,
  961.     "@",    64,
  962.     "+",    43,
  963.     "-",    45,
  964.     "*",    42,
  965.     "/",    47,
  966.     "DIV",    299,
  967.     "MOD",    300,
  968.     "UNARY",    301,
  969.     "^",    94,
  970.     "DOT",    302,
  971.     "[",    91,
  972.     "(",    40,
  973.     "NOT",    303,
  974.     "~",    126,
  975.     "QID",    304,
  976.     "-unknown-",    -1    /* ends search */
  977. };
  978.  
  979. char * yyreds[] =
  980. {
  981.     "-no such reduction-",
  982.     "start : exp",
  983.     "start : type_exp",
  984.     "type_exp : type",
  985.     "exp : exp '^'",
  986.     "exp : '-'",
  987.     "exp : '-' exp",
  988.     "exp : '+' exp",
  989.     "exp : not_exp exp",
  990.     "not_exp : NOT",
  991.     "not_exp : '~'",
  992.     "exp : CAP '(' exp ')'",
  993.     "exp : ORD '(' exp ')'",
  994.     "exp : ABS '(' exp ')'",
  995.     "exp : HIGH '(' exp ')'",
  996.     "exp : MIN_FUNC '(' type ')'",
  997.     "exp : MAX_FUNC '(' type ')'",
  998.     "exp : FLOAT_FUNC '(' exp ')'",
  999.     "exp : VAL '(' type ',' exp ')'",
  1000.     "exp : CHR '(' exp ')'",
  1001.     "exp : ODD '(' exp ')'",
  1002.     "exp : TRUNC '(' exp ')'",
  1003.     "exp : SIZE exp",
  1004.     "exp : INC '(' exp ')'",
  1005.     "exp : INC '(' exp ',' exp ')'",
  1006.     "exp : DEC '(' exp ')'",
  1007.     "exp : DEC '(' exp ',' exp ')'",
  1008.     "exp : exp DOT NAME",
  1009.     "exp : set",
  1010.     "exp : exp IN set",
  1011.     "exp : INCL '(' exp ',' exp ')'",
  1012.     "exp : EXCL '(' exp ',' exp ')'",
  1013.     "set : '{' arglist '}'",
  1014.     "set : type '{' arglist '}'",
  1015.     "exp : exp '['",
  1016.     "exp : exp '[' non_empty_arglist ']'",
  1017.     "exp : exp '('",
  1018.     "exp : exp '(' arglist ')'",
  1019.     "arglist : /* empty */",
  1020.     "arglist : exp",
  1021.     "arglist : arglist ',' exp",
  1022.     "non_empty_arglist : exp",
  1023.     "non_empty_arglist : non_empty_arglist ',' exp",
  1024.     "exp : '{' type '}' exp",
  1025.     "exp : type '(' exp ')'",
  1026.     "exp : '(' exp ')'",
  1027.     "exp : exp '@' exp",
  1028.     "exp : exp '*' exp",
  1029.     "exp : exp '/' exp",
  1030.     "exp : exp DIV exp",
  1031.     "exp : exp MOD exp",
  1032.     "exp : exp '+' exp",
  1033.     "exp : exp '-' exp",
  1034.     "exp : exp '=' exp",
  1035.     "exp : exp NOTEQUAL exp",
  1036.     "exp : exp '#' exp",
  1037.     "exp : exp LEQ exp",
  1038.     "exp : exp GEQ exp",
  1039.     "exp : exp '<' exp",
  1040.     "exp : exp '>' exp",
  1041.     "exp : exp LOGICAL_AND exp",
  1042.     "exp : exp OROR exp",
  1043.     "exp : exp ASSIGN exp",
  1044.     "exp : M2_TRUE",
  1045.     "exp : M2_FALSE",
  1046.     "exp : INT",
  1047.     "exp : UINT",
  1048.     "exp : CHAR",
  1049.     "exp : FLOAT",
  1050.     "exp : variable",
  1051.     "exp : LAST",
  1052.     "exp : REGNAME",
  1053.     "exp : SIZE '(' type ')'",
  1054.     "exp : STRING",
  1055.     "block : fblock",
  1056.     "fblock : BLOCKNAME",
  1057.     "fblock : block COLONCOLON BLOCKNAME",
  1058.     "variable : fblock",
  1059.     "variable : INTERNAL_VAR",
  1060.     "variable : block COLONCOLON NAME",
  1061.     "variable : NAME",
  1062.     "type : TYPENAME",
  1063. };
  1064. #endif /* YYDEBUG */
  1065. #line 1 "/usr/lib/yaccpar"
  1066. /*    @(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10    */
  1067.  
  1068. /*
  1069. ** Skeleton parser driver for yacc output
  1070. */
  1071.  
  1072. /*
  1073. ** yacc user known macros and defines
  1074. */
  1075. #define YYERROR        goto yyerrlab
  1076. #define YYACCEPT    { free(yys); free(yyv); return(0); }
  1077. #define YYABORT        { free(yys); free(yyv); return(1); }
  1078. #define YYBACKUP( newtoken, newvalue )\
  1079. {\
  1080.     if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
  1081.     {\
  1082.         yyerror( "syntax error - cannot backup" );\
  1083.         goto yyerrlab;\
  1084.     }\
  1085.     yychar = newtoken;\
  1086.     yystate = *yyps;\
  1087.     yylval = newvalue;\
  1088.     goto yynewstate;\
  1089. }
  1090. #define YYRECOVERING()    (!!yyerrflag)
  1091. #ifndef YYDEBUG
  1092. #    define YYDEBUG    1    /* make debugging available */
  1093. #endif
  1094.  
  1095. /*
  1096. ** user known globals
  1097. */
  1098. int yydebug;            /* set to 1 to get debugging */
  1099.  
  1100. /*
  1101. ** driver internal defines
  1102. */
  1103. #define YYFLAG        (-1000)
  1104.  
  1105. /*
  1106. ** static variables used by the parser
  1107. */
  1108. static YYSTYPE *yyv;            /* value stack */
  1109. static int *yys;            /* state stack */
  1110.  
  1111. static YYSTYPE *yypv;            /* top of value stack */
  1112. static int *yyps;            /* top of state stack */
  1113.  
  1114. static int yystate;            /* current state */
  1115. static int yytmp;            /* extra var (lasts between blocks) */
  1116.  
  1117. int yynerrs;            /* number of errors */
  1118.  
  1119. int yyerrflag;            /* error recovery flag */
  1120. int yychar;            /* current input token number */
  1121.  
  1122.  
  1123. /*
  1124. ** yyparse - return 0 if worked, 1 if syntax error not recovered from
  1125. */
  1126. int
  1127. yyparse()
  1128. {
  1129.     register YYSTYPE *yypvt;    /* top of value stack for $vars */
  1130.     unsigned yymaxdepth = YYMAXDEPTH;
  1131.  
  1132.     /*
  1133.     ** Initialize externals - yyparse may be called more than once
  1134.     */
  1135.     yyv = (YYSTYPE*)xmalloc(yymaxdepth*sizeof(YYSTYPE));
  1136.     yys = (int*)xmalloc(yymaxdepth*sizeof(int));
  1137.     if (!yyv || !yys)
  1138.     {
  1139.         yyerror( "out of memory" );
  1140.         return(1);
  1141.     }
  1142.     yypv = &yyv[-1];
  1143.     yyps = &yys[-1];
  1144.     yystate = 0;
  1145.     yytmp = 0;
  1146.     yynerrs = 0;
  1147.     yyerrflag = 0;
  1148.     yychar = -1;
  1149.  
  1150.     goto yystack;
  1151.     {
  1152.         register YYSTYPE *yy_pv;    /* top of value stack */
  1153.         register int *yy_ps;        /* top of state stack */
  1154.         register int yy_state;        /* current state */
  1155.         register int  yy_n;        /* internal state number info */
  1156.  
  1157.         /*
  1158.         ** get globals into registers.
  1159.         ** branch to here only if YYBACKUP was called.
  1160.         */
  1161.     yynewstate:
  1162.         yy_pv = yypv;
  1163.         yy_ps = yyps;
  1164.         yy_state = yystate;
  1165.         goto yy_newstate;
  1166.  
  1167.         /*
  1168.         ** get globals into registers.
  1169.         ** either we just started, or we just finished a reduction
  1170.         */
  1171.     yystack:
  1172.         yy_pv = yypv;
  1173.         yy_ps = yyps;
  1174.         yy_state = yystate;
  1175.  
  1176.         /*
  1177.         ** top of for (;;) loop while no reductions done
  1178.         */
  1179.     yy_stack:
  1180.         /*
  1181.         ** put a state and value onto the stacks
  1182.         */
  1183. #if YYDEBUG
  1184.         /*
  1185.         ** if debugging, look up token value in list of value vs.
  1186.         ** name pairs.  0 and negative (-1) are special values.
  1187.         ** Note: linear search is used since time is not a real
  1188.         ** consideration while debugging.
  1189.         */
  1190.         if ( yydebug )
  1191.         {
  1192.             register int yy_i;
  1193.  
  1194.             (void)printf( "State %d, token ", yy_state );
  1195.             if ( yychar == 0 )
  1196.                 (void)printf( "end-of-file\n" );
  1197.             else if ( yychar < 0 )
  1198.                 (void)printf( "-none-\n" );
  1199.             else
  1200.             {
  1201.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  1202.                     yy_i++ )
  1203.                 {
  1204.                     if ( yytoks[yy_i].t_val == yychar )
  1205.                         break;
  1206.                 }
  1207.                 (void)printf( "%s\n", yytoks[yy_i].t_name );
  1208.             }
  1209.         }
  1210. #endif /* YYDEBUG */
  1211.         if ( ++yy_ps >= &yys[ yymaxdepth ] )    /* room on stack? */
  1212.         {
  1213.             /*
  1214.             ** xreallocate and recover.  Note that pointers
  1215.             ** have to be reset, or bad things will happen
  1216.             */
  1217.             int yyps_index = (yy_ps - yys);
  1218.             int yypv_index = (yy_pv - yyv);
  1219.             int yypvt_index = (yypvt - yyv);
  1220.             yymaxdepth += YYMAXDEPTH;
  1221.             yyv = (YYSTYPE*)xrealloc((char*)yyv,
  1222.                 yymaxdepth * sizeof(YYSTYPE));
  1223.             yys = (int*)xrealloc((char*)yys,
  1224.                 yymaxdepth * sizeof(int));
  1225.             if (!yyv || !yys)
  1226.             {
  1227.                 yyerror( "yacc stack overflow" );
  1228.                 return(1);
  1229.             }
  1230.             yy_ps = yys + yyps_index;
  1231.             yy_pv = yyv + yypv_index;
  1232.             yypvt = yyv + yypvt_index;
  1233.         }
  1234.         *yy_ps = yy_state;
  1235.         *++yy_pv = yyval;
  1236.  
  1237.         /*
  1238.         ** we have a new state - find out what to do
  1239.         */
  1240.     yy_newstate:
  1241.         if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
  1242.             goto yydefault;        /* simple state */
  1243. #if YYDEBUG
  1244.         /*
  1245.         ** if debugging, need to mark whether new token grabbed
  1246.         */
  1247.         yytmp = yychar < 0;
  1248. #endif
  1249.         if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  1250.             yychar = 0;        /* reached EOF */
  1251. #if YYDEBUG
  1252.         if ( yydebug && yytmp )
  1253.         {
  1254.             register int yy_i;
  1255.  
  1256.             (void)printf( "Received token " );
  1257.             if ( yychar == 0 )
  1258.                 (void)printf( "end-of-file\n" );
  1259.             else if ( yychar < 0 )
  1260.                 (void)printf( "-none-\n" );
  1261.             else
  1262.             {
  1263.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  1264.                     yy_i++ )
  1265.                 {
  1266.                     if ( yytoks[yy_i].t_val == yychar )
  1267.                         break;
  1268.                 }
  1269.                 (void)printf( "%s\n", yytoks[yy_i].t_name );
  1270.             }
  1271.         }
  1272. #endif /* YYDEBUG */
  1273.         if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
  1274.             goto yydefault;
  1275.         if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )    /*valid shift*/
  1276.         {
  1277.             yychar = -1;
  1278.             yyval = yylval;
  1279.             yy_state = yy_n;
  1280.             if ( yyerrflag > 0 )
  1281.                 yyerrflag--;
  1282.             goto yy_stack;
  1283.         }
  1284.  
  1285.     yydefault:
  1286.         if ( ( yy_n = yydef[ yy_state ] ) == -2 )
  1287.         {
  1288. #if YYDEBUG
  1289.             yytmp = yychar < 0;
  1290. #endif
  1291.             if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  1292.                 yychar = 0;        /* reached EOF */
  1293. #if YYDEBUG
  1294.             if ( yydebug && yytmp )
  1295.             {
  1296.                 register int yy_i;
  1297.  
  1298.                 (void)printf( "Received token " );
  1299.                 if ( yychar == 0 )
  1300.                     (void)printf( "end-of-file\n" );
  1301.                 else if ( yychar < 0 )
  1302.                     (void)printf( "-none-\n" );
  1303.                 else
  1304.                 {
  1305.                     for ( yy_i = 0;
  1306.                         yytoks[yy_i].t_val >= 0;
  1307.                         yy_i++ )
  1308.                     {
  1309.                         if ( yytoks[yy_i].t_val
  1310.                             == yychar )
  1311.                         {
  1312.                             break;
  1313.                         }
  1314.                     }
  1315.                     (void)printf( "%s\n", yytoks[yy_i].t_name );
  1316.                 }
  1317.             }
  1318. #endif /* YYDEBUG */
  1319.             /*
  1320.             ** look through exception table
  1321.             */
  1322.             {
  1323.                 register int *yyxi = yyexca;
  1324.  
  1325.                 while ( ( *yyxi != -1 ) ||
  1326.                     ( yyxi[1] != yy_state ) )
  1327.                 {
  1328.                     yyxi += 2;
  1329.                 }
  1330.                 while ( ( *(yyxi += 2) >= 0 ) &&
  1331.                     ( *yyxi != yychar ) )
  1332.                     ;
  1333.                 if ( ( yy_n = yyxi[1] ) < 0 )
  1334.                     YYACCEPT;
  1335.             }
  1336.         }
  1337.  
  1338.         /*
  1339.         ** check for syntax error
  1340.         */
  1341.         if ( yy_n == 0 )    /* have an error */
  1342.         {
  1343.             /* no worry about speed here! */
  1344.             switch ( yyerrflag )
  1345.             {
  1346.             case 0:        /* new error */
  1347.                 yyerror( "syntax error" );
  1348.                 goto skip_init;
  1349.             yyerrlab:
  1350.                 /*
  1351.                 ** get globals into registers.
  1352.                 ** we have a user generated syntax type error
  1353.                 */
  1354.                 yy_pv = yypv;
  1355.                 yy_ps = yyps;
  1356.                 yy_state = yystate;
  1357.                 yynerrs++;
  1358.             skip_init:
  1359.             case 1:
  1360.             case 2:        /* incompletely recovered error */
  1361.                     /* try again... */
  1362.                 yyerrflag = 3;
  1363.                 /*
  1364.                 ** find state where "error" is a legal
  1365.                 ** shift action
  1366.                 */
  1367.                 while ( yy_ps >= yys )
  1368.                 {
  1369.                     yy_n = yypact[ *yy_ps ] + YYERRCODE;
  1370.                     if ( yy_n >= 0 && yy_n < YYLAST &&
  1371.                         yychk[yyact[yy_n]] == YYERRCODE)                    {
  1372.                         /*
  1373.                         ** simulate shift of "error"
  1374.                         */
  1375.                         yy_state = yyact[ yy_n ];
  1376.                         goto yy_stack;
  1377.                     }
  1378.                     /*
  1379.                     ** current state has no shift on
  1380.                     ** "error", pop stack
  1381.                     */
  1382. #if YYDEBUG
  1383. #    define _POP_ "Error recovery pops state %d, uncovers state %d\n"
  1384.                     if ( yydebug )
  1385.                         (void)printf( _POP_, *yy_ps,
  1386.                             yy_ps[-1] );
  1387. #    undef _POP_
  1388. #endif
  1389.                     yy_ps--;
  1390.                     yy_pv--;
  1391.                 }
  1392.                 /*
  1393.                 ** there is no state on stack with "error" as
  1394.                 ** a valid shift.  give up.
  1395.                 */
  1396.                 YYABORT;
  1397.             case 3:        /* no shift yet; eat a token */
  1398. #if YYDEBUG
  1399.                 /*
  1400.                 ** if debugging, look up token in list of
  1401.                 ** pairs.  0 and negative shouldn't occur,
  1402.                 ** but since timing doesn't matter when
  1403.                 ** debugging, it doesn't hurt to leave the
  1404.                 ** tests here.
  1405.                 */
  1406.                 if ( yydebug )
  1407.                 {
  1408.                     register int yy_i;
  1409.  
  1410.                     (void)printf( "Error recovery discards " );
  1411.                     if ( yychar == 0 )
  1412.                         (void)printf( "token end-of-file\n" );
  1413.                     else if ( yychar < 0 )
  1414.                         (void)printf( "token -none-\n" );
  1415.                     else
  1416.                     {
  1417.                         for ( yy_i = 0;
  1418.                             yytoks[yy_i].t_val >= 0;
  1419.                             yy_i++ )
  1420.                         {
  1421.                             if ( yytoks[yy_i].t_val
  1422.                                 == yychar )
  1423.                             {
  1424.                                 break;
  1425.                             }
  1426.                         }
  1427.                         (void)printf( "token %s\n",
  1428.                             yytoks[yy_i].t_name );
  1429.                     }
  1430.                 }
  1431. #endif /* YYDEBUG */
  1432.                 if ( yychar == 0 )    /* reached EOF. quit */
  1433.                     YYABORT;
  1434.                 yychar = -1;
  1435.                 goto yy_newstate;
  1436.             }
  1437.         }/* end if ( yy_n == 0 ) */
  1438.         /*
  1439.         ** reduction by production yy_n
  1440.         ** put stack tops, etc. so things right after switch
  1441.         */
  1442. #if YYDEBUG
  1443.         /*
  1444.         ** if debugging, print the string that is the user's
  1445.         ** specification of the reduction which is just about
  1446.         ** to be done.
  1447.         */
  1448.         if ( yydebug )
  1449.             (void)printf( "Reduce by (%d) \"%s\"\n",
  1450.                 yy_n, yyreds[ yy_n ] );
  1451. #endif
  1452.         yytmp = yy_n;            /* value to switch over */
  1453.         yypvt = yy_pv;            /* $vars top of value stack */
  1454.         /*
  1455.         ** Look in goto table for next state
  1456.         ** Sorry about using yy_state here as temporary
  1457.         ** register variable, but why not, if it works...
  1458.         ** If yyr2[ yy_n ] doesn't have the low order bit
  1459.         ** set, then there is no action to be done for
  1460.         ** this reduction.  So, no saving & unsaving of
  1461.         ** registers done.  The only difference between the
  1462.         ** code just after the if and the body of the if is
  1463.         ** the goto yy_stack in the body.  This way the test
  1464.         ** can be made before the choice of what to do is needed.
  1465.         */
  1466.         {
  1467.             /* length of production doubled with extra bit */
  1468.             register int yy_len = yyr2[ yy_n ];
  1469.  
  1470.             if ( !( yy_len & 01 ) )
  1471.             {
  1472.                 yy_len >>= 1;
  1473.                 yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  1474.                 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  1475.                     *( yy_ps -= yy_len ) + 1;
  1476.                 if ( yy_state >= YYLAST ||
  1477.                     yychk[ yy_state =
  1478.                     yyact[ yy_state ] ] != -yy_n )
  1479.                 {
  1480.                     yy_state = yyact[ yypgo[ yy_n ] ];
  1481.                 }
  1482.                 goto yy_stack;
  1483.             }
  1484.             yy_len >>= 1;
  1485.             yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  1486.             yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  1487.                 *( yy_ps -= yy_len ) + 1;
  1488.             if ( yy_state >= YYLAST ||
  1489.                 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
  1490.             {
  1491.                 yy_state = yyact[ yypgo[ yy_n ] ];
  1492.             }
  1493.         }
  1494.                     /* save until reenter driver code */
  1495.         yystate = yy_state;
  1496.         yyps = yy_ps;
  1497.         yypv = yy_pv;
  1498.     }
  1499.     /*
  1500.     ** code supplied by user is placed in this switch
  1501.     */
  1502.     switch( yytmp )
  1503.     {
  1504.         
  1505. case 3:
  1506. # line 197 "./m2-exp.y"
  1507. { write_exp_elt_opcode(OP_TYPE);
  1508.           write_exp_elt_type(yypvt[-0].tval);
  1509.           write_exp_elt_opcode(OP_TYPE);
  1510.         } break;
  1511. case 4:
  1512. # line 206 "./m2-exp.y"
  1513. { write_exp_elt_opcode (UNOP_IND); } break;
  1514. case 5:
  1515. # line 209 "./m2-exp.y"
  1516. { number_sign = -1; } break;
  1517. case 6:
  1518. # line 211 "./m2-exp.y"
  1519. { number_sign = 1;
  1520.               write_exp_elt_opcode (UNOP_NEG); } break;
  1521. case 7:
  1522. # line 216 "./m2-exp.y"
  1523. { write_exp_elt_opcode(UNOP_PLUS); } break;
  1524. case 8:
  1525. # line 220 "./m2-exp.y"
  1526. { write_exp_elt_opcode (UNOP_LOGICAL_NOT); } break;
  1527. case 11:
  1528. # line 228 "./m2-exp.y"
  1529. { write_exp_elt_opcode (UNOP_CAP); } break;
  1530. case 12:
  1531. # line 232 "./m2-exp.y"
  1532. { write_exp_elt_opcode (UNOP_ORD); } break;
  1533. case 13:
  1534. # line 236 "./m2-exp.y"
  1535. { write_exp_elt_opcode (UNOP_ABS); } break;
  1536. case 14:
  1537. # line 240 "./m2-exp.y"
  1538. { write_exp_elt_opcode (UNOP_HIGH); } break;
  1539. case 15:
  1540. # line 244 "./m2-exp.y"
  1541. { write_exp_elt_opcode (UNOP_MIN);
  1542.               write_exp_elt_type (yypvt[-1].tval);
  1543.               write_exp_elt_opcode (UNOP_MIN); } break;
  1544. case 16:
  1545. # line 250 "./m2-exp.y"
  1546. { write_exp_elt_opcode (UNOP_MAX);
  1547.               write_exp_elt_type (yypvt[-1].tval);
  1548.               write_exp_elt_opcode (UNOP_MIN); } break;
  1549. case 17:
  1550. # line 256 "./m2-exp.y"
  1551. { write_exp_elt_opcode (UNOP_FLOAT); } break;
  1552. case 18:
  1553. # line 260 "./m2-exp.y"
  1554. { write_exp_elt_opcode (BINOP_VAL);
  1555.               write_exp_elt_type (yypvt[-3].tval);
  1556.               write_exp_elt_opcode (BINOP_VAL); } break;
  1557. case 19:
  1558. # line 266 "./m2-exp.y"
  1559. { write_exp_elt_opcode (UNOP_CHR); } break;
  1560. case 20:
  1561. # line 270 "./m2-exp.y"
  1562. { write_exp_elt_opcode (UNOP_ODD); } break;
  1563. case 21:
  1564. # line 274 "./m2-exp.y"
  1565. { write_exp_elt_opcode (UNOP_TRUNC); } break;
  1566. case 22:
  1567. # line 278 "./m2-exp.y"
  1568. { write_exp_elt_opcode (UNOP_SIZEOF); } break;
  1569. case 23:
  1570. # line 283 "./m2-exp.y"
  1571. { write_exp_elt_opcode(UNOP_PREINCREMENT); } break;
  1572. case 24:
  1573. # line 287 "./m2-exp.y"
  1574. { write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
  1575.               write_exp_elt_opcode(BINOP_ADD);
  1576.               write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); } break;
  1577. case 25:
  1578. # line 293 "./m2-exp.y"
  1579. { write_exp_elt_opcode(UNOP_PREDECREMENT);} break;
  1580. case 26:
  1581. # line 297 "./m2-exp.y"
  1582. { write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
  1583.               write_exp_elt_opcode(BINOP_SUB);
  1584.               write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); } break;
  1585. case 27:
  1586. # line 303 "./m2-exp.y"
  1587. { write_exp_elt_opcode (STRUCTOP_STRUCT);
  1588.               write_exp_string (yypvt[-0].sval);
  1589.               write_exp_elt_opcode (STRUCTOP_STRUCT); } break;
  1590. case 29:
  1591. # line 312 "./m2-exp.y"
  1592. { error("Sets are not implemented.");} break;
  1593. case 30:
  1594. # line 316 "./m2-exp.y"
  1595. { error("Sets are not implemented.");} break;
  1596. case 31:
  1597. # line 320 "./m2-exp.y"
  1598. { error("Sets are not implemented.");} break;
  1599. case 32:
  1600. # line 323 "./m2-exp.y"
  1601. { error("Sets are not implemented.");} break;
  1602. case 33:
  1603. # line 325 "./m2-exp.y"
  1604. { error("Sets are not implemented.");} break;
  1605. case 34:
  1606. # line 334 "./m2-exp.y"
  1607. { start_arglist(); } break;
  1608. case 35:
  1609. # line 336 "./m2-exp.y"
  1610. { write_exp_elt_opcode (MULTI_SUBSCRIPT);
  1611.               write_exp_elt_longcst ((LONGEST) end_arglist());
  1612.               write_exp_elt_opcode (MULTI_SUBSCRIPT); } break;
  1613. case 36:
  1614. # line 344 "./m2-exp.y"
  1615. { start_arglist (); } break;
  1616. case 37:
  1617. # line 346 "./m2-exp.y"
  1618. { write_exp_elt_opcode (OP_FUNCALL);
  1619.               write_exp_elt_longcst ((LONGEST) end_arglist ());
  1620.               write_exp_elt_opcode (OP_FUNCALL); } break;
  1621. case 39:
  1622. # line 355 "./m2-exp.y"
  1623. { arglist_len = 1; } break;
  1624. case 40:
  1625. # line 359 "./m2-exp.y"
  1626. { arglist_len++; } break;
  1627. case 41:
  1628. # line 364 "./m2-exp.y"
  1629. { arglist_len = 1; } break;
  1630. case 42:
  1631. # line 369 "./m2-exp.y"
  1632. { arglist_len++; } break;
  1633. case 43:
  1634. # line 374 "./m2-exp.y"
  1635. { write_exp_elt_opcode (UNOP_MEMVAL);
  1636.               write_exp_elt_type (yypvt[-2].tval);
  1637.               write_exp_elt_opcode (UNOP_MEMVAL); } break;
  1638. case 44:
  1639. # line 380 "./m2-exp.y"
  1640. { write_exp_elt_opcode (UNOP_CAST);
  1641.               write_exp_elt_type (yypvt[-3].tval);
  1642.               write_exp_elt_opcode (UNOP_CAST); } break;
  1643. case 45:
  1644. # line 386 "./m2-exp.y"
  1645. { } break;
  1646. case 46:
  1647. # line 394 "./m2-exp.y"
  1648. { write_exp_elt_opcode (BINOP_REPEAT); } break;
  1649. case 47:
  1650. # line 398 "./m2-exp.y"
  1651. { write_exp_elt_opcode (BINOP_MUL); } break;
  1652. case 48:
  1653. # line 402 "./m2-exp.y"
  1654. { write_exp_elt_opcode (BINOP_DIV); } break;
  1655. case 49:
  1656. # line 406 "./m2-exp.y"
  1657. { write_exp_elt_opcode (BINOP_INTDIV); } break;
  1658. case 50:
  1659. # line 410 "./m2-exp.y"
  1660. { write_exp_elt_opcode (BINOP_REM); } break;
  1661. case 51:
  1662. # line 414 "./m2-exp.y"
  1663. { write_exp_elt_opcode (BINOP_ADD); } break;
  1664. case 52:
  1665. # line 418 "./m2-exp.y"
  1666. { write_exp_elt_opcode (BINOP_SUB); } break;
  1667. case 53:
  1668. # line 422 "./m2-exp.y"
  1669. { write_exp_elt_opcode (BINOP_EQUAL); } break;
  1670. case 54:
  1671. # line 426 "./m2-exp.y"
  1672. { write_exp_elt_opcode (BINOP_NOTEQUAL); } break;
  1673. case 55:
  1674. # line 428 "./m2-exp.y"
  1675. { write_exp_elt_opcode (BINOP_NOTEQUAL); } break;
  1676. case 56:
  1677. # line 432 "./m2-exp.y"
  1678. { write_exp_elt_opcode (BINOP_LEQ); } break;
  1679. case 57:
  1680. # line 436 "./m2-exp.y"
  1681. { write_exp_elt_opcode (BINOP_GEQ); } break;
  1682. case 58:
  1683. # line 440 "./m2-exp.y"
  1684. { write_exp_elt_opcode (BINOP_LESS); } break;
  1685. case 59:
  1686. # line 444 "./m2-exp.y"
  1687. { write_exp_elt_opcode (BINOP_GTR); } break;
  1688. case 60:
  1689. # line 448 "./m2-exp.y"
  1690. { write_exp_elt_opcode (BINOP_LOGICAL_AND); } break;
  1691. case 61:
  1692. # line 452 "./m2-exp.y"
  1693. { write_exp_elt_opcode (BINOP_LOGICAL_OR); } break;
  1694. case 62:
  1695. # line 456 "./m2-exp.y"
  1696. { write_exp_elt_opcode (BINOP_ASSIGN); } break;
  1697. case 63:
  1698. # line 463 "./m2-exp.y"
  1699. { write_exp_elt_opcode (OP_BOOL);
  1700.               write_exp_elt_longcst ((LONGEST) yypvt[-0].ulval);
  1701.               write_exp_elt_opcode (OP_BOOL); } break;
  1702. case 64:
  1703. # line 469 "./m2-exp.y"
  1704. { write_exp_elt_opcode (OP_BOOL);
  1705.               write_exp_elt_longcst ((LONGEST) yypvt[-0].ulval);
  1706.               write_exp_elt_opcode (OP_BOOL); } break;
  1707. case 65:
  1708. # line 475 "./m2-exp.y"
  1709. { write_exp_elt_opcode (OP_LONG);
  1710.               write_exp_elt_type (builtin_type_m2_int);
  1711.               write_exp_elt_longcst ((LONGEST) yypvt[-0].lval);
  1712.               write_exp_elt_opcode (OP_LONG); } break;
  1713. case 66:
  1714. # line 482 "./m2-exp.y"
  1715. {
  1716.               write_exp_elt_opcode (OP_LONG);
  1717.               write_exp_elt_type (builtin_type_m2_card);
  1718.               write_exp_elt_longcst ((LONGEST) yypvt[-0].ulval);
  1719.               write_exp_elt_opcode (OP_LONG);
  1720.             } break;
  1721. case 67:
  1722. # line 491 "./m2-exp.y"
  1723. { write_exp_elt_opcode (OP_LONG);
  1724.               write_exp_elt_type (builtin_type_m2_char);
  1725.               write_exp_elt_longcst ((LONGEST) yypvt[-0].ulval);
  1726.               write_exp_elt_opcode (OP_LONG); } break;
  1727. case 68:
  1728. # line 499 "./m2-exp.y"
  1729. { write_exp_elt_opcode (OP_DOUBLE);
  1730.               write_exp_elt_type (builtin_type_m2_real);
  1731.               write_exp_elt_dblcst (yypvt[-0].dval);
  1732.               write_exp_elt_opcode (OP_DOUBLE); } break;
  1733. case 70:
  1734. # line 510 "./m2-exp.y"
  1735. { write_exp_elt_opcode (OP_LAST);
  1736.               write_exp_elt_longcst ((LONGEST) yypvt[-0].lval);
  1737.               write_exp_elt_opcode (OP_LAST); } break;
  1738. case 71:
  1739. # line 516 "./m2-exp.y"
  1740. { write_exp_elt_opcode (OP_REGISTER);
  1741.               write_exp_elt_longcst ((LONGEST) yypvt[-0].lval);
  1742.               write_exp_elt_opcode (OP_REGISTER); } break;
  1743. case 72:
  1744. # line 522 "./m2-exp.y"
  1745. { write_exp_elt_opcode (OP_LONG);
  1746.               write_exp_elt_type (builtin_type_int);
  1747.               write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yypvt[-1].tval));
  1748.               write_exp_elt_opcode (OP_LONG); } break;
  1749. case 73:
  1750. # line 529 "./m2-exp.y"
  1751. { write_exp_elt_opcode (OP_M2_STRING);
  1752.               write_exp_string (yypvt[-0].sval);
  1753.               write_exp_elt_opcode (OP_M2_STRING); } break;
  1754. case 74:
  1755. # line 536 "./m2-exp.y"
  1756. { yyval.bval = SYMBOL_BLOCK_VALUE(yypvt[-0].sym); } break;
  1757. case 75:
  1758. # line 540 "./m2-exp.y"
  1759. { struct symbol *sym
  1760.                 = lookup_symbol (copy_name (yypvt[-0].sval), expression_context_block,
  1761.                          VAR_NAMESPACE, 0, NULL);
  1762.               yyval.sym = sym;} break;
  1763. case 76:
  1764. # line 549 "./m2-exp.y"
  1765. { struct symbol *tem
  1766.                 = lookup_symbol (copy_name (yypvt[-0].sval), yypvt[-2].bval,
  1767.                          VAR_NAMESPACE, 0, NULL);
  1768.               if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
  1769.                 error ("No function \"%s\" in specified context.",
  1770.                    copy_name (yypvt[-0].sval));
  1771.               yyval.sym = tem;
  1772.             } break;
  1773. case 77:
  1774. # line 561 "./m2-exp.y"
  1775. { write_exp_elt_opcode(OP_VAR_VALUE);
  1776.               write_exp_elt_sym (yypvt[-0].sym);
  1777.               write_exp_elt_opcode (OP_VAR_VALUE); } break;
  1778. case 78:
  1779. # line 568 "./m2-exp.y"
  1780. { write_exp_elt_opcode (OP_INTERNALVAR);
  1781.               write_exp_elt_intern (yypvt[-0].ivar);
  1782.               write_exp_elt_opcode (OP_INTERNALVAR); } break;
  1783. case 79:
  1784. # line 575 "./m2-exp.y"
  1785. { struct symbol *sym;
  1786.               sym = lookup_symbol (copy_name (yypvt[-0].sval), yypvt[-2].bval,
  1787.                            VAR_NAMESPACE, 0, NULL);
  1788.               if (sym == 0)
  1789.                 error ("No symbol \"%s\" in specified context.",
  1790.                    copy_name (yypvt[-0].sval));
  1791.  
  1792.               write_exp_elt_opcode (OP_VAR_VALUE);
  1793.               write_exp_elt_sym (sym);
  1794.               write_exp_elt_opcode (OP_VAR_VALUE); } break;
  1795. case 80:
  1796. # line 589 "./m2-exp.y"
  1797. { struct symbol *sym;
  1798.               int is_a_field_of_this;
  1799.  
  1800.                sym = lookup_symbol (copy_name (yypvt[-0].sval),
  1801.                            expression_context_block,
  1802.                            VAR_NAMESPACE,
  1803.                            &is_a_field_of_this,
  1804.                            NULL);
  1805.               if (sym)
  1806.                 {
  1807.                   switch (sym->class)
  1808.                 {
  1809.                 case LOC_REGISTER:
  1810.                 case LOC_ARG:
  1811.                 case LOC_LOCAL:
  1812.                 case LOC_REF_ARG:
  1813.                 case LOC_REGPARM:
  1814.                 case LOC_LOCAL_ARG:
  1815.                   if (innermost_block == 0 ||
  1816.                       contained_in (block_found,
  1817.                             innermost_block))
  1818.                     innermost_block = block_found;
  1819.                   break;
  1820.  
  1821.                 case LOC_UNDEF:
  1822.                 case LOC_CONST:
  1823.                 case LOC_STATIC:
  1824.                 case LOC_TYPEDEF:
  1825.                 case LOC_LABEL:    /* maybe should go above? */
  1826.                 case LOC_BLOCK:
  1827.                 case LOC_CONST_BYTES:
  1828.                 case LOC_OPTIMIZED_OUT:
  1829.                   /* These are listed so gcc -Wall will reveal
  1830.                      un-handled cases.  */
  1831.                   break;
  1832.                 }
  1833.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1834.                   write_exp_elt_sym (sym);
  1835.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1836.                 }
  1837.               else
  1838.                 {
  1839.                   struct minimal_symbol *msymbol;
  1840.                   register char *arg = copy_name (yypvt[-0].sval);
  1841.  
  1842.                   msymbol = lookup_minimal_symbol (arg,
  1843.                       (struct objfile *) NULL);
  1844.                   if (msymbol != NULL)
  1845.                 {
  1846.                   write_exp_elt_opcode (OP_LONG);
  1847.                   write_exp_elt_type (builtin_type_int);
  1848.                   write_exp_elt_longcst ((LONGEST) SYMBOL_VALUE_ADDRESS (msymbol));
  1849.                   write_exp_elt_opcode (OP_LONG);
  1850.                   write_exp_elt_opcode (UNOP_MEMVAL);
  1851.                   if (msymbol -> type == mst_data ||
  1852.                       msymbol -> type == mst_bss)
  1853.                     write_exp_elt_type (builtin_type_int);
  1854.                   else if (msymbol -> type == mst_text)
  1855.                     write_exp_elt_type (lookup_function_type (builtin_type_int));
  1856.                   else
  1857.                     write_exp_elt_type (builtin_type_char);
  1858.                   write_exp_elt_opcode (UNOP_MEMVAL);
  1859.                 }
  1860.                   else if (!have_full_symbols () && !have_partial_symbols ())
  1861.                 error ("No symbol table is loaded.  Use the \"symbol-file\" command.");
  1862.                   else
  1863.                 error ("No symbol \"%s\" in current context.",
  1864.                        copy_name (yypvt[-0].sval));
  1865.                 }
  1866.             } break;
  1867. case 81:
  1868. # line 663 "./m2-exp.y"
  1869. { yyval.tval = lookup_typename (copy_name (yypvt[-0].sval),
  1870.                         expression_context_block, 0); } break;
  1871.     }
  1872.     goto yystack;        /* reset registers in driver code */
  1873. }
  1874.