home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / graphtal / yacc.c < prev    next >
C/C++ Source or Header  |  1992-11-03  |  66KB  |  2,109 lines

  1.  
  2. /*  A Bison parser, made from yacc.y  */
  3.  
  4. #define YYBISON 1  /* Identify Bison output.  */
  5.  
  6. #define    tVALUE    258
  7. #define    tNAME    259
  8. #define    tCONSTANT    260
  9. #define    tLSYSTEM    261
  10. #define    tTABLE    262
  11. #define    tCONST    263
  12. #define    tATTRIBUTES    264
  13. #define    tDERIVATION    265
  14. #define    tAXIOM    266
  15. #define    tPITCH    267
  16. #define    tROLL    268
  17. #define    tTURN    269
  18. #define    tANGLE    270
  19. #define    tFORWARD    271
  20. #define    tRANDOMIZE    272
  21. #define    tINFINITY    273
  22. #define    tTROPISM    274
  23. #define    tWEIGHT    275
  24. #define    tEYE    276
  25. #define    tLOOKAT    277
  26. #define    tUP    278
  27. #define    tFOV    279
  28. #define    tCONERES    280
  29. #define    tSPHERERES    281
  30. #define    tHULL    282
  31. #define    tSPHERE    283
  32. #define    tTRIANGLE    284
  33. #define    tPLANE    285
  34. #define    tCYLINDER    286
  35. #define    tCONE    287
  36. #define    tTRANSLATE    288
  37. #define    tROTATE    289
  38. #define    tSCALE    290
  39. #define    tTRANSFORM    291
  40. #define    tSIN    292
  41. #define    tCOS    293
  42. #define    tTAN    294
  43. #define    tASIN    295
  44. #define    tACOS    296
  45. #define    tATAN    297
  46. #define    tABS    298
  47. #define    tSQRT    299
  48. #define    tEXP    300
  49. #define    tLOG    301
  50. #define    tLOG10    302
  51. #define    tRAND    303
  52. #define    tGAUSS    304
  53. #define    tIF    305
  54. #define    tTURTLEX    306
  55. #define    tTURTLEY    307
  56. #define    tTURTLEZ    308
  57. #define    tSCOPE    309
  58. #define    tAND    310
  59. #define    tOR    311
  60. #define    tEQ    312
  61. #define    tNEQ    313
  62. #define    tGEQ    314
  63. #define    tLEQ    315
  64. #define    tARROW    316
  65. #define    tPOW    317
  66. #define    tUMINUS    318
  67.  
  68. #line 1 "yacc.y"
  69.  
  70. /*
  71.  * yacc.y - parser for graphtal.
  72.  *
  73.  * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
  74.  * All rights reserved.
  75.  *
  76.  * This software may be freely copied, modified, and redistributed
  77.  * provided that this copyright notice is preserved on all copies.
  78.  *
  79.  * You may not distribute this software, in whole or in part, as part of
  80.  * any commercial product without the express consent of the authors.
  81.  *
  82.  * There is no warranty or other guarantee of fitness of this software
  83.  * for any purpose.  It is provided solely "as is".
  84.  *
  85.  */
  86.  
  87. // #ifdef _AIX
  88. //   #pragma alloca
  89. // # include <malloc.h>
  90. // # include <unistd.h>
  91. // #else
  92. # include <unistd.h>
  93. # ifndef alloca
  94. #  include <malloc.h>
  95. #  ifndef alloca
  96. #   define alloca
  97. #  endif
  98. # endif
  99. // #endif
  100.  
  101. #include <stdlib.h>
  102. #include <iostream.h>
  103.  
  104. #include "yyerror.h"
  105. #include "rcString.h"
  106. #include "LSystem.h"
  107. #include "Expression.h"
  108. #include "ExprItems.h"
  109. #include "table.h"
  110. #include "Color.h"
  111. #include "Options.h"
  112. #include "Primitives.h"
  113. #include "Hull.h"
  114. #include "Interpreter.h"
  115.  
  116. extern int yylex();
  117.  
  118. LSystem* lsystem = NULL;
  119.  
  120. declareTable(ExprSymtab, rcString, ExpressionPtr);
  121. implementTable(ExprSymtab, rcString, ExpressionPtr);
  122.  
  123. declareTable(IntSymtab, rcString, int);
  124. implementTable(IntSymtab, rcString, int);
  125.  
  126. declareTable(TableSymtab, rcString, TablePtr)
  127. implementTable(TableSymtab, rcString, TablePtr)
  128.  
  129. static ExprSymtab  GlobalConst(503);
  130. static ExprSymtab* LocalConst = new ExprSymtab(503);
  131. static IntSymtab*  FormalParam = new IntSymtab(17);
  132. static HullSymtab* theHulls = new HullSymtab(17);
  133. static TableSymtab theTables(17);
  134.  
  135. static int definingLocalConst = 0;
  136. static int nthParam = 0;
  137. static ProdModuleList* axiom = NULL;
  138. static DerivationList* derivation = NULL;
  139.  
  140. #line 73 "yacc.y"
  141. typedef union { double realnumber;
  142.      int intnumber;
  143.  
  144.      Vector* vector;
  145.      TransMatrix* trans;
  146.      GeoObject* geoObject;
  147.      Hull* hull;
  148.          DerivationList* derivations;
  149.      TableList* table_list;
  150.      Table* table;
  151.      ProductionList* prod_list;
  152.          Production* production;
  153.      Predecessor* predecessor;
  154.      NameList* name_list;
  155.      SuccessorList* succ_list;
  156.          Successor* successor;
  157.      ProdModuleList* module_list;
  158.      ProdModule* module;
  159.  
  160.      ExpressionList* expr_list;
  161.          Expression* expr;
  162.          Value* value;
  163.      rcString* name;
  164.        } YYSTYPE;
  165.  
  166. #ifndef YYLTYPE
  167. typedef
  168.   struct yyltype
  169.     {
  170.       int timestamp;
  171.       int first_line;
  172.       int first_column;
  173.       int last_line;
  174.       int last_column;
  175.       char *text;
  176.    }
  177.   yyltype;
  178.  
  179. #define YYLTYPE yyltype
  180. #endif
  181.  
  182. #ifndef YYDEBUG
  183. #define YYDEBUG 1
  184. #endif
  185.  
  186. #include <stdio.h>
  187.  
  188. #ifndef __STDC__
  189. #define const
  190. #endif
  191.  
  192.  
  193.  
  194. #define    YYFINAL        303
  195. #define    YYFLAG        -32768
  196. #define    YYNTBASE    88
  197.  
  198. #define YYTRANSLATE(x) ((unsigned)(x) <= 318 ? yytranslate[x] : 126)
  199.  
  200. static const char yytranslate[] = {     0,
  201.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  202.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  203.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  204.      2,     2,    57,     2,     2,    81,    70,    78,     2,    83,
  205.     86,    68,    66,    84,    67,    82,    69,     2,     2,     2,
  206.      2,     2,     2,     2,     2,     2,     2,    85,    87,    62,
  207.     73,    63,     2,     2,     2,     2,     2,     2,     2,     2,
  208.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  209.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  210.     76,    79,    77,    71,     2,     2,     2,     2,     2,     2,
  211.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  212.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  213.      2,     2,    74,    80,    75,     2,     2,     2,     2,     2,
  214.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  215.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  216.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  217.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  218.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  219.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  220.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  221.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  222.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  223.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  224.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  225.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  226.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  227.      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
  228.     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  229.     26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
  230.     36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
  231.     46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
  232.     56,    58,    59,    60,    61,    64,    65,    72
  233. };
  234.  
  235. #if YYDEBUG != 0
  236. static const short yyprhs[] = {     0,
  237.      0,     8,    10,    11,    14,    16,    19,    24,    25,    28,
  238.     35,    37,    40,    43,    47,    51,    56,    60,    65,    71,
  239.     75,    77,    80,    83,    85,    87,    90,    93,    98,   102,
  240.    107,   113,   115,   118,   126,   128,   131,   135,   140,   142,
  241.    145,   147,   149,   151,   153,   155,   157,   159,   161,   163,
  242.    165,   167,   169,   171,   173,   175,   179,   181,   185,   188,
  243.    190,   193,   197,   200,   201,   205,   207,   210,   212,   217,
  244.    219,   223,   225,   227,   229,   231,   233,   236,   240,   244,
  245.    248,   252,   256,   260,   264,   268,   271,   275,   279,   283,
  246.    287,   291,   295,   299,   302,   305,   308,   311,   314,   317,
  247.    320,   323,   326,   329,   332,   335,   338,   341,   350,   353,
  248.    358,   362,   365,   369,   375,   376,   379,   383,   387,   391,
  249.    395,   399,   403,   407,   410,   414,   422,   426,   434,   442,
  250.    450,   454,   458,   462,   465,   470,   471,   475,   479,   481
  251. };
  252.  
  253. #endif
  254.  
  255. static const short yyrhs[] = {     6,
  256.      4,   124,    89,    93,   101,   119,     0,    90,     0,     0,
  257.      8,    91,     0,    92,     0,    91,    92,     0,     5,    73,
  258.    116,   124,     0,     0,    93,    94,     0,    27,     4,    74,
  259.     95,    75,   124,     0,    96,     0,    96,    99,     0,    95,
  260.     96,     0,    95,    96,    99,     0,    28,    98,    97,     0,
  261.     29,    97,    97,    97,     0,    30,    97,    97,     0,    31,
  262.     98,    97,    97,     0,    32,    98,    97,    98,    97,     0,
  263.     98,    98,    98,     0,     3,     0,    67,     3,     0,    66,
  264.      3,     0,     4,     0,   100,     0,    99,   100,     0,    33,
  265.     97,     0,    35,    98,    98,    98,     0,    34,    97,    98,
  266.      0,    36,    97,    97,    97,     0,    36,    97,    97,    97,
  267.     97,     0,   102,     0,   101,   102,     0,     7,     4,    74,
  268.     90,   103,    75,   124,     0,   104,     0,   103,   104,     0,
  269.    105,   110,   124,     0,   105,   109,   110,   124,     0,   106,
  270.      0,   106,   107,     0,    74,     0,    75,     0,    76,     0,
  271.     77,     0,    71,     0,    78,     0,    66,     0,    67,     0,
  272.     79,     0,    69,     0,    80,     0,    81,     0,    82,     0,
  273.     70,     0,     4,     0,    83,   108,   125,     0,     4,     0,
  274.    108,    84,     4,     0,    85,   116,     0,   111,     0,   110,
  275.    111,     0,    64,   112,   113,     0,    64,   112,     0,     0,
  276.     83,     3,    86,     0,   114,     0,   113,   114,     0,   106,
  277.      0,   106,    83,   115,   125,     0,   116,     0,   115,    84,
  278.    116,     0,     3,     0,    51,     0,    52,     0,    53,     0,
  279.      4,     0,    54,     4,     0,   116,    56,   116,     0,   116,
  280.     55,   116,     0,   116,    58,   116,     0,   116,    59,   116,
  281.      0,   116,    60,   116,     0,   116,    61,   116,     0,   116,
  282.     63,   116,     0,   116,    62,   116,     0,    57,   116,     0,
  283.    116,    66,   116,     0,   116,    67,   116,     0,   116,    68,
  284.    116,     0,   116,    69,   116,     0,   116,    70,   116,     0,
  285.    116,    65,   116,     0,   116,    71,   116,     0,    67,   116,
  286.      0,    37,   118,     0,    38,   118,     0,    39,   118,     0,
  287.     40,   118,     0,    41,   118,     0,    42,   118,     0,    43,
  288.    118,     0,    44,   118,     0,    45,   118,     0,    46,   118,
  289.      0,    47,   118,     0,    48,   117,     0,    49,   117,     0,
  290.     50,    83,   116,    84,   116,    84,   116,   125,     0,     4,
  291.    117,     0,     4,    83,   115,   125,     0,    83,   116,   125,
  292.      0,    83,   125,     0,    83,   116,   125,     0,     9,    74,
  293.    120,    75,   124,     0,     0,   120,   121,     0,    10,   122,
  294.    124,     0,    11,   113,   124,     0,    12,   116,   124,     0,
  295.     13,   116,   124,     0,    14,   116,   124,     0,    15,   116,
  296.    124,     0,    16,   116,   124,     0,    17,   124,     0,    17,
  297.    116,   124,     0,    19,   116,    84,   116,    84,   116,   124,
  298.      0,    20,   116,   124,     0,    21,   116,    84,   116,    84,
  299.    116,   124,     0,    22,   116,    84,   116,    84,   116,   124,
  300.      0,    23,   116,    84,   116,    84,   116,   124,     0,    24,
  301.    116,   124,     0,    25,     3,   124,     0,    26,     3,   124,
  302.      0,     4,   123,     0,   122,    84,     4,   123,     0,     0,
  303.     83,   116,   125,     0,    83,    18,   125,     0,    87,     0,
  304.     86,     0
  305. };
  306.  
  307. #if YYDEBUG != 0
  308. static const short yyrline[] = { 0,
  309.    162,   175,   179,   180,   183,   184,   187,   201,   202,   205,
  310.    213,   218,   226,   231,   241,   248,   257,   265,   273,   283,
  311.    289,   294,   300,   305,   318,   322,   330,   336,   341,   347,
  312.    354,   364,   369,   376,   392,   398,   406,   415,   426,   431,
  313.    438,   440,   442,   444,   446,   448,   450,   452,   454,   456,
  314.    458,   460,   462,   464,   466,   470,   474,   483,   494,   498,
  315.    503,   510,   514,   520,   521,   526,   531,   538,   543,   550,
  316.    555,   562,   565,   569,   572,   575,   595,   606,   608,   610,
  317.    612,   614,   616,   618,   620,   622,   625,   627,   629,   631,
  318.    633,   635,   637,   639,   642,   644,   646,   648,   650,   652,
  319.    654,   656,   658,   660,   662,   664,   666,   668,   670,   674,
  320.    678,   682,   685,   689,   692,   693,   696,   698,   700,   705,
  321.    709,   714,   721,   726,   743,   748,   754,   758,   765,   772,
  322.    778,   783,   788,   795,   806,   819,   821,   825,   829,   830
  323. };
  324.  
  325. static const char * const yytname[] = {   "$","error","$illegal.","tVALUE","tNAME",
  326. "tCONSTANT","tLSYSTEM","tTABLE","tCONST","tATTRIBUTES","tDERIVATION","tAXIOM",
  327. "tPITCH","tROLL","tTURN","tANGLE","tFORWARD","tRANDOMIZE","tINFINITY","tTROPISM",
  328. "tWEIGHT","tEYE","tLOOKAT","tUP","tFOV","tCONERES","tSPHERERES","tHULL","tSPHERE",
  329. "tTRIANGLE","tPLANE","tCYLINDER","tCONE","tTRANSLATE","tROTATE","tSCALE","tTRANSFORM",
  330. "tSIN","tCOS","tTAN","tASIN","tACOS","tATAN","tABS","tSQRT","tEXP","tLOG","tLOG10",
  331. "tRAND","tGAUSS","tIF","tTURTLEX","tTURTLEY","tTURTLEZ","tSCOPE","tAND","tOR",
  332. "'!'","tEQ","tNEQ","tGEQ","tLEQ","'<'","'>'","tARROW","tPOW","'+'","'-'","'*'",
  333. "'/'","'%'","'^'","tUMINUS","'='","'{'","'}'","'['","']'","'&'","'\\\\'","'|'",
  334. "'$'","'.'","'('","','","':'","')'","';'","lgrammar","global_const","constant_def",
  335. "constants","constant","hulls","hull","primitives","primitive","vector","number",
  336. "transforms","transformation","tables","table","productions","production","predecessor",
  337. "name","arguments","parameters","condition","successors","successor","probability",
  338. "modules","module","expr_list","expression","no_argument","one_argument","attributes",
  339. "attr_list","attr_item","derivations","steps","sc","rp",""
  340. };
  341. #endif
  342.  
  343. static const short yyr1[] = {     0,
  344.     88,    89,    90,    90,    91,    91,    92,    93,    93,    94,
  345.     95,    95,    95,    95,    96,    96,    96,    96,    96,    97,
  346.     98,    98,    98,    98,    99,    99,   100,   100,   100,   100,
  347.    100,   101,   101,   102,   103,   103,   104,   104,   105,   105,
  348.    106,   106,   106,   106,   106,   106,   106,   106,   106,   106,
  349.    106,   106,   106,   106,   106,   107,   108,   108,   109,   110,
  350.    110,   111,   111,   112,   112,   113,   113,   114,   114,   115,
  351.    115,   116,   116,   116,   116,   116,   116,   116,   116,   116,
  352.    116,   116,   116,   116,   116,   116,   116,   116,   116,   116,
  353.    116,   116,   116,   116,   116,   116,   116,   116,   116,   116,
  354.    116,   116,   116,   116,   116,   116,   116,   116,   116,   116,
  355.    116,   117,   118,   119,   120,   120,   121,   121,   121,   121,
  356.    121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
  357.    121,   121,   121,   122,   122,   123,   123,   123,   124,   125
  358. };
  359.  
  360. static const short yyr2[] = {     0,
  361.      7,     1,     0,     2,     1,     2,     4,     0,     2,     6,
  362.      1,     2,     2,     3,     3,     4,     3,     4,     5,     3,
  363.      1,     2,     2,     1,     1,     2,     2,     4,     3,     4,
  364.      5,     1,     2,     7,     1,     2,     3,     4,     1,     2,
  365.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  366.      1,     1,     1,     1,     1,     3,     1,     3,     2,     1,
  367.      2,     3,     2,     0,     3,     1,     2,     1,     4,     1,
  368.      3,     1,     1,     1,     1,     1,     2,     3,     3,     3,
  369.      3,     3,     3,     3,     3,     2,     3,     3,     3,     3,
  370.      3,     3,     3,     2,     2,     2,     2,     2,     2,     2,
  371.      2,     2,     2,     2,     2,     2,     2,     8,     2,     4,
  372.      3,     2,     3,     5,     0,     2,     3,     3,     3,     3,
  373.      3,     3,     3,     2,     3,     7,     3,     7,     7,     7,
  374.      3,     3,     3,     2,     4,     0,     3,     3,     1,     1
  375. };
  376.  
  377. static const short yydefact[] = {     0,
  378.      0,     0,   139,     3,     0,     8,     2,     0,     4,     5,
  379.      0,     0,     6,     0,     0,     9,     0,    32,    72,    76,
  380.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  381.      0,     0,     0,     0,    73,    74,    75,     0,     0,     0,
  382.      0,     0,     0,     0,     0,    33,     1,     0,   109,     0,
  383.     95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
  384.    105,     0,   106,   107,     0,    77,    86,    94,     0,     0,
  385.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  386.      0,     0,     0,     0,     7,     3,     0,   115,   140,     0,
  387.     70,   112,     0,     0,   111,    79,    78,    80,    81,    82,
  388.     83,    85,    84,    92,    87,    88,    89,    90,    91,    93,
  389.      0,     0,     0,     0,     0,     0,     0,    11,     0,     0,
  390.    110,   113,     0,    55,    47,    48,    50,    54,    45,    41,
  391.     42,    43,    44,    46,    49,    51,    52,    53,     0,    35,
  392.      0,    39,    21,    24,     0,     0,     0,     0,     0,     0,
  393.      0,     0,     0,    13,     0,     0,     0,     0,    12,    25,
  394.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  395.      0,     0,     0,     0,     0,     0,     0,   116,    71,     0,
  396.     42,    36,    64,     0,     0,     0,    60,     0,    40,    23,
  397.     22,    15,     0,     0,    17,     0,     0,    10,    14,    27,
  398.      0,     0,     0,    26,   136,     0,    68,     0,    66,     0,
  399.      0,     0,     0,     0,     0,   124,     0,     0,     0,     0,
  400.      0,     0,     0,     0,   114,     0,    34,     0,    63,    59,
  401.      0,    61,    37,    57,     0,    16,    20,    18,     0,    29,
  402.      0,     0,     0,   134,     0,   117,     0,    67,   118,   119,
  403.    120,   121,   122,   123,   125,     0,   127,     0,     0,     0,
  404.    131,   132,   133,     0,     0,    62,    38,     0,    56,    19,
  405.     28,    30,     0,     0,   136,     0,     0,     0,     0,     0,
  406.    108,    65,    58,    31,   138,   137,   135,    69,     0,     0,
  407.      0,     0,     0,     0,     0,     0,   126,   128,   129,   130,
  408.      0,     0,     0
  409. };
  410.  
  411. static const short yydefgoto[] = {   301,
  412.      6,     7,     9,    10,    11,    16,   117,   118,   148,   149,
  413.    159,   160,    17,    18,   139,   140,   141,   207,   189,   235,
  414.    185,   186,   187,   229,   208,   209,    90,    91,    49,    51,
  415.     47,   119,   178,   206,   244,     4,    92
  416. };
  417.  
  418. static const short yypact[] = {    10,
  419.     16,   -64,-32768,    29,    45,-32768,-32768,   -17,    45,-32768,
  420.     12,   402,-32768,    75,    84,-32768,    -3,-32768,-32768,    -7,
  421.     14,    14,    14,    14,    14,    14,    14,    14,    14,    14,
  422.     14,    22,    22,    23,-32768,-32768,-32768,    86,   402,   402,
  423.    402,   405,    21,    33,    41,-32768,-32768,   298,-32768,   402,
  424. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  425. -32768,    47,-32768,-32768,   402,-32768,   -57,   -57,   428,   402,
  426.    402,   402,   402,   402,   402,   402,   402,   402,   402,   402,
  427.    402,   402,   402,   402,-32768,    29,    72,-32768,-32768,   -29,
  428.    630,-32768,   428,   353,-32768,   661,   647,   675,   675,   172,
  429.    172,   172,   172,   -57,    13,    13,   -57,   -57,   -57,   -57,
  430.    146,     7,     7,     7,     7,     7,     2,    93,   295,   402,
  431. -32768,-32768,   402,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  432. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   194,-32768,
  433.    -49,    51,-32768,-32768,   133,   134,     7,     7,     7,     7,
  434.      7,     7,   -64,    93,     7,     7,     7,     7,    93,-32768,
  435.    135,   146,   402,   402,   402,   402,   402,   246,   402,   402,
  436.    402,   402,   402,   402,   138,   139,   -64,-32768,   630,   450,
  437.    -64,-32768,    62,   402,    79,   -61,-32768,   142,-32768,-32768,
  438. -32768,-32768,     7,     7,-32768,     7,     7,-32768,    93,-32768,
  439.      7,     7,     7,-32768,    64,   -66,    65,    43,-32768,   405,
  440.    405,   405,   405,   405,   405,-32768,   470,   405,   490,   510,
  441.    530,   405,   -64,   -64,-32768,   402,-32768,   160,   146,   630,
  442.    -61,-32768,-32768,-32768,     1,-32768,-32768,-32768,     7,-32768,
  443.      7,     7,   350,-32768,   162,-32768,   402,-32768,-32768,-32768,
  444. -32768,-32768,-32768,-32768,-32768,   402,-32768,   402,   402,   402,
  445. -32768,-32768,-32768,   428,    78,   146,-32768,   164,-32768,-32768,
  446. -32768,     7,    47,   428,    64,   -29,   550,   570,   590,   610,
  447. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   402,   402,
  448.    402,   402,   405,   405,   405,   405,-32768,-32768,-32768,-32768,
  449.    170,   179,-32768
  450. };
  451.  
  452. static const short yypgoto[] = {-32768,
  453. -32768,    94,-32768,   173,-32768,-32768,-32768,    66,  -107,  -103,
  454.     30,  -157,-32768,   171,-32768,    50,-32768,   -87,-32768,-32768,
  455. -32768,     5,  -151,-32768,   -38,  -191,   -55,   -12,    60,   349,
  456. -32768,-32768,-32768,-32768,   -82,   -37,   -68
  457. };
  458.  
  459.  
  460. #define    YYLAST        746
  461.  
  462.  
  463. static const short yytable[] = {    42,
  464.     95,   204,   183,    14,    85,    45,   150,    78,   147,   143,
  465.    144,   151,   152,    84,   183,     1,   248,   245,    14,     2,
  466.      3,   121,     3,   142,   122,     3,    67,    68,    69,   112,
  467.    113,   114,   115,   116,   232,   184,     5,    93,    15,   192,
  468.    193,   204,   195,   196,   197,   194,   124,   200,   201,     8,
  469.    203,   142,    94,   202,   120,    12,    89,    96,    97,    98,
  470.     99,   100,   101,   102,   103,   104,   105,   106,   107,   108,
  471.    109,   110,   145,   146,   248,    48,   153,    78,    43,   232,
  472.     81,    82,    83,    84,   268,   236,    89,    44,   238,    66,
  473.    237,    63,    64,   239,    86,   242,    50,   240,   241,   112,
  474.    113,   114,   115,   116,    62,    65,    87,   179,   125,   126,
  475.    180,   127,   128,   129,    88,   198,   130,   131,   132,   133,
  476.    134,   135,   136,   137,   138,   155,   156,   157,   158,     3,
  477.    216,   270,    89,   188,   272,   190,   191,   271,   205,   225,
  478.    223,   224,   183,   227,   228,   234,   243,   247,   233,   124,
  479.    210,   211,   212,   213,   214,   215,   217,   218,   219,   220,
  480.    221,   222,   265,   282,   284,   275,   269,   283,   246,   302,
  481.    249,   230,   250,   251,   252,   253,   254,   255,   303,   111,
  482.    257,    13,   154,   199,   261,   262,   263,    46,   182,   231,
  483.    266,   276,   287,   267,     0,   281,     0,   124,     0,     0,
  484.      0,     0,     0,     0,   285,   286,     0,   288,     0,     0,
  485.      0,   125,   126,   264,   127,   128,   129,     0,     0,   130,
  486.    131,   132,   133,   134,   135,   136,   137,   138,     0,     0,
  487.    274,-32768,-32768,-32768,-32768,     0,    78,    79,    80,    81,
  488.     82,    83,    84,   277,     0,   278,   279,   280,    19,    20,
  489.      0,     0,     0,     0,     0,   297,   298,   299,   300,   125,
  490.    126,     0,   127,   128,   129,     0,     0,   130,   181,   132,
  491.    133,   134,   135,   136,   137,   138,   293,   294,   295,   296,
  492.      0,     0,    21,    22,    23,    24,    25,    26,    27,    28,
  493.     29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
  494.     19,    20,    39,     0,   161,   162,   163,   164,   165,   166,
  495.    167,   168,    40,   169,   170,   171,   172,   173,   174,   175,
  496.    176,     0,     0,     0,     0,     0,     0,     0,    41,     0,
  497.      0,     0,     3,     0,    21,    22,    23,    24,    25,    26,
  498.     27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
  499.     37,    38,    19,    20,    39,     0,     0,     0,     0,     0,
  500.      0,     0,     0,     0,    40,     0,     0,   273,     0,   177,
  501.     52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
  502.     41,     0,     0,    89,     0,     0,    21,    22,    23,    24,
  503.     25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
  504.     35,    36,    37,    38,    19,    20,    39,    70,    71,     0,
  505.     72,    73,    74,    75,    76,    77,    40,    78,    79,    80,
  506.     81,    82,    83,    84,     0,     0,     0,     0,     0,     0,
  507.      0,     0,    41,     0,     0,     0,   123,     0,    21,    22,
  508.     23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
  509.     33,    34,    35,    36,    37,    38,     0,     0,    39,    70,
  510.     71,     0,    72,    73,    74,    75,    76,    77,    40,    78,
  511.     79,    80,    81,    82,    83,    84,     0,     0,     0,     0,
  512.      0,     0,    70,    71,    41,    72,    73,    74,    75,    76,
  513.     77,     3,    78,    79,    80,    81,    82,    83,    84,     0,
  514.      0,     0,     0,     0,    70,    71,     0,    72,    73,    74,
  515.     75,    76,    77,    89,    78,    79,    80,    81,    82,    83,
  516.     84,     0,     0,     0,    70,    71,     0,    72,    73,    74,
  517.     75,    76,    77,   226,    78,    79,    80,    81,    82,    83,
  518.     84,     0,     0,     0,    70,    71,     0,    72,    73,    74,
  519.     75,    76,    77,   256,    78,    79,    80,    81,    82,    83,
  520.     84,     0,     0,     0,    70,    71,     0,    72,    73,    74,
  521.     75,    76,    77,   258,    78,    79,    80,    81,    82,    83,
  522.     84,     0,     0,     0,    70,    71,     0,    72,    73,    74,
  523.     75,    76,    77,   259,    78,    79,    80,    81,    82,    83,
  524.     84,     0,     0,     0,    70,    71,     0,    72,    73,    74,
  525.     75,    76,    77,   260,    78,    79,    80,    81,    82,    83,
  526.     84,     0,     0,     0,    70,    71,     0,    72,    73,    74,
  527.     75,    76,    77,   289,    78,    79,    80,    81,    82,    83,
  528.     84,     0,     0,     0,    70,    71,     0,    72,    73,    74,
  529.     75,    76,    77,   290,    78,    79,    80,    81,    82,    83,
  530.     84,     0,     0,     0,    70,    71,     0,    72,    73,    74,
  531.     75,    76,    77,   291,    78,    79,    80,    81,    82,    83,
  532.     84,     0,     0,     0,    70,    71,     0,    72,    73,    74,
  533.     75,    76,    77,   292,    78,    79,    80,    81,    82,    83,
  534.     84,    70,     0,     0,    72,    73,    74,    75,    76,    77,
  535.      0,    78,    79,    80,    81,    82,    83,    84,    72,    73,
  536.     74,    75,    76,    77,     0,    78,    79,    80,    81,    82,
  537.     83,    84,-32768,-32768,    74,    75,    76,    77,     0,    78,
  538.     79,    80,    81,    82,    83,    84
  539. };
  540.  
  541. static const short yycheck[] = {    12,
  542.     69,   159,    64,     7,    42,     9,   114,    65,   112,     3,
  543.      4,   115,   116,    71,    64,     6,   208,    84,     7,     4,
  544.     87,    90,    87,   111,    93,    87,    39,    40,    41,    28,
  545.     29,    30,    31,    32,   186,    85,     8,    50,    27,   147,
  546.    148,   199,   150,   151,   152,   149,     4,   155,   156,     5,
  547.    158,   139,    65,   157,    84,    73,    86,    70,    71,    72,
  548.     73,    74,    75,    76,    77,    78,    79,    80,    81,    82,
  549.     83,    84,    66,    67,   266,    83,    75,    65,     4,   231,
  550.     68,    69,    70,    71,    84,   193,    86,     4,   196,     4,
  551.    194,    32,    33,   197,    74,   203,    83,   201,   202,    28,
  552.     29,    30,    31,    32,    83,    83,    74,   120,    66,    67,
  553.    123,    69,    70,    71,    74,   153,    74,    75,    76,    77,
  554.     78,    79,    80,    81,    82,    33,    34,    35,    36,    87,
  555.    168,   239,    86,    83,   242,     3,     3,   241,     4,   177,
  556.      3,     3,    64,   181,    83,     4,    83,    83,   186,     4,
  557.    163,   164,   165,   166,   167,   168,   169,   170,   171,   172,
  558.    173,   174,     3,    86,   272,     4,   235,     4,   206,     0,
  559.    208,   184,   210,   211,   212,   213,   214,   215,     0,    86,
  560.    218,     9,   117,   154,   222,   223,   224,    17,   139,   185,
  561.    229,   247,   275,   231,    -1,   264,    -1,     4,    -1,    -1,
  562.     -1,    -1,    -1,    -1,   273,   274,    -1,   276,    -1,    -1,
  563.     -1,    66,    67,   226,    69,    70,    71,    -1,    -1,    74,
  564.     75,    76,    77,    78,    79,    80,    81,    82,    -1,    -1,
  565.    243,    60,    61,    62,    63,    -1,    65,    66,    67,    68,
  566.     69,    70,    71,   256,    -1,   258,   259,   260,     3,     4,
  567.     -1,    -1,    -1,    -1,    -1,   293,   294,   295,   296,    66,
  568.     67,    -1,    69,    70,    71,    -1,    -1,    74,    75,    76,
  569.     77,    78,    79,    80,    81,    82,   289,   290,   291,   292,
  570.     -1,    -1,    37,    38,    39,    40,    41,    42,    43,    44,
  571.     45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
  572.      3,     4,    57,    -1,    10,    11,    12,    13,    14,    15,
  573.     16,    17,    67,    19,    20,    21,    22,    23,    24,    25,
  574.     26,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    83,    -1,
  575.     -1,    -1,    87,    -1,    37,    38,    39,    40,    41,    42,
  576.     43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
  577.     53,    54,     3,     4,    57,    -1,    -1,    -1,    -1,    -1,
  578.     -1,    -1,    -1,    -1,    67,    -1,    -1,    18,    -1,    75,
  579.     22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
  580.     83,    -1,    -1,    86,    -1,    -1,    37,    38,    39,    40,
  581.     41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
  582.     51,    52,    53,    54,     3,     4,    57,    55,    56,    -1,
  583.     58,    59,    60,    61,    62,    63,    67,    65,    66,    67,
  584.     68,    69,    70,    71,    -1,    -1,    -1,    -1,    -1,    -1,
  585.     -1,    -1,    83,    -1,    -1,    -1,    84,    -1,    37,    38,
  586.     39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
  587.     49,    50,    51,    52,    53,    54,    -1,    -1,    57,    55,
  588.     56,    -1,    58,    59,    60,    61,    62,    63,    67,    65,
  589.     66,    67,    68,    69,    70,    71,    -1,    -1,    -1,    -1,
  590.     -1,    -1,    55,    56,    83,    58,    59,    60,    61,    62,
  591.     63,    87,    65,    66,    67,    68,    69,    70,    71,    -1,
  592.     -1,    -1,    -1,    -1,    55,    56,    -1,    58,    59,    60,
  593.     61,    62,    63,    86,    65,    66,    67,    68,    69,    70,
  594.     71,    -1,    -1,    -1,    55,    56,    -1,    58,    59,    60,
  595.     61,    62,    63,    84,    65,    66,    67,    68,    69,    70,
  596.     71,    -1,    -1,    -1,    55,    56,    -1,    58,    59,    60,
  597.     61,    62,    63,    84,    65,    66,    67,    68,    69,    70,
  598.     71,    -1,    -1,    -1,    55,    56,    -1,    58,    59,    60,
  599.     61,    62,    63,    84,    65,    66,    67,    68,    69,    70,
  600.     71,    -1,    -1,    -1,    55,    56,    -1,    58,    59,    60,
  601.     61,    62,    63,    84,    65,    66,    67,    68,    69,    70,
  602.     71,    -1,    -1,    -1,    55,    56,    -1,    58,    59,    60,
  603.     61,    62,    63,    84,    65,    66,    67,    68,    69,    70,
  604.     71,    -1,    -1,    -1,    55,    56,    -1,    58,    59,    60,
  605.     61,    62,    63,    84,    65,    66,    67,    68,    69,    70,
  606.     71,    -1,    -1,    -1,    55,    56,    -1,    58,    59,    60,
  607.     61,    62,    63,    84,    65,    66,    67,    68,    69,    70,
  608.     71,    -1,    -1,    -1,    55,    56,    -1,    58,    59,    60,
  609.     61,    62,    63,    84,    65,    66,    67,    68,    69,    70,
  610.     71,    -1,    -1,    -1,    55,    56,    -1,    58,    59,    60,
  611.     61,    62,    63,    84,    65,    66,    67,    68,    69,    70,
  612.     71,    55,    -1,    -1,    58,    59,    60,    61,    62,    63,
  613.     -1,    65,    66,    67,    68,    69,    70,    71,    58,    59,
  614.     60,    61,    62,    63,    -1,    65,    66,    67,    68,    69,
  615.     70,    71,    58,    59,    60,    61,    62,    63,    -1,    65,
  616.     66,    67,    68,    69,    70,    71
  617. };
  618. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  619. #line 3 "/usr/local/lib/bison/bison.simple"
  620.  
  621. /* Skeleton output parser for bison,
  622.    Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
  623.  
  624.    This program is free software; you can redistribute it and/or modify
  625.    it under the terms of the GNU General Public License as published by
  626.    the Free Software Foundation; either version 1, or (at your option)
  627.    any later version.
  628.  
  629.    This program is distributed in the hope that it will be useful,
  630.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  631.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  632.    GNU General Public License for more details.
  633.  
  634.    You should have received a copy of the GNU General Public License
  635.    along with this program; if not, write to the Free Software
  636.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  637.  
  638.  
  639. #ifndef alloca
  640. #ifdef __GNUC__
  641. #define alloca __builtin_alloca
  642. #else /* not GNU C.  */
  643. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
  644. #include <alloca.h>
  645. #else /* not sparc */
  646. #if defined (MSDOS) && !defined (__TURBOC__)
  647. #include <malloc.h>
  648. #else /* not MSDOS, or __TURBOC__ */
  649. #if defined(_AIX)
  650. #include <malloc.h>
  651.  #pragma alloca
  652. #endif /* not _AIX */
  653. #endif /* not MSDOS, or __TURBOC__ */
  654. #endif /* not sparc.  */
  655. #endif /* not GNU C.  */
  656. #endif /* alloca not defined.  */
  657.  
  658. /* This is the parser code that is written into each bison parser
  659.   when the %semantic_parser declaration is not specified in the grammar.
  660.   It was written by Richard Stallman by simplifying the hairy parser
  661.   used when %semantic_parser is specified.  */
  662.  
  663. /* Note: there must be only one dollar sign in this file.
  664.    It is replaced by the list of actions, each action
  665.    as one case of the switch.  */
  666.  
  667. #define yyerrok        (yyerrstatus = 0)
  668. #define yyclearin    (yychar = YYEMPTY)
  669. #define YYEMPTY        -2
  670. #define YYEOF        0
  671. #define YYACCEPT    return(0)
  672. #define YYABORT     return(1)
  673. #define YYERROR        goto yyerrlab1
  674. /* Like YYERROR except do call yyerror.
  675.    This remains here temporarily to ease the
  676.    transition to the new meaning of YYERROR, for GCC.
  677.    Once GCC version 2 has supplanted version 1, this can go.  */
  678. #define YYFAIL        goto yyerrlab
  679. #define YYRECOVERING()  (!!yyerrstatus)
  680. #define YYBACKUP(token, value) \
  681. do                                \
  682.   if (yychar == YYEMPTY && yylen == 1)                \
  683.     { yychar = (token), yylval = (value);            \
  684.       yychar1 = YYTRANSLATE (yychar);                \
  685.       YYPOPSTACK;                        \
  686.       goto yybackup;                        \
  687.     }                                \
  688.   else                                \
  689.     { yyerror ("syntax error: cannot back up"); YYERROR; }    \
  690. while (0)
  691.  
  692. #define YYTERROR    1
  693. #define YYERRCODE    256
  694.  
  695. #ifndef YYPURE
  696. #define YYLEX        yylex()
  697. #endif
  698.  
  699. #ifdef YYPURE
  700. #ifdef YYLSP_NEEDED
  701. #define YYLEX        yylex(&yylval, &yylloc)
  702. #else
  703. #define YYLEX        yylex(&yylval)
  704. #endif
  705. #endif
  706.  
  707. /* If nonreentrant, generate the variables here */
  708.  
  709. #ifndef YYPURE
  710.  
  711. int    yychar;            /*  the lookahead symbol        */
  712. YYSTYPE    yylval;            /*  the semantic value of the        */
  713.                 /*  lookahead symbol            */
  714.  
  715. #ifdef YYLSP_NEEDED
  716. YYLTYPE yylloc;            /*  location data for the lookahead    */
  717.                 /*  symbol                */
  718. #endif
  719.  
  720. int yynerrs;            /*  number of parse errors so far       */
  721. #endif  /* not YYPURE */
  722.  
  723. #if YYDEBUG != 0
  724. int yydebug;            /*  nonzero means print parse trace    */
  725. /* Since this is uninitialized, it does not stop multiple parsers
  726.    from coexisting.  */
  727. #endif
  728.  
  729. /*  YYINITDEPTH indicates the initial size of the parser's stacks    */
  730.  
  731. #ifndef    YYINITDEPTH
  732. #define YYINITDEPTH 200
  733. #endif
  734.  
  735. /*  YYMAXDEPTH is the maximum size the stacks can grow to
  736.     (effective only if the built-in stack extension method is used).  */
  737.  
  738. #if YYMAXDEPTH == 0
  739. #undef YYMAXDEPTH
  740. #endif
  741.  
  742. #ifndef YYMAXDEPTH
  743. #define YYMAXDEPTH 10000
  744. #endif
  745.  
  746. #if __GNUC__ > 1        /* GNU C and GNU C++ define this.  */
  747. #define __yy_bcopy(FROM,TO,COUNT)    __builtin_memcpy(TO,FROM,COUNT)
  748. #else                /* not GNU C or C++ */
  749. #ifndef __cplusplus
  750.  
  751. /* This is the most reliable way to avoid incompatibilities
  752.    in available built-in functions on various systems.  */
  753. static void
  754. __yy_bcopy (from, to, count)
  755.      char *from;
  756.      char *to;
  757.      int count;
  758. {
  759.   register char *f = from;
  760.   register char *t = to;
  761.   register int i = count;
  762.  
  763.   while (i-- > 0)
  764.     *t++ = *f++;
  765. }
  766.  
  767. #else /* __cplusplus */
  768.  
  769. /* This is the most reliable way to avoid incompatibilities
  770.    in available built-in functions on various systems.  */
  771. static void
  772. __yy_bcopy (char *from, char *to, int count)
  773. {
  774.   register char *f = from;
  775.   register char *t = to;
  776.   register int i = count;
  777.  
  778.   while (i-- > 0)
  779.     *t++ = *f++;
  780. }
  781.  
  782. #endif
  783. #endif
  784.  
  785. #line 169 "/usr/local/lib/bison/bison.simple"
  786. int
  787. yyparse()
  788. {
  789.   register int yystate;
  790.   register int yyn;
  791.   register short *yyssp;
  792.   register YYSTYPE *yyvsp;
  793.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  794.   int yychar1;        /*  lookahead token as an internal (translated) token number */
  795.  
  796.   short    yyssa[YYINITDEPTH];    /*  the state stack            */
  797.   YYSTYPE yyvsa[YYINITDEPTH];    /*  the semantic value stack        */
  798.  
  799.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  800.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  801.  
  802. #ifdef YYLSP_NEEDED
  803.   YYLTYPE yylsa[YYINITDEPTH];    /*  the location stack            */
  804.   YYLTYPE *yyls = yylsa;
  805.   YYLTYPE *yylsp;
  806.  
  807. #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
  808. #else
  809. #define YYPOPSTACK   (yyvsp--, yyssp--)
  810. #endif
  811.  
  812.   int yystacksize = YYINITDEPTH;
  813.  
  814. #ifdef YYPURE
  815.   int yychar;
  816.   YYSTYPE yylval;
  817.   int yynerrs;
  818. #ifdef YYLSP_NEEDED
  819.   YYLTYPE yylloc;
  820. #endif
  821. #endif
  822.  
  823.   YYSTYPE yyval;        /*  the variable used to return        */
  824.                 /*  semantic values from the action    */
  825.                 /*  routines                */
  826.  
  827.   int yylen;
  828.  
  829. #if YYDEBUG != 0
  830.   if (yydebug)
  831.     fprintf(stderr, "Starting parse\n");
  832. #endif
  833.  
  834.   yystate = 0;
  835.   yyerrstatus = 0;
  836.   yynerrs = 0;
  837.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  838.  
  839.   /* Initialize stack pointers.
  840.      Waste one element of value and location stack
  841.      so that they stay on the same level as the state stack.  */
  842.  
  843.   yyssp = yyss - 1;
  844.   yyvsp = yyvs;
  845. #ifdef YYLSP_NEEDED
  846.   yylsp = yyls;
  847. #endif
  848.  
  849. /* Push a new state, which is found in  yystate  .  */
  850. /* In all cases, when you get here, the value and location stacks
  851.    have just been pushed. so pushing a state here evens the stacks.  */
  852. yynewstate:
  853.  
  854.   *++yyssp = yystate;
  855.  
  856.   if (yyssp >= yyss + yystacksize - 1)
  857.     {
  858.       /* Give user a chance to reallocate the stack */
  859.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  860.       YYSTYPE *yyvs1 = yyvs;
  861.       short *yyss1 = yyss;
  862. #ifdef YYLSP_NEEDED
  863.       YYLTYPE *yyls1 = yyls;
  864. #endif
  865.  
  866.       /* Get the current used size of the three stacks, in elements.  */
  867.       int size = yyssp - yyss + 1;
  868.  
  869. #ifdef yyoverflow
  870.       /* Each stack pointer address is followed by the size of
  871.      the data in use in that stack, in bytes.  */
  872.       yyoverflow("parser stack overflow",
  873.          &yyss1, size * sizeof (*yyssp),
  874.          &yyvs1, size * sizeof (*yyvsp),
  875. #ifdef YYLSP_NEEDED
  876.          &yyls1, size * sizeof (*yylsp),
  877. #endif
  878.          &yystacksize);
  879.  
  880.       yyss = yyss1; yyvs = yyvs1;
  881. #ifdef YYLSP_NEEDED
  882.       yyls = yyls1;
  883. #endif
  884. #else /* no yyoverflow */
  885.       /* Extend the stack our own way.  */
  886.       if (yystacksize >= YYMAXDEPTH)
  887.     {
  888.       yyerror("parser stack overflow");
  889.       return 2;
  890.     }
  891.       yystacksize *= 2;
  892.       if (yystacksize > YYMAXDEPTH)
  893.     yystacksize = YYMAXDEPTH;
  894.       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
  895.       __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  896.       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
  897.       __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  898. #ifdef YYLSP_NEEDED
  899.       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
  900.       __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  901. #endif
  902. #endif /* no yyoverflow */
  903.  
  904.       yyssp = yyss + size - 1;
  905.       yyvsp = yyvs + size - 1;
  906. #ifdef YYLSP_NEEDED
  907.       yylsp = yyls + size - 1;
  908. #endif
  909.  
  910. #if YYDEBUG != 0
  911.       if (yydebug)
  912.     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
  913. #endif
  914.  
  915.       if (yyssp >= yyss + yystacksize - 1)
  916.     YYABORT;
  917.     }
  918.  
  919. #if YYDEBUG != 0
  920.   if (yydebug)
  921.     fprintf(stderr, "Entering state %d\n", yystate);
  922. #endif
  923.  
  924.  yybackup:
  925.  
  926. /* Do appropriate processing given the current state.  */
  927. /* Read a lookahead token if we need one and don't already have one.  */
  928. /* yyresume: */
  929.  
  930.   /* First try to decide what to do without reference to lookahead token.  */
  931.  
  932.   yyn = yypact[yystate];
  933.   if (yyn == YYFLAG)
  934.     goto yydefault;
  935.  
  936.   /* Not known => get a lookahead token if don't already have one.  */
  937.  
  938.   /* yychar is either YYEMPTY or YYEOF
  939.      or a valid token in external form.  */
  940.  
  941.   if (yychar == YYEMPTY)
  942.     {
  943. #if YYDEBUG != 0
  944.       if (yydebug)
  945.     fprintf(stderr, "Reading a token: ");
  946. #endif
  947.       yychar = YYLEX;
  948.     }
  949.  
  950.   /* Convert token to internal form (in yychar1) for indexing tables with */
  951.  
  952.   if (yychar <= 0)        /* This means end of input. */
  953.     {
  954.       yychar1 = 0;
  955.       yychar = YYEOF;        /* Don't call YYLEX any more */
  956.  
  957. #if YYDEBUG != 0
  958.       if (yydebug)
  959.     fprintf(stderr, "Now at end of input.\n");
  960. #endif
  961.     }
  962.   else
  963.     {
  964.       yychar1 = YYTRANSLATE(yychar);
  965.  
  966. #if YYDEBUG != 0
  967.       if (yydebug)
  968.     {
  969.       fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
  970.       /* Give the individual parser a way to print the precise meaning
  971.          of a token, for further debugging info.  */
  972. #ifdef YYPRINT
  973.       YYPRINT (stderr, yychar, yylval);
  974. #endif
  975.       fprintf (stderr, ")\n");
  976.     }
  977. #endif
  978.     }
  979.  
  980.   yyn += yychar1;
  981.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  982.     goto yydefault;
  983.  
  984.   yyn = yytable[yyn];
  985.  
  986.   /* yyn is what to do for this token type in this state.
  987.      Negative => reduce, -yyn is rule number.
  988.      Positive => shift, yyn is new state.
  989.        New state is final state => don't bother to shift,
  990.        just return success.
  991.      0, or most negative number => error.  */
  992.  
  993.   if (yyn < 0)
  994.     {
  995.       if (yyn == YYFLAG)
  996.     goto yyerrlab;
  997.       yyn = -yyn;
  998.       goto yyreduce;
  999.     }
  1000.   else if (yyn == 0)
  1001.     goto yyerrlab;
  1002.  
  1003.   if (yyn == YYFINAL)
  1004.     YYACCEPT;
  1005.  
  1006.   /* Shift the lookahead token.  */
  1007.  
  1008. #if YYDEBUG != 0
  1009.   if (yydebug)
  1010.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  1011. #endif
  1012.  
  1013.   /* Discard the token being shifted unless it is eof.  */
  1014.   if (yychar != YYEOF)
  1015.     yychar = YYEMPTY;
  1016.  
  1017.   *++yyvsp = yylval;
  1018. #ifdef YYLSP_NEEDED
  1019.   *++yylsp = yylloc;
  1020. #endif
  1021.  
  1022.   /* count tokens shifted since error; after three, turn off error status.  */
  1023.   if (yyerrstatus) yyerrstatus--;
  1024.  
  1025.   yystate = yyn;
  1026.   goto yynewstate;
  1027.  
  1028. /* Do the default action for the current state.  */
  1029. yydefault:
  1030.  
  1031.   yyn = yydefact[yystate];
  1032.   if (yyn == 0)
  1033.     goto yyerrlab;
  1034.  
  1035. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  1036. yyreduce:
  1037.   yylen = yyr2[yyn];
  1038.   yyval = yyvsp[1-yylen]; /* implement default value of the action */
  1039.  
  1040. #if YYDEBUG != 0
  1041.   if (yydebug)
  1042.     {
  1043.       int i;
  1044.  
  1045.       fprintf (stderr, "Reducing via rule %d (line %d), ",
  1046.            yyn, yyrline[yyn]);
  1047.  
  1048.       /* Print the symboles being reduced, and their result.  */
  1049.       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
  1050.     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
  1051.       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  1052.     }
  1053. #endif
  1054.  
  1055.  
  1056.   switch (yyn) {
  1057.  
  1058. case 1:
  1059. #line 164 "yacc.y"
  1060. {
  1061.            if (!axiom)
  1062.              yyerror("no axiom defined");
  1063.            if (!derivation)
  1064.              yyerror("no derivation list defined");
  1065.  
  1066.            lsystem = new LSystem(Name(yyvsp[-5].name), yyvsp[-1].table_list, axiom, derivation);
  1067.            theOptions.hulls = theHulls;
  1068.            delete yyvsp[-5].name;
  1069.          ;
  1070.     break;}
  1071. case 2:
  1072. #line 176 "yacc.y"
  1073. { definingLocalConst = 1; ;
  1074.     break;}
  1075. case 7:
  1076. #line 188 "yacc.y"
  1077.            if (definingLocalConst) {
  1078.              if (!LocalConst->insert(*yyvsp[-3].name, yyvsp[-1].expr->simplify()))
  1079.                yyerror("Constant " + *yyvsp[-3].name + " already defined");
  1080.            }
  1081.            else {
  1082.              if (!GlobalConst.insert(*yyvsp[-3].name, yyvsp[-1].expr->simplify()))
  1083.                yyerror("Constant " + *yyvsp[-3].name + " already defined");
  1084.            }
  1085.            delete yyvsp[-3].name;
  1086.          ;
  1087.     break;}
  1088. case 10:
  1089. #line 206 "yacc.y"
  1090. {
  1091.            if (!theHulls->insert(*yyvsp[-4].name, yyvsp[-2].hull))
  1092.              yyerror("hull " + *yyvsp[-4].name + " already defined");
  1093.            delete yyvsp[-4].name;
  1094.          ;
  1095.     break;}
  1096. case 11:
  1097. #line 214 "yacc.y"
  1098. {
  1099.            yyval.hull = new Hull;
  1100.            yyval.hull->addPrimitive(yyvsp[0].geoObject);
  1101.          ;
  1102.     break;}
  1103. case 12:
  1104. #line 219 "yacc.y"
  1105. {
  1106.            if (!yyvsp[-1].geoObject->setTransform(yyvsp[0].trans)) 
  1107.              yyerror("singular matrix");
  1108.  
  1109.            yyval.hull = new Hull;
  1110.            yyval.hull->addPrimitive(yyvsp[-1].geoObject);
  1111.          ;
  1112.     break;}
  1113. case 13:
  1114. #line 227 "yacc.y"
  1115.            yyval.hull = yyvsp[-1].hull;
  1116.            yyval.hull->addPrimitive(yyvsp[0].geoObject);
  1117.          ;
  1118.     break;}
  1119. case 14:
  1120. #line 232 "yacc.y"
  1121.            if (!yyvsp[-1].geoObject->setTransform(yyvsp[0].trans)) 
  1122.              yyerror("singular matrix");
  1123.  
  1124.            yyval.hull = yyvsp[-2].hull;
  1125.            yyval.hull->addPrimitive(yyvsp[-1].geoObject);
  1126.          ;
  1127.     break;}
  1128. case 15:
  1129. #line 242 "yacc.y"
  1130. {
  1131.            if ((yyval.geoObject = Sphere::create(yyvsp[-1].realnumber, *yyvsp[0].vector)) == NULL)
  1132.              yyerror("degenerate sphere");
  1133.  
  1134.            delete yyvsp[0].vector;
  1135.                  ;
  1136.     break;}
  1137. case 16:
  1138. #line 249 "yacc.y"
  1139. {
  1140.            if ((yyval.geoObject = Triangle::create(*yyvsp[-2].vector, *yyvsp[-1].vector, *yyvsp[0].vector)) == NULL)
  1141.              yyerror("degenerate triangle");
  1142.  
  1143.            delete yyvsp[-2].vector; 
  1144.            delete yyvsp[-1].vector; 
  1145.            delete yyvsp[0].vector;
  1146.                  ;
  1147.     break;}
  1148. case 17:
  1149. #line 258 "yacc.y"
  1150. {
  1151.            if ((yyval.geoObject = Plane::create(*yyvsp[-1].vector, *yyvsp[0].vector)) == NULL)
  1152.              yyerror("degenerate plane normal");
  1153.  
  1154.            delete yyvsp[-1].vector; 
  1155.            delete yyvsp[0].vector;
  1156.                  ;
  1157.     break;}
  1158. case 18:
  1159. #line 266 "yacc.y"
  1160. {
  1161.            if ((yyval.geoObject = Cylinder::create(yyvsp[-2].realnumber, *yyvsp[-1].vector, *yyvsp[0].vector)) == NULL)
  1162.              yyerror("degenerate cylinder");
  1163.  
  1164.            delete yyvsp[-1].vector; 
  1165.            delete yyvsp[0].vector;
  1166.                  ;
  1167.     break;}
  1168. case 19:
  1169. #line 274 "yacc.y"
  1170. {
  1171.            if ((yyval.geoObject = Cone::create(yyvsp[-3].realnumber, *yyvsp[-2].vector, yyvsp[-1].realnumber, *yyvsp[0].vector)) == NULL)
  1172.              yyerror("degenerate cone");
  1173.  
  1174.            delete yyvsp[-2].vector; 
  1175.            delete yyvsp[0].vector;
  1176.                  ;
  1177.     break;}
  1178. case 20:
  1179. #line 284 "yacc.y"
  1180.            yyval.vector = new Vector(yyvsp[-2].realnumber, yyvsp[-1].realnumber, yyvsp[0].realnumber);
  1181.          ;
  1182.     break;}
  1183. case 21:
  1184. #line 290 "yacc.y"
  1185.            yyval.realnumber = *yyvsp[0].value; 
  1186.            delete yyvsp[0].value;
  1187.          ;
  1188.     break;}
  1189. case 22:
  1190. #line 295 "yacc.y"
  1191. {
  1192.            yyval.realnumber = *yyvsp[0].value;
  1193.            yyval.realnumber = -yyval.realnumber;
  1194.            delete yyvsp[0].value;
  1195.          ;
  1196.     break;}
  1197. case 23:
  1198. #line 301 "yacc.y"
  1199.            yyval.realnumber = *yyvsp[0].value; 
  1200.            delete yyvsp[0].value;
  1201.          ;
  1202.     break;}
  1203. case 24:
  1204. #line 306 "yacc.y"
  1205. {
  1206.            Expression *expr;
  1207.  
  1208.            if (!GlobalConst.lookup(*yyvsp[0].name, expr))
  1209.              yyerror(*yyvsp[0].name + " unknown");
  1210.            else
  1211.                      yyval.realnumber = expr->evaluate();
  1212.  
  1213.            delete yyvsp[0].name;
  1214.          ;
  1215.     break;}
  1216. case 25:
  1217. #line 319 "yacc.y"
  1218.            yyval.trans = yyvsp[0].trans;
  1219.              ;
  1220.     break;}
  1221. case 26:
  1222. #line 323 "yacc.y"
  1223. {
  1224.            (*yyvsp[-1].trans) *= (*yyvsp[0].trans);
  1225.            yyval.trans = yyvsp[-1].trans;
  1226.            delete yyvsp[0].trans;
  1227.          ;
  1228.     break;}
  1229. case 27:
  1230. #line 331 "yacc.y"
  1231. {
  1232.            yyval.trans = new TransMatrix;
  1233.            yyval.trans->translate(*yyvsp[0].vector);
  1234.            delete yyvsp[0].vector;
  1235.          ;
  1236.     break;}
  1237. case 28:
  1238. #line 337 "yacc.y"
  1239. {
  1240.            yyval.trans = new TransMatrix;
  1241.            yyval.trans->scale(yyvsp[-2].realnumber, yyvsp[-1].realnumber, yyvsp[0].realnumber);
  1242.          ;
  1243.     break;}
  1244. case 29:
  1245. #line 342 "yacc.y"
  1246. {
  1247.            yyval.trans = new TransMatrix;
  1248.            yyval.trans->rotate(*yyvsp[-1].vector, dtor(yyvsp[0].realnumber));
  1249.            delete yyvsp[-1].vector;
  1250.          ;
  1251.     break;}
  1252. case 30:
  1253. #line 348 "yacc.y"
  1254. {
  1255.            yyval.trans = new TransMatrix(*yyvsp[-2].vector, *yyvsp[-1].vector, *yyvsp[0].vector);
  1256.            delete yyvsp[-2].vector;
  1257.            delete yyvsp[-1].vector;
  1258.            delete yyvsp[0].vector;
  1259.          ;
  1260.     break;}
  1261. case 31:
  1262. #line 355 "yacc.y"
  1263. {
  1264.            yyval.trans = new TransMatrix(*yyvsp[-3].vector, *yyvsp[-2].vector, *yyvsp[-1].vector, *yyvsp[0].vector);
  1265.            delete yyvsp[-3].vector;
  1266.            delete yyvsp[-2].vector;
  1267.            delete yyvsp[-1].vector;
  1268.            delete yyvsp[0].vector;
  1269.          ;
  1270.     break;}
  1271. case 32:
  1272. #line 365 "yacc.y"
  1273.            yyval.table_list = new TableList(1);
  1274.            yyval.table_list->append(yyvsp[0].table);
  1275.          ;
  1276.     break;}
  1277. case 33:
  1278. #line 370 "yacc.y"
  1279.            yyval.table_list = yyvsp[-1].table_list;
  1280.            yyval.table_list->append(yyvsp[0].table);
  1281.          ;
  1282.     break;}
  1283. case 34:
  1284. #line 377 "yacc.y"
  1285. {
  1286.            Table *table = new Table(Name(yyvsp[-5].name), yyvsp[-2].prod_list);
  1287.            if (!theTables.insert(*yyvsp[-5].name, table))
  1288.              yyerror("Table " + *yyvsp[-5].name + " already defined");
  1289.            else {
  1290.              // delete current local constants
  1291.              delete LocalConst;
  1292.              LocalConst = new ExprSymtab(503);
  1293.  
  1294.              yyval.table = table;
  1295.            }
  1296.            delete yyvsp[-5].name;
  1297.          ;
  1298.     break;}
  1299. case 35:
  1300. #line 393 "yacc.y"
  1301.            nthParam = 0; 
  1302.            yyval.prod_list = new ProductionList;
  1303.            yyval.prod_list->append(yyvsp[0].production);
  1304.          ;
  1305.     break;}
  1306. case 36:
  1307. #line 399 "yacc.y"
  1308.            nthParam = 0; 
  1309.            yyval.prod_list = yyvsp[-1].prod_list;
  1310.            yyval.prod_list->append(yyvsp[0].production);
  1311.          ;
  1312.     break;}
  1313. case 37:
  1314. #line 407 "yacc.y"
  1315.            yyval.production = new Production(yyvsp[-2].predecessor, NULL, yyvsp[-1].succ_list);
  1316.            if (yyval.production->cumulateProbability())
  1317.              yyerror("Sum of production probabilities is > 1");
  1318.  
  1319.                    delete FormalParam;
  1320.            FormalParam = new IntSymtab(17);
  1321.          ;
  1322.     break;}
  1323. case 38:
  1324. #line 416 "yacc.y"
  1325. {
  1326.            yyval.production = new Production(yyvsp[-3].predecessor, yyvsp[-2].expr, yyvsp[-1].succ_list);
  1327.            if (yyval.production->cumulateProbability())
  1328.              yyerror("Sum of production probabilities is > 1");
  1329.  
  1330.                    delete FormalParam;
  1331.            FormalParam = new IntSymtab(17);
  1332.          ;
  1333.     break;}
  1334. case 39:
  1335. #line 427 "yacc.y"
  1336.            yyval.predecessor = new Predecessor(Name(yyvsp[0].name), NULL); 
  1337.            delete yyvsp[0].name;
  1338.          ;
  1339.     break;}
  1340. case 40:
  1341. #line 432 "yacc.y"
  1342.            yyval.predecessor = new Predecessor(Name(yyvsp[-1].name), yyvsp[0].name_list); 
  1343.            delete yyvsp[-1].name;
  1344.          ;
  1345.     break;}
  1346. case 41:
  1347. #line 439 "yacc.y"
  1348. { yyval.name = new rcString("{"); ;
  1349.     break;}
  1350. case 42:
  1351. #line 441 "yacc.y"
  1352. { yyval.name = new rcString("}"); ;
  1353.     break;}
  1354. case 43:
  1355. #line 443 "yacc.y"
  1356. { yyval.name = new rcString("["); ;
  1357.     break;}
  1358. case 44:
  1359. #line 445 "yacc.y"
  1360. { yyval.name = new rcString("]"); ;
  1361.     break;}
  1362. case 45:
  1363. #line 447 "yacc.y"
  1364. { yyval.name = new rcString("^"); ;
  1365.     break;}
  1366. case 46:
  1367. #line 449 "yacc.y"
  1368. { yyval.name = new rcString("&"); ;
  1369.     break;}
  1370. case 47:
  1371. #line 451 "yacc.y"
  1372. { yyval.name = new rcString("+"); ;
  1373.     break;}
  1374. case 48:
  1375. #line 453 "yacc.y"
  1376. { yyval.name = new rcString("-"); ;
  1377.     break;}
  1378. case 49:
  1379. #line 455 "yacc.y"
  1380. { yyval.name = new rcString("\\"); ;
  1381.     break;}
  1382. case 50:
  1383. #line 457 "yacc.y"
  1384. { yyval.name = new rcString("/"); ;
  1385.     break;}
  1386. case 51:
  1387. #line 459 "yacc.y"
  1388. { yyval.name = new rcString("|"); ;
  1389.     break;}
  1390. case 52:
  1391. #line 461 "yacc.y"
  1392. { yyval.name = new rcString("$"); ;
  1393.     break;}
  1394. case 53:
  1395. #line 463 "yacc.y"
  1396. { yyval.name = new rcString("."); ;
  1397.     break;}
  1398. case 54:
  1399. #line 465 "yacc.y"
  1400. { yyval.name = new rcString("~"); ;
  1401.     break;}
  1402. case 55:
  1403. #line 467 "yacc.y"
  1404. { yyval.name = yyvsp[0].name; ;
  1405.     break;}
  1406. case 56:
  1407. #line 471 "yacc.y"
  1408. { yyval.name_list = yyvsp[-1].name_list; ;
  1409.     break;}
  1410. case 57:
  1411. #line 475 "yacc.y"
  1412.            yyval.name_list = new NameList(1);
  1413.            yyval.name_list->append(new Name(yyvsp[0].name));
  1414.            if (!FormalParam->insert(*yyvsp[0].name, nthParam++))
  1415.              yyerror("Parameter " + *yyvsp[0].name + " already used");
  1416.  
  1417.            delete yyvsp[0].name;
  1418.          ;
  1419.     break;}
  1420. case 58:
  1421. #line 484 "yacc.y"
  1422.            yyval.name_list = yyvsp[-2].name_list;
  1423.            yyval.name_list->append(new Name(yyvsp[0].name));
  1424.            if (!FormalParam->insert(*yyvsp[0].name, nthParam++))
  1425.              yyerror("Parameter " + *yyvsp[0].name + " already used");
  1426.  
  1427.            delete yyvsp[0].name;
  1428.          ;
  1429.     break;}
  1430. case 59:
  1431. #line 495 "yacc.y"
  1432. { yyval.expr = yyvsp[0].expr->simplify(); ;
  1433.     break;}
  1434. case 60:
  1435. #line 499 "yacc.y"
  1436. {
  1437.            yyval.succ_list = new SuccessorList(1);
  1438.            yyval.succ_list->append(yyvsp[0].successor);
  1439.          ;
  1440.     break;}
  1441. case 61:
  1442. #line 504 "yacc.y"
  1443.            yyval.succ_list = yyvsp[-1].succ_list;
  1444.            yyval.succ_list->append(yyvsp[0].successor);
  1445.          ;
  1446.     break;}
  1447. case 62:
  1448. #line 511 "yacc.y"
  1449. {
  1450.            yyval.successor = new Successor(yyvsp[-1].realnumber, yyvsp[0].module_list);
  1451.          ;
  1452.     break;}
  1453. case 63:
  1454. #line 515 "yacc.y"
  1455. {
  1456.            yyval.successor = new Successor(yyvsp[0].realnumber, NULL);
  1457.          ;
  1458.     break;}
  1459. case 64:
  1460. #line 520 "yacc.y"
  1461. { yyval.realnumber = 1.0; ;
  1462.     break;}
  1463. case 65:
  1464. #line 521 "yacc.y"
  1465. { yyval.realnumber = *yyvsp[-1].value;
  1466.                   delete yyvsp[-1].value;
  1467.                 ;
  1468.     break;}
  1469. case 66:
  1470. #line 527 "yacc.y"
  1471. {
  1472.            yyval.module_list = new ProdModuleList(1);
  1473.            yyval.module_list->append(yyvsp[0].module);
  1474.          ;
  1475.     break;}
  1476. case 67:
  1477. #line 532 "yacc.y"
  1478. {
  1479.            yyval.module_list = yyvsp[-1].module_list;
  1480.            yyval.module_list->append(yyvsp[0].module);
  1481.          ;
  1482.     break;}
  1483. case 68:
  1484. #line 539 "yacc.y"
  1485. {
  1486.            yyval.module = new ProdModule(Name(yyvsp[0].name), NULL);
  1487.            delete yyvsp[0].name;
  1488.          ;
  1489.     break;}
  1490. case 69:
  1491. #line 544 "yacc.y"
  1492. {
  1493.            yyval.module = new ProdModule(Name(yyvsp[-3].name), yyvsp[-1].expr_list);
  1494.            delete yyvsp[-3].name;
  1495.          ;
  1496.     break;}
  1497. case 70:
  1498. #line 551 "yacc.y"
  1499. {
  1500.            yyval.expr_list = new ExpressionList(1);
  1501.            yyval.expr_list->append(yyvsp[0].expr->simplify());
  1502.          ;
  1503.     break;}
  1504. case 71:
  1505. #line 556 "yacc.y"
  1506. {
  1507.            yyvsp[-2].expr_list->append(yyvsp[0].expr->simplify());
  1508.            yyval.expr_list = yyvsp[-2].expr_list;
  1509.          ;
  1510.     break;}
  1511. case 72:
  1512. #line 562 "yacc.y"
  1513. { yyval.expr = new Expression(new ValueItem(yyvsp[0].value));
  1514.               delete yyvsp[0].value;
  1515.             ;
  1516.     break;}
  1517. case 73:
  1518. #line 566 "yacc.y"
  1519. { yyval.expr = new Expression(new Variable(Name("tx"),
  1520.                           Interpreter::getTx())); 
  1521.          ;
  1522.     break;}
  1523. case 74:
  1524. #line 570 "yacc.y"
  1525. { yyval.expr = new Expression(new Variable(Name("ty"), 
  1526.                           Interpreter::getTy())); ;
  1527.     break;}
  1528. case 75:
  1529. #line 573 "yacc.y"
  1530. { yyval.expr = new Expression(new Variable(Name("tz"), 
  1531.                           Interpreter::getTz())); ;
  1532.     break;}
  1533. case 76:
  1534. #line 576 "yacc.y"
  1535. { Expression *expr;
  1536.            int nth;
  1537.            
  1538.            // a formal parameter, local or global constant ?
  1539.            if (!FormalParam->lookup(*yyvsp[0].name, nth)) {
  1540.              if (!LocalConst->lookup(*yyvsp[0].name, expr)) {
  1541.                if (!GlobalConst.lookup(*yyvsp[0].name, expr))
  1542.              yyerror("`" + *yyvsp[0].name + "' unknown");
  1543.                else
  1544.              yyval.expr = new Expression(*expr);
  1545.              }
  1546.              else
  1547.                yyval.expr = new Expression(*expr);
  1548.            }
  1549.            else
  1550.              yyval.expr = new Expression(new Variable(Name(yyvsp[0].name), 
  1551.                               Formals(nth)));
  1552.            delete yyvsp[0].name;
  1553.          ;
  1554.     break;}
  1555. case 77:
  1556. #line 596 "yacc.y"
  1557. {
  1558.            Expression *expr;
  1559.  
  1560.            if (!GlobalConst.lookup(*yyvsp[0].name, expr))
  1561.              yyerror("::" + *yyvsp[0].name + " unknown");
  1562.            else
  1563.              yyval.expr = new Expression(*expr);
  1564.  
  1565.            delete yyvsp[0].name;
  1566.          ;
  1567.     break;}
  1568. case 78:
  1569. #line 607 "yacc.y"
  1570. { yyval.expr = new Expression(new Or,  yyvsp[-2].expr, yyvsp[0].expr); ;
  1571.     break;}
  1572. case 79:
  1573. #line 609 "yacc.y"
  1574. { yyval.expr = new Expression(new And, yyvsp[-2].expr, yyvsp[0].expr); ;
  1575.     break;}
  1576. case 80:
  1577. #line 611 "yacc.y"
  1578. { yyval.expr = new Expression(new Eq,  yyvsp[-2].expr, yyvsp[0].expr); ;
  1579.     break;}
  1580. case 81:
  1581. #line 613 "yacc.y"
  1582. { yyval.expr = new Expression(new Neq, yyvsp[-2].expr, yyvsp[0].expr); ;
  1583.     break;}
  1584. case 82:
  1585. #line 615 "yacc.y"
  1586. { yyval.expr = new Expression(new Geq, yyvsp[-2].expr, yyvsp[0].expr); ;
  1587.     break;}
  1588. case 83:
  1589. #line 617 "yacc.y"
  1590. { yyval.expr = new Expression(new Leq, yyvsp[-2].expr, yyvsp[0].expr); ;
  1591.     break;}
  1592. case 84:
  1593. #line 619 "yacc.y"
  1594. { yyval.expr = new Expression(new Gt,  yyvsp[-2].expr, yyvsp[0].expr); ;
  1595.     break;}
  1596. case 85:
  1597. #line 621 "yacc.y"
  1598. { yyval.expr = new Expression(new Lt,  yyvsp[-2].expr, yyvsp[0].expr); ;
  1599.     break;}
  1600. case 86:
  1601. #line 623 "yacc.y"
  1602. { yyval.expr = new Expression(new Not,  yyvsp[0].expr); ;
  1603.     break;}
  1604. case 87:
  1605. #line 626 "yacc.y"
  1606. { yyval.expr = new Expression(new Add, yyvsp[-2].expr, yyvsp[0].expr); ;
  1607.     break;}
  1608. case 88:
  1609. #line 628 "yacc.y"
  1610. { yyval.expr = new Expression(new Sub, yyvsp[-2].expr, yyvsp[0].expr); ;
  1611.     break;}
  1612. case 89:
  1613. #line 630 "yacc.y"
  1614. { yyval.expr = new Expression(new Mul, yyvsp[-2].expr, yyvsp[0].expr); ;
  1615.     break;}
  1616. case 90:
  1617. #line 632 "yacc.y"
  1618. { yyval.expr = new Expression(new Div, yyvsp[-2].expr, yyvsp[0].expr); ;
  1619.     break;}
  1620. case 91:
  1621. #line 634 "yacc.y"
  1622. { yyval.expr = new Expression(new Mod, yyvsp[-2].expr, yyvsp[0].expr); ;
  1623.     break;}
  1624. case 92:
  1625. #line 636 "yacc.y"
  1626. { yyval.expr = new Expression(new Pow, yyvsp[-2].expr, yyvsp[0].expr); ;
  1627.     break;}
  1628. case 93:
  1629. #line 638 "yacc.y"
  1630. { yyval.expr = new Expression(new Pow, yyvsp[-2].expr, yyvsp[0].expr); ;
  1631.     break;}
  1632. case 94:
  1633. #line 640 "yacc.y"
  1634. { yyval.expr = new Expression(new Uminus,  yyvsp[0].expr); ;
  1635.     break;}
  1636. case 95:
  1637. #line 643 "yacc.y"
  1638. { yyval.expr = new Expression(new Sin, yyvsp[0].expr); ;
  1639.     break;}
  1640. case 96:
  1641. #line 645 "yacc.y"
  1642. { yyval.expr = new Expression(new Cos, yyvsp[0].expr); ;
  1643.     break;}
  1644. case 97:
  1645. #line 647 "yacc.y"
  1646. { yyval.expr = new Expression(new Tan, yyvsp[0].expr); ;
  1647.     break;}
  1648. case 98:
  1649. #line 649 "yacc.y"
  1650. { yyval.expr = new Expression(new Asin, yyvsp[0].expr); ;
  1651.     break;}
  1652. case 99:
  1653. #line 651 "yacc.y"
  1654. { yyval.expr = new Expression(new Acos, yyvsp[0].expr); ;
  1655.     break;}
  1656. case 100:
  1657. #line 653 "yacc.y"
  1658. { yyval.expr = new Expression(new Atan, yyvsp[0].expr); ;
  1659.     break;}
  1660. case 101:
  1661. #line 655 "yacc.y"
  1662. { yyval.expr = new Expression(new Abs, yyvsp[0].expr); ;
  1663.     break;}
  1664. case 102:
  1665. #line 657 "yacc.y"
  1666. { yyval.expr = new Expression(new Sqrt, yyvsp[0].expr); ;
  1667.     break;}
  1668. case 103:
  1669. #line 659 "yacc.y"
  1670. { yyval.expr = new Expression(new Exp, yyvsp[0].expr); ;
  1671.     break;}
  1672. case 104:
  1673. #line 661 "yacc.y"
  1674. { yyval.expr = new Expression(new Log, yyvsp[0].expr); ;
  1675.     break;}
  1676. case 105:
  1677. #line 663 "yacc.y"
  1678. { yyval.expr = new Expression(new Log, yyvsp[0].expr); ;
  1679.     break;}
  1680. case 106:
  1681. #line 665 "yacc.y"
  1682. { yyval.expr = new Expression(new Rand); ;
  1683.     break;}
  1684. case 107:
  1685. #line 667 "yacc.y"
  1686. { yyval.expr = new Expression(new Gauss); ;
  1687.     break;}
  1688. case 108:
  1689. #line 669 "yacc.y"
  1690. { yyval.expr = new Expression(new If, yyvsp[-5].expr, yyvsp[-3].expr, yyvsp[-1].expr); ;
  1691.     break;}
  1692. case 109:
  1693. #line 671 "yacc.y"
  1694.            yyerror("Function " + *yyvsp[-1].name + "() unknown"); 
  1695.          ;
  1696.     break;}
  1697. case 110:
  1698. #line 675 "yacc.y"
  1699.            yyerror("Function " + *yyvsp[-3].name + "(arguments) unknown"); 
  1700.          ;
  1701.     break;}
  1702. case 111:
  1703. #line 679 "yacc.y"
  1704. { yyval.expr = yyvsp[-1].expr; ;
  1705.     break;}
  1706. case 112:
  1707. #line 683 "yacc.y"
  1708. { yyval.expr = NULL; ;
  1709.     break;}
  1710. case 113:
  1711. #line 686 "yacc.y"
  1712. { yyval.expr = yyvsp[-1].expr->simplify(); ;
  1713.     break;}
  1714. case 117:
  1715. #line 697 "yacc.y"
  1716. { derivation = yyvsp[-1].derivations; ;
  1717.     break;}
  1718. case 118:
  1719. #line 699 "yacc.y"
  1720. { axiom = yyvsp[-1].module_list; ;
  1721.     break;}
  1722. case 119:
  1723. #line 701 "yacc.y"
  1724.            theOptions.defaultPitch = dtor(yyvsp[-1].expr->evaluate());
  1725.            delete yyvsp[-1].expr;
  1726.          ;
  1727.     break;}
  1728. case 120:
  1729. #line 706 "yacc.y"
  1730. { theOptions.defaultRoll = dtor(yyvsp[-1].expr->evaluate());
  1731.            delete yyvsp[-1].expr;
  1732.          ;
  1733.     break;}
  1734. case 121:
  1735. #line 710 "yacc.y"
  1736.            theOptions.defaultTurn = dtor(yyvsp[-1].expr->evaluate());
  1737.            delete yyvsp[-1].expr;
  1738.          ;
  1739.     break;}
  1740. case 122:
  1741. #line 715 "yacc.y"
  1742.            theOptions.defaultPitch = 
  1743.            theOptions.defaultRoll  = 
  1744.            theOptions.defaultTurn  =  dtor(yyvsp[-1].expr->evaluate());
  1745.            delete yyvsp[-1].expr;
  1746.          ;
  1747.     break;}
  1748. case 123:
  1749. #line 722 "yacc.y"
  1750.            theOptions.defaultForward = yyvsp[-1].expr->evaluate();
  1751.            delete yyvsp[-1].expr;
  1752.          ;
  1753.     break;}
  1754. case 124:
  1755. #line 727 "yacc.y"
  1756.            long now;
  1757.  
  1758. // #if defined(_AIX)
  1759. //              stime(&now);
  1760. //#elif defined(__DECCXX)
  1761.  
  1762. #if defined(__DECCXX)
  1763.            now = getpid();
  1764. #else
  1765.              time(&now);
  1766. #endif
  1767.            if (theOptions.verbose) 
  1768.              cerr << "randomize " << now << "\n";
  1769.            srand48(now);
  1770.          ;
  1771.     break;}
  1772. case 125:
  1773. #line 744 "yacc.y"
  1774.            srand48((long)yyvsp[-1].expr->evaluate()); 
  1775.            delete yyvsp[-1].expr;
  1776.          ;
  1777.     break;}
  1778. case 126:
  1779. #line 749 "yacc.y"
  1780.            theOptions.tropismX = yyvsp[-5].expr->simplify();
  1781.            theOptions.tropismY = yyvsp[-3].expr->simplify();
  1782.            theOptions.tropismZ = yyvsp[-1].expr->simplify();
  1783.          ;
  1784.     break;}
  1785. case 127:
  1786. #line 755 "yacc.y"
  1787.            theOptions.weight = yyvsp[-1].expr->simplify();
  1788.          ;
  1789.     break;}
  1790. case 128:
  1791. #line 759 "yacc.y"
  1792. {
  1793.            theOptions.autoscale = 0;
  1794.            theOptions.eye = 
  1795.              Vector(yyvsp[-5].expr->evaluate(), yyvsp[-3].expr->evaluate(), yyvsp[-1].expr->evaluate());
  1796.            delete yyvsp[-5].expr; delete yyvsp[-3].expr; delete yyvsp[-1].expr;
  1797.          ;
  1798.     break;}
  1799. case 129:
  1800. #line 766 "yacc.y"
  1801. {
  1802.            theOptions.autoscale = 0;
  1803.            theOptions.lookat = 
  1804.              Vector(yyvsp[-5].expr->evaluate(), yyvsp[-3].expr->evaluate(), yyvsp[-1].expr->evaluate());
  1805.            delete yyvsp[-5].expr; delete yyvsp[-3].expr; delete yyvsp[-1].expr;
  1806.          ;
  1807.     break;}
  1808. case 130:
  1809. #line 773 "yacc.y"
  1810. {
  1811.            theOptions.up = 
  1812.              Vector(yyvsp[-5].expr->evaluate(), yyvsp[-3].expr->evaluate(), yyvsp[-1].expr->evaluate());
  1813.            delete yyvsp[-5].expr; delete yyvsp[-3].expr; delete yyvsp[-1].expr;
  1814.          ;
  1815.     break;}
  1816. case 131:
  1817. #line 779 "yacc.y"
  1818. {
  1819.            theOptions.fov = yyvsp[-1].expr->evaluate();
  1820.            delete yyvsp[-1].expr;
  1821.          ;
  1822.     break;}
  1823. case 132:
  1824. #line 784 "yacc.y"
  1825. {
  1826.            theOptions.coneResolution = (int) *yyvsp[-1].value;
  1827.            delete yyvsp[-1].value;
  1828.          ;
  1829.     break;}
  1830. case 133:
  1831. #line 789 "yacc.y"
  1832. {
  1833.            theOptions.sphereResolution = (int) *yyvsp[-1].value;
  1834.            delete yyvsp[-1].value;
  1835.          ;
  1836.     break;}
  1837. case 134:
  1838. #line 796 "yacc.y"
  1839. { Table *t;
  1840.  
  1841.            if (!theTables.lookup(*yyvsp[-1].name, t))
  1842.              yyerror("Unknown table " + *yyvsp[-1].name);
  1843.            else {
  1844.              yyval.derivations = new DerivationList(1);
  1845.              yyval.derivations->append(new DerivationItem(t,yyvsp[0].intnumber));
  1846.            }
  1847.            delete yyvsp[-1].name;
  1848.          ;
  1849.     break;}
  1850. case 135:
  1851. #line 807 "yacc.y"
  1852. { Table *t;
  1853.  
  1854.            yyval.derivations = yyvsp[-3].derivations;
  1855.            if (!theTables.lookup(*yyvsp[-1].name, t))
  1856.              yyerror("Unknown table " + *yyvsp[-1].name);
  1857.            else
  1858.              yyval.derivations->append(new DerivationItem(t,yyvsp[0].intnumber));
  1859.  
  1860.            delete yyvsp[-1].name;
  1861.          ;
  1862.     break;}
  1863. case 136:
  1864. #line 820 "yacc.y"
  1865. { yyval.intnumber = 1; ;
  1866.     break;}
  1867. case 137:
  1868. #line 822 "yacc.y"
  1869. { yyval.intnumber = (int) real(yyvsp[-1].expr->evaluate());
  1870.            delete yyvsp[-1].expr;
  1871.          ;
  1872.     break;}
  1873. case 138:
  1874. #line 826 "yacc.y"
  1875. { yyval.intnumber = -1; ;
  1876.     break;}
  1877. case 139:
  1878. #line 829 "yacc.y"
  1879. { yyerrok; ;
  1880.     break;}
  1881. case 140:
  1882. #line 830 "yacc.y"
  1883. { yyerrok; ;
  1884.     break;}
  1885. }
  1886.    /* the action file gets copied in in place of this dollarsign */
  1887. #line 440 "/usr/local/lib/bison/bison.simple"
  1888.  
  1889.   yyvsp -= yylen;
  1890.   yyssp -= yylen;
  1891. #ifdef YYLSP_NEEDED
  1892.   yylsp -= yylen;
  1893. #endif
  1894.  
  1895. #if YYDEBUG != 0
  1896.   if (yydebug)
  1897.     {
  1898.       short *ssp1 = yyss - 1;
  1899.       fprintf (stderr, "state stack now");
  1900.       while (ssp1 != yyssp)
  1901.     fprintf (stderr, " %d", *++ssp1);
  1902.       fprintf (stderr, "\n");
  1903.     }
  1904. #endif
  1905.  
  1906.   *++yyvsp = yyval;
  1907.  
  1908. #ifdef YYLSP_NEEDED
  1909.   yylsp++;
  1910.   if (yylen == 0)
  1911.     {
  1912.       yylsp->first_line = yylloc.first_line;
  1913.       yylsp->first_column = yylloc.first_column;
  1914.       yylsp->last_line = (yylsp-1)->last_line;
  1915.       yylsp->last_column = (yylsp-1)->last_column;
  1916.       yylsp->text = 0;
  1917.     }
  1918.   else
  1919.     {
  1920.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  1921.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  1922.     }
  1923. #endif
  1924.  
  1925.   /* Now "shift" the result of the reduction.
  1926.      Determine what state that goes to,
  1927.      based on the state we popped back to
  1928.      and the rule number reduced by.  */
  1929.  
  1930.   yyn = yyr1[yyn];
  1931.  
  1932.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1933.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1934.     yystate = yytable[yystate];
  1935.   else
  1936.     yystate = yydefgoto[yyn - YYNTBASE];
  1937.  
  1938.   goto yynewstate;
  1939.  
  1940. yyerrlab:   /* here on detecting error */
  1941.  
  1942.   if (! yyerrstatus)
  1943.     /* If not already recovering from an error, report this error.  */
  1944.     {
  1945.       ++yynerrs;
  1946.  
  1947. #ifdef YYERROR_VERBOSE
  1948.       yyn = yypact[yystate];
  1949.  
  1950.       if (yyn > YYFLAG && yyn < YYLAST)
  1951.     {
  1952.       int size = 0;
  1953.       char *msg;
  1954.       int x, count;
  1955.  
  1956.       count = 0;
  1957.       for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
  1958.         if (yycheck[x + yyn] == x)
  1959.           size += strlen(yytname[x]) + 15, count++;
  1960.       msg = (char *) malloc(size + 15);
  1961.       if (msg != 0)
  1962.         {
  1963.           strcpy(msg, "parse error");
  1964.  
  1965.           if (count < 5)
  1966.         {
  1967.           count = 0;
  1968.           for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
  1969.             if (yycheck[x + yyn] == x)
  1970.               {
  1971.             strcat(msg, count == 0 ? ", expecting `" : " or `");
  1972.             strcat(msg, yytname[x]);
  1973.             strcat(msg, "'");
  1974.             count++;
  1975.               }
  1976.         }
  1977.           yyerror(msg);
  1978.           free(msg);
  1979.         }
  1980.       else
  1981.         yyerror ("parse error; also virtual memory exceeded");
  1982.     }
  1983.       else
  1984. #endif /* YYERROR_VERBOSE */
  1985.     yyerror("parse error");
  1986.     }
  1987.  
  1988. yyerrlab1:   /* here on error raised explicitly by an action */
  1989.  
  1990.   if (yyerrstatus == 3)
  1991.     {
  1992.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  1993.  
  1994.       /* return failure if at end of input */
  1995.       if (yychar == YYEOF)
  1996.     YYABORT;
  1997.  
  1998. #if YYDEBUG != 0
  1999.       if (yydebug)
  2000.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  2001. #endif
  2002.  
  2003.       yychar = YYEMPTY;
  2004.     }
  2005.  
  2006.   /* Else will try to reuse lookahead token
  2007.      after shifting the error token.  */
  2008.  
  2009.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  2010.  
  2011.   goto yyerrhandle;
  2012.  
  2013. yyerrdefault:  /* current state does not do anything special for the error token. */
  2014.  
  2015. #if 0
  2016.   /* This is wrong; only states that explicitly want error tokens
  2017.      should shift them.  */
  2018.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  2019.   if (yyn) goto yydefault;
  2020. #endif
  2021.  
  2022. yyerrpop:   /* pop the current state because it cannot handle the error token */
  2023.  
  2024.   if (yyssp == yyss) YYABORT;
  2025.   yyvsp--;
  2026.   yystate = *--yyssp;
  2027. #ifdef YYLSP_NEEDED
  2028.   yylsp--;
  2029. #endif
  2030.  
  2031. #if YYDEBUG != 0
  2032.   if (yydebug)
  2033.     {
  2034.       short *ssp1 = yyss - 1;
  2035.       fprintf (stderr, "Error: state stack now");
  2036.       while (ssp1 != yyssp)
  2037.     fprintf (stderr, " %d", *++ssp1);
  2038.       fprintf (stderr, "\n");
  2039.     }
  2040. #endif
  2041.  
  2042. yyerrhandle:
  2043.  
  2044.   yyn = yypact[yystate];
  2045.   if (yyn == YYFLAG)
  2046.     goto yyerrdefault;
  2047.  
  2048.   yyn += YYTERROR;
  2049.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  2050.     goto yyerrdefault;
  2051.  
  2052.   yyn = yytable[yyn];
  2053.   if (yyn < 0)
  2054.     {
  2055.       if (yyn == YYFLAG)
  2056.     goto yyerrpop;
  2057.       yyn = -yyn;
  2058.       goto yyreduce;
  2059.     }
  2060.   else if (yyn == 0)
  2061.     goto yyerrpop;
  2062.  
  2063.   if (yyn == YYFINAL)
  2064.     YYACCEPT;
  2065.  
  2066. #if YYDEBUG != 0
  2067.   if (yydebug)
  2068.     fprintf(stderr, "Shifting error token, ");
  2069. #endif
  2070.  
  2071.   *++yyvsp = yylval;
  2072. #ifdef YYLSP_NEEDED
  2073.   *++yylsp = yylloc;
  2074. #endif
  2075.  
  2076.   yystate = yyn;
  2077.   goto yynewstate;
  2078. }
  2079. #line 833 "yacc.y"
  2080.  
  2081.  
  2082.