`TermParser.java`

    // *******************************************************************
    // This file has been automatically generated from the grammar in file
    // Term.grm by ilog.language.syntax.ParserGenerator on
    // Mon Dec 20 18:48:40 PST 2004 --- !!! PLEASE DO NO EDIT !!!
    // *******************************************************************

    import java.io.Reader;
    import java.io.StringReader;
    import java.io.IOException;
    import ilog.language.util.ArrayList;
    import ilog.language.util.FiniteStack;
    import ilog.language.syntax.*;
    import java.util.*;

    /* ************ */
    /* PARSER CLASS */
    /* ************ */

    class TermParser extends DynamicParser
    {
      /* ************************ */
      /* PARSER CLASS CONSTRUCTOR */
      /* ************************ */

      public TermParser(Tokenizer t)
        {
          input = t;
          choiceStack = new FiniteStack(10);
          trailStack = new FiniteStack(100);
          resolveRRsWithPrecedence = false;

          /* **************** */
          /* OPERATOR SYMBOLS */
          /* **************** */

          operators = new ArrayList(27);

          newOperator(":-",3,1,2,2);
          newOperator(":-",3,1,2,0);
          newOperator("-->",3,1,2,2);
          newOperator(";",3,101,1,2);
          newOperator(",",3,201,1,2);
          newOperator("=",3,501,2,2);
          newOperator("\\=",3,501,2,2);
          newOperator("==",3,501,2,2);
          newOperator("\\==",3,501,2,2);
          newOperator("=..",3,501,2,2);
          newOperator("is",3,501,2,2);
          newOperator("=:=",3,501,2,2);
          newOperator("=\\=",3,501,2,2);
          newOperator("<",3,501,2,2);
          newOperator("<=",3,501,2,2);
          newOperator(">",3,501,2,2);
          newOperator(">=",3,501,2,2);
          newOperator("+",3,701,0,2);
          newOperator("-",3,701,0,2);
          newOperator("*",3,801,0,2);
          newOperator("/",3,801,0,2);
          newOperator("&",3,1001,1,2);
          newOperator("^",3,1001,1,2);
          newOperator("-",3,1001,1,0);
          newOperator("if",3,401,2,0);
          newOperator("then",3,351,1,2);
          newOperator("else",3,381,2,2);
        }

      /* ************************* */
      /* PARSER CLASS DECLARATIONS */
      /* ************************* */

      Stack terms = new Stack();
      Term term, temp;

      /* ********************** */
      /* STATIC INITIALIZATIONS */
      /* ********************** */

      static
        {
          initializeTerminals();
          initializeNonTerminals();
          initializeRules();
          initializeParserActions();
          initializeParserStates();
          initializeActionTables();
          initializeGotoTables();
          initializeStateTables();
        }

      /* ********************* */
      /* PARTIAL PARSE METHODS */
      /* ********************* */

      final static ParseNode $SESSION_SWITCH$ = new ParseNode(terminals[3]);

      public final void parseSession (String s) throws IOException
        {
          parseSession(new StringReader(s));
        }

      public final void parseSession (Reader r) throws IOException
        {
          input.setReader(r);
          errorManager().recoverFromErrors(false);
          setSwitchToken($SESSION_SWITCH$);
          parse();
        }

      /* **************** */
      /* SEMANTIC ACTIONS */
      /* **************** */

      protected ParseNode semanticAction(ParserRule $rule$) throws IOException
        {
          ParseNode $head$ = new ParseNode($rule$.head);

          switch($rule$.index())
            {
              case 2:
                {
                $head$ = $head$.copy(node($rule$,2));
                break;
                }
              case 8:
                {
                System.out.println("*** Bye bye!...");
                System.exit(0);
                break;
                }
              case 12:
                {
                terms = new Stack();
                break;
                }
              case 13:
                {
                term = (Term)terms.pop();

                // Operator (re)definition:
                if (term.functor != null && term.functor.equals("op")
                    && term.body != null && term.body.size() == 3)
                  {
                    try
                      {
                        Op(((Term)term.body.get(2)).functor,
                           ((Term)term.body.get(1)).functor,
                           (int)((Term)term.body.get(0)).number);
                      }
                    catch (Exception e)
                      {
                        System.err.println("*** Bad op declaration: "+term);
                      }
                  }

                out.println(term.toString()); // print out the term's canonical form
                cutAll();                     // delete all pending token choices
                TermTokenizer.prompt();
                break;
                }
              case 15:
                {
                errorManager().reportErrors(true);
                TermTokenizer.prompt();
                break;
                }
              case 18:
                {
                terms.push(node($rule$,1).isInteger() ? new Term((int)node($rule$,1).nvalue())
                                        : new Term(node($rule$,1).nvalue()));
                break;
                }
              case 19:
                {
                terms.push(new Term(node($rule$,1).svalue()));
                break;
                }
              case 20:
                {
                terms.push(new Term(node($rule$,-1).svalue(),new Vector()));
                break;
                }
              case 22:
                {
                terms.push(new Term(node($rule$,0).svalue(),new Vector()));
                break;
                }
              case 23:
                {
                term = (Term)terms.pop();
                ((Term)terms.peek()).body.add(term);
                break;
                }
              case 24:
                {
                term = (Term)terms.pop();
                terms.push(new Term(node($rule$,0).svalue(),new Vector()));
                ((Term)terms.peek()).body.add(term);
                break;
                }
              case 25:
                {
                term = (Term)terms.pop();
                ((Term)terms.peek()).body.add(term);
                break;
                }
              case 26:
                {
                term = (Term)terms.pop();
                terms.push(new Term(node($rule$,2).svalue(),new Vector()));
                ((Term)terms.peek()).body.add(term);
                break;
                }
              case 28:
                {
                term = (Term)terms.pop();
                ((Term)terms.peek()).body.add(term);
                break;
                }
              case 29:
                {
                term = (Term)terms.pop();
                ((Term)terms.peek()).body.add(term);
                break;
                }
              case 0: case 1:
                break;
              default:
                $head$ = $head$.copy(node($rule$,1));
                break;
            }
          return $head$;
        }

      /* ********************* */
      /* UNDO SEMANTIC ACTIONS */
      /* ********************* */

      protected void undoSemanticAction(ParserRule $rule$,ParseNode $head$) throws IOException
        {
          switch($rule$.index())
            {
              case 18:
                {
                terms.pop();
                break;
                }
              case 19:
                {
                terms.pop();
                break;
                }
              case 20:
                {
                terms.pop();
                break;
                }
              case 22:
                {
                terms.pop();
                break;
                }
              case 23:
                {
                temp = (Term)terms.peek();
                term = (Term)temp.body.lastElement();
                temp.body.removeElementAt(temp.body.size()-1);
                terms.push(term);
                break;
                }
              case 24:
                {
                temp = (Term)terms.pop();
                term = (Term)temp.body.lastElement();
                terms.push(term);
                break;
                }
              case 25:
                {
                temp = (Term)terms.peek();
                term = (Term)temp.body.lastElement();
                temp.body.removeElementAt(temp.body.size()-1);
                terms.push(term);
                break;
                }
              case 26:
                {
                temp = (Term)terms.pop();
                term = (Term)temp.body.lastElement();
                terms.push((Term)temp.body.lastElement());
                break;
                }
              case 28:
                {
                temp = (Term)terms.peek();
                term = (Term)temp.body.lastElement();
                temp.body.removeElementAt(temp.body.size()-1);
                terms.push(term);
                break;
                }
              case 29:
                {
                temp = (Term)terms.peek();
                term = (Term)temp.body.lastElement();
                temp.body.removeElementAt(temp.body.size()-1);
                terms.push(term);
                break;
                }
            }
          }

      /* *************************** */
      /* OPERATOR DEFINITION METHODS */
      /* *************************** */

      public final void Op (String o, String s, int p) throws NonFatalParseErrorException
        {
          defineOperator("Op",o,s,p);
        }

      /* **************** */
      /* TERMINAL SYMBOLS */
      /* **************** */

      static void initializeTerminals ()
        {
          terminals = new ParserTerminal[14];

          newTerminal(0,"$EMPTY$",1,2);
          newTerminal(1,"$E_O_I$",1,2);
          newTerminal(2,"error",1,2);
          newTerminal(3,"$Session_switch$",1,2);
          newTerminal(4,"NUMBER",1,2);
          newTerminal(5,"FUNCTOR",1,2);
          newTerminal(6,"OP_",1,2);
          newTerminal(7,"_OP_",1,2);
          newTerminal(8,"_OP",1,2);
          newTerminal(9,"exit",1,2);
          newTerminal(10,".",1,2);
          newTerminal(11,"(",1,2);
          newTerminal(12,")",1,2);
          newTerminal(13,",",1,2);
        }

      /* ******************** */
      /* NON-TERMINAL SYMBOLS */
      /* ******************** */

      static void initializeNonTerminals ()
        {
          nonterminals = new ParserNonTerminal[16];

          newNonTerminal(0,"$START$");
          newNonTerminal(1,"$ROOTS$");
          newNonTerminal(2,"Session");
          newNonTerminal(3,"Op");
          newNonTerminal(4,"Clauses");
          newNonTerminal(5,"Exit");
          newNonTerminal(6,"$ACTION0$");
          newNonTerminal(7,"Clause");
          newNonTerminal(8,"Term");
          newNonTerminal(9,"$ACTION1$");
          newNonTerminal(10,"$ACTION2$");
          newNonTerminal(11,"$ACTION3$");
          newNonTerminal(12,"Body");
          newNonTerminal(13,"$ACTION4$");
          newNonTerminal(14,"$ACTION5$");
          newNonTerminal(15,"$ACTION6$");
        }

      /* **************** */
      /* PRODUCTION RULES */
      /* **************** */

      static void initializeRules ()
        {
          rules = new ParserRule[30];

          rules[0] = new ParserRule(0,1,0,1,2);
          rules[1] = new ParserRule(1,1,1,1,2);
          rules[2] = new ParserRule(1,2,2,1,2);
          rules[3] = new ParserRule(3,1,3,1);
          rules[4] = new ParserRule(3,1,4,1);
          rules[5] = new ParserRule(3,1,5,1);
          rules[6] = new ParserRule(2,2,6,1,2);
          rules[7] = new ParserRule(2,1,7,1,2);
          rules[8] = new ParserRule(6,0,8,1,2);
          rules[9] = new ParserRule(5,3,9,1,2);
          rules[10] = new ParserRule(4,1,10,1,2);
          rules[11] = new ParserRule(4,2,11,1,2);
          rules[12] = new ParserRule(9,0,12,1,2);
          rules[13] = new ParserRule(10,0,13,1,2);
          rules[14] = new ParserRule(7,4,14,1,2);
          rules[15] = new ParserRule(11,0,15,1,2);
          rules[16] = new ParserRule(7,3,16,1,2);
          rules[17] = new ParserRule(3,1,17,1,2);
          rules[18] = new ParserRule(8,1,18,1,2);
          rules[19] = new ParserRule(8,1,19,1,2);
          rules[20] = new ParserRule(13,0,20,1,2);
          rules[21] = new ParserRule(8,5,21,1,2);
          rules[22] = new ParserRule(14,0,22,1,2);
          rules[23] = new ParserRule(8,3,23,1);
          rules[24] = new ParserRule(15,0,24,1,2);
          rules[25] = new ParserRule(8,4,25,2);
          rules[26] = new ParserRule(8,2,26,2);
          rules[27] = new ParserRule(8,3,27,1,2);
          rules[28] = new ParserRule(12,1,28,1,2);
          rules[29] = new ParserRule(12,3,29,1,2);
        }

      /* ************** */
      /* PARSER ACTIONS */
      /* ************** */

      static void initializeParserActions ()
        {
          actions = new ParserAction[212];

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

      /* ************* */
      /* PARSER STATES */
      /* ************* */

      static void initializeParserStates ()
        {
          states = new ParserState[42];

          for (int i=0; i<42; i++) newState(i);
        }

      /* ************* */
      /* ACTION TABLES */
      /* ************* */

      static void initializeActionTables ()
        {
          newActionTables(36);

          newActionTable(0,9);
    	setAction(0,2,2);
    	setAction(0,4,5);
    	setAction(0,8,9);
    	setAction(0,9,3);
    	setAction(0,11,10);
    	setAction(0,6,7);
    	setAction(0,3,4);
    	setAction(0,7,8);
    	setAction(0,5,6);

          newActionTable(1,1);
    	setAction(1,10,11);

          newActionTable(2,1);
    	setAction(2,1,12);

          newActionTable(3,8);
    	setAction(3,2,13);
    	setAction(3,4,15);
    	setAction(3,8,19);
    	setAction(3,9,14);
    	setAction(3,11,20);
    	setAction(3,6,17);
    	setAction(3,7,18);
    	setAction(3,5,16);

          newActionTable(4,6);
    	setAction(4,4,21);
    	setAction(4,8,22);
    	setAction(4,6,24);
    	setAction(4,11,23);
    	setAction(4,7,25);
    	setAction(4,5,26);

          newActionTable(5,1);
    	setAction(5,10,27);

          newActionTable(6,1);
    	setAction(6,1,1);

          newActionTable(7,8);
    	setAction(7,2,36);
    	setAction(7,4,37);
    	setAction(7,9,42);
    	setAction(7,8,41);
    	setAction(7,11,43);
    	setAction(7,6,39);
    	setAction(7,7,40);
    	setAction(7,5,38);

          newActionTable(8,1);
    	setAction(8,1,44);

          newActionTable(9,1);
    	setAction(9,1,45);

          newActionTable(10,1);
    	setAction(10,10,46);

          newActionTable(11,1);
    	setAction(11,1,47);

          newActionTable(12,5);
    	setAction(12,13,52);
    	setAction(12,8,49);
    	setAction(12,10,50);
    	setAction(12,7,48);
    	setAction(12,12,51);

          newActionTable(13,6);
    	setAction(13,13,58);
    	setAction(13,8,54);
    	setAction(13,11,56);
    	setAction(13,10,55);
    	setAction(13,7,53);
    	setAction(13,12,57);

          newActionTable(14,3);
    	setAction(14,8,59);
    	setAction(14,10,61);
    	setAction(14,7,60);

          newActionTable(15,9);
    	setAction(15,4,74);
    	setAction(15,13,73);
    	setAction(15,8,80);
    	setAction(15,6,76);
    	setAction(15,11,82);
    	setAction(15,10,70);
    	setAction(15,7,78);
    	setAction(15,5,75);
    	setAction(15,12,72);

          newActionTable(16,6);
    	setAction(16,13,88);
    	setAction(16,8,85);
    	setAction(16,11,83);
    	setAction(16,10,86);
    	setAction(16,7,84);
    	setAction(16,12,87);

          newActionTable(17,6);
    	setAction(17,13,94);
    	setAction(17,8,90);
    	setAction(17,11,92);
    	setAction(17,10,91);
    	setAction(17,7,89);
    	setAction(17,12,93);

          newActionTable(18,6);
    	setAction(18,13,100);
    	setAction(18,8,96);
    	setAction(18,11,98);
    	setAction(18,10,97);
    	setAction(18,7,95);
    	setAction(18,12,99);

          newActionTable(19,6);
    	setAction(19,4,101);
    	setAction(19,8,105);
    	setAction(19,11,106);
    	setAction(19,6,103);
    	setAction(19,7,104);
    	setAction(19,5,102);

          newActionTable(20,4);
    	setAction(20,13,116);
    	setAction(20,8,113);
    	setAction(20,7,114);
    	setAction(20,12,115);

          newActionTable(21,2);
    	setAction(21,13,117);
    	setAction(21,12,118);

          newActionTable(22,5);
    	setAction(22,13,129);
    	setAction(22,8,126);
    	setAction(22,10,127);
    	setAction(22,7,125);
    	setAction(22,12,128);

          newActionTable(23,4);
    	setAction(23,13,133);
    	setAction(23,8,130);
    	setAction(23,7,131);
    	setAction(23,12,132);

          newActionTable(24,5);
    	setAction(24,13,138);
    	setAction(24,8,135);
    	setAction(24,10,136);
    	setAction(24,7,134);
    	setAction(24,12,137);

          newActionTable(25,6);
    	setAction(25,4,139);
    	setAction(25,8,143);
    	setAction(25,11,144);
    	setAction(25,6,141);
    	setAction(25,7,142);
    	setAction(25,5,140);

          newActionTable(26,5);
    	setAction(26,13,159);
    	setAction(26,8,156);
    	setAction(26,10,157);
    	setAction(26,7,154);
    	setAction(26,12,158);

          newActionTable(27,5);
    	setAction(27,13,174);
    	setAction(27,8,171);
    	setAction(27,10,172);
    	setAction(27,7,169);
    	setAction(27,12,173);

          newActionTable(28,3);
    	setAction(28,8,175);
    	setAction(28,7,176);
    	setAction(28,12,177);

          newActionTable(29,5);
    	setAction(29,13,182);
    	setAction(29,8,179);
    	setAction(29,10,180);
    	setAction(29,7,178);
    	setAction(29,12,181);

          newActionTable(30,1);
    	setAction(30,10,183);

          newActionTable(31,9);
    	setAction(31,2,185);
    	setAction(31,4,186);
    	setAction(31,9,191);
    	setAction(31,8,190);
    	setAction(31,11,192);
    	setAction(31,6,188);
    	setAction(31,1,184);
    	setAction(31,7,189);
    	setAction(31,5,187);

          newActionTable(32,8);
    	setAction(32,2,193);
    	setAction(32,4,194);
    	setAction(32,9,199);
    	setAction(32,8,198);
    	setAction(32,11,200);
    	setAction(32,6,196);
    	setAction(32,7,197);
    	setAction(32,5,195);

          newActionTable(33,1);
    	setAction(33,1,201);

          newActionTable(34,1);
    	setAction(34,10,202);

          newActionTable(35,9);
    	setAction(35,2,204);
    	setAction(35,4,205);
    	setAction(35,9,210);
    	setAction(35,8,209);
    	setAction(35,11,211);
    	setAction(35,6,207);
    	setAction(35,1,203);
    	setAction(35,7,208);
    	setAction(35,5,206);

        }

      /* *********** */
      /* GOTO TABLES */
      /* *********** */

      static void initializeGotoTables ()
        {
          newGotoTables(16);

          newGotoTable(0,6);
    	setGoto(0,2,2);
    	setGoto(0,4,3);
    	setGoto(0,9,4);
    	setGoto(0,1,6);
    	setGoto(0,7,8);
    	setGoto(0,5,9);

          newGotoTable(1,1);
    	setGoto(1,11,40);

          newGotoTable(2,0);

          newGotoTable(3,3);
    	setGoto(3,9,4);
    	setGoto(3,7,38);
    	setGoto(3,5,39);

          newGotoTable(4,2);
    	setGoto(4,8,15);
    	setGoto(4,3,18);

          newGotoTable(5,1);
    	setGoto(5,6,11);

          newGotoTable(6,5);
    	setGoto(6,2,10);
    	setGoto(6,4,3);
    	setGoto(6,9,4);
    	setGoto(6,7,8);
    	setGoto(6,5,9);

          newGotoTable(7,1);
    	setGoto(7,10,36);

          newGotoTable(8,2);
    	setGoto(8,8,34);
    	setGoto(8,3,18);

          newGotoTable(9,1);
    	setGoto(9,14,32);

          newGotoTable(10,1);
    	setGoto(10,13,22);

          newGotoTable(11,3);
    	setGoto(11,8,23);
    	setGoto(11,3,18);
    	setGoto(11,12,24);

          newGotoTable(12,2);
    	setGoto(12,8,27);
    	setGoto(12,3,18);

          newGotoTable(13,1);
    	setGoto(13,15,30);

          newGotoTable(14,2);
    	setGoto(14,8,31);
    	setGoto(14,3,18);

          newGotoTable(15,2);
    	setGoto(15,8,33);
    	setGoto(15,3,18);

        }

      /* ************ */
      /* STATE TABLES */
      /* ************ */

      static void initializeStateTables ()
        {
          setTables(0,0,0);
          setTables(1,1,1);
          setTables(2,2,2);
          setTables(3,3,3);
          setTables(4,4,4);
          setTables(5,5,5);
          setTables(6,6,2);
          setTables(7,3,6);
          setTables(8,7,2);
          setTables(9,8,2);
          setTables(10,9,2);
          setTables(11,10,2);
          setTables(12,11,2);
          setTables(13,12,2);
          setTables(14,13,2);
          setTables(15,14,7);
          setTables(16,4,8);
          setTables(17,15,9);
    //    Dynamic Actions in State 17:
    	 newDynamicActionTable(17,1);
    	     newDynamicActions(17,0,2);
    	      setDynamicAction(17,0,0,68);
    	      setDynamicAction(17,0,1,77);
          setTables(18,16,2);
          setTables(19,17,2);
          setTables(20,18,2);
          setTables(21,19,10);
          setTables(22,4,11);
          setTables(23,20,2);
          setTables(24,21,2);
          setTables(25,4,12);
          setTables(26,22,2);
          setTables(27,23,2);
          setTables(28,24,2);
          setTables(29,25,13);
          setTables(30,4,14);
          setTables(31,26,2);
    //    Dynamic Actions in State 31:
    	 newDynamicActionTable(31,2);
    	     newDynamicActions(31,0,2);
    	      setDynamicAction(31,0,0,152);
    	      setDynamicAction(31,0,1,153);
    	     newDynamicActions(31,1,2);
    	      setDynamicAction(31,1,0,151);
    	      setDynamicAction(31,1,1,155);
          setTables(32,4,15);
          setTables(33,27,2);
    //    Dynamic Actions in State 33:
    	 newDynamicActionTable(33,2);
    	     newDynamicActions(33,0,2);
    	      setDynamicAction(33,0,0,167);
    	      setDynamicAction(33,0,1,168);
    	     newDynamicActions(33,1,2);
    	      setDynamicAction(33,1,0,166);
    	      setDynamicAction(33,1,1,170);
          setTables(34,28,2);
          setTables(35,29,2);
          setTables(36,30,2);
          setTables(37,31,2);
          setTables(38,32,2);
          setTables(39,33,2);
          setTables(40,34,2);
          setTables(41,35,2);
        }
    }

    /* ***************** */
    /* ANCILLARY CLASSES */
    /* ***************** */

    class Term
    {
      String functor = null;
      Vector body = null;
      double number = Double.NaN;
      boolean isInteger = false;

      Term (double n)
        {
          number = n;
        }

      Term (int n)
        {
          number = n;
          isInteger = true;
        }

      Term (String functor)
        {
          this.functor = functor;
        }

      Term (String functor, Vector body)
        {
          this.functor = functor;
          this.body = body;
        }

      public final boolean isNumber ()
        {
          return !Double.isNaN(number);
        }

      public final boolean hasBody ()
        {
          return (body != null && !body.isEmpty());
        }

      public String toString ()
        {
          if (isNumber())
            return(isInteger ? String.valueOf((int)number)
                             : String.valueOf(number));

          if (!hasBody())
            return functor;

          StringBuffer s = new StringBuffer(functor);

          s.append("(");
          for (int i=0; i<body.size(); i++)
            {
              s.append(body.get(i));
              if (i<body.size()-1) s.append(",");
            }
          s.append(")");

          return s.toString();
        }
    }

This file was generated on Mon Dec 20 19:03:12 PST 2004 from file `TermParser.java`
by the `ilog.language.tools.Hilite` Java tool written by Hassan Aït-Kaci