// *******************************************************************
// This file has been automatically generated from the grammar in file
// Hoot.grm by hlt.language.syntax.ParserGenerator on
// Sat Sep 14 07:43:25 PDT 2019 --- !!! PLEASE DO NO EDIT !!!
// *******************************************************************

package hlt.osf.hoot;

import java.io.Reader;
import java.io.StringReader;
import java.io.IOException;
import hlt.language.syntax.*;
import hlt.language.tools.Misc;
import hlt.language.tools.Debug;
import hlt.language.util.Stack;
import hlt.language.util.ArrayList;
import hlt.language.util.IntIterator;
import hlt.language.util.Error;
import hlt.language.util.Span;
import hlt.language.util.Locatable;
import hlt.osf.io.*;
import hlt.osf.base.*;
import hlt.osf.util.*;
import hlt.osf.exec.*;
import hlt.language.io.CircularInclusionException;
import java.util.HashMap;
import java.util.HashSet;
import java.io.PrintStream;
import java.io.FileNotFoundException;


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

public class HootParser extends StaticParser
{
  /* ************************ */
  /* PARSER CLASS CONSTRUCTOR */
  /* ************************ */

  public HootParser (Tokenizer t)
    {
      input = t;
      xmlroot = "HootExpression";
      xmlRootNSPrefix = "hoot";
      String[] ns = {"hoot","http://www.hak-lt.com/ns/hoot"};
      namespaces = ns;
    }

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


/* ************************************************************************ */
/* *************************** GLOBAL VARIABLES *************************** */
/* ************************************************************************ */

/* ************************************************************************ */

/**
 * This is the HOOT execution context.
 */
static Context context = new Context(1000000,2,3);

/* ************************************************************************ */

/* ************************************************************************ */
/* ************************** TAXONOMY MANAGEMENT ************************* */
/* ************************************************************************ */

/* ************************************************************************ */

void declareIsa (String s1, String s2) throws LockedCodeArrayException
{
  try
    {
      context.declareIsa(s1,s2,location);
    }
  catch (RuntimeException e)
    {
      logError(new Error().setMsg(e.getMessage()));
    }
}

/* ************************************************************************ */

void processIsaDeclaration (Stack lhs, Stack rhs)
{
  int lsize = lhs.size();
  int rsize = rhs.size();

  for (int i=0; i<lsize; i++)
    for (int j=0; j<rsize; j++)
      declareIsa((String)lhs.get(i),(String)rhs.get(j));
}

/* ************************************************************************ */

/* ************************************************************************ */
/* ************************* EXPRESSION PROCESSING ************************ */
/* ************************************************************************ */

/* ************************************************************************ */

/**
 * The following static items are used for auxiliary parsing from
 * strings and XML display type of a parsed HOOT term.
 */

/**
 * This flag indicates whether parsed HOOT-term's XML form is to be displayed.
 */
static boolean showXml = false;

/**
 * This flag indicates whether the current HOOT-term being displayed
 * is or not in normalized form.
 */
static boolean originalForm = true;

/**
 * This indicates which tokenizer is in effect while parsing a HOOT term.
 */
static HootTokenizer stringTokenizer;

/**
 * This is the parser used when parsing from a string (as opposed to a
 * file buffer).
 */
static HootParser stringParser;

/**
 * This initializes the tokenizer used when parsing out of a string,
 * and the string parser accordingly, and sets the parser's parse-tree
 * type to "XML".
 */
static
  {
    if (stringParser == null)
      {
	stringTokenizer = new HootTokenizer();
	stringParser = new HootParser(stringTokenizer);
	stringParser.setTreeType("XML");
      }
  }

/**
 * This processes a &psi;-term being parsed. It builds an uninterpreted
 * &psi;-term graph structure out of the various syntactic parts passed
 * as arguments (as explained in the <a
 * href="../ctr16.pdf">specification</a>.

 * The parser, calling this method, builds and feature-normalizes a
 * <tt>PsiTerm</tt> object. It does not interpret sort expressions (just
 * builds sort expressions). This is handy to control reading and
 * normalizing even without an encoded taxonomy by accumulating
 * uninterpreted syntactic expressions.
 *
 * <p/>
 *
 * This also produces a pretty-printed display <tt>String</tt> of the
 * feature-normalized <tt>PsiTerm</tt> object built by the parser. If
 * the <tt>showXml</tt> flag is <tt>true</tt>, it also displays the XML
 * serialization of the &psi;-term syntax tree (<i>i.e.</i>, of the
 * input that was read).
 *
 * <p/>
 *
 * If the <tt>showXml</tt> flag is <tt>true</tt>, in order to display the
 * XML serialization of the normalized &psi;-term that was built from the
 * string that was parsed, it can only be obtained by parsing the normalized
 * term's display string so that a new syntax tree can generate the needed
 * XML form.
 *
 */
void processPsiTerm (String tag, SortExpression sort, Stack keys, Stack subterms)
{
  time = System.currentTimeMillis();

  // build and normalize the parsed HOOT term:
  PsiTerm pst = buildPsiTerm(new HashSet(),Tag.getTag(tag),sort,keys,subterms);
  // generate a string display form for the normalized psiterm:
  String psiTermString = pst.displayForm(4); // margin is 4 to account for "*** "

  try
    {
      if (!originalForm)
	{
	  displayLine("*** Normalized HOOT term:\n");
	  // display the normalized psiterm:
	  displayLine("*** "+psiTermString+"\n");
	}
      
      // Tag.tallyTags();	// show known tags
      Tag.clearKnownTags();	// clear the tags

      if (showXml)
	{
	  // display the XML form of the parsed psiterm (whether first or second parsing):
	  System.out.println("*** XML form of "+(originalForm ? "original" : "normalized")+" HOOT term:\n");
	  writeXml(currentNode(),System.out);
	}

      if (originalForm)
	{
	  originalForm = false;
	  // reparse the normalized psiterm string to display its XML tree:
	  stringParser.parseHootExpression(psiTermString);
      	}
      originalForm = true;
    }
  catch (RuntimeException e)
    {
      logError(new Error().setMsg(e.getMessage()));
      e.printStackTrace();
    }
  catch (Exception e)	// for writeXml ...
    {
      logError(new Error().setMsg(e.getMessage()));
    }

  time = System.currentTimeMillis() - time;
  if (Context.isTiming())
    displayLine("*** Processing time = "+time+" ms");
}

/**
 * Using the given hash set of tags already associated to previously
 * constructed &psi;-terms, this builds an uninterpreted &psi;-term
 * structure out of the syntactic parts given as arguments.
 */
PsiTerm buildPsiTerm (HashSet tags, Tag tag, SortExpression sort, Stack keys, Stack subterms)
{
  // dereference the tag to get to the correct one if needed:
  tag = tag.deref();

  // this is the psiterm to build:
  PsiTerm pst = null;

  // check if this tag has been seen before:
  if (tags.contains(tag))
    // this tag is a reoccurring tag: 
    {
      // mark the tag as shared and retrieve its term:
      pst = tag.markAsShared().term();
      // merge the existing term's sort with the given sort:
      pst.mergeSortWith(sort);
    }
  else
    // this tag has not occurred before:
    {
      // add the tag to the tag occurrences:
      tags.add(tag);
      // create a new psiterm with the given sort and tag:
      pst = new PsiTerm(sort).setTag(tag);
    }

  // build the subterms if there are any:
  if (subterms != null) // (then must have keys != null as well)
    {
      // this is to count implicit positions of subterms if any:
      int implicitPosition = 0;

      // this is to hold a subterm to build if any:
      PsiTerm subterm = null;

      // this is to hold an already existing subterm if any:
      PsiTerm existingSubterm = null;

      // build each subterm one at a time:
      while (!subterms.empty())
	{
	  // get the current raw subterm to build:
	  RawPsiTerm rawsub = (RawPsiTerm)subterms.pop();
	  // build the current subterm
	  subterm = buildPsiTerm(tags,
				 Tag.getTag(rawsub.tag),
				 rawsub.sort,
				 rawsub.keys,
				 rawsub.subterms).deref();

	  // get the current subterm's key
	  Object key = keys.pop();

	  if (key == null)
	    // this is an implicitly contiguous position
	    {
	      implicitPosition++;

	      // retrieve the possibly existing subterm:
	      existingSubterm = pst.getSubterm(implicitPosition);
	      if (existingSubterm == null)
		pst.setSubterm(implicitPosition,subterm.deref());
	      else
		existingSubterm.deref().merge(subterm.deref());

	      continue;
	    }

	  if (key instanceof Integer)
	    // this is an explicitly specified position
	    {
	      int position = ((Integer)key).intValue();
	      
	      existingSubterm = pst.getSubterm(position);
	      if (existingSubterm == null)
		pst.setSubterm(position,subterm.deref());
	      else
		existingSubterm.deref().merge(subterm.deref());

	      continue;
	    }

	  // this is a feature subterm
	  Feature feature = Feature.getFeature((String)key);

	  existingSubterm = pst.getSubterm(feature);
	  if (existingSubterm == null)
	    pst.setSubterm(feature,subterm);
	  else
	    existingSubterm.merge(subterm.deref());
	}
    }

  // return dereferenced pst in case its tag was bound by merging subterms
  return pst = pst.deref();
}

/**
 * This processes a sort expression in the context of an encoded sort
 * taxonomy. Given the current sort context, it compiles it, evaluates
 * it, and prints out the resulting maximal (possibly disjunctive) sort
 * matching the resulting sort code.  If in timing mode, it also reports
 * the processing time in milliseconds.
 */
void processSortExpression (SortExpression expression)
{
  try
    {
      time = System.currentTimeMillis();
      displayLine(// "*** " +
		  (Context.isTracing()
		   ? (expression.displayForm() +
		      // " => "+expression.bitcode().toBitString() +
		      " >= ")
		   : "") +
		  // expression.maxLowerBound());
		  expression.decoded());
      time = System.currentTimeMillis() - time;
      if (Context.isTiming())
	displayLine("*** Processing time = "+time+" ms");
    }
  catch (RuntimeException e)
    {
      logError(new Error().setMsg(e.getMessage()));
    }
}

/* ************************************************************************ */
/* **************************** PRAGMA PROCESSING ************************* */
/* ************************************************************************ */

static boolean isMute, showTree;

static long time;

// etc...

// public final void initialize ()
// {
//   Pragmas.AUTOMATIC = false;
//   // etc ...
// }

/* ************************************************************************ */

/**
 * This calls the method in charge of dispatching which action to take
 * depending on the pragma.  If in timing mode, also reports the
 * processing time in milliseconds.
 */
final void processPragma (String pragma, Stack args)
{
  time = System.currentTimeMillis();
  executePragma(pragma,args);
  time = System.currentTimeMillis() - time;
  if (Context.isTiming())
    displayLine("*** %"+pragma+" pragma processing time = "+time+" ms");
}

/**
 * This is the method in charge of dispatching which action to execute
 * for which pragma.
 */
final void executePragma (String pragma, Stack args)
{
  setLocation();

  if (pragma == "exit")
    HootMain.exit();

  if (pragma == "eval")
    {
      PsiTerm.evaluateSorts(true);
      displayLine("*** Sort expression evaluation has been turned on...");
      return;
    }

  if (pragma == "no-eval")
    {
      PsiTerm.evaluateSorts(false);
      displayLine("*** Sort expression evaluation has been turned off...");
      return;
    }

  if (pragma == "toggle-eval")
    {
      PsiTerm.toggleSortEvaluation();
      displayLine("*** Sort expression evaluation has been turned "
		  +(PsiTerm.evalSorts() ? "on" : "off")+"...");
      return;
    }

  if (pragma == "include")
    { // This has a bug in that an extra dot at the console is needed to
      // get the prompt.  The origin of this comes from IncludeReader
      // that swallows the IO.EOI at the end of the file being included
      // and as a result the tokenizer's promptIsNeeded returns
      // false. There is no easy way to fix that besides a deep and
      // careful analysis of how the read() method in IncludeReader and
      // the nextToken() nextChar() methods in (Abstract)StreamTokenizer
      // work. For now, keep it as it is. However, when we enter:
      // '%include "foo.hoot". %encode.' on the same line, this works as
      // expected and we get the prompt.
      displayLine(">>> Proceeding to include and process files...");
      includeFiles(args);
      displayLine(">>> Files have been included and processed...");
      return;
    }

  if (pragma == "encode")
    {
      displaySize();
      encodeSorts();
      return;
    }	

  if (pragma == "save")
    {
      saveTaxonomy(args);
      return;
    }	

  if (pragma == "load")
    {
      loadTaxonomy(args);
      return;
    }	

  if (pragma == "enumsize")
    {
      displayLine("*** Sort enumeration size set to "+Decoded.enumSize());
      return;
    }	

  if (pragma == "size")
    {
      displaySize();
      return;
    }	

  if (pragma == "sorts")
    {
      displaySorts();
      return;
    }	

  if (pragma == "last")
    {
      displayLastExpression();
      return;
    }	

  // if (pragma == "height")
  //   {
  //     computeHeight(arg1);
  //     return;
  //   }	

  if (pragma == "cleartags")
    {
      Tag.clearKnownTags();
      displayLine("*** Cleared all known tags");
      return;
    }	

  if (pragma == "clear")
    {
      Tag.clearKnownTags();
      context.reset();
      displayLine("*** The sort taxonomy has been cleared ("+
		  numberOfSorts(context.taxonomy().size())+" defined)");
      return;
    }	

  if (pragma == "parents")
    {
      displayParents((SortExpression)args.get(0));
      return;
    }

  if (pragma == "children")
    {
      displayChildren((SortExpression)args.get(0));
      return;
    }

  if (pragma == "descendants")
    {
      showDescendants((SortExpression)args.get(0));
      return;
    }	

  if (pragma == "ancestors")
    {
      showAncestors((SortExpression)args.get(0));
      return;
    }	

  if (pragma == "mute")
    {
      isMute = !isMute;
      display("Muted output has been turned "+(isMute ? "on" : "off")+"...\n");
      if (isMute) displayLine("*** ...");
      return;
    }

  if (pragma == "tree")
    {
      parseTreeType = (showTree = !showTree) ? COMPACT_TREE : NO_TREE;
      display("Parse tree display has been turned "+(showTree ? "on" : "off")+"...\n");
      return;
    }

  if (pragma == "time")
    {
      Context.toggleTiming();
      displayLine("*** Processing timing has been turned "+(Context.isTiming() ? "on" : "off")+"...");
      return;
    }

  if (pragma == "trace")
    {
      if (isMute)
	{
	  display("Cannot trace evaluation in mute mode; turn mute mode off with '%mute.'");
	  return;
	}
      
      Context.toggleTracing();
      display("Execution tracing has been turned "+(Context.isTracing() ? "on" : "off")+"...\n");
      return;
    }

  if (pragma == "gc")
    {
      display("\n");
      Misc.forceGC(!isMute,dm.getOutputStream());
      return;
    }

  if (pragma == "syntax")
    {
      toggleTrace();
      display("Parser trace has been turned "+(tracingIsOn() ? "on" : "off")+"...\n");
      return;
    }

  if (pragma == "help")
    {
      helpPragma();
      return;
    }

  displayLine("*** Unknown pragma: '%"+pragma+"' (ignored) - type '%help.' for known pragmas.");
}

/* ************************************************************************ */

/**
 * Given a sort expression, this will display its parents in the current
 * taxonomy. 
 */
final void displayParents (SortExpression exp)
{
  try
    {
      // if this is only a sort symbol, just display its parents:
      if (exp.isSymbol())
	{
	  displayParents(context.getSort(((SymbolSortExpression)exp).name()));
	  return;
	}

      // otherwise, evaluate the expression, decode the value, and
      // display its least upper bounds:
      displayLine("*** "+displayForm(context.decode(exp.bitcode()).lubs(),true));
    }
  catch (RuntimeException e)
    {
      logError(new Error().setMsg(e.getMessage()));
    }
}

/* ************************************************************************ */

final void displayParents (Sort sort)
{
  if (sort.isTop())
    displayLine("*** "+dfm.displayTopForm());
  else
    displayLine("*** "+displayForm(sort.parents(),true));
}

/* ************************************************************************ */

/**
 * Given a sort expression, this will display its children in the current
 * taxonomy. 
 */
final void displayChildren (SortExpression exp)
{
  try
    {
      // if this is only a sort symbol, just display its children:
      if (exp.isSymbol())
	{
	  displayChildren(context.getSort(((SymbolSortExpression)exp).name()));
	  return;
	}

      // otherwise, evaluate the expression, decode the value, and
      // display its maximal lower bounds:
      displayLine("*** "+displayForm(context.decode(exp.bitcode()).glbs(),false));
    }
  catch (RuntimeException e)
    {
      logError(new Error().setMsg(e.getMessage()));
    }
}

/* ************************************************************************ */

final void displayChildren (Sort sort)
{
  if (sort.isBottom())
    displayLine("*** "+dfm.displayBottomForm());
  else
    displayLine("*** "+displayForm(sort.children(),false));
}

/* ************************************************************************ */

/**
 * This loads the stack of files whose names are in the specified
 * stack. Each file should contain HOOT declarations or expressions.
 */
final void includeFiles (Stack files)
{
  if (files == null || files.isEmpty())
    {
      logError(syntaxError("missing file arguments in %include pragma",location));
      return;
    }

  while (!files.isEmpty())
    {
      String fileName = (String)files.pop();
      
      try
	{
	  displayLine("*** Reading from file: "+fileName);
	  ((HootTokenizer)input).include(fileName);
	  displayLine(">>> Finished including file: "+fileName);
	}
      catch (FileNotFoundException e)
	{
	  logError(syntaxError("file not found: "+fileName,location));
	}
      catch (CircularInclusionException e)
	{
	  logError(syntaxError("circular file inclusion of file: "+fileName,location));
	}
      catch (RuntimeException e)
	{
	  logError(new Error().setMsg(e.getMessage()));
	}
    }
}

/* ************************************************************************ */

/**
 * This saves the currently encoded taxonomy into the file whose name is
 * in the specified stack.
 */
final void saveTaxonomy (Stack files)
{
  if (files == null || files.isEmpty())
    {
      logError(syntaxError("missing file arguments in %save pragma",location));
      return;
    }

  if (!context.taxonomy().isLocked())
    {
      logError(syntaxError("cannot save a non-encoded taxonomy",location));
      return;
    }

  while (!files.isEmpty())
    {
      String fileName = (String)files.pop();
      displayLine("*** Saving encoded taxonomy into file: "+fileName);

      try
	{
	  context.taxonomy().save(fileName);
	}
      catch (FileNotFoundException e)
	{
	  logError(syntaxError("file not found: "+fileName,location));
	}

      displayLine("*** "+(context.taxonomy().size()-1)+" encoded sorts saved into file: "+fileName);
    }
}

/* ************************************************************************ */

/**
 * This loads an encoded taxonomy from the file whose name is in the
 * specified stack.
 */
final void loadTaxonomy (Stack files)
{
  if (files == null || files.isEmpty())
    {
      logError(syntaxError("missing file arguments in %load pragma",location));
      return;
    }

  if (context.taxonomy().isLocked())
    {
      logError(syntaxError("there is already an encoded taxonomy - use %clear if you wish to load a new taxonomy",location));
      return;
    }

  while (!files.isEmpty())
    {
      String fileName = (String)files.pop();
      displayLine("*** Loading encoded taxonomy from file: "+fileName);

      try
	{
	  context.taxonomy().load(fileName);
	}
      catch (FileNotFoundException e)
	{
	  logError(syntaxError("file not found: "+fileName,location));
	}
      catch (IOException e)
	{
	  logError(syntaxError("IO error while loading: "+fileName,location));
	}

      displayLine("*** "+(context.taxonomy().size()-1)+" encoded sorts loaded from file: "+fileName);
    }
}

/* ************************************************************************ */

void displayLastExpression ()
{
  try
    {
      SortExpression expression = context.lastExpression();
      displayLine("*** "+expression.displayForm()+"  ==>  "+expression.maxLowerBound());      
    }
  catch (RuntimeException e)
    {
      logError(new Error().setMsg(e.getMessage()));
    }
}

/* ************************************************************************ */

// void computeHeight (String sort)
// {
//   try
//     {
//       displayLine("*** The height of "+sort+" is "+context.getSort(sort).height());
//     }
//   catch (RuntimeException e)
//     {
//       logError(new Error().setMsg(e.getMessage()));
//     }
// }

/* ************************************************************************ */

void showAncestors (SortExpression exp)
{
  try
    {
      // if this is only a sort symbol, just display its ancestors:
      if (exp.isSymbol())
	{
	  Sort sort = context.getSort(((SymbolSortExpression)exp).name());
	  displayLine("*** "+displayForm(sort.ancestors(context.taxonomy()),true));
	  return;
	}

      // otherwise, evaluate and decode the expression, and get its ancestors:
      HashSet ancestors = context.decode(exp.bitcode()).ancestors(context.taxonomy());

      displayLine("*** "+displayForm(ancestors,true));
    }
  catch (RuntimeException e)
    {
      logError(new Error().setMsg(e.getMessage()));
    }
}

/* ************************************************************************ */

void showDescendants (SortExpression exp)
{
  try
    {
      // if this is only a sort symbol, just display its descendants:
      if (exp.isSymbol())
	{
	  Sort sort = context.getSort(((SymbolSortExpression)exp).name());
	  displayLine("*** "+displayForm(sort.descendants(context.taxonomy()),false));
	  return;
	}

      // otherwise, evaluate and decode the expression, and get its descendants:
      HashSet descendants = context.decode(exp.bitcode()).descendants(context.taxonomy());

      displayLine("*** "+displayForm(descendants,false));
    }
  catch (RuntimeException e)
    {
      logError(new Error().setMsg(e.getMessage()));
    }
}

/* ************************************************************************ */

String numberOfSorts (int n)
{
  if (n <= 0)
    return "no sort";

  return n + " sort" + (n==1?"":"s");
}

/**
 * This encodes the sorts declared thus far and locks the sort taxonomy;
 * (<i>i.e.</i>, no new sorts may be declared until this taxononmy has
 * been cleared (see the '<tt>%clear</tt>' pragma).
 */
void encodeSorts ()
{
  try
    {
      context.encodeSorts();
      displayLine("*** The sort taxonomy has been encoded ("+
		  numberOfSorts(context.taxonomy().size()-1)+" defined)");
    }
  catch (CyclicSortOrderingException e)
    {
      logError(new Error().setSee("").setMsg(e.getMessage()));
      _criticalError = true;
    }
  catch (RuntimeException e)
    {
      logError(new Error().setMsg(e.getMessage()));
    }
}  

/* ************************************************************************ */

final void helpPragma ()
{
  displayLine("*** Known pragmas (all must be followed by a period - '.'):");
  displayLine("\t------------  ------");
  displayLine("\t      PRAGMA  EFFECT");
  displayLine("\t------------  ------");

  displayLine("\t       %exit  exit session");

  displayLine("\t    %include  read the unclassified ontology from the given file (name specified as a quoted string)");
  displayLine("\t     %encode  classify the current ontology");
  displayLine("\t       %save  save a classified ontology into the given file (name specified as a quoted string)");
  displayLine("\t       %load  read a saved classified ontology from the given file (name specified as a quoted string)");

  displayLine("\t       %size  print the number of symbols in the current sort taxonomy");
  displayLine("\t      %sorts  display the codes of all symbols in current sort taxonomy");
  displayLine("\t    %defined  list all the non-built-in sorts symbols in the current taxonomy");
  displayLine("\t   %builtins  list all the sorts symbols in the current taxonomy");
  displayLine("\t      %clear  erase the codes of all symbols in the current sort taxonomy");

  displayLine("\t       %eval  turn on sort evaluation");
  displayLine("\t    %no-eval  turn off sort evaluation");
  displayLine("\t%toggle-eval  toggle on/off sort evaluation");
  displayLine("\t       %time  toggle on/off execution time reporting");
  displayLine("\t  %automatic  toggle on/off automatic sort encoding");
  displayLine("\t       %mute  toggle on/off intermediate displays");

  displayLine("\t       %last  print the last evaluated sort expression and its maximal lower bound sort(s)");

  displayLine("\t     %height  print the height of the specified sort (size of longest is-a chain from it to {})");
  displayLine("\t      %width  print the size of the widest maximal antichain containing the specified sort");

  displayLine("\t   %children  print the set of maximal strict lower bounds of the specified sort");
  displayLine("\t%descendants  print the set of strict lower bounds of the specified sort");
  displayLine("\t    %parents  print the set of minimal strict upper bounds of the specified sort");
  displayLine("\t  %ancestors  print the set of strict upper bounds of the specified sort");
  displayLine("\t   %enumsize  set number of symbols to display in sort enumerations");


  displayLine("\t        %isa  check whether the first specified sort is a subsort of the second one");

  displayLine("\t       %tree  toggle on/off graphical display of syntax tree");
  displayLine("\t         %gc  force immediate garbage collection");
  displayLine("\t     %syntax  toggle on/off parser tracing");
  displayLine("\t      %trace  toggle on/off evaluation tracing");
  displayLine("\t       %help  list this information");
  newLine();
}

/* ************************************************************************ */
/* ************************** DISPLAY MANAGEMENT ************************** */
/* ************************************************************************ */

/**
 * The display manager.
 */
static DisplayManager dm = context.displayManager();

/**
 * The display form manager.
 */
static DisplayFormManager dfm = dm.displayFormManager();

/* ************************************************************************ */

/**
 * Redirect the output to the specified PrintStream.
 */
public final void setOutputStream (PrintStream stream)
{
  dm.setOutputStream(stream);
}

/* ************************************************************************ */

/**
 * Returns the display form of the given sort.
 */
String displayForm (Sort sort)
{
  return dfm.displaySortForm(sort);
}

/* ************************************************************************ */

/**
 * Returns the display form of set of sorts represented by the specified BitCode.
 */
String displayForm (BitCode sorts)
{
  return dfm.displayForm(sorts,context.taxonomy());
}
/* ************************************************************************ */

/**
 * Returns the display form of the given hash set of sorts.
 */
String displayForm (HashSet sorts, boolean upper)
{
  return dfm.displayForm(sorts,upper);
}


/* ************************************************************************ */

/**
 * Displays the number of declared sorts on the display manager's output stream.
 */
void displaySize ()
{
  try
    {
      displayLine("*** There are "+numberOfSorts(context.taxonomy().size())+" defined");
    }
  catch (RuntimeException e)
    {
      logError(new Error().setMsg(e.getMessage()));
    }
}

/* ************************************************************************ */

/**
 * Displays the declared sorts on the display manager's output stream.
 */
void displaySorts ()
{
  try
    {
      displayLine("*** Declared sorts:");
      context.taxonomy().showSortCodes();
      displayLine("*** "+numberOfSorts(context.taxonomy().size()-1)+" defined");
    }
  catch (RuntimeException e)
    {
      logError(new Error().setMsg(e.getMessage()));
    }
}

/* ************************************************************************ */

/**
 * If not in mute mode, displays the specified string on the display manager's
 * output stream.
 */
final void display (String s)
{
  if (isMute)
    return;

  dm.print(s);
}

/* ************************************************************************ */

/**
 * If not in mute mode, displays the specified string on the display manager's
 * output stream, and ends it with a newline.
 */
static final void displayLine (String s)
{
  if (isMute)
    return;

  dm.println(s);
}

/* ************************************************************************ */

/**
 * Outputs a newline on the display manager's output stream.
 */
final void newLine ()
{
  dm.println();
}


/* ************************************************************************ */
/* *************************** ERROR MANAGEMENT *************************** */
/* ************************************************************************ */

/* ************************************************************************ */

/**
 * This parser's error log.
 */
ErrorLogger errorLogger = context.errorLogger();

/**
 * Records the specified Error in this parser's error log.
 */
final void logError (Error error)
{
  errorLogger.recordError(error);
}

/**
 * When this is true, a context reset is called for upon reporting errors.
 */
private boolean _criticalError = false;

/**
 * When at top level, displays all the errors recorded in the error log
 * and clears it.
 */
void reportErrors ()
{
  if (((HootTokenizer)input).reader.depth() > 0)
    return;

  int size = errorLogger.size();
  int errorNo = 0;
  int warningNo = 0;

  for (int i=0; i<size; i++)
    {
      Error error = errorLogger.getError(i);
      displayLine(error.toString());
      if (error.isWarning())
	warningNo++;
      else
	errorNo++;
    }

  if (warningNo > 0)
    displayLine("*** There "+(warningNo==1 ? "was " : "were ")+warningNo+" warning"+(warningNo>1 ? "s" : ""));
  if (errorNo > 0)
    displayLine("*** There "+(errorNo==1 ? "was " : "were ")+errorNo+" error"+(errorNo>1 ? "s" : ""));

  if (_criticalError)
    {
      displayLine("*** Resetting context...");
      context.reset();
      _criticalError = false;
    }

  errorLogger.clearErrors();
}

/* ************************************************************************ */

/* ************************************************************************ */

/**
 * This is used for recording the location of syntactic constructs in the
 * input stream in order to locate where potential errors occur.
 */
Locatable location;

/* ************************************************************************ */

/**
 * Returns a syntax error object with specified message.
 */
final Error syntacticError (String msg)
{
  return new Error().setLabel("Syntax Error: ").setMsg(msg);
}

/* ************************************************************************ */

/**
 * Returns a syntax error object with specified message, and situated
 * as the specifed <tt>Locatable</tt> extent.
 */
final Error syntacticError (String msg, Locatable extent)
{
  return syntacticError(msg).setExtent(extent);
}

/* ************************************************************************ */

/**
 * Returns an evaluation error object with specified message.
 */
final Error evaluationError (String msg)
{
  return new Error().setLabel("Evaluation Error: ").setMsg(msg);
}

/* ************************************************************************ */

/**
 * Returns an evaluation error object with specified message,
 * and situated as the specifed <tt>Locatable</tt> extent.
 */
final Error evaluationError (String msg, Locatable extent)
{
  return evaluationError(msg).setExtent(extent);
}

/* ************************************************************************ */

// /**
//  * This method is used to situate an expression's abstract syntax with respect
//  * to its concrete syntax origin (specified as the given <tt>Locatable</tt>).
//  */
// final Expression locate (Expression e, Locatable l)
// {
//   return e.setExtent(l);
// }

// /**
//  * This method is used to situate an expression's abstract syntax with the
//  * extent of the latest <tt>location</tt>.
//  */
// final Expression locate (Expression e)
// {
//   return e.setExtent(location);
// }

// final Expression locateSymbol (ParseNode node)
// {
//   return locate(symbol(node.svalue()),node);
// }

/* ************************************************************************ */

/**
 * Prints out a prompt if needed for interactive input.
 */
final void prompt ()
{
  ((HootTokenizer)input).prompt();
}

/**
 * Reports errors if any and, if interactive, prompts the user for more
 * input.
 */
final void commitParse ()
{
  reportErrors();
  prompt();
}

/* ************************************************************************ */

/**
 * Sets the location to that of the specified <tt>Locatable</tt>.
 */
final void setLocation (Locatable locatable)
{
  location = locatable;
}

/* ************************************************************************ */

/**
 * Sets the location to that of the current parse node (<i>i.e.</i>, the node
 * currently at the top of the parse stack).
 */
final void setLocation ()
{
  setLocation(currentNode());
}

/* ************************************************************************ */



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

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

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

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

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

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

  final static ParseNode $SORTEXPRESSION_SWITCH$ = new ParseNode(terminals[4]);

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

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

  final static ParseNode $HOOTEXPRESSION_SWITCH$ = new ParseNode(terminals[5]);

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

  public final void parseHootExpression (Reader r) throws IOException
    {
      input.setReader(r);
      errorManager().recoverFromErrors(false);
      setSwitchToken($HOOTEXPRESSION_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 3:
            {
            $head$ = $head$.copy(node($rule$,2));
            break;
            }
          case 4:
            {
            $head$ = $head$.copy(node($rule$,2));
            break;
            }
          case 9:
            {
            commitParse();
            break;
            }
          case 16:
            {
            HootIsaDeclarationStatement $node1$;
                if (node($rule$,1) instanceof HootIsaDeclarationStatement)
                   $node1$ = (HootIsaDeclarationStatement)node($rule$,1);
                 else
                 {
                     $node1$ = new HootIsaDeclarationStatement(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }

        setLocation();
        processIsaDeclaration($node1$.lhs,$node1$.rhs);
            break;
            }
          case 17:
            {
            HootIsaDeclarationStatement $node0$ = new HootIsaDeclarationStatement($head$);
                 $head$ = (HootIsaDeclarationStatement)$node0$;
    HootSortSymbols $node1$;
                if (node($rule$,1) instanceof HootSortSymbols)
                   $node1$ = (HootSortSymbols)node($rule$,1);
                 else
                 {
                     $node1$ = new HootSortSymbols(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }
    HootSortSymbols $node3$;
                if (node($rule$,3) instanceof HootSortSymbols)
                   $node3$ = (HootSortSymbols)node($rule$,3);
                 else
                 {
                     $node3$ = new HootSortSymbols(node($rule$,3));
                     replaceStackNode($rule$,3,$node3$);
                   }

        $node0$.lhs = $node1$.symbols;
        $node0$.rhs = $node3$.symbols;
            break;
            }
          case 19:
            {
            HootSortSymbols $node0$ = new HootSortSymbols($head$);
                 $head$ = (HootSortSymbols)$node0$;

        $node0$.symbols = new Stack();
        $node0$.symbols.push(node($rule$,1).svalue());
            break;
            }
          case 20:
            {
            HootSortSymbols $node0$ = new HootSortSymbols($head$);
                 $head$ = (HootSortSymbols)$node0$;
    HootSortSymbols $node3$;
                if (node($rule$,3) instanceof HootSortSymbols)
                   $node3$ = (HootSortSymbols)node($rule$,3);
                 else
                 {
                     $node3$ = new HootSortSymbols(node($rule$,3));
                     replaceStackNode($rule$,3,$node3$);
                   }

        ($node0$.symbols = $node3$.symbols).push(node($rule$,1).svalue());
            break;
            }
          case 21:
            {
            HootPsiTerm $node1$;
                if (node($rule$,1) instanceof HootPsiTerm)
                   $node1$ = (HootPsiTerm)node($rule$,1);
                 else
                 {
                     $node1$ = new HootPsiTerm(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }

        processPsiTerm($node1$.tag,$node1$.sort,$node1$.keys,$node1$.subterms);
            break;
            }
          case 22:
            {
            HootPsiTerm $node0$ = new HootPsiTerm($head$);
                 $head$ = (HootPsiTerm)$node0$;

        $node0$.tag = node($rule$,1).svalue();
        $node0$.sort = new SymbolSortExpression("@",context);
            break;
            }
          case 23:
            {
            HootPsiTerm $node0$ = new HootPsiTerm($head$);
                 $head$ = (HootPsiTerm)$node0$;
    HootUntaggedPsiTerm $node1$;
                if (node($rule$,1) instanceof HootUntaggedPsiTerm)
                   $node1$ = (HootUntaggedPsiTerm)node($rule$,1);
                 else
                 {
                     $node1$ = new HootUntaggedPsiTerm(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }

        $node0$.sort = $node1$.sort;
        $node0$.keys = $node1$.keys;
        $node0$.subterms = $node1$.subterms;
            break;
            }
          case 24:
            {
            HootPsiTerm $node0$ = new HootPsiTerm($head$);
                 $head$ = (HootPsiTerm)$node0$;
    HootUntaggedPsiTerm $node3$;
                if (node($rule$,3) instanceof HootUntaggedPsiTerm)
                   $node3$ = (HootUntaggedPsiTerm)node($rule$,3);
                 else
                 {
                     $node3$ = new HootUntaggedPsiTerm(node($rule$,3));
                     replaceStackNode($rule$,3,$node3$);
                   }

        $node0$.tag = node($rule$,1).svalue();
        $node0$.sort = $node3$.sort;
        $node0$.keys = $node3$.keys;
        $node0$.subterms = $node3$.subterms;
            break;
            }
          case 25:
            {
            HootUntaggedPsiTerm $node0$ = new HootUntaggedPsiTerm($head$);
                 $head$ = (HootUntaggedPsiTerm)$node0$;
    HootSortExpression $node1$;
                if (node($rule$,1) instanceof HootSortExpression)
                   $node1$ = (HootSortExpression)node($rule$,1);
                 else
                 {
                     $node1$ = new HootSortExpression(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }
    HootBody_opt $node2$;
                if (node($rule$,2) instanceof HootBody_opt)
                   $node2$ = (HootBody_opt)node($rule$,2);
                 else
                 {
                     $node2$ = new HootBody_opt(node($rule$,2));
                     replaceStackNode($rule$,2,$node2$);
                   }

        $node0$.sort = $node1$.expression;
        $node0$.keys = $node2$.keys;
        $node0$.subterms = $node2$.subterms;
            break;
            }
          case 27:
            {
            HootBody_opt $node0$ = new HootBody_opt($head$);
                 $head$ = (HootBody_opt)$node0$;
    HootSubTerms $node2$;
                if (node($rule$,2) instanceof HootSubTerms)
                   $node2$ = (HootSubTerms)node($rule$,2);
                 else
                 {
                     $node2$ = new HootSubTerms(node($rule$,2));
                     replaceStackNode($rule$,2,$node2$);
                   }

        $node0$.keys = $node2$.keys;
        $node0$.subterms = $node2$.subterms;
            break;
            }
          case 28:
            {
            HootSubTerms $node0$ = new HootSubTerms($head$);
                 $head$ = (HootSubTerms)$node0$;
    HootSubTerm $node1$;
                if (node($rule$,1) instanceof HootSubTerm)
                   $node1$ = (HootSubTerm)node($rule$,1);
                 else
                 {
                     $node1$ = new HootSubTerm(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }

        $node0$.keys = new Stack();
        $node0$.keys.push($node1$.key);
        $node0$.subterms = new Stack();
        $node0$.subterms.push($node1$.psiterm);
            break;
            }
          case 29:
            {
            HootSubTerms $node0$ = new HootSubTerms($head$);
                 $head$ = (HootSubTerms)$node0$;
    HootSubTerms $node3$;
                if (node($rule$,3) instanceof HootSubTerms)
                   $node3$ = (HootSubTerms)node($rule$,3);
                 else
                 {
                     $node3$ = new HootSubTerms(node($rule$,3));
                     replaceStackNode($rule$,3,$node3$);
                   }
    HootSubTerm $node1$;
                if (node($rule$,1) instanceof HootSubTerm)
                   $node1$ = (HootSubTerm)node($rule$,1);
                 else
                 {
                     $node1$ = new HootSubTerm(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }

        ($node0$.keys = $node3$.keys).push($node1$.key);
        ($node0$.subterms = $node3$.subterms).push($node1$.psiterm);
            break;
            }
          case 30:
            {
            HootSubTerm $node0$ = new HootSubTerm($head$);
                 $head$ = (HootSubTerm)$node0$;
    HootPsiTerm $node1$;
                if (node($rule$,1) instanceof HootPsiTerm)
                   $node1$ = (HootPsiTerm)node($rule$,1);
                 else
                 {
                     $node1$ = new HootPsiTerm(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }

        $node0$.key = null;
        $node0$.psiterm = new RawPsiTerm($node1$.tag,$node1$.sort,$node1$.keys,$node1$.subterms);
            break;
            }
          case 31:
            {
            HootSubTerm $node0$ = new HootSubTerm($head$);
                 $head$ = (HootSubTerm)$node0$;
    HootFeature $node1$;
                if (node($rule$,1) instanceof HootFeature)
                   $node1$ = (HootFeature)node($rule$,1);
                 else
                 {
                     $node1$ = new HootFeature(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }
    HootPsiTerm $node3$;
                if (node($rule$,3) instanceof HootPsiTerm)
                   $node3$ = (HootPsiTerm)node($rule$,3);
                 else
                 {
                     $node3$ = new HootPsiTerm(node($rule$,3));
                     replaceStackNode($rule$,3,$node3$);
                   }

        $node0$.key = $node1$.feature;
        $node0$.psiterm = new RawPsiTerm($node3$.tag,$node3$.sort,$node3$.keys,$node3$.subterms);
            break;
            }
          case 32:
            {
            HootFeature $node0$ = new HootFeature($head$);
                 $head$ = (HootFeature)$node0$;

        $node0$.feature = Integer.valueOf((int)node($rule$,1).nvalue());
            break;
            }
          case 33:
            {
            HootFeature $node0$ = new HootFeature($head$);
                 $head$ = (HootFeature)$node0$;

        $node0$.feature = node($rule$,1).svalue();
            break;
            }
          case 34:
            {
            HootSortExpression $node0$ = new HootSortExpression($head$);
                 $head$ = (HootSortExpression)$node0$;
    HootConstant $node1$;
                if (node($rule$,1) instanceof HootConstant)
                   $node1$ = (HootConstant)node($rule$,1);
                 else
                 {
                     $node1$ = new HootConstant(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }

        $node0$.expression = new ConstantSortExpression($node1$.constant);
            break;
            }
          case 35:
            {
            HootSortExpression $node0$ = new HootSortExpression($head$);
                 $head$ = (HootSortExpression)$node0$;

        $node0$.expression = new SymbolSortExpression(node($rule$,1).svalue(),context);
            break;
            }
          case 36:
            {
            HootSortExpression $node0$ = new HootSortExpression($head$);
                 $head$ = (HootSortExpression)$node0$;
    HootSortList $node2$;
                if (node($rule$,2) instanceof HootSortList)
                   $node2$ = (HootSortList)node($rule$,2);
                 else
                 {
                     $node2$ = new HootSortList(node($rule$,2));
                     replaceStackNode($rule$,2,$node2$);
                   }

        $node0$.expression = new DisjunctiveSort($node2$.sortList,context);
            break;
            }
          case 37:
            {
            HootSortExpression $node0$ = new HootSortExpression($head$);
                 $head$ = (HootSortExpression)$node0$;
    HootSortExpression $node2$;
                if (node($rule$,2) instanceof HootSortExpression)
                   $node2$ = (HootSortExpression)node($rule$,2);
                 else
                 {
                     $node2$ = new HootSortExpression(node($rule$,2));
                     replaceStackNode($rule$,2,$node2$);
                   }

        $node0$.expression = new NotSortExpression($node2$.expression);
            break;
            }
          case 38:
            {
            HootSortExpression $node0$ = new HootSortExpression($head$);
                 $head$ = (HootSortExpression)$node0$;
    HootSortExpression $node1$;
                if (node($rule$,1) instanceof HootSortExpression)
                   $node1$ = (HootSortExpression)node($rule$,1);
                 else
                 {
                     $node1$ = new HootSortExpression(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }
    HootSortExpression $node3$;
                if (node($rule$,3) instanceof HootSortExpression)
                   $node3$ = (HootSortExpression)node($rule$,3);
                 else
                 {
                     $node3$ = new HootSortExpression(node($rule$,3));
                     replaceStackNode($rule$,3,$node3$);
                   }

        $node0$.expression = new AndSortExpression($node1$.expression,$node3$.expression);
            break;
            }
          case 39:
            {
            HootSortExpression $node0$ = new HootSortExpression($head$);
                 $head$ = (HootSortExpression)$node0$;
    HootSortExpression $node1$;
                if (node($rule$,1) instanceof HootSortExpression)
                   $node1$ = (HootSortExpression)node($rule$,1);
                 else
                 {
                     $node1$ = new HootSortExpression(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }
    HootSortExpression $node3$;
                if (node($rule$,3) instanceof HootSortExpression)
                   $node3$ = (HootSortExpression)node($rule$,3);
                 else
                 {
                     $node3$ = new HootSortExpression(node($rule$,3));
                     replaceStackNode($rule$,3,$node3$);
                   }

        $node0$.expression = new OrSortExpression($node1$.expression,$node3$.expression);
            break;
            }
          case 40:
            {
            HootSortExpression $node0$ = new HootSortExpression($head$);
                 $head$ = (HootSortExpression)$node0$;
    HootSortExpression $node1$;
                if (node($rule$,1) instanceof HootSortExpression)
                   $node1$ = (HootSortExpression)node($rule$,1);
                 else
                 {
                     $node1$ = new HootSortExpression(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }
    HootSortExpression $node3$;
                if (node($rule$,3) instanceof HootSortExpression)
                   $node3$ = (HootSortExpression)node($rule$,3);
                 else
                 {
                     $node3$ = new HootSortExpression(node($rule$,3));
                     replaceStackNode($rule$,3,$node3$);
                   }

        $node0$.expression = new ButnotSortExpression($node1$.expression,$node3$.expression);
            break;
            }
          case 41:
            {
            HootSortExpression $node0$ = new HootSortExpression($head$);
                 $head$ = (HootSortExpression)$node0$;
    HootSortExpression $node2$;
                if (node($rule$,2) instanceof HootSortExpression)
                   $node2$ = (HootSortExpression)node($rule$,2);
                 else
                 {
                     $node2$ = new HootSortExpression(node($rule$,2));
                     replaceStackNode($rule$,2,$node2$);
                   }

        $node0$.expression = $node2$.expression.setParenthesized(true);
            break;
            }
          case 42:
            {
            HootConstant $node0$ = new HootConstant($head$);
                 $head$ = (HootConstant)$node0$;
 $node0$.constant = new IntegerConstant((int)node($rule$,1).nvalue());
            break;
            }
          case 43:
            {
            HootConstant $node0$ = new HootConstant($head$);
                 $head$ = (HootConstant)$node0$;
 $node0$.constant = new CharConstant(node($rule$,1).svalue().charAt(0));
            break;
            }
          case 44:
            {
            HootConstant $node0$ = new HootConstant($head$);
                 $head$ = (HootConstant)$node0$;
 $node0$.constant = new FloatConstant(node($rule$,1).nvalue());
            break;
            }
          case 45:
            {
            HootConstant $node0$ = new HootConstant($head$);
                 $head$ = (HootConstant)$node0$;
 $node0$.constant = new StringConstant(node($rule$,1).svalue());
            break;
            }
          case 46:
            {
            HootConstant $node0$ = new HootConstant($head$);
                 $head$ = (HootConstant)$node0$;
 $node0$.constant = new BooleanConstant(node($rule$,1).svalue() == "true" ? true : false);
            break;
            }
          case 50:
            {
            HootSortList $node0$ = new HootSortList($head$);
                 $head$ = (HootSortList)$node0$;

        ($node0$.sortList = new Stack()).push(node($rule$,1).svalue());
            break;
            }
          case 51:
            {
            HootSortList $node0$ = new HootSortList($head$);
                 $head$ = (HootSortList)$node0$;
    HootSortList $node3$;
                if (node($rule$,3) instanceof HootSortList)
                   $node3$ = (HootSortList)node($rule$,3);
                 else
                 {
                     $node3$ = new HootSortList(node($rule$,3));
                     replaceStackNode($rule$,3,$node3$);
                   }

        ($node0$.sortList = $node3$.sortList).push(node($rule$,1).svalue());
            break;
            }
          case 52:
            {
            setLocation();
        helpPragma();
            break;
            }
          case 53:
            {
            setLocation();
        HootMain.exit();
            break;
            }
          case 54:
            {
            HootFileList $node2$;
                if (node($rule$,2) instanceof HootFileList)
                   $node2$ = (HootFileList)node($rule$,2);
                 else
                 {
                     $node2$ = new HootFileList(node($rule$,2));
                     replaceStackNode($rule$,2,$node2$);
                   }

        setLocation();
        includeFiles($node2$.files);
            break;
            }
          case 55:
            {
            setLocation();
        displaySize();
        encodeSorts();
            break;
            }
          case 56:
            {
            setLocation();
        PsiTerm.evaluateSorts(true);
        displayLine("*** Sort expression evaluation has been turned on...");
            break;
            }
          case 57:
            {
            setLocation();
        displaySorts();
            break;
            }
          case 58:
            {
            setLocation();
        // to do
            break;
            }
          case 59:
            {
            setLocation();
            break;
            }
          case 60:
            {
            setLocation();
        isMute = !isMute;
        display("Muted output has been turned "+(isMute ? "on" : "off")+"...\n");
        if (isMute) displayLine("*** ...");
            break;
            }
          case 61:
            {
            setLocation();
        displaySize();
            break;
            }
          case 62:
            {
            setLocation();
        // to do
            break;
            }
          case 63:
            {
            setLocation();
        // to do
            break;
            }
          case 64:
            {
            HootSortExpression $node2$;
                if (node($rule$,2) instanceof HootSortExpression)
                   $node2$ = (HootSortExpression)node($rule$,2);
                 else
                 {
                     $node2$ = new HootSortExpression(node($rule$,2));
                     replaceStackNode($rule$,2,$node2$);
                   }

        setLocation();
        displayChildren($node2$.expression);
            break;
            }
          case 65:
            {
            HootSortExpression $node2$;
                if (node($rule$,2) instanceof HootSortExpression)
                   $node2$ = (HootSortExpression)node($rule$,2);
                 else
                 {
                     $node2$ = new HootSortExpression(node($rule$,2));
                     replaceStackNode($rule$,2,$node2$);
                   }

        setLocation();
        showDescendants($node2$.expression);
            break;
            }
          case 66:
            {
            HootSortExpression $node2$;
                if (node($rule$,2) instanceof HootSortExpression)
                   $node2$ = (HootSortExpression)node($rule$,2);
                 else
                 {
                     $node2$ = new HootSortExpression(node($rule$,2));
                     replaceStackNode($rule$,2,$node2$);
                   }

        setLocation();
        displayParents($node2$.expression);
            break;
            }
          case 67:
            {
            HootSortExpression $node2$;
                if (node($rule$,2) instanceof HootSortExpression)
                   $node2$ = (HootSortExpression)node($rule$,2);
                 else
                 {
                     $node2$ = new HootSortExpression(node($rule$,2));
                     replaceStackNode($rule$,2,$node2$);
                   }

        setLocation();
        showAncestors($node2$.expression);
            break;
            }
          case 68:
            {
            setLocation();
        Decoded.setEnumSize((int)node($rule$,2).nvalue());
            break;
            }
          case 69:
            {
            setLocation();
        // to do
            break;
            }
          case 70:
            {
            setLocation();
        Tag.clearKnownTags();
        context.reset();
        displayLine("*** The sort taxonomy has been cleared ("+
  	  	    numberOfSorts(context.taxonomy().size())+" defined)");
            break;
            }
          case 71:
            {
            setLocation();
        parseTreeType = (showTree = !showTree) ? COMPACT_TREE : NO_TREE;
        display("Parse tree display has been turned "+(showTree ? "on" : "off")+"...\n");
            break;
            }
          case 72:
            {
            setLocation();
        Context.toggleTiming();
        displayLine("*** Processing timing has been turned "+(Context.isTiming() ? "on" : "off")+"...");
            break;
            }
          case 73:
            {
            setLocation();
        display("\n");
        Misc.forceGC(!isMute,dm.getOutputStream());
            break;
            }
          case 74:
            {
            setLocation();
        toggleTrace();
        display("Parser trace has been turned "+(tracingIsOn() ? "on" : "off")+"...\n");
            break;
            }
          case 75:
            {
            setLocation();
        if (isMute)
  	  {
  	    display("Cannot trace evaluation in mute mode; turn mute mode off with '%mute.'");
  	    break;
  	  }
        Context.toggleTracing();
        display("Execution tracing has been turned "+(Context.isTracing() ? "on" : "off")+"...\n");
            break;
            }
          case 76:
            {
            setLocation();
        displayLine("*** Unknown pragma (ignored) - type '%help.' for known pragmas.");
        //      displayLine("*** Unknown pragma: '%"+pragma+"' (ignored) - type '%help.' for known pragmas.");
            break;
            }
          case 77:
            {
            HootFileList $node0$ = new HootFileList($head$);
                 $head$ = (HootFileList)$node0$;

        ($node0$.files = new Stack()).push(node($rule$,1).svalue());
            break;
            }
          case 78:
            {
            HootFileList $node0$ = new HootFileList($head$);
                 $head$ = (HootFileList)$node0$;
    HootFileList $node2$;
                if (node($rule$,2) instanceof HootFileList)
                   $node2$ = (HootFileList)node($rule$,2);
                 else
                 {
                     $node2$ = new HootFileList(node($rule$,2));
                     replaceStackNode($rule$,2,$node2$);
                   }

        ($node0$.files = $node2$.files).push(node($rule$,1).svalue());
            break;
            }
          case 0: case 1: case 6: case 11: case 26: 
            break;
          default:
            $head$ = $head$.copy(node($rule$,1));
            break;
        }
      return $head$;
    }

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

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

      newTerminal(0,"$EMPTY$",1,2);
      newTerminal(1,"$E_O_I$",1,2);
      newTerminal(2,"error",1,2);
      newTerminal(3,"$HootProgram_switch$",1,2);
      newTerminal(4,"$SortExpression_switch$",1,2);
      newTerminal(5,"$HootExpression_switch$",1,2);
      newTerminal(6,"EOS",1,2);
      newTerminal(7,"IDENTIFIER",11,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "identifier" attributes = { value = $VALUE } ]
        terminals[7].setXmlInfo(new XmlInfo("identifier","hoot"));
        XmlAttributeInfo[] xmlAttributes = new XmlAttributeInfo[1];
        xmlAttributes[0] = new XmlAttributeInfo("value");
        terminals[7].addXmlInfo(xmlAttributes);
      }
      newTerminal(8,"STRING",11,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "constant" attributes = { sort = "string" value = $VALUE } ]
        terminals[8].setXmlInfo(new XmlInfo("constant","hoot"));
        XmlAttributeInfo[] xmlAttributes = new XmlAttributeInfo[2];
        xmlAttributes[0] = XmlAttributeInfo.literalXmlAttributeInfo("sort","string");
        xmlAttributes[1] = new XmlAttributeInfo("value");
        terminals[8].addXmlInfo(xmlAttributes);
      }
      newTerminal(9,"TOP",11,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "sort" attributes = { symbol = "*TOP*" } ]
        terminals[9].setXmlInfo(new XmlInfo("sort","hoot"));
        XmlAttributeInfo[] xmlAttributes = new XmlAttributeInfo[1];
        xmlAttributes[0] = XmlAttributeInfo.literalXmlAttributeInfo("symbol","*TOP*");
        terminals[9].addXmlInfo(xmlAttributes);
      }
      newTerminal(10,"BOTTOM",11,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "sort" attributes = { symbol = "*BOTTOM*" } ]
        terminals[10].setXmlInfo(new XmlInfo("sort","hoot"));
        XmlAttributeInfo[] xmlAttributes = new XmlAttributeInfo[1];
        xmlAttributes[0] = XmlAttributeInfo.literalXmlAttributeInfo("symbol","*BOTTOM*");
        terminals[10].addXmlInfo(xmlAttributes);
      }
      newTerminal(11,"TAG",11,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "tag" attributes = { value = $VALUE } ]
        terminals[11].setXmlInfo(new XmlInfo("tag","hoot"));
        XmlAttributeInfo[] xmlAttributes = new XmlAttributeInfo[1];
        xmlAttributes[0] = new XmlAttributeInfo("value");
        terminals[11].addXmlInfo(xmlAttributes);
      }
      newTerminal(12,"INTEGER",11,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "constant" attributes = { sort = "integer" value = $VALUE } ]
        terminals[12].setXmlInfo(new XmlInfo("constant","hoot"));
        XmlAttributeInfo[] xmlAttributes = new XmlAttributeInfo[2];
        xmlAttributes[0] = XmlAttributeInfo.literalXmlAttributeInfo("sort","integer");
        xmlAttributes[1] = new XmlAttributeInfo("value");
        terminals[12].addXmlInfo(xmlAttributes);
      }
      newTerminal(13,"CHAR",11,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "constant" attributes = { sort = "char" value = $VALUE } ]
        terminals[13].setXmlInfo(new XmlInfo("constant","hoot"));
        XmlAttributeInfo[] xmlAttributes = new XmlAttributeInfo[2];
        xmlAttributes[0] = XmlAttributeInfo.literalXmlAttributeInfo("sort","char");
        xmlAttributes[1] = new XmlAttributeInfo("value");
        terminals[13].addXmlInfo(xmlAttributes);
      }
      newTerminal(14,"FLOAT",11,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "constant" attributes = { sort = "float" value = $VALUE } ]
        terminals[14].setXmlInfo(new XmlInfo("constant","hoot"));
        XmlAttributeInfo[] xmlAttributes = new XmlAttributeInfo[2];
        xmlAttributes[0] = XmlAttributeInfo.literalXmlAttributeInfo("sort","float");
        xmlAttributes[1] = new XmlAttributeInfo("value");
        terminals[14].addXmlInfo(xmlAttributes);
      }
      newTerminal(15,"BOOLEAN",11,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "constant" attributes = { sort = "boolean" value = $VALUE } ]
        terminals[15].setXmlInfo(new XmlInfo("constant","hoot"));
        XmlAttributeInfo[] xmlAttributes = new XmlAttributeInfo[2];
        xmlAttributes[0] = XmlAttributeInfo.literalXmlAttributeInfo("sort","boolean");
        xmlAttributes[1] = new XmlAttributeInfo("value");
        terminals[15].addXmlInfo(xmlAttributes);
      }
      newTerminal(16,"EXIT_PRAGMA",21,2);
      newTerminal(17,"HELP_PRAGMA",21,2);
      newTerminal(18,"INCLUDE_PRAGMA",21,2);
      newTerminal(19,"ENCODE_PRAGMA",21,2);
      newTerminal(20,"EVAL_PRAGMA",21,2);
      newTerminal(21,"SORTS_PRAGMA",21,2);
      newTerminal(22,"DEFINED_PRAGMA",21,2);
      newTerminal(23,"SYMBOLS_PRAGMA",21,2);
      newTerminal(24,"MUTE_PRAGMA",21,2);
      newTerminal(25,"SIZE_PRAGMA",21,2);
      newTerminal(26,"HEIGHT_PRAGMA",21,2);
      newTerminal(27,"WIDTH_PRAGMA",21,2);
      newTerminal(28,"CHILDREN_PRAGMA",21,2);
      newTerminal(29,"DESCENDANTS_PRAGMA",21,2);
      newTerminal(30,"PARENTS_PRAGMA",21,2);
      newTerminal(31,"ANCESTORS_PRAGMA",21,2);
      newTerminal(32,"ENUMSIZE_PRAGMA",21,2);
      newTerminal(33,"ISA_PRAGMA",21,2);
      newTerminal(34,"REFRESH_PRAGMA",21,2);
      newTerminal(35,"TREE_PRAGMA",21,2);
      newTerminal(36,"TIMING_PRAGMA",21,2);
      newTerminal(37,"GC_PRAGMA",21,2);
      newTerminal(38,"SYNTAX_PRAGMA",21,2);
      newTerminal(39,"TRACE_PRAGMA",21,2);
      newTerminal(40,"UNKNOWN_PRAGMA",21,2);
      newTerminal(41,"ARROW",31,2);
      newTerminal(42,"ISA",41,2);
      newTerminal(43,"BUTNOT",51,1);
      newTerminal(44,"OR",61,0);
      newTerminal(45,"AND",71,0);
      newTerminal(46,"NOT",81,1);
      newTerminal(47,",",1,2);
      newTerminal(48,":",1,2);
      newTerminal(49,"(",1,2);
      newTerminal(50,")",1,2);
      newTerminal(51,"{",1,2);
      newTerminal(52,"}",1,2);
      newTerminal(53,";",1,2);
    }

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

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

      newNonTerminal(0,"$START$");
      newNonTerminal(1,"$ROOTS$");
      newNonTerminal(2,"HootProgram");
      newNonTerminal(3,"SortExpression");
      newNonTerminal(4,"HootExpression");
      newNonTerminal(5,"IsaDeclarationStatement");
      newNonTerminal(6,"SortSymbols");
      newNonTerminal(7,"Constant");
      newNonTerminal(8,"SortList");
      newNonTerminal(9,"PsiTerm");
      newNonTerminal(10,"UntaggedPsiTerm");
      newNonTerminal(11,"Body_opt");
      newNonTerminal(12,"SubTerms");
      newNonTerminal(13,"SubTerm");
      newNonTerminal(14,"Feature");
      newNonTerminal(15,"FileList");
      newNonTerminal(16,"Statements_opt");
      newNonTerminal(17,"Statement");
      newNonTerminal(18,"StatementType");
      newNonTerminal(19,"EndOfStatement");
      newNonTerminal(20,"$ACTION0$");
      newNonTerminal(21,"PragmaStatement");
      newNonTerminal(22,"SortDeclarationStatement");
      newNonTerminal(23,"SortSymbol");
      newNonTerminal(24,"Sort");
    }

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

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

      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(1,2,3,1,2);
      rules[4] = new ParserRule(1,2,4,1,2);
      rules[5] = new ParserRule(2,1,5,1,2);
      rules[6] = new ParserRule(16,0,6,1,2);
      rules[7] = new ParserRule(16,2,7,1,2);
      rules[8] = new ParserRule(17,2,8,1,2);
      rules[9] = new ParserRule(20,0,9,1,2);
      rules[10] = new ParserRule(19,2,10,1,2);
      rules[11] = new ParserRule(18,0,11,1,2);
      rules[12] = new ParserRule(18,1,12,1,2);
      rules[13] = new ParserRule(18,1,13,1,2);
      rules[14] = new ParserRule(18,1,14,1,2);
      rules[15] = new ParserRule(18,1,15,1,2);
      rules[16] = new ParserRule(22,1,16,1,2);
      rules[17] = new ParserRule(5,3,17,41,2);
      rules[18] = new ParserRule(23,1,18,11,2);
      rules[19] = new ParserRule(6,1,19,1,2);
      rules[20] = new ParserRule(6,3,20,1,2);
      rules[21] = new ParserRule(4,1,21,1,2);
      rules[22] = new ParserRule(9,1,22,11,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "term" attributes = { tag = 1/value } ]
        rules[22].setXmlInfo(new XmlInfo("term","hoot"));
        XmlAttributeInfo[] xmlAttributes = new XmlAttributeInfo[1];
        xmlAttributes[0] = XmlAttributeInfo.refXmlAttributeInfo("tag","value");
        xmlAttributes[0].setChild(1);
        rules[22].addXmlInfo(xmlAttributes);
      }
      rules[23] = new ParserRule(9,1,23,1,2);
      rules[24] = new ParserRule(9,3,24,1,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "term" attributes = { tag = 1/value } children = ( 3[0] ) ]
        rules[24].setXmlInfo(new XmlInfo("term","hoot"));
        XmlAttributeInfo[] xmlAttributes = new XmlAttributeInfo[1];
        xmlAttributes[0] = XmlAttributeInfo.refXmlAttributeInfo("tag","value");
        xmlAttributes[0].setChild(1);
        rules[24].addXmlInfo(xmlAttributes);
        int[] xmlChildren = {3};
        rules[24].addXmlInfo(xmlChildren);
          {
             int[][] paths = new int[1][];
             int[] path;
             path = new int[1];
             path[0] = 0;
             paths[0] = path;
             rules[24].addXmlInfo(paths);
          }
      }
      rules[25] = new ParserRule(10,2,25,1,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "term" children = ( 1 2 ) ]
        rules[25].setXmlInfo(new XmlInfo("term","hoot"));
        int[] xmlChildren = {1,2};
        rules[25].addXmlInfo(xmlChildren);
      }
      rules[26] = new ParserRule(11,0,26,1,2);
      rules[27] = new ParserRule(11,3,27,1,2);
      rules[28] = new ParserRule(12,1,28,1,2);
      rules[29] = new ParserRule(12,3,29,1,2);
      rules[30] = new ParserRule(13,1,30,1,2);
      rules[31] = new ParserRule(13,3,31,31,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "feature" attributes = { name = 1/value } children = ( 3 ) ]
        rules[31].setXmlInfo(new XmlInfo("feature","hoot"));
        XmlAttributeInfo[] xmlAttributes = new XmlAttributeInfo[1];
        xmlAttributes[0] = XmlAttributeInfo.refXmlAttributeInfo("name","value");
        xmlAttributes[0].setChild(1);
        rules[31].addXmlInfo(xmlAttributes);
        int[] xmlChildren = {3};
        rules[31].addXmlInfo(xmlChildren);
      }
      rules[32] = new ParserRule(14,1,32,11,2);
      rules[33] = new ParserRule(14,1,33,11,2);
      rules[34] = new ParserRule(3,1,34,1,2);
      rules[35] = new ParserRule(3,1,35,1,2);
      rules[36] = new ParserRule(3,3,36,1,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "disjunction" children = ( 2 ) ]
        rules[36].setXmlInfo(new XmlInfo("disjunction","hoot"));
        int[] xmlChildren = {2};
        rules[36].addXmlInfo(xmlChildren);
      }
      rules[37] = new ParserRule(3,2,37,81,1);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "not" children = ( 2 ) ]
        rules[37].setXmlInfo(new XmlInfo("not","hoot"));
        int[] xmlChildren = {2};
        rules[37].addXmlInfo(xmlChildren);
      }
      rules[38] = new ParserRule(3,3,38,71,0);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "and" children = ( 1 3 ) ]
        rules[38].setXmlInfo(new XmlInfo("and","hoot"));
        int[] xmlChildren = {1,3};
        rules[38].addXmlInfo(xmlChildren);
      }
      rules[39] = new ParserRule(3,3,39,61,0);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "or" children = ( 1 3 ) ]
        rules[39].setXmlInfo(new XmlInfo("or","hoot"));
        int[] xmlChildren = {1,3};
        rules[39].addXmlInfo(xmlChildren);
      }
      rules[40] = new ParserRule(3,3,40,51,1);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "butnot" children = ( 1 3 ) ]
        rules[40].setXmlInfo(new XmlInfo("butnot","hoot"));
        int[] xmlChildren = {1,3};
        rules[40].addXmlInfo(xmlChildren);
      }
      rules[41] = new ParserRule(3,3,41,1,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "parenthesis" children = ( 2 ) ]
        rules[41].setXmlInfo(new XmlInfo("parenthesis","hoot"));
        int[] xmlChildren = {2};
        rules[41].addXmlInfo(xmlChildren);
      }
      rules[42] = new ParserRule(7,1,42,11,2);
      rules[43] = new ParserRule(7,1,43,11,2);
      rules[44] = new ParserRule(7,1,44,11,2);
      rules[45] = new ParserRule(7,1,45,11,2);
      rules[46] = new ParserRule(7,1,46,11,2);
      rules[47] = new ParserRule(24,1,47,11,2);
      rules[48] = new ParserRule(24,1,48,11,2);
      rules[49] = new ParserRule(24,1,49,11,2);
      { // Code for XML serialization annotation:
        // [ nsprefix = "hoot" localname = "sort" attributes = { symbol = 1/value } ]
        rules[49].setXmlInfo(new XmlInfo("sort","hoot"));
        XmlAttributeInfo[] xmlAttributes = new XmlAttributeInfo[1];
        xmlAttributes[0] = XmlAttributeInfo.refXmlAttributeInfo("symbol","value");
        xmlAttributes[0].setChild(1);
        rules[49].addXmlInfo(xmlAttributes);
      }
      rules[50] = new ParserRule(8,1,50,1,2);
      rules[51] = new ParserRule(8,3,51,1,2);
      rules[52] = new ParserRule(21,1,52,21,2);
      rules[53] = new ParserRule(21,1,53,21,2);
      rules[54] = new ParserRule(21,2,54,21,2);
      rules[55] = new ParserRule(21,1,55,21,2);
      rules[56] = new ParserRule(21,1,56,21,2);
      rules[57] = new ParserRule(21,1,57,21,2);
      rules[58] = new ParserRule(21,1,58,21,2);
      rules[59] = new ParserRule(21,1,59,21,2);
      rules[60] = new ParserRule(21,1,60,21,2);
      rules[61] = new ParserRule(21,1,61,21,2);
      rules[62] = new ParserRule(21,1,62,21,2);
      rules[63] = new ParserRule(21,1,63,21,2);
      rules[64] = new ParserRule(21,2,64,21,2);
      rules[65] = new ParserRule(21,2,65,21,2);
      rules[66] = new ParserRule(21,2,66,21,2);
      rules[67] = new ParserRule(21,2,67,21,2);
      rules[68] = new ParserRule(21,2,68,11,2);
      rules[69] = new ParserRule(21,3,69,21,2);
      rules[70] = new ParserRule(21,1,70,21,2);
      rules[71] = new ParserRule(21,1,71,21,2);
      rules[72] = new ParserRule(21,1,72,21,2);
      rules[73] = new ParserRule(21,1,73,21,2);
      rules[74] = new ParserRule(21,1,74,21,2);
      rules[75] = new ParserRule(21,1,75,21,2);
      rules[76] = new ParserRule(21,1,76,21,2);
      rules[77] = new ParserRule(15,1,77,11,2);
      rules[78] = new ParserRule(15,2,78,11,2);
    }

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

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

      newAction(0,5,0);
      newAction(1,2,0);
      newAction(2,0,3);
      newAction(3,0,4);
      newAction(4,0,5);
      newAction(5,1,6);
      newAction(6,1,6);
      newAction(7,1,6);
      newAction(8,1,6);
      newAction(9,1,6);
      newAction(10,1,6);
      newAction(11,1,6);
      newAction(12,1,6);
      newAction(13,1,6);
      newAction(14,1,6);
      newAction(15,1,6);
      newAction(16,1,6);
      newAction(17,1,6);
      newAction(18,1,6);
      newAction(19,1,6);
      newAction(20,1,6);
      newAction(21,1,6);
      newAction(22,1,6);
      newAction(23,1,6);
      newAction(24,1,6);
      newAction(25,1,6);
      newAction(26,1,6);
      newAction(27,1,6);
      newAction(28,1,6);
      newAction(29,1,6);
      newAction(30,1,6);
      newAction(31,1,6);
      newAction(32,1,6);
      newAction(33,1,6);
      newAction(34,1,6);
      newAction(35,1,6);
      newAction(36,1,6);
      newAction(37,1,6);
      newAction(38,1,6);
      newAction(39,1,6);
      newAction(40,1,6);
      newAction(41,1,6);
      newAction(42,1,6);
      newAction(43,1,6);
      newAction(44,1,6);
      newAction(45,1,1);
      newAction(46,1,6);
      newAction(47,1,6);
      newAction(48,1,6);
      newAction(49,1,6);
      newAction(50,1,6);
      newAction(51,1,6);
      newAction(52,1,6);
      newAction(53,1,6);
      newAction(54,1,6);
      newAction(55,1,6);
      newAction(56,1,6);
      newAction(57,1,6);
      newAction(58,1,6);
      newAction(59,1,6);
      newAction(60,1,6);
      newAction(61,1,6);
      newAction(62,1,6);
      newAction(63,1,6);
      newAction(64,1,6);
      newAction(65,1,6);
      newAction(66,1,6);
      newAction(67,1,6);
      newAction(68,1,6);
      newAction(69,1,6);
      newAction(70,1,6);
      newAction(71,1,6);
      newAction(72,1,6);
      newAction(73,1,6);
      newAction(74,1,6);
      newAction(75,1,6);
      newAction(76,1,6);
      newAction(77,1,6);
      newAction(78,1,6);
      newAction(79,1,6);
      newAction(80,1,6);
      newAction(81,1,6);
      newAction(82,1,6);
      newAction(83,1,6);
      newAction(84,1,6);
      newAction(85,1,6);
      newAction(86,0,10);
      newAction(87,0,11);
      newAction(88,0,13);
      newAction(89,0,17);
      newAction(90,0,18);
      newAction(91,0,19);
      newAction(92,0,20);
      newAction(93,0,21);
      newAction(94,0,56);
      newAction(95,0,57);
      newAction(96,0,59);
      newAction(97,0,10);
      newAction(98,0,11);
      newAction(99,0,13);
      newAction(100,0,17);
      newAction(101,0,18);
      newAction(102,0,19);
      newAction(103,0,20);
      newAction(104,0,21);
      newAction(105,0,22);
      newAction(106,0,56);
      newAction(107,0,57);
      newAction(108,0,59);
      newAction(109,1,5);
      newAction(110,1,11);
      newAction(111,0,10);
      newAction(112,0,11);
      newAction(113,0,13);
      newAction(114,0,17);
      newAction(115,0,18);
      newAction(116,0,19);
      newAction(117,0,20);
      newAction(118,0,21);
      newAction(119,0,22);
      newAction(120,0,28);
      newAction(121,0,29);
      newAction(122,0,30);
      newAction(123,0,31);
      newAction(124,0,32);
      newAction(125,0,33);
      newAction(126,0,34);
      newAction(127,0,35);
      newAction(128,0,36);
      newAction(129,0,37);
      newAction(130,0,38);
      newAction(131,0,39);
      newAction(132,0,40);
      newAction(133,0,41);
      newAction(134,0,42);
      newAction(135,0,43);
      newAction(136,0,44);
      newAction(137,0,45);
      newAction(138,0,46);
      newAction(139,0,47);
      newAction(140,0,48);
      newAction(141,0,49);
      newAction(142,0,50);
      newAction(143,0,51);
      newAction(144,0,52);
      newAction(145,0,53);
      newAction(146,0,55);
      newAction(147,0,56);
      newAction(148,0,57);
      newAction(149,1,7);
      newAction(150,1,7);
      newAction(151,1,7);
      newAction(152,1,7);
      newAction(153,1,7);
      newAction(154,1,7);
      newAction(155,1,7);
      newAction(156,1,7);
      newAction(157,1,7);
      newAction(158,1,7);
      newAction(159,1,7);
      newAction(160,1,7);
      newAction(161,1,7);
      newAction(162,1,7);
      newAction(163,1,7);
      newAction(164,1,7);
      newAction(165,1,7);
      newAction(166,1,7);
      newAction(167,1,7);
      newAction(168,1,7);
      newAction(169,1,7);
      newAction(170,1,7);
      newAction(171,1,7);
      newAction(172,1,7);
      newAction(173,1,7);
      newAction(174,1,7);
      newAction(175,1,7);
      newAction(176,1,7);
      newAction(177,1,7);
      newAction(178,1,7);
      newAction(179,1,7);
      newAction(180,1,7);
      newAction(181,1,7);
      newAction(182,1,7);
      newAction(183,1,7);
      newAction(184,1,7);
      newAction(185,1,7);
      newAction(186,1,7);
      newAction(187,1,7);
      newAction(188,1,7);
      newAction(189,1,34);
      newAction(190,1,34);
      newAction(191,1,34);
      newAction(192,1,34);
      newAction(193,1,34);
      newAction(194,1,34);
      newAction(195,1,34);
      newAction(196,1,34);
      newAction(197,1,34);
      newAction(198,1,34);
      newAction(199,1,34);
      newAction(200,1,34);
      newAction(201,1,34);
      newAction(202,1,34);
      newAction(203,1,34);
      newAction(204,1,34);
      newAction(205,1,34);
      newAction(206,1,34);
      newAction(207,1,35);
      newAction(208,1,35);
      newAction(209,1,35);
      newAction(210,1,35);
      newAction(211,1,35);
      newAction(212,1,35);
      newAction(213,1,35);
      newAction(214,1,35);
      newAction(215,1,35);
      newAction(216,1,35);
      newAction(217,1,35);
      newAction(218,1,35);
      newAction(219,1,35);
      newAction(220,1,35);
      newAction(221,1,35);
      newAction(222,1,35);
      newAction(223,1,35);
      newAction(224,1,35);
      newAction(225,0,56);
      newAction(226,0,57);
      newAction(227,0,59);
      newAction(228,0,10);
      newAction(229,0,11);
      newAction(230,0,13);
      newAction(231,0,17);
      newAction(232,0,18);
      newAction(233,0,19);
      newAction(234,0,20);
      newAction(235,0,21);
      newAction(236,0,56);
      newAction(237,0,57);
      newAction(238,0,59);
      newAction(239,0,60);
      newAction(240,0,61);
      newAction(241,0,62);
      newAction(242,1,26);
      newAction(243,1,26);
      newAction(244,1,26);
      newAction(245,1,26);
      newAction(246,0,88);
      newAction(247,0,10);
      newAction(248,0,11);
      newAction(249,0,13);
      newAction(250,0,17);
      newAction(251,0,18);
      newAction(252,0,19);
      newAction(253,0,20);
      newAction(254,0,21);
      newAction(255,0,56);
      newAction(256,0,57);
      newAction(257,0,59);
      newAction(258,1,21);
      newAction(259,1,21);
      newAction(260,0,83);
      newAction(261,1,19);
      newAction(262,1,19);
      newAction(263,0,80);
      newAction(264,1,42);
      newAction(265,1,42);
      newAction(266,1,42);
      newAction(267,1,42);
      newAction(268,1,42);
      newAction(269,1,42);
      newAction(270,1,42);
      newAction(271,1,42);
      newAction(272,1,42);
      newAction(273,1,42);
      newAction(274,1,42);
      newAction(275,1,42);
      newAction(276,1,42);
      newAction(277,1,42);
      newAction(278,1,42);
      newAction(279,1,42);
      newAction(280,1,42);
      newAction(281,1,42);
      newAction(282,1,43);
      newAction(283,1,43);
      newAction(284,1,43);
      newAction(285,1,43);
      newAction(286,1,43);
      newAction(287,1,43);
      newAction(288,1,43);
      newAction(289,1,43);
      newAction(290,1,43);
      newAction(291,1,43);
      newAction(292,1,43);
      newAction(293,1,43);
      newAction(294,1,43);
      newAction(295,1,43);
      newAction(296,1,43);
      newAction(297,1,43);
      newAction(298,1,43);
      newAction(299,1,43);
      newAction(300,1,44);
      newAction(301,1,44);
      newAction(302,1,44);
      newAction(303,1,44);
      newAction(304,1,44);
      newAction(305,1,44);
      newAction(306,1,44);
      newAction(307,1,44);
      newAction(308,1,44);
      newAction(309,1,44);
      newAction(310,1,44);
      newAction(311,1,44);
      newAction(312,1,44);
      newAction(313,1,44);
      newAction(314,1,44);
      newAction(315,1,44);
      newAction(316,1,44);
      newAction(317,1,44);
      newAction(318,1,45);
      newAction(319,1,45);
      newAction(320,1,45);
      newAction(321,1,45);
      newAction(322,1,45);
      newAction(323,1,45);
      newAction(324,1,45);
      newAction(325,1,45);
      newAction(326,1,45);
      newAction(327,1,45);
      newAction(328,1,45);
      newAction(329,1,45);
      newAction(330,1,45);
      newAction(331,1,45);
      newAction(332,1,45);
      newAction(333,1,45);
      newAction(334,1,45);
      newAction(335,1,45);
      newAction(336,1,46);
      newAction(337,1,46);
      newAction(338,1,46);
      newAction(339,1,46);
      newAction(340,1,46);
      newAction(341,1,46);
      newAction(342,1,46);
      newAction(343,1,46);
      newAction(344,1,46);
      newAction(345,1,46);
      newAction(346,1,46);
      newAction(347,1,46);
      newAction(348,1,46);
      newAction(349,1,46);
      newAction(350,1,46);
      newAction(351,1,46);
      newAction(352,1,46);
      newAction(353,1,46);
      newAction(354,1,22);
      newAction(355,1,22);
      newAction(356,1,22);
      newAction(357,1,22);
      newAction(358,0,78);
      newAction(359,1,23);
      newAction(360,1,23);
      newAction(361,1,23);
      newAction(362,1,23);
      newAction(363,1,9);
      newAction(364,1,12);
      newAction(365,1,13);
      newAction(366,1,14);
      newAction(367,1,15);
      newAction(368,1,52);
      newAction(369,1,53);
      newAction(370,0,73);
      newAction(371,1,55);
      newAction(372,1,56);
      newAction(373,1,57);
      newAction(374,1,58);
      newAction(375,1,59);
      newAction(376,1,60);
      newAction(377,1,61);
      newAction(378,1,62);
      newAction(379,1,63);
      newAction(380,0,10);
      newAction(381,0,11);
      newAction(382,0,13);
      newAction(383,0,17);
      newAction(384,0,18);
      newAction(385,0,19);
      newAction(386,0,20);
      newAction(387,0,21);
      newAction(388,0,56);
      newAction(389,0,57);
      newAction(390,0,59);
      newAction(391,0,10);
      newAction(392,0,11);
      newAction(393,0,13);
      newAction(394,0,17);
      newAction(395,0,18);
      newAction(396,0,19);
      newAction(397,0,20);
      newAction(398,0,21);
      newAction(399,0,56);
      newAction(400,0,57);
      newAction(401,0,59);
      newAction(402,0,10);
      newAction(403,0,11);
      newAction(404,0,13);
      newAction(405,0,17);
      newAction(406,0,18);
      newAction(407,0,19);
      newAction(408,0,20);
      newAction(409,0,21);
      newAction(410,0,56);
      newAction(411,0,57);
      newAction(412,0,59);
      newAction(413,0,10);
      newAction(414,0,11);
      newAction(415,0,13);
      newAction(416,0,17);
      newAction(417,0,18);
      newAction(418,0,19);
      newAction(419,0,20);
      newAction(420,0,21);
      newAction(421,0,56);
      newAction(422,0,57);
      newAction(423,0,59);
      newAction(424,0,67);
      newAction(425,0,10);
      newAction(426,0,11);
      newAction(427,0,13);
      newAction(428,0,17);
      newAction(429,0,18);
      newAction(430,0,19);
      newAction(431,0,20);
      newAction(432,0,21);
      newAction(433,0,56);
      newAction(434,0,57);
      newAction(435,0,59);
      newAction(436,1,70);
      newAction(437,1,71);
      newAction(438,1,72);
      newAction(439,1,73);
      newAction(440,1,74);
      newAction(441,1,75);
      newAction(442,1,76);
      newAction(443,1,16);
      newAction(444,1,18);
      newAction(445,1,18);
      newAction(446,1,49);
      newAction(447,1,49);
      newAction(448,1,49);
      newAction(449,1,49);
      newAction(450,1,49);
      newAction(451,1,47);
      newAction(452,1,47);
      newAction(453,1,47);
      newAction(454,1,47);
      newAction(455,1,47);
      newAction(456,1,47);
      newAction(457,1,47);
      newAction(458,1,47);
      newAction(459,1,47);
      newAction(460,1,47);
      newAction(461,1,47);
      newAction(462,1,47);
      newAction(463,1,47);
      newAction(464,1,47);
      newAction(465,1,47);
      newAction(466,1,47);
      newAction(467,1,47);
      newAction(468,1,47);
      newAction(469,1,47);
      newAction(470,1,47);
      newAction(471,1,48);
      newAction(472,1,48);
      newAction(473,1,48);
      newAction(474,1,48);
      newAction(475,1,48);
      newAction(476,1,48);
      newAction(477,1,48);
      newAction(478,1,48);
      newAction(479,1,48);
      newAction(480,1,48);
      newAction(481,1,48);
      newAction(482,1,48);
      newAction(483,1,48);
      newAction(484,1,48);
      newAction(485,1,48);
      newAction(486,1,48);
      newAction(487,1,48);
      newAction(488,1,48);
      newAction(489,1,48);
      newAction(490,1,48);
      newAction(491,0,60);
      newAction(492,0,61);
      newAction(493,0,62);
      newAction(494,0,10);
      newAction(495,0,11);
      newAction(496,0,13);
      newAction(497,0,17);
      newAction(498,0,18);
      newAction(499,0,19);
      newAction(500,0,20);
      newAction(501,0,21);
      newAction(502,0,56);
      newAction(503,0,57);
      newAction(504,0,59);
      newAction(505,1,49);
      newAction(506,1,49);
      newAction(507,1,49);
      newAction(508,1,49);
      newAction(509,1,49);
      newAction(510,1,49);
      newAction(511,1,49);
      newAction(512,1,49);
      newAction(513,1,49);
      newAction(514,1,49);
      newAction(515,1,49);
      newAction(516,1,49);
      newAction(517,1,49);
      newAction(518,1,49);
      newAction(519,1,49);
      newAction(520,1,49);
      newAction(521,1,49);
      newAction(522,1,49);
      newAction(523,1,49);
      newAction(524,1,49);
      newAction(525,0,10);
      newAction(526,0,11);
      newAction(527,0,13);
      newAction(528,0,17);
      newAction(529,0,18);
      newAction(530,0,19);
      newAction(531,0,20);
      newAction(532,0,21);
      newAction(533,0,56);
      newAction(534,0,57);
      newAction(535,0,59);
      newAction(536,0,10);
      newAction(537,0,11);
      newAction(538,0,13);
      newAction(539,0,17);
      newAction(540,0,18);
      newAction(541,0,19);
      newAction(542,0,20);
      newAction(543,0,21);
      newAction(544,0,56);
      newAction(545,0,57);
      newAction(546,0,59);
      newAction(547,0,10);
      newAction(548,0,11);
      newAction(549,0,13);
      newAction(550,0,17);
      newAction(551,0,18);
      newAction(552,0,19);
      newAction(553,0,20);
      newAction(554,0,21);
      newAction(555,0,56);
      newAction(556,0,57);
      newAction(557,0,59);
      newAction(558,0,60);
      newAction(559,0,61);
      newAction(560,0,62);
      newAction(561,1,69);
      newAction(562,0,60);
      newAction(563,0,61);
      newAction(564,0,62);
      newAction(565,1,40);
      newAction(566,1,40);
      newAction(567,1,40);
      newAction(568,1,40);
      newAction(569,1,40);
      newAction(570,1,40);
      newAction(571,1,40);
      newAction(572,1,40);
      newAction(573,1,40);
      newAction(574,1,40);
      newAction(575,1,40);
      newAction(576,1,40);
      newAction(577,1,40);
      newAction(578,1,40);
      newAction(579,1,40);
      newAction(580,0,60);
      newAction(581,0,61);
      newAction(582,1,39);
      newAction(583,1,39);
      newAction(584,1,39);
      newAction(585,1,39);
      newAction(586,1,39);
      newAction(587,1,39);
      newAction(588,1,39);
      newAction(589,1,39);
      newAction(590,1,39);
      newAction(591,1,39);
      newAction(592,1,39);
      newAction(593,1,39);
      newAction(594,1,39);
      newAction(595,1,39);
      newAction(596,1,39);
      newAction(597,1,39);
      newAction(598,1,39);
      newAction(599,0,60);
      newAction(600,1,38);
      newAction(601,1,38);
      newAction(602,1,38);
      newAction(603,1,38);
      newAction(604,1,38);
      newAction(605,1,38);
      newAction(606,1,38);
      newAction(607,1,38);
      newAction(608,1,38);
      newAction(609,1,38);
      newAction(610,1,38);
      newAction(611,1,38);
      newAction(612,1,38);
      newAction(613,1,38);
      newAction(614,1,38);
      newAction(615,1,38);
      newAction(616,1,38);
      newAction(617,1,38);
      newAction(618,1,68);
      newAction(619,0,60);
      newAction(620,0,61);
      newAction(621,0,62);
      newAction(622,1,67);
      newAction(623,0,60);
      newAction(624,0,61);
      newAction(625,0,62);
      newAction(626,1,66);
      newAction(627,0,60);
      newAction(628,0,61);
      newAction(629,0,62);
      newAction(630,1,65);
      newAction(631,0,60);
      newAction(632,0,61);
      newAction(633,0,62);
      newAction(634,1,64);
      newAction(635,1,54);
      newAction(636,1,77);
      newAction(637,0,73);
      newAction(638,1,78);
      newAction(639,1,8);
      newAction(640,1,8);
      newAction(641,1,8);
      newAction(642,1,8);
      newAction(643,1,8);
      newAction(644,1,8);
      newAction(645,1,8);
      newAction(646,1,8);
      newAction(647,1,8);
      newAction(648,1,8);
      newAction(649,1,8);
      newAction(650,1,8);
      newAction(651,1,8);
      newAction(652,1,8);
      newAction(653,1,8);
      newAction(654,1,8);
      newAction(655,1,8);
      newAction(656,1,8);
      newAction(657,1,8);
      newAction(658,1,8);
      newAction(659,1,8);
      newAction(660,1,8);
      newAction(661,1,8);
      newAction(662,1,8);
      newAction(663,1,8);
      newAction(664,1,8);
      newAction(665,1,8);
      newAction(666,1,8);
      newAction(667,1,8);
      newAction(668,1,8);
      newAction(669,1,8);
      newAction(670,1,8);
      newAction(671,1,8);
      newAction(672,1,8);
      newAction(673,1,8);
      newAction(674,1,8);
      newAction(675,1,8);
      newAction(676,1,8);
      newAction(677,1,8);
      newAction(678,1,8);
      newAction(679,0,77);
      newAction(680,1,10);
      newAction(681,1,10);
      newAction(682,1,10);
      newAction(683,1,10);
      newAction(684,1,10);
      newAction(685,1,10);
      newAction(686,1,10);
      newAction(687,1,10);
      newAction(688,1,10);
      newAction(689,1,10);
      newAction(690,1,10);
      newAction(691,1,10);
      newAction(692,1,10);
      newAction(693,1,10);
      newAction(694,1,10);
      newAction(695,1,10);
      newAction(696,1,10);
      newAction(697,1,10);
      newAction(698,1,10);
      newAction(699,1,10);
      newAction(700,1,10);
      newAction(701,1,10);
      newAction(702,1,10);
      newAction(703,1,10);
      newAction(704,1,10);
      newAction(705,1,10);
      newAction(706,1,10);
      newAction(707,1,10);
      newAction(708,1,10);
      newAction(709,1,10);
      newAction(710,1,10);
      newAction(711,1,10);
      newAction(712,1,10);
      newAction(713,1,10);
      newAction(714,1,10);
      newAction(715,1,10);
      newAction(716,1,10);
      newAction(717,1,10);
      newAction(718,1,10);
      newAction(719,1,10);
      newAction(720,0,10);
      newAction(721,0,11);
      newAction(722,0,13);
      newAction(723,0,17);
      newAction(724,0,18);
      newAction(725,0,19);
      newAction(726,0,20);
      newAction(727,0,21);
      newAction(728,0,56);
      newAction(729,0,57);
      newAction(730,0,59);
      newAction(731,1,24);
      newAction(732,1,24);
      newAction(733,1,24);
      newAction(734,1,24);
      newAction(735,0,82);
      newAction(736,1,20);
      newAction(737,1,20);
      newAction(738,1,18);
      newAction(739,1,18);
      newAction(740,1,18);
      newAction(741,0,82);
      newAction(742,1,17);
      newAction(743,0,60);
      newAction(744,0,61);
      newAction(745,0,62);
      newAction(746,0,86);
      newAction(747,1,41);
      newAction(748,1,41);
      newAction(749,1,41);
      newAction(750,1,41);
      newAction(751,1,41);
      newAction(752,1,41);
      newAction(753,1,41);
      newAction(754,1,41);
      newAction(755,1,41);
      newAction(756,1,41);
      newAction(757,1,41);
      newAction(758,1,41);
      newAction(759,1,41);
      newAction(760,1,41);
      newAction(761,1,41);
      newAction(762,1,41);
      newAction(763,1,41);
      newAction(764,1,41);
      newAction(765,1,25);
      newAction(766,1,25);
      newAction(767,1,25);
      newAction(768,1,25);
      newAction(769,0,10);
      newAction(770,0,11);
      newAction(771,0,13);
      newAction(772,0,90);
      newAction(773,0,18);
      newAction(774,0,19);
      newAction(775,0,20);
      newAction(776,0,21);
      newAction(777,0,22);
      newAction(778,0,94);
      newAction(779,0,56);
      newAction(780,0,57);
      newAction(781,0,99);
      newAction(782,1,32);
      newAction(783,1,42);
      newAction(784,1,42);
      newAction(785,1,42);
      newAction(786,1,42);
      newAction(787,1,42);
      newAction(788,1,42);
      newAction(789,1,28);
      newAction(790,0,97);
      newAction(791,1,30);
      newAction(792,1,30);
      newAction(793,0,95);
      newAction(794,1,33);
      newAction(795,1,49);
      newAction(796,1,49);
      newAction(797,1,49);
      newAction(798,1,49);
      newAction(799,1,49);
      newAction(800,1,49);
      newAction(801,0,10);
      newAction(802,0,11);
      newAction(803,0,13);
      newAction(804,0,17);
      newAction(805,0,18);
      newAction(806,0,19);
      newAction(807,0,20);
      newAction(808,0,21);
      newAction(809,0,22);
      newAction(810,0,56);
      newAction(811,0,57);
      newAction(812,0,59);
      newAction(813,1,31);
      newAction(814,1,31);
      newAction(815,0,10);
      newAction(816,0,11);
      newAction(817,0,13);
      newAction(818,0,90);
      newAction(819,0,18);
      newAction(820,0,19);
      newAction(821,0,20);
      newAction(822,0,21);
      newAction(823,0,22);
      newAction(824,0,94);
      newAction(825,0,56);
      newAction(826,0,57);
      newAction(827,1,29);
      newAction(828,1,27);
      newAction(829,1,27);
      newAction(830,1,27);
      newAction(831,1,27);
      newAction(832,1,37);
      newAction(833,1,37);
      newAction(834,1,37);
      newAction(835,1,37);
      newAction(836,1,37);
      newAction(837,1,37);
      newAction(838,1,37);
      newAction(839,1,37);
      newAction(840,1,37);
      newAction(841,1,37);
      newAction(842,1,37);
      newAction(843,1,37);
      newAction(844,1,37);
      newAction(845,1,37);
      newAction(846,1,37);
      newAction(847,1,37);
      newAction(848,1,37);
      newAction(849,1,37);
      newAction(850,0,105);
      newAction(851,1,50);
      newAction(852,0,103);
      newAction(853,0,56);
      newAction(854,0,57);
      newAction(855,0,59);
      newAction(856,1,51);
      newAction(857,1,36);
      newAction(858,1,36);
      newAction(859,1,36);
      newAction(860,1,36);
      newAction(861,1,36);
      newAction(862,1,36);
      newAction(863,1,36);
      newAction(864,1,36);
      newAction(865,1,36);
      newAction(866,1,36);
      newAction(867,1,36);
      newAction(868,1,36);
      newAction(869,1,36);
      newAction(870,1,36);
      newAction(871,1,36);
      newAction(872,1,36);
      newAction(873,1,36);
      newAction(874,1,36);
      newAction(875,1,4);
      newAction(876,1,3);
      newAction(877,0,60);
      newAction(878,0,61);
      newAction(879,0,62);
      newAction(880,1,2);
    }

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

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

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

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

  static void initializeActionTables ()
    {
      newActionTables(94);

      newActionTable(0,43);
	setAction(0,1,5);
	setAction(0,2,6);
	setAction(0,3,2);
	setAction(0,4,3);
	setAction(0,5,4);
	setAction(0,6,7);
	setAction(0,7,8);
	setAction(0,8,9);
	setAction(0,9,10);
	setAction(0,10,11);
	setAction(0,11,12);
	setAction(0,12,13);
	setAction(0,13,14);
	setAction(0,14,15);
	setAction(0,15,16);
	setAction(0,16,17);
	setAction(0,17,18);
	setAction(0,18,19);
	setAction(0,19,20);
	setAction(0,20,21);
	setAction(0,21,22);
	setAction(0,22,23);
	setAction(0,23,24);
	setAction(0,24,25);
	setAction(0,25,26);
	setAction(0,26,27);
	setAction(0,27,28);
	setAction(0,28,29);
	setAction(0,29,30);
	setAction(0,30,31);
	setAction(0,31,32);
	setAction(0,32,33);
	setAction(0,33,34);
	setAction(0,34,35);
	setAction(0,35,36);
	setAction(0,36,37);
	setAction(0,37,38);
	setAction(0,38,39);
	setAction(0,39,40);
	setAction(0,40,41);
	setAction(0,46,42);
	setAction(0,49,43);
	setAction(0,51,44);

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

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

      newActionTable(3,40);
	setAction(3,1,46);
	setAction(3,2,47);
	setAction(3,6,48);
	setAction(3,7,49);
	setAction(3,8,50);
	setAction(3,9,51);
	setAction(3,10,52);
	setAction(3,11,53);
	setAction(3,12,54);
	setAction(3,13,55);
	setAction(3,14,56);
	setAction(3,15,57);
	setAction(3,16,58);
	setAction(3,17,59);
	setAction(3,18,60);
	setAction(3,19,61);
	setAction(3,20,62);
	setAction(3,21,63);
	setAction(3,22,64);
	setAction(3,23,65);
	setAction(3,24,66);
	setAction(3,25,67);
	setAction(3,26,68);
	setAction(3,27,69);
	setAction(3,28,70);
	setAction(3,29,71);
	setAction(3,30,72);
	setAction(3,31,73);
	setAction(3,32,74);
	setAction(3,33,75);
	setAction(3,34,76);
	setAction(3,35,77);
	setAction(3,36,78);
	setAction(3,37,79);
	setAction(3,38,80);
	setAction(3,39,81);
	setAction(3,40,82);
	setAction(3,46,83);
	setAction(3,49,84);
	setAction(3,51,85);

      newActionTable(4,11);
	setAction(4,49,88);
	setAction(4,51,86);
	setAction(4,7,96);
	setAction(4,8,92);
	setAction(4,9,94);
	setAction(4,10,95);
	setAction(4,12,89);
	setAction(4,13,90);
	setAction(4,46,87);
	setAction(4,14,91);
	setAction(4,15,93);

      newActionTable(5,12);
	setAction(5,49,99);
	setAction(5,51,97);
	setAction(5,7,108);
	setAction(5,8,103);
	setAction(5,9,106);
	setAction(5,10,107);
	setAction(5,11,105);
	setAction(5,12,100);
	setAction(5,13,101);
	setAction(5,46,98);
	setAction(5,14,102);
	setAction(5,15,104);

      newActionTable(6,40);
	setAction(6,1,109);
	setAction(6,2,120);
	setAction(6,6,110);
	setAction(6,7,146);
	setAction(6,8,117);
	setAction(6,9,147);
	setAction(6,10,148);
	setAction(6,11,119);
	setAction(6,12,114);
	setAction(6,13,115);
	setAction(6,14,116);
	setAction(6,15,118);
	setAction(6,16,122);
	setAction(6,17,121);
	setAction(6,18,123);
	setAction(6,19,124);
	setAction(6,20,125);
	setAction(6,21,126);
	setAction(6,22,127);
	setAction(6,23,128);
	setAction(6,24,129);
	setAction(6,25,130);
	setAction(6,26,131);
	setAction(6,27,132);
	setAction(6,28,133);
	setAction(6,29,134);
	setAction(6,30,135);
	setAction(6,31,136);
	setAction(6,32,137);
	setAction(6,33,138);
	setAction(6,34,139);
	setAction(6,35,140);
	setAction(6,36,141);
	setAction(6,37,142);
	setAction(6,38,143);
	setAction(6,39,144);
	setAction(6,40,145);
	setAction(6,46,112);
	setAction(6,49,113);
	setAction(6,51,111);

      newActionTable(7,40);
	setAction(7,1,149);
	setAction(7,2,150);
	setAction(7,6,151);
	setAction(7,7,152);
	setAction(7,8,153);
	setAction(7,9,154);
	setAction(7,10,155);
	setAction(7,11,156);
	setAction(7,12,157);
	setAction(7,13,158);
	setAction(7,14,159);
	setAction(7,15,160);
	setAction(7,16,161);
	setAction(7,17,162);
	setAction(7,18,163);
	setAction(7,19,164);
	setAction(7,20,165);
	setAction(7,21,166);
	setAction(7,22,167);
	setAction(7,23,168);
	setAction(7,24,169);
	setAction(7,25,170);
	setAction(7,26,171);
	setAction(7,27,172);
	setAction(7,28,173);
	setAction(7,29,174);
	setAction(7,30,175);
	setAction(7,31,176);
	setAction(7,32,177);
	setAction(7,33,178);
	setAction(7,34,179);
	setAction(7,35,180);
	setAction(7,36,181);
	setAction(7,37,182);
	setAction(7,38,183);
	setAction(7,39,184);
	setAction(7,40,185);
	setAction(7,46,186);
	setAction(7,49,187);
	setAction(7,51,188);

      newActionTable(8,18);
	setAction(8,1,189);
	setAction(8,6,190);
	setAction(8,7,191);
	setAction(8,8,192);
	setAction(8,9,193);
	setAction(8,10,194);
	setAction(8,43,199);
	setAction(8,12,195);
	setAction(8,44,200);
	setAction(8,13,196);
	setAction(8,45,201);
	setAction(8,14,197);
	setAction(8,46,202);
	setAction(8,15,198);
	setAction(8,47,203);
	setAction(8,49,204);
	setAction(8,50,205);
	setAction(8,51,206);

      newActionTable(9,18);
	setAction(9,1,207);
	setAction(9,6,208);
	setAction(9,7,209);
	setAction(9,8,210);
	setAction(9,9,211);
	setAction(9,10,212);
	setAction(9,43,217);
	setAction(9,12,213);
	setAction(9,44,218);
	setAction(9,13,214);
	setAction(9,45,219);
	setAction(9,14,215);
	setAction(9,46,220);
	setAction(9,15,216);
	setAction(9,47,221);
	setAction(9,49,222);
	setAction(9,50,223);
	setAction(9,51,224);

      newActionTable(10,3);
	setAction(10,7,227);
	setAction(10,9,225);
	setAction(10,10,226);

      newActionTable(11,8);
	setAction(11,1,242);
	setAction(11,49,246);
	setAction(11,50,245);
	setAction(11,6,243);
	setAction(11,43,241);
	setAction(11,44,240);
	setAction(11,45,239);
	setAction(11,47,244);

      newActionTable(12,2);
	setAction(12,1,258);
	setAction(12,6,259);

      newActionTable(13,1);
	setAction(13,42,260);

      newActionTable(14,3);
	setAction(14,6,261);
	setAction(14,42,262);
	setAction(14,47,263);

      newActionTable(15,18);
	setAction(15,1,264);
	setAction(15,6,265);
	setAction(15,7,266);
	setAction(15,8,267);
	setAction(15,9,268);
	setAction(15,10,269);
	setAction(15,43,274);
	setAction(15,12,270);
	setAction(15,44,275);
	setAction(15,13,271);
	setAction(15,45,276);
	setAction(15,14,272);
	setAction(15,46,277);
	setAction(15,15,273);
	setAction(15,47,278);
	setAction(15,49,279);
	setAction(15,50,280);
	setAction(15,51,281);

      newActionTable(16,18);
	setAction(16,1,282);
	setAction(16,6,283);
	setAction(16,7,284);
	setAction(16,8,285);
	setAction(16,9,286);
	setAction(16,10,287);
	setAction(16,43,292);
	setAction(16,12,288);
	setAction(16,44,293);
	setAction(16,13,289);
	setAction(16,45,294);
	setAction(16,14,290);
	setAction(16,46,295);
	setAction(16,15,291);
	setAction(16,47,296);
	setAction(16,49,297);
	setAction(16,50,298);
	setAction(16,51,299);

      newActionTable(17,18);
	setAction(17,1,300);
	setAction(17,6,301);
	setAction(17,7,302);
	setAction(17,8,303);
	setAction(17,9,304);
	setAction(17,10,305);
	setAction(17,43,310);
	setAction(17,12,306);
	setAction(17,44,311);
	setAction(17,13,307);
	setAction(17,45,312);
	setAction(17,14,308);
	setAction(17,46,313);
	setAction(17,15,309);
	setAction(17,47,314);
	setAction(17,49,315);
	setAction(17,50,316);
	setAction(17,51,317);

      newActionTable(18,18);
	setAction(18,1,318);
	setAction(18,6,319);
	setAction(18,7,320);
	setAction(18,8,321);
	setAction(18,9,322);
	setAction(18,10,323);
	setAction(18,43,328);
	setAction(18,12,324);
	setAction(18,44,329);
	setAction(18,13,325);
	setAction(18,45,330);
	setAction(18,14,326);
	setAction(18,46,331);
	setAction(18,15,327);
	setAction(18,47,332);
	setAction(18,49,333);
	setAction(18,50,334);
	setAction(18,51,335);

      newActionTable(19,18);
	setAction(19,1,336);
	setAction(19,6,337);
	setAction(19,7,338);
	setAction(19,8,339);
	setAction(19,9,340);
	setAction(19,10,341);
	setAction(19,43,346);
	setAction(19,12,342);
	setAction(19,44,347);
	setAction(19,13,343);
	setAction(19,45,348);
	setAction(19,14,344);
	setAction(19,46,349);
	setAction(19,15,345);
	setAction(19,47,350);
	setAction(19,49,351);
	setAction(19,50,352);
	setAction(19,51,353);

      newActionTable(20,5);
	setAction(20,48,358);
	setAction(20,1,354);
	setAction(20,50,357);
	setAction(20,6,355);
	setAction(20,47,356);

      newActionTable(21,4);
	setAction(21,1,359);
	setAction(21,50,362);
	setAction(21,6,360);
	setAction(21,47,361);

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

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

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

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

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

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

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

      newActionTable(29,1);
	setAction(29,8,370);

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

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

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

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

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

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

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

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

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

      newActionTable(39,1);
	setAction(39,12,424);

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

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

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

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

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

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

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

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

      newActionTable(48,7);
	setAction(48,49,450);
	setAction(48,6,446);
	setAction(48,42,444);
	setAction(48,43,447);
	setAction(48,44,448);
	setAction(48,45,449);
	setAction(48,47,445);

      newActionTable(49,20);
	setAction(49,1,451);
	setAction(49,6,452);
	setAction(49,7,453);
	setAction(49,8,454);
	setAction(49,9,455);
	setAction(49,10,456);
	setAction(49,43,461);
	setAction(49,12,457);
	setAction(49,44,462);
	setAction(49,13,458);
	setAction(49,45,463);
	setAction(49,14,459);
	setAction(49,46,464);
	setAction(49,15,460);
	setAction(49,47,465);
	setAction(49,49,466);
	setAction(49,50,467);
	setAction(49,51,468);
	setAction(49,52,469);
	setAction(49,53,470);

      newActionTable(50,20);
	setAction(50,1,471);
	setAction(50,6,472);
	setAction(50,7,473);
	setAction(50,8,474);
	setAction(50,9,475);
	setAction(50,10,476);
	setAction(50,43,481);
	setAction(50,12,477);
	setAction(50,44,482);
	setAction(50,13,478);
	setAction(50,45,483);
	setAction(50,14,479);
	setAction(50,46,484);
	setAction(50,15,480);
	setAction(50,47,485);
	setAction(50,49,486);
	setAction(50,50,487);
	setAction(50,51,488);
	setAction(50,52,489);
	setAction(50,53,490);

      newActionTable(51,14);
	setAction(51,7,504);
	setAction(51,8,500);
	setAction(51,9,502);
	setAction(51,10,503);
	setAction(51,43,493);
	setAction(51,44,492);
	setAction(51,12,497);
	setAction(51,45,491);
	setAction(51,13,498);
	setAction(51,46,495);
	setAction(51,14,499);
	setAction(51,15,501);
	setAction(51,49,496);
	setAction(51,51,494);

      newActionTable(52,20);
	setAction(52,1,505);
	setAction(52,6,506);
	setAction(52,7,507);
	setAction(52,8,508);
	setAction(52,9,509);
	setAction(52,10,510);
	setAction(52,43,515);
	setAction(52,12,511);
	setAction(52,44,516);
	setAction(52,13,512);
	setAction(52,45,517);
	setAction(52,14,513);
	setAction(52,46,518);
	setAction(52,15,514);
	setAction(52,47,519);
	setAction(52,49,520);
	setAction(52,50,521);
	setAction(52,51,522);
	setAction(52,52,523);
	setAction(52,53,524);

      newActionTable(53,4);
	setAction(53,6,561);
	setAction(53,43,560);
	setAction(53,44,559);
	setAction(53,45,558);

      newActionTable(54,18);
	setAction(54,1,565);
	setAction(54,6,566);
	setAction(54,7,567);
	setAction(54,8,568);
	setAction(54,9,569);
	setAction(54,10,570);
	setAction(54,43,564);
	setAction(54,44,563);
	setAction(54,12,571);
	setAction(54,45,562);
	setAction(54,13,572);
	setAction(54,14,573);
	setAction(54,46,575);
	setAction(54,15,574);
	setAction(54,47,576);
	setAction(54,49,577);
	setAction(54,50,578);
	setAction(54,51,579);

      newActionTable(55,18);
	setAction(55,1,582);
	setAction(55,6,583);
	setAction(55,7,584);
	setAction(55,8,585);
	setAction(55,9,586);
	setAction(55,10,587);
	setAction(55,43,592);
	setAction(55,44,593);
	setAction(55,12,588);
	setAction(55,45,580);
	setAction(55,13,589);
	setAction(55,14,590);
	setAction(55,46,594);
	setAction(55,15,591);
	setAction(55,47,595);
	setAction(55,49,596);
	setAction(55,50,597);
	setAction(55,51,598);

      newActionTable(56,18);
	setAction(56,1,600);
	setAction(56,6,601);
	setAction(56,7,602);
	setAction(56,8,603);
	setAction(56,9,604);
	setAction(56,10,605);
	setAction(56,43,610);
	setAction(56,12,606);
	setAction(56,44,611);
	setAction(56,45,612);
	setAction(56,13,607);
	setAction(56,14,608);
	setAction(56,46,613);
	setAction(56,15,609);
	setAction(56,47,614);
	setAction(56,49,615);
	setAction(56,50,616);
	setAction(56,51,617);

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

      newActionTable(58,4);
	setAction(58,6,622);
	setAction(58,43,621);
	setAction(58,44,620);
	setAction(58,45,619);

      newActionTable(59,4);
	setAction(59,6,626);
	setAction(59,43,625);
	setAction(59,44,624);
	setAction(59,45,623);

      newActionTable(60,4);
	setAction(60,6,630);
	setAction(60,43,629);
	setAction(60,44,628);
	setAction(60,45,627);

      newActionTable(61,4);
	setAction(61,6,634);
	setAction(61,43,633);
	setAction(61,44,632);
	setAction(61,45,631);

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

      newActionTable(63,2);
	setAction(63,6,636);
	setAction(63,8,637);

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

      newActionTable(65,40);
	setAction(65,1,639);
	setAction(65,2,640);
	setAction(65,6,641);
	setAction(65,7,642);
	setAction(65,8,643);
	setAction(65,9,644);
	setAction(65,10,645);
	setAction(65,11,646);
	setAction(65,12,647);
	setAction(65,13,648);
	setAction(65,14,649);
	setAction(65,15,650);
	setAction(65,16,651);
	setAction(65,17,652);
	setAction(65,18,653);
	setAction(65,19,654);
	setAction(65,20,655);
	setAction(65,21,656);
	setAction(65,22,657);
	setAction(65,23,658);
	setAction(65,24,659);
	setAction(65,25,660);
	setAction(65,26,661);
	setAction(65,27,662);
	setAction(65,28,663);
	setAction(65,29,664);
	setAction(65,30,665);
	setAction(65,31,666);
	setAction(65,32,667);
	setAction(65,33,668);
	setAction(65,34,669);
	setAction(65,35,670);
	setAction(65,36,671);
	setAction(65,37,672);
	setAction(65,38,673);
	setAction(65,39,674);
	setAction(65,40,675);
	setAction(65,46,676);
	setAction(65,49,677);
	setAction(65,51,678);

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

      newActionTable(67,40);
	setAction(67,1,680);
	setAction(67,2,681);
	setAction(67,6,682);
	setAction(67,7,683);
	setAction(67,8,684);
	setAction(67,9,685);
	setAction(67,10,686);
	setAction(67,11,687);
	setAction(67,12,688);
	setAction(67,13,689);
	setAction(67,14,690);
	setAction(67,15,691);
	setAction(67,16,692);
	setAction(67,17,693);
	setAction(67,18,694);
	setAction(67,19,695);
	setAction(67,20,696);
	setAction(67,21,697);
	setAction(67,22,698);
	setAction(67,23,699);
	setAction(67,24,700);
	setAction(67,25,701);
	setAction(67,26,702);
	setAction(67,27,703);
	setAction(67,28,704);
	setAction(67,29,705);
	setAction(67,30,706);
	setAction(67,31,707);
	setAction(67,32,708);
	setAction(67,33,709);
	setAction(67,34,710);
	setAction(67,35,711);
	setAction(67,36,712);
	setAction(67,37,713);
	setAction(67,38,714);
	setAction(67,39,715);
	setAction(67,40,716);
	setAction(67,46,717);
	setAction(67,49,718);
	setAction(67,51,719);

      newActionTable(68,4);
	setAction(68,1,731);
	setAction(68,50,734);
	setAction(68,6,732);
	setAction(68,47,733);

      newActionTable(69,1);
	setAction(69,7,735);

      newActionTable(70,2);
	setAction(70,6,736);
	setAction(70,42,737);

      newActionTable(71,3);
	setAction(71,6,738);
	setAction(71,42,739);
	setAction(71,47,740);

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

      newActionTable(73,4);
	setAction(73,50,746);
	setAction(73,43,745);
	setAction(73,44,744);
	setAction(73,45,743);

      newActionTable(74,18);
	setAction(74,1,747);
	setAction(74,6,748);
	setAction(74,7,749);
	setAction(74,8,750);
	setAction(74,9,751);
	setAction(74,10,752);
	setAction(74,43,757);
	setAction(74,12,753);
	setAction(74,44,758);
	setAction(74,13,754);
	setAction(74,45,759);
	setAction(74,14,755);
	setAction(74,46,760);
	setAction(74,15,756);
	setAction(74,47,761);
	setAction(74,49,762);
	setAction(74,50,763);
	setAction(74,51,764);

      newActionTable(75,4);
	setAction(75,1,765);
	setAction(75,50,768);
	setAction(75,6,766);
	setAction(75,47,767);

      newActionTable(76,12);
	setAction(76,49,771);
	setAction(76,51,769);
	setAction(76,7,778);
	setAction(76,8,775);
	setAction(76,9,779);
	setAction(76,10,780);
	setAction(76,11,777);
	setAction(76,12,772);
	setAction(76,13,773);
	setAction(76,46,770);
	setAction(76,14,774);
	setAction(76,15,776);

      newActionTable(77,1);
	setAction(77,50,781);

      newActionTable(78,7);
	setAction(78,49,787);
	setAction(78,50,788);
	setAction(78,41,782);
	setAction(78,43,783);
	setAction(78,44,784);
	setAction(78,45,785);
	setAction(78,47,786);

      newActionTable(79,2);
	setAction(79,50,789);
	setAction(79,47,790);

      newActionTable(80,2);
	setAction(80,50,792);
	setAction(80,47,791);

      newActionTable(81,1);
	setAction(81,41,793);

      newActionTable(82,7);
	setAction(82,49,799);
	setAction(82,50,800);
	setAction(82,41,794);
	setAction(82,43,795);
	setAction(82,44,796);
	setAction(82,45,797);
	setAction(82,47,798);

      newActionTable(83,2);
	setAction(83,50,814);
	setAction(83,47,813);

      newActionTable(84,1);
	setAction(84,50,827);

      newActionTable(85,4);
	setAction(85,1,828);
	setAction(85,50,831);
	setAction(85,6,829);
	setAction(85,47,830);

      newActionTable(86,18);
	setAction(86,1,832);
	setAction(86,6,833);
	setAction(86,7,834);
	setAction(86,8,835);
	setAction(86,9,836);
	setAction(86,10,837);
	setAction(86,43,842);
	setAction(86,12,838);
	setAction(86,44,843);
	setAction(86,13,839);
	setAction(86,45,844);
	setAction(86,14,840);
	setAction(86,46,845);
	setAction(86,15,841);
	setAction(86,47,846);
	setAction(86,49,847);
	setAction(86,50,848);
	setAction(86,51,849);

      newActionTable(87,1);
	setAction(87,52,850);

      newActionTable(88,2);
	setAction(88,52,851);
	setAction(88,53,852);

      newActionTable(89,1);
	setAction(89,52,856);

      newActionTable(90,18);
	setAction(90,1,857);
	setAction(90,6,858);
	setAction(90,7,859);
	setAction(90,8,860);
	setAction(90,9,861);
	setAction(90,10,862);
	setAction(90,43,867);
	setAction(90,12,863);
	setAction(90,44,868);
	setAction(90,13,864);
	setAction(90,45,869);
	setAction(90,14,865);
	setAction(90,46,870);
	setAction(90,15,866);
	setAction(90,47,871);
	setAction(90,49,872);
	setAction(90,50,873);
	setAction(90,51,874);

      newActionTable(91,1);
	setAction(91,1,875);

      newActionTable(92,4);
	setAction(92,1,876);
	setAction(92,43,879);
	setAction(92,44,878);
	setAction(92,45,877);

      newActionTable(93,1);
	setAction(93,1,880);

    }

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

  static void initializeGotoTables ()
    {
      newGotoTables(29);

      newGotoTable(0,3);
	setGoto(0,16,6);
	setGoto(0,1,1);
	setGoto(0,2,2);

      newGotoTable(1,0);

      newGotoTable(2,2);
	setGoto(2,16,6);
	setGoto(2,2,108);

      newGotoTable(3,3);
	setGoto(3,3,107);
	setGoto(3,7,8);
	setGoto(3,24,9);

      newGotoTable(4,6);
	setGoto(4,3,12);
	setGoto(4,4,106);
	setGoto(4,7,8);
	setGoto(4,24,9);
	setGoto(4,9,14);
	setGoto(4,10,23);

      newGotoTable(5,13);
	setGoto(5,3,12);
	setGoto(5,4,27);
	setGoto(5,5,54);
	setGoto(5,6,15);
	setGoto(5,7,8);
	setGoto(5,9,14);
	setGoto(5,10,23);
	setGoto(5,17,7);
	setGoto(5,18,24);
	setGoto(5,21,25);
	setGoto(5,22,26);
	setGoto(5,23,16);
	setGoto(5,24,9);

      newGotoTable(6,2);
	setGoto(6,8,101);
	setGoto(6,24,102);

      newGotoTable(7,3);
	setGoto(7,3,100);
	setGoto(7,7,8);
	setGoto(7,24,9);

      newGotoTable(8,1);
	setGoto(8,11,87);

      newGotoTable(9,3);
	setGoto(9,3,85);
	setGoto(9,7,8);
	setGoto(9,24,9);

      newGotoTable(10,2);
	setGoto(10,19,75);
	setGoto(10,20,76);

      newGotoTable(11,1);
	setGoto(11,15,72);

      newGotoTable(12,3);
	setGoto(12,3,71);
	setGoto(12,7,8);
	setGoto(12,24,9);

      newGotoTable(13,3);
	setGoto(13,3,70);
	setGoto(13,7,8);
	setGoto(13,24,9);

      newGotoTable(14,3);
	setGoto(14,3,69);
	setGoto(14,7,8);
	setGoto(14,24,9);

      newGotoTable(15,3);
	setGoto(15,3,68);
	setGoto(15,7,8);
	setGoto(15,24,9);

      newGotoTable(16,3);
	setGoto(16,3,58);
	setGoto(16,7,8);
	setGoto(16,24,9);

      newGotoTable(17,3);
	setGoto(17,3,63);
	setGoto(17,7,8);
	setGoto(17,24,9);

      newGotoTable(18,3);
	setGoto(18,3,66);
	setGoto(18,7,8);
	setGoto(18,24,9);

      newGotoTable(19,3);
	setGoto(19,3,65);
	setGoto(19,7,8);
	setGoto(19,24,9);

      newGotoTable(20,3);
	setGoto(20,3,64);
	setGoto(20,7,8);
	setGoto(20,24,9);

      newGotoTable(21,1);
	setGoto(21,15,74);

      newGotoTable(22,4);
	setGoto(22,3,12);
	setGoto(22,7,8);
	setGoto(22,24,9);
	setGoto(22,10,79);

      newGotoTable(23,2);
	setGoto(23,6,81);
	setGoto(23,23,16);

      newGotoTable(24,2);
	setGoto(24,6,84);
	setGoto(24,23,16);

      newGotoTable(25,8);
	setGoto(25,3,12);
	setGoto(25,7,8);
	setGoto(25,24,9);
	setGoto(25,9,92);
	setGoto(25,10,23);
	setGoto(25,12,89);
	setGoto(25,13,91);
	setGoto(25,14,93);

      newGotoTable(26,5);
	setGoto(26,3,12);
	setGoto(26,7,8);
	setGoto(26,24,9);
	setGoto(26,9,96);
	setGoto(26,10,23);

      newGotoTable(27,8);
	setGoto(27,3,12);
	setGoto(27,7,8);
	setGoto(27,24,9);
	setGoto(27,9,92);
	setGoto(27,10,23);
	setGoto(27,12,98);
	setGoto(27,13,91);
	setGoto(27,14,93);

      newGotoTable(28,2);
	setGoto(28,8,104);
	setGoto(28,24,102);

    }

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

  static void initializeStateTables ()
    {
      setTables(0,0,0);
      setTables(1,1,1);
      setTables(2,2,1);
      setTables(3,3,2);
      setTables(4,4,3);
      setTables(5,5,4);
      setTables(6,6,5);
      setTables(7,7,1);
      setTables(8,8,1);
      setTables(9,9,1);
      setTables(10,10,6);
      setTables(11,4,7);
      setTables(12,11,8);
      setTables(13,4,9);
      setTables(14,12,1);
      setTables(15,13,1);
      setTables(16,14,1);
      setTables(17,15,1);
      setTables(18,16,1);
      setTables(19,17,1);
      setTables(20,18,1);
      setTables(21,19,1);
      setTables(22,20,1);
      setTables(23,21,1);
      setTables(24,22,10);
      setTables(25,23,1);
      setTables(26,24,1);
      setTables(27,25,1);
      setTables(28,26,1);
      setTables(29,27,1);
      setTables(30,28,1);
      setTables(31,29,11);
      setTables(32,30,1);
      setTables(33,31,1);
      setTables(34,32,1);
      setTables(35,33,1);
      setTables(36,34,1);
      setTables(37,35,1);
      setTables(38,36,1);
      setTables(39,37,1);
      setTables(40,38,1);
      setTables(41,4,12);
      setTables(42,4,13);
      setTables(43,4,14);
      setTables(44,4,15);
      setTables(45,39,1);
      setTables(46,4,16);
      setTables(47,40,1);
      setTables(48,41,1);
      setTables(49,42,1);
      setTables(50,43,1);
      setTables(51,44,1);
      setTables(52,45,1);
      setTables(53,46,1);
      setTables(54,47,1);
      setTables(55,48,1);
      setTables(56,49,1);
      setTables(57,50,1);
      setTables(58,51,17);
      setTables(59,52,1);
      setTables(60,4,18);
      setTables(61,4,19);
      setTables(62,4,20);
      setTables(63,53,1);
      setTables(64,54,1);
      setTables(65,55,1);
      setTables(66,56,1);
      setTables(67,57,1);
      setTables(68,58,1);
      setTables(69,59,1);
      setTables(70,60,1);
      setTables(71,61,1);
      setTables(72,62,1);
      setTables(73,63,21);
      setTables(74,64,1);
      setTables(75,65,1);
      setTables(76,66,1);
      setTables(77,67,1);
      setTables(78,4,22);
      setTables(79,68,1);
      setTables(80,69,23);
      setTables(81,70,1);
      setTables(82,71,1);
      setTables(83,69,24);
      setTables(84,72,1);
      setTables(85,73,1);
      setTables(86,74,1);
      setTables(87,75,1);
      setTables(88,76,25);
      setTables(89,77,1);
      setTables(90,78,1);
      setTables(91,79,1);
      setTables(92,80,1);
      setTables(93,81,1);
      setTables(94,82,1);
      setTables(95,5,26);
      setTables(96,83,1);
      setTables(97,76,27);
      setTables(98,84,1);
      setTables(99,85,1);
      setTables(100,86,1);
      setTables(101,87,1);
      setTables(102,88,1);
      setTables(103,10,28);
      setTables(104,89,1);
      setTables(105,90,1);
      setTables(106,91,1);
      setTables(107,92,1);
      setTables(108,93,1);
    }
}

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

class HootIsaDeclarationStatement extends ParseNode 
{
  HootIsaDeclarationStatement (ParseNode node)
    {
      super(node);
    }

  Stack lhs;
  Stack rhs;
}

class HootSortSymbols extends ParseNode 
{
  HootSortSymbols (ParseNode node)
    {
      super(node);
    }

  Stack symbols;
}

class HootSortList extends ParseNode 
{
  HootSortList (ParseNode node)
    {
      super(node);
    }

  Stack sortList;
}

class HootPsiTerm extends HootUntaggedPsiTerm 
{
  HootPsiTerm (ParseNode node)
    {
      super(node);
    }

  String tag;
}

class HootBody_opt extends ParseNode 
{
  HootBody_opt (ParseNode node)
    {
      super(node);
    }

  Stack keys;
  Stack subterms;
}

class HootUntaggedPsiTerm extends HootBody_opt 
{
  HootUntaggedPsiTerm (ParseNode node)
    {
      super(node);
    }

  SortExpression sort;
}

class HootSubTerms extends HootBody_opt 
{
  HootSubTerms (ParseNode node)
    {
      super(node);
    }

  
}

class HootSubTerm extends ParseNode 
{
  HootSubTerm (ParseNode node)
    {
      super(node);
    }

  Object key;
  Object psiterm;
}

class HootFeature extends ParseNode 
{
  HootFeature (ParseNode node)
    {
      super(node);
    }

  Object feature;
}

class HootFileList extends ParseNode 
{
  HootFileList (ParseNode node)
    {
      super(node);
    }

  Stack files;
}



/* ************************************************************************ */
/* ************************* END OF GRAMMAR RULES ************************* */
/* ************************************************************************ */

/* ************************************************************************ */
/* ******************************* UTILITIES ****************************** */
/* ************************************************************************ */

class RawPsiTerm
  {
    String tag;
    SortExpression sort;
    Stack keys;
    Stack subterms;

    RawPsiTerm (String tag, SortExpression sort, Stack keys, Stack subterms)
      {
	this.tag = tag;
	this.sort = sort;
	this.keys = keys;
	this.subterms = subterms;
      }
  }

/* ************************************************************************ */
/* ***************************** END  OF  GRAMMAR ************************* */
/* ************************************************************************ */

/* ************************************************************************ */


