// *******************************************************************
// This file has been automatically generated from the grammar in file
// OsfV1.grm by hlt.language.syntax.ParserGenerator on
// Sun Sep 15 13:34:58 CEST 2013 --- !!! PLEASE DO NO EDIT !!!
// *******************************************************************

package hlt.osf.v1;

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 OsfV1Parser extends StaticParser
{
  /* ************************ */
  /* PARSER CLASS CONSTRUCTOR */
  /* ************************ */

  public OsfV1Parser (Tokenizer t)
    {
      input = t;
      xmlroot = "OsfV1Program";
    }

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


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

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

/**
 * This is the OSF 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 (ArrayList lhs, ArrayList 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 ************************ */
/* ************************************************************************ */

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

/**
 * This builds an uninterpreted &psi;-term structure out of the
 * syntactic parts given as arguments as explained in the <a
 * href="#pstconstruc">specification</a>, then interprets its sort
 * expressions in the current context and prints out its interpreted
 * normalized form.
 */
void processPsiTerm (String tag, SortExpression sort, Stack keys, Stack subterms)
{
  PsiTerm pst = buildPsiTerm(new HashSet(),Tag.getTag(tag),sort,keys,subterms);
  try
    {
      time = System.currentTimeMillis();
      displayLine("*** "+pst.displayForm(4)); // margin is 4 to account for "*** "
      // Tag.tallyTags();	// show known tags
      Tag.clearKnownTags();	// clear the tags
      time = System.currentTimeMillis() - time;
      if (Context.isTiming())
	displayLine("*** Processing time = "+time+" ms");
    }
  catch (RuntimeException e)
    {
      logError(new Error().setMsg(e.getMessage()));
    }
}

/**
 * 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.value().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 of the pragma.  If in timing mode, also reports the
 * processing time in milliseconds.
 */
final void processPragma (String pragma, ArrayList 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, ArrayList args)
{
  setLocation();

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

  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.osf". %encode.' on the same line, this works as
      // expected and we get the prompt.
      includeFiles((Stack)args);
      return;
    }

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

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

  if (pragma == "load")
    {
      loadTaxonomy((Stack)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 ("+
		  (context.taxonomy().size())+" sorts 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 == "evaluate")
    {
      PsiTerm.toggleSortEvaluation();
      if (!isMute)
	display("Sort expression evaluation has been turned "
	       +(PsiTerm.evaluateSorts() ? "on" : "off")+"...\n");
      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.decodedValue(exp.value()).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.decodedValue(exp.value()).mlbs(),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 OSF V1 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);
	  ((OsfV1Tokenizer)input).include(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(),true));
	  return;
	}

      // otherwise, evaluate and decode the expression, and get its ancestors:
      HashSet ancestors = context.decodedValue(exp.value()).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(),false));
	  return;
	}

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

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

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

/**
 * 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 ("+
		  (context.taxonomy().size()-1)+" sorts 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   %evaluate  toggle on/off automatic 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 strinct 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.displaySortsForm(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 "+context.taxonomy().size()+" sorts 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("*** "+(context.taxonomy().size()-1)+" sorts 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 (((OsfV1Tokenizer)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 ()
{
  ((OsfV1Tokenizer)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 $OSFV1PROGRAM_SWITCH$ = new ParseNode(terminals[3]);

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

  public final void parseOsfV1Program (Reader r) throws IOException
    {
      input.setReader(r);
      errorManager().recoverFromErrors(false);
      setSwitchToken($OSFV1PROGRAM_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();
    }

  /* **************** */
  /* 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 8:
            {
            commitParse();
            break;
            }
          case 11:
            {
            OsfV1PragmaArguments_opt $node2$;
                if (node($rule$,2) instanceof OsfV1PragmaArguments_opt)
                   $node2$ = (OsfV1PragmaArguments_opt)node($rule$,2);
                 else
                 {
                     $node2$ = new OsfV1PragmaArguments_opt(node($rule$,2));
                     replaceStackNode($rule$,2,$node2$);
                   }

        processPragma(node($rule$,1).svalue().intern(),$node2$.args);
            break;
            }
          case 15:
            {
            OsfV1IsaDeclarationStatement $node1$;
                if (node($rule$,1) instanceof OsfV1IsaDeclarationStatement)
                   $node1$ = (OsfV1IsaDeclarationStatement)node($rule$,1);
                 else
                 {
                     $node1$ = new OsfV1IsaDeclarationStatement(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }

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

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

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

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

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

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

        $node0$.sort = $node1$.sort;
        $node0$.keys = $node1$.keys;
        $node0$.subterms = $node1$.subterms;
            break;
            }
          case 23:
            {
            OsfV1PsiTerm $node0$ = new OsfV1PsiTerm($head$);
                 $head$ = (OsfV1PsiTerm)$node0$;
    OsfV1UntaggedPsiTerm $node3$;
                if (node($rule$,3) instanceof OsfV1UntaggedPsiTerm)
                   $node3$ = (OsfV1UntaggedPsiTerm)node($rule$,3);
                 else
                 {
                     $node3$ = new OsfV1UntaggedPsiTerm(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 24:
            {
            OsfV1UntaggedPsiTerm $node0$ = new OsfV1UntaggedPsiTerm($head$);
                 $head$ = (OsfV1UntaggedPsiTerm)$node0$;
    OsfV1SortExpression $node1$;
                if (node($rule$,1) instanceof OsfV1SortExpression)
                   $node1$ = (OsfV1SortExpression)node($rule$,1);
                 else
                 {
                     $node1$ = new OsfV1SortExpression(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }
    OsfV1Body_opt $node2$;
                if (node($rule$,2) instanceof OsfV1Body_opt)
                   $node2$ = (OsfV1Body_opt)node($rule$,2);
                 else
                 {
                     $node2$ = new OsfV1Body_opt(node($rule$,2));
                     replaceStackNode($rule$,2,$node2$);
                   }

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

        $node0$.keys = $node2$.keys;
        $node0$.subterms = $node2$.subterms;
            break;
            }
          case 27:
            {
            OsfV1SubTerms $node0$ = new OsfV1SubTerms($head$);
                 $head$ = (OsfV1SubTerms)$node0$;
    OsfV1SubTerm $node1$;
                if (node($rule$,1) instanceof OsfV1SubTerm)
                   $node1$ = (OsfV1SubTerm)node($rule$,1);
                 else
                 {
                     $node1$ = new OsfV1SubTerm(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 28:
            {
            OsfV1SubTerms $node0$ = new OsfV1SubTerms($head$);
                 $head$ = (OsfV1SubTerms)$node0$;
    OsfV1SubTerms $node3$;
                if (node($rule$,3) instanceof OsfV1SubTerms)
                   $node3$ = (OsfV1SubTerms)node($rule$,3);
                 else
                 {
                     $node3$ = new OsfV1SubTerms(node($rule$,3));
                     replaceStackNode($rule$,3,$node3$);
                   }
    OsfV1SubTerm $node1$;
                if (node($rule$,1) instanceof OsfV1SubTerm)
                   $node1$ = (OsfV1SubTerm)node($rule$,1);
                 else
                 {
                     $node1$ = new OsfV1SubTerm(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }

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

        $node0$.key = null;
        $node0$.psiterm = new RawPsiTerm($node1$.tag,$node1$.sort,$node1$.keys,$node1$.subterms);
            break;
            }
          case 30:
            {
            OsfV1SubTerm $node0$ = new OsfV1SubTerm($head$);
                 $head$ = (OsfV1SubTerm)$node0$;
    OsfV1Feature $node1$;
                if (node($rule$,1) instanceof OsfV1Feature)
                   $node1$ = (OsfV1Feature)node($rule$,1);
                 else
                 {
                     $node1$ = new OsfV1Feature(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }
    OsfV1PsiTerm $node3$;
                if (node($rule$,3) instanceof OsfV1PsiTerm)
                   $node3$ = (OsfV1PsiTerm)node($rule$,3);
                 else
                 {
                     $node3$ = new OsfV1PsiTerm(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 31:
            {
            OsfV1Feature $node0$ = new OsfV1Feature($head$);
                 $head$ = (OsfV1Feature)$node0$;

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

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

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

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

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

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

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

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

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

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

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

        ($node0$.sortList = $node3$.sortList).push(node($rule$,1).svalue());
            break;
            }
          case 53:
            {
            Decoded.setEnumSize((int)node($rule$,1).nvalue());
            break;
            }
          case 54:
            {
            OsfV1PragmaArguments_opt $node0$ = new OsfV1PragmaArguments_opt($head$);
                 $head$ = (OsfV1PragmaArguments_opt)$node0$;
    OsfV1FileList $node1$;
                if (node($rule$,1) instanceof OsfV1FileList)
                   $node1$ = (OsfV1FileList)node($rule$,1);
                 else
                 {
                     $node1$ = new OsfV1FileList(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }

        $node0$.args = $node1$.files;
            break;
            }
          case 55:
            {
            OsfV1PragmaArguments_opt $node0$ = new OsfV1PragmaArguments_opt($head$);
                 $head$ = (OsfV1PragmaArguments_opt)$node0$;
    OsfV1SortExpression $node1$;
                if (node($rule$,1) instanceof OsfV1SortExpression)
                   $node1$ = (OsfV1SortExpression)node($rule$,1);
                 else
                 {
                     $node1$ = new OsfV1SortExpression(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }

        $node0$.args = new ArrayList(1);
        $node0$.args.add($node1$.expression);
            break;
            }
          case 56:
            {
            OsfV1PragmaArguments_opt $node0$ = new OsfV1PragmaArguments_opt($head$);
                 $head$ = (OsfV1PragmaArguments_opt)$node0$;
    OsfV1SortExpression $node1$;
                if (node($rule$,1) instanceof OsfV1SortExpression)
                   $node1$ = (OsfV1SortExpression)node($rule$,1);
                 else
                 {
                     $node1$ = new OsfV1SortExpression(node($rule$,1));
                     replaceStackNode($rule$,1,$node1$);
                   }
    OsfV1SortExpression $node2$;
                if (node($rule$,2) instanceof OsfV1SortExpression)
                   $node2$ = (OsfV1SortExpression)node($rule$,2);
                 else
                 {
                     $node2$ = new OsfV1SortExpression(node($rule$,2));
                     replaceStackNode($rule$,2,$node2$);
                   }

        $node0$.args = new ArrayList(2);
        $node0$.args.add($node1$.expression);
        $node0$.args.add($node2$.expression);
            break;
            }
          case 57:
            {
            OsfV1FileList $node0$ = new OsfV1FileList($head$);
                 $head$ = (OsfV1FileList)$node0$;

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

        ($node0$.files = $node2$.files).push(node($rule$,1).svalue());
            break;
            }
          case 0: case 1: case 5: case 10: case 25: case 52: 
            break;
          default:
            $head$ = $head$.copy(node($rule$,1));
            break;
        }
      return $head$;
    }

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

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

      newTerminal(0,"$EMPTY$",1,2);
      newTerminal(1,"$E_O_I$",1,2);
      newTerminal(2,"error",1,2);
      newTerminal(3,"$OsfV1Program_switch$",1,2);
      newTerminal(4,"$SortExpression_switch$",1,2);
      newTerminal(5,"EOS",1,2);
      newTerminal(6,"IDENTIFIER",11,2);
      newTerminal(7,"PRAGMA",11,2);
      newTerminal(8,"STRING",11,2);
      newTerminal(9,"TOP",11,2);
      newTerminal(10,"BOTTOM",11,2);
      newTerminal(11,"TAG",11,2);
      newTerminal(12,"INTEGER",11,2);
      newTerminal(13,"CHAR",11,2);
      newTerminal(14,"FLOAT",11,2);
      newTerminal(15,"BOOLEAN",11,2);
      newTerminal(16,"ARROW",21,2);
      newTerminal(17,"ISA",31,2);
      newTerminal(18,"BUTNOT",41,1);
      newTerminal(19,"OR",51,0);
      newTerminal(20,"AND",61,0);
      newTerminal(21,"NOT",71,1);
      newTerminal(22,",",1,2);
      newTerminal(23,":",1,2);
      newTerminal(24,"(",1,2);
      newTerminal(25,")",1,2);
      newTerminal(26,"{",1,2);
      newTerminal(27,"}",1,2);
      newTerminal(28,";",1,2);
    }

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

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

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

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

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

      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(2,1,4,1,2);
      rules[5] = new ParserRule(16,0,5,1,2);
      rules[6] = new ParserRule(16,2,6,1,2);
      rules[7] = new ParserRule(17,2,7,1,2);
      rules[8] = new ParserRule(20,0,8,1,2);
      rules[9] = new ParserRule(19,2,9,1,2);
      rules[10] = new ParserRule(18,0,10,1,2);
      rules[11] = new ParserRule(18,2,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(22,1,15,1,2);
      rules[16] = new ParserRule(4,3,16,31,2);
      rules[17] = new ParserRule(24,1,17,11,2);
      rules[18] = new ParserRule(5,1,18,1,2);
      rules[19] = new ParserRule(5,3,19,1,2);
      rules[20] = new ParserRule(23,1,20,1,2);
      rules[21] = new ParserRule(10,1,21,11,2);
      rules[22] = new ParserRule(10,1,22,1,2);
      rules[23] = new ParserRule(10,3,23,1,2);
      rules[24] = new ParserRule(8,2,24,1,2);
      rules[25] = new ParserRule(9,0,25,1,2);
      rules[26] = new ParserRule(9,3,26,1,2);
      rules[27] = new ParserRule(11,1,27,1,2);
      rules[28] = new ParserRule(11,3,28,1,2);
      rules[29] = new ParserRule(12,1,29,1,2);
      rules[30] = new ParserRule(12,3,30,21,2);
      rules[31] = new ParserRule(13,1,31,11,2);
      rules[32] = new ParserRule(13,1,32,11,2);
      rules[33] = new ParserRule(3,1,33,1,2);
      rules[34] = new ParserRule(3,1,34,1,2);
      rules[35] = new ParserRule(3,3,35,1,2);
      rules[36] = new ParserRule(3,2,36,71,1);
      rules[37] = new ParserRule(3,3,37,61,0);
      rules[38] = new ParserRule(3,3,38,51,0);
      rules[39] = new ParserRule(3,3,39,41,1);
      rules[40] = new ParserRule(3,3,40,1,2);
      rules[41] = new ParserRule(6,1,41,11,2);
      rules[42] = new ParserRule(6,1,42,11,2);
      rules[43] = new ParserRule(6,1,43,11,2);
      rules[44] = new ParserRule(6,1,44,11,2);
      rules[45] = new ParserRule(6,1,45,11,2);
      rules[46] = new ParserRule(25,1,46,11,2);
      rules[47] = new ParserRule(25,1,47,11,2);
      rules[48] = new ParserRule(25,1,48,11,2);
      rules[49] = new ParserRule(7,1,49,1,2);
      rules[50] = new ParserRule(7,3,50,1,2);
      rules[51] = new ParserRule(21,1,51,11,2);
      rules[52] = new ParserRule(14,0,52,1,2);
      rules[53] = new ParserRule(14,1,53,11,2);
      rules[54] = new ParserRule(14,1,54,1,2);
      rules[55] = new ParserRule(14,1,55,1,2);
      rules[56] = new ParserRule(14,2,56,1,2);
      rules[57] = new ParserRule(15,1,57,11,2);
      rules[58] = new ParserRule(15,2,58,11,2);
    }

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

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

      newAction(0,5,0);
      newAction(1,2,0);
      newAction(2,0,3);
      newAction(3,0,4);
      newAction(4,1,5);
      newAction(5,1,5);
      newAction(6,1,5);
      newAction(7,1,5);
      newAction(8,1,5);
      newAction(9,1,5);
      newAction(10,1,5);
      newAction(11,1,5);
      newAction(12,1,5);
      newAction(13,1,5);
      newAction(14,1,5);
      newAction(15,1,5);
      newAction(16,1,5);
      newAction(17,1,5);
      newAction(18,1,5);
      newAction(19,1,5);
      newAction(20,1,1);
      newAction(21,1,5);
      newAction(22,1,5);
      newAction(23,1,5);
      newAction(24,1,5);
      newAction(25,1,5);
      newAction(26,1,5);
      newAction(27,1,5);
      newAction(28,1,5);
      newAction(29,1,5);
      newAction(30,1,5);
      newAction(31,1,5);
      newAction(32,1,5);
      newAction(33,1,5);
      newAction(34,1,5);
      newAction(35,1,5);
      newAction(36,1,5);
      newAction(37,0,9);
      newAction(38,0,10);
      newAction(39,0,12);
      newAction(40,0,15);
      newAction(41,0,16);
      newAction(42,0,17);
      newAction(43,0,18);
      newAction(44,0,19);
      newAction(45,0,31);
      newAction(46,0,32);
      newAction(47,0,38);
      newAction(48,1,4);
      newAction(49,1,10);
      newAction(50,0,9);
      newAction(51,0,10);
      newAction(52,0,12);
      newAction(53,0,15);
      newAction(54,0,16);
      newAction(55,0,17);
      newAction(56,0,18);
      newAction(57,0,19);
      newAction(58,0,20);
      newAction(59,0,26);
      newAction(60,0,27);
      newAction(61,0,30);
      newAction(62,0,31);
      newAction(63,0,32);
      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,33);
      newAction(81,1,33);
      newAction(82,1,33);
      newAction(83,1,33);
      newAction(84,1,33);
      newAction(85,1,33);
      newAction(86,1,33);
      newAction(87,1,33);
      newAction(88,1,33);
      newAction(89,1,33);
      newAction(90,1,33);
      newAction(91,1,33);
      newAction(92,1,33);
      newAction(93,1,33);
      newAction(94,1,33);
      newAction(95,1,33);
      newAction(96,1,33);
      newAction(97,1,33);
      newAction(98,1,34);
      newAction(99,1,34);
      newAction(100,1,34);
      newAction(101,1,34);
      newAction(102,1,34);
      newAction(103,1,34);
      newAction(104,1,34);
      newAction(105,1,34);
      newAction(106,1,34);
      newAction(107,1,34);
      newAction(108,1,34);
      newAction(109,1,34);
      newAction(110,1,34);
      newAction(111,1,34);
      newAction(112,1,34);
      newAction(113,1,34);
      newAction(114,1,34);
      newAction(115,1,34);
      newAction(116,0,31);
      newAction(117,0,32);
      newAction(118,0,38);
      newAction(119,0,9);
      newAction(120,0,10);
      newAction(121,0,12);
      newAction(122,0,15);
      newAction(123,0,16);
      newAction(124,0,17);
      newAction(125,0,18);
      newAction(126,0,19);
      newAction(127,0,31);
      newAction(128,0,32);
      newAction(129,0,38);
      newAction(130,0,41);
      newAction(131,0,42);
      newAction(132,0,43);
      newAction(133,1,25);
      newAction(134,1,25);
      newAction(135,1,25);
      newAction(136,0,61);
      newAction(137,0,9);
      newAction(138,0,10);
      newAction(139,0,12);
      newAction(140,0,15);
      newAction(141,0,16);
      newAction(142,0,17);
      newAction(143,0,18);
      newAction(144,0,19);
      newAction(145,0,31);
      newAction(146,0,32);
      newAction(147,0,38);
      newAction(148,0,56);
      newAction(149,1,18);
      newAction(150,1,18);
      newAction(151,0,53);
      newAction(152,1,41);
      newAction(153,1,41);
      newAction(154,1,41);
      newAction(155,1,41);
      newAction(156,1,41);
      newAction(157,1,41);
      newAction(158,1,41);
      newAction(159,1,41);
      newAction(160,1,41);
      newAction(161,1,41);
      newAction(162,1,41);
      newAction(163,1,41);
      newAction(164,1,41);
      newAction(165,1,41);
      newAction(166,1,41);
      newAction(167,1,41);
      newAction(168,1,41);
      newAction(169,1,41);
      newAction(170,1,42);
      newAction(171,1,42);
      newAction(172,1,42);
      newAction(173,1,42);
      newAction(174,1,42);
      newAction(175,1,42);
      newAction(176,1,42);
      newAction(177,1,42);
      newAction(178,1,42);
      newAction(179,1,42);
      newAction(180,1,42);
      newAction(181,1,42);
      newAction(182,1,42);
      newAction(183,1,42);
      newAction(184,1,42);
      newAction(185,1,42);
      newAction(186,1,42);
      newAction(187,1,42);
      newAction(188,1,43);
      newAction(189,1,43);
      newAction(190,1,43);
      newAction(191,1,43);
      newAction(192,1,43);
      newAction(193,1,43);
      newAction(194,1,43);
      newAction(195,1,43);
      newAction(196,1,43);
      newAction(197,1,43);
      newAction(198,1,43);
      newAction(199,1,43);
      newAction(200,1,43);
      newAction(201,1,43);
      newAction(202,1,43);
      newAction(203,1,43);
      newAction(204,1,43);
      newAction(205,1,43);
      newAction(206,1,44);
      newAction(207,1,44);
      newAction(208,1,44);
      newAction(209,1,44);
      newAction(210,1,44);
      newAction(211,1,44);
      newAction(212,1,44);
      newAction(213,1,44);
      newAction(214,1,44);
      newAction(215,1,44);
      newAction(216,1,44);
      newAction(217,1,44);
      newAction(218,1,44);
      newAction(219,1,44);
      newAction(220,1,44);
      newAction(221,1,44);
      newAction(222,1,44);
      newAction(223,1,44);
      newAction(224,1,45);
      newAction(225,1,45);
      newAction(226,1,45);
      newAction(227,1,45);
      newAction(228,1,45);
      newAction(229,1,45);
      newAction(230,1,45);
      newAction(231,1,45);
      newAction(232,1,45);
      newAction(233,1,45);
      newAction(234,1,45);
      newAction(235,1,45);
      newAction(236,1,45);
      newAction(237,1,45);
      newAction(238,1,45);
      newAction(239,1,45);
      newAction(240,1,45);
      newAction(241,1,45);
      newAction(242,1,21);
      newAction(243,1,21);
      newAction(244,1,21);
      newAction(245,0,51);
      newAction(246,1,22);
      newAction(247,1,22);
      newAction(248,1,22);
      newAction(249,1,8);
      newAction(250,0,9);
      newAction(251,0,10);
      newAction(252,0,12);
      newAction(253,0,35);
      newAction(254,0,16);
      newAction(255,0,17);
      newAction(256,0,36);
      newAction(257,0,19);
      newAction(258,1,52);
      newAction(259,0,31);
      newAction(260,0,32);
      newAction(261,0,38);
      newAction(262,1,12);
      newAction(263,1,13);
      newAction(264,1,14);
      newAction(265,1,51);
      newAction(266,1,51);
      newAction(267,1,51);
      newAction(268,1,51);
      newAction(269,1,51);
      newAction(270,1,51);
      newAction(271,1,51);
      newAction(272,1,51);
      newAction(273,1,51);
      newAction(274,1,51);
      newAction(275,1,51);
      newAction(276,1,51);
      newAction(277,1,15);
      newAction(278,1,20);
      newAction(279,1,17);
      newAction(280,1,17);
      newAction(281,1,48);
      newAction(282,1,48);
      newAction(283,1,48);
      newAction(284,1,48);
      newAction(285,1,48);
      newAction(286,1,46);
      newAction(287,1,46);
      newAction(288,1,46);
      newAction(289,1,46);
      newAction(290,1,46);
      newAction(291,1,46);
      newAction(292,1,46);
      newAction(293,1,46);
      newAction(294,1,46);
      newAction(295,1,46);
      newAction(296,1,46);
      newAction(297,1,46);
      newAction(298,1,46);
      newAction(299,1,46);
      newAction(300,1,46);
      newAction(301,1,46);
      newAction(302,1,46);
      newAction(303,1,46);
      newAction(304,1,46);
      newAction(305,1,46);
      newAction(306,1,47);
      newAction(307,1,47);
      newAction(308,1,47);
      newAction(309,1,47);
      newAction(310,1,47);
      newAction(311,1,47);
      newAction(312,1,47);
      newAction(313,1,47);
      newAction(314,1,47);
      newAction(315,1,47);
      newAction(316,1,47);
      newAction(317,1,47);
      newAction(318,1,47);
      newAction(319,1,47);
      newAction(320,1,47);
      newAction(321,1,47);
      newAction(322,1,47);
      newAction(323,1,47);
      newAction(324,1,47);
      newAction(325,1,47);
      newAction(326,1,11);
      newAction(327,0,41);
      newAction(328,0,42);
      newAction(329,0,43);
      newAction(330,1,55);
      newAction(331,0,9);
      newAction(332,0,10);
      newAction(333,0,12);
      newAction(334,0,15);
      newAction(335,0,16);
      newAction(336,0,17);
      newAction(337,0,18);
      newAction(338,0,19);
      newAction(339,0,31);
      newAction(340,0,32);
      newAction(341,0,38);
      newAction(342,1,41);
      newAction(343,1,41);
      newAction(344,1,41);
      newAction(345,1,41);
      newAction(346,1,41);
      newAction(347,1,41);
      newAction(348,1,41);
      newAction(349,1,41);
      newAction(350,1,41);
      newAction(351,1,41);
      newAction(352,1,41);
      newAction(353,1,41);
      newAction(354,1,41);
      newAction(355,1,41);
      newAction(356,1,41);
      newAction(357,1,44);
      newAction(358,1,44);
      newAction(359,1,44);
      newAction(360,1,44);
      newAction(361,1,44);
      newAction(362,1,44);
      newAction(363,1,44);
      newAction(364,1,44);
      newAction(365,1,44);
      newAction(366,1,44);
      newAction(367,1,44);
      newAction(368,1,44);
      newAction(369,1,44);
      newAction(370,1,44);
      newAction(371,1,44);
      newAction(372,1,54);
      newAction(373,1,48);
      newAction(374,1,48);
      newAction(375,1,48);
      newAction(376,1,48);
      newAction(377,1,48);
      newAction(378,1,48);
      newAction(379,1,48);
      newAction(380,1,48);
      newAction(381,1,48);
      newAction(382,1,48);
      newAction(383,1,48);
      newAction(384,1,48);
      newAction(385,1,48);
      newAction(386,1,48);
      newAction(387,1,48);
      newAction(388,1,48);
      newAction(389,1,48);
      newAction(390,1,48);
      newAction(391,1,48);
      newAction(392,1,48);
      newAction(393,1,58);
      newAction(394,1,57);
      newAction(395,0,40);
      newAction(396,0,9);
      newAction(397,0,10);
      newAction(398,0,12);
      newAction(399,0,15);
      newAction(400,0,16);
      newAction(401,0,17);
      newAction(402,0,18);
      newAction(403,0,19);
      newAction(404,0,31);
      newAction(405,0,32);
      newAction(406,0,38);
      newAction(407,0,9);
      newAction(408,0,10);
      newAction(409,0,12);
      newAction(410,0,15);
      newAction(411,0,16);
      newAction(412,0,17);
      newAction(413,0,18);
      newAction(414,0,19);
      newAction(415,0,31);
      newAction(416,0,32);
      newAction(417,0,38);
      newAction(418,0,9);
      newAction(419,0,10);
      newAction(420,0,12);
      newAction(421,0,15);
      newAction(422,0,16);
      newAction(423,0,17);
      newAction(424,0,18);
      newAction(425,0,19);
      newAction(426,0,31);
      newAction(427,0,32);
      newAction(428,0,38);
      newAction(429,0,41);
      newAction(430,0,42);
      newAction(431,0,43);
      newAction(432,1,56);
      newAction(433,0,41);
      newAction(434,0,42);
      newAction(435,0,43);
      newAction(436,1,39);
      newAction(437,1,39);
      newAction(438,1,39);
      newAction(439,1,39);
      newAction(440,1,39);
      newAction(441,1,39);
      newAction(442,1,39);
      newAction(443,1,39);
      newAction(444,1,39);
      newAction(445,1,39);
      newAction(446,1,39);
      newAction(447,1,39);
      newAction(448,1,39);
      newAction(449,1,39);
      newAction(450,1,39);
      newAction(451,0,41);
      newAction(452,0,42);
      newAction(453,1,38);
      newAction(454,1,38);
      newAction(455,1,38);
      newAction(456,1,38);
      newAction(457,1,38);
      newAction(458,1,38);
      newAction(459,1,38);
      newAction(460,1,38);
      newAction(461,1,38);
      newAction(462,1,38);
      newAction(463,1,38);
      newAction(464,1,38);
      newAction(465,1,38);
      newAction(466,1,38);
      newAction(467,1,38);
      newAction(468,1,38);
      newAction(469,1,38);
      newAction(470,0,41);
      newAction(471,1,37);
      newAction(472,1,37);
      newAction(473,1,37);
      newAction(474,1,37);
      newAction(475,1,37);
      newAction(476,1,37);
      newAction(477,1,37);
      newAction(478,1,37);
      newAction(479,1,37);
      newAction(480,1,37);
      newAction(481,1,37);
      newAction(482,1,37);
      newAction(483,1,37);
      newAction(484,1,37);
      newAction(485,1,37);
      newAction(486,1,37);
      newAction(487,1,37);
      newAction(488,1,37);
      newAction(489,1,7);
      newAction(490,1,7);
      newAction(491,1,7);
      newAction(492,1,7);
      newAction(493,1,7);
      newAction(494,1,7);
      newAction(495,1,7);
      newAction(496,1,7);
      newAction(497,1,7);
      newAction(498,1,7);
      newAction(499,1,7);
      newAction(500,1,7);
      newAction(501,1,7);
      newAction(502,1,7);
      newAction(503,1,7);
      newAction(504,1,7);
      newAction(505,0,50);
      newAction(506,1,9);
      newAction(507,1,9);
      newAction(508,1,9);
      newAction(509,1,9);
      newAction(510,1,9);
      newAction(511,1,9);
      newAction(512,1,9);
      newAction(513,1,9);
      newAction(514,1,9);
      newAction(515,1,9);
      newAction(516,1,9);
      newAction(517,1,9);
      newAction(518,1,9);
      newAction(519,1,9);
      newAction(520,1,9);
      newAction(521,1,9);
      newAction(522,0,9);
      newAction(523,0,10);
      newAction(524,0,12);
      newAction(525,0,15);
      newAction(526,0,16);
      newAction(527,0,17);
      newAction(528,0,18);
      newAction(529,0,19);
      newAction(530,0,31);
      newAction(531,0,32);
      newAction(532,0,38);
      newAction(533,1,23);
      newAction(534,1,23);
      newAction(535,1,23);
      newAction(536,0,55);
      newAction(537,1,19);
      newAction(538,1,19);
      newAction(539,1,17);
      newAction(540,1,17);
      newAction(541,1,17);
      newAction(542,0,55);
      newAction(543,1,16);
      newAction(544,0,41);
      newAction(545,0,42);
      newAction(546,0,43);
      newAction(547,0,59);
      newAction(548,1,40);
      newAction(549,1,40);
      newAction(550,1,40);
      newAction(551,1,40);
      newAction(552,1,40);
      newAction(553,1,40);
      newAction(554,1,40);
      newAction(555,1,40);
      newAction(556,1,40);
      newAction(557,1,40);
      newAction(558,1,40);
      newAction(559,1,40);
      newAction(560,1,40);
      newAction(561,1,40);
      newAction(562,1,40);
      newAction(563,1,40);
      newAction(564,1,40);
      newAction(565,1,40);
      newAction(566,1,24);
      newAction(567,1,24);
      newAction(568,1,24);
      newAction(569,0,9);
      newAction(570,0,10);
      newAction(571,0,12);
      newAction(572,0,63);
      newAction(573,0,16);
      newAction(574,0,17);
      newAction(575,0,18);
      newAction(576,0,19);
      newAction(577,0,20);
      newAction(578,0,67);
      newAction(579,0,31);
      newAction(580,0,32);
      newAction(581,0,72);
      newAction(582,1,31);
      newAction(583,1,41);
      newAction(584,1,41);
      newAction(585,1,41);
      newAction(586,1,41);
      newAction(587,1,41);
      newAction(588,1,41);
      newAction(589,1,27);
      newAction(590,0,70);
      newAction(591,1,29);
      newAction(592,1,29);
      newAction(593,0,68);
      newAction(594,1,32);
      newAction(595,1,48);
      newAction(596,1,48);
      newAction(597,1,48);
      newAction(598,1,48);
      newAction(599,1,48);
      newAction(600,1,48);
      newAction(601,0,9);
      newAction(602,0,10);
      newAction(603,0,12);
      newAction(604,0,15);
      newAction(605,0,16);
      newAction(606,0,17);
      newAction(607,0,18);
      newAction(608,0,19);
      newAction(609,0,20);
      newAction(610,0,31);
      newAction(611,0,32);
      newAction(612,0,38);
      newAction(613,1,30);
      newAction(614,1,30);
      newAction(615,0,9);
      newAction(616,0,10);
      newAction(617,0,12);
      newAction(618,0,63);
      newAction(619,0,16);
      newAction(620,0,17);
      newAction(621,0,18);
      newAction(622,0,19);
      newAction(623,0,20);
      newAction(624,0,67);
      newAction(625,0,31);
      newAction(626,0,32);
      newAction(627,1,28);
      newAction(628,1,26);
      newAction(629,1,26);
      newAction(630,1,26);
      newAction(631,1,36);
      newAction(632,1,36);
      newAction(633,1,36);
      newAction(634,1,36);
      newAction(635,1,36);
      newAction(636,1,36);
      newAction(637,1,36);
      newAction(638,1,36);
      newAction(639,1,36);
      newAction(640,1,36);
      newAction(641,1,36);
      newAction(642,1,36);
      newAction(643,1,36);
      newAction(644,1,36);
      newAction(645,1,36);
      newAction(646,1,36);
      newAction(647,1,36);
      newAction(648,1,36);
      newAction(649,0,78);
      newAction(650,1,49);
      newAction(651,0,76);
      newAction(652,0,31);
      newAction(653,0,32);
      newAction(654,0,38);
      newAction(655,1,50);
      newAction(656,1,35);
      newAction(657,1,35);
      newAction(658,1,35);
      newAction(659,1,35);
      newAction(660,1,35);
      newAction(661,1,35);
      newAction(662,1,35);
      newAction(663,1,35);
      newAction(664,1,35);
      newAction(665,1,35);
      newAction(666,1,35);
      newAction(667,1,35);
      newAction(668,1,35);
      newAction(669,1,35);
      newAction(670,1,35);
      newAction(671,1,35);
      newAction(672,1,35);
      newAction(673,1,35);
      newAction(674,1,3);
      newAction(675,0,41);
      newAction(676,0,42);
      newAction(677,0,43);
      newAction(678,1,2);
    }

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

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

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

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

  static void initializeActionTables ()
    {
      newActionTables(72);

      newActionTable(0,18);
	setAction(0,1,4);
	setAction(0,2,5);
	setAction(0,3,2);
	setAction(0,4,3);
	setAction(0,5,6);
	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,21,17);
	setAction(0,24,18);
	setAction(0,26,19);

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

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

      newActionTable(3,16);
	setAction(3,1,21);
	setAction(3,2,22);
	setAction(3,5,23);
	setAction(3,6,24);
	setAction(3,7,25);
	setAction(3,8,26);
	setAction(3,9,27);
	setAction(3,10,28);
	setAction(3,11,29);
	setAction(3,12,30);
	setAction(3,13,31);
	setAction(3,14,32);
	setAction(3,15,33);
	setAction(3,21,34);
	setAction(3,24,35);
	setAction(3,26,36);

      newActionTable(4,11);
	setAction(4,21,38);
	setAction(4,6,47);
	setAction(4,8,43);
	setAction(4,9,45);
	setAction(4,24,39);
	setAction(4,10,46);
	setAction(4,26,37);
	setAction(4,12,40);
	setAction(4,13,41);
	setAction(4,14,42);
	setAction(4,15,44);

      newActionTable(5,16);
	setAction(5,1,48);
	setAction(5,2,59);
	setAction(5,5,49);
	setAction(5,6,61);
	setAction(5,7,60);
	setAction(5,8,56);
	setAction(5,9,62);
	setAction(5,10,63);
	setAction(5,11,58);
	setAction(5,12,53);
	setAction(5,13,54);
	setAction(5,14,55);
	setAction(5,15,57);
	setAction(5,21,51);
	setAction(5,24,52);
	setAction(5,26,50);

      newActionTable(6,16);
	setAction(6,1,64);
	setAction(6,2,65);
	setAction(6,5,66);
	setAction(6,6,67);
	setAction(6,7,68);
	setAction(6,8,69);
	setAction(6,9,70);
	setAction(6,10,71);
	setAction(6,11,72);
	setAction(6,12,73);
	setAction(6,13,74);
	setAction(6,14,75);
	setAction(6,15,76);
	setAction(6,21,77);
	setAction(6,24,78);
	setAction(6,26,79);

      newActionTable(7,18);
	setAction(7,1,80);
	setAction(7,5,81);
	setAction(7,6,82);
	setAction(7,8,83);
	setAction(7,9,84);
	setAction(7,10,85);
	setAction(7,12,86);
	setAction(7,13,87);
	setAction(7,14,88);
	setAction(7,15,89);
	setAction(7,19,91);
	setAction(7,18,90);
	setAction(7,21,93);
	setAction(7,20,92);
	setAction(7,22,94);
	setAction(7,25,96);
	setAction(7,24,95);
	setAction(7,26,97);

      newActionTable(8,18);
	setAction(8,1,98);
	setAction(8,5,99);
	setAction(8,6,100);
	setAction(8,8,101);
	setAction(8,9,102);
	setAction(8,10,103);
	setAction(8,12,104);
	setAction(8,13,105);
	setAction(8,14,106);
	setAction(8,15,107);
	setAction(8,19,109);
	setAction(8,18,108);
	setAction(8,21,111);
	setAction(8,20,110);
	setAction(8,22,112);
	setAction(8,25,114);
	setAction(8,24,113);
	setAction(8,26,115);

      newActionTable(9,3);
	setAction(9,6,118);
	setAction(9,9,116);
	setAction(9,10,117);

      newActionTable(10,7);
	setAction(10,19,131);
	setAction(10,18,132);
	setAction(10,5,133);
	setAction(10,20,130);
	setAction(10,22,134);
	setAction(10,25,135);
	setAction(10,24,136);

      newActionTable(11,1);
	setAction(11,17,148);

      newActionTable(12,3);
	setAction(12,17,150);
	setAction(12,5,149);
	setAction(12,22,151);

      newActionTable(13,18);
	setAction(13,1,152);
	setAction(13,5,153);
	setAction(13,6,154);
	setAction(13,8,155);
	setAction(13,9,156);
	setAction(13,10,157);
	setAction(13,12,158);
	setAction(13,13,159);
	setAction(13,14,160);
	setAction(13,15,161);
	setAction(13,19,163);
	setAction(13,18,162);
	setAction(13,21,165);
	setAction(13,20,164);
	setAction(13,22,166);
	setAction(13,25,168);
	setAction(13,24,167);
	setAction(13,26,169);

      newActionTable(14,18);
	setAction(14,1,170);
	setAction(14,5,171);
	setAction(14,6,172);
	setAction(14,8,173);
	setAction(14,9,174);
	setAction(14,10,175);
	setAction(14,12,176);
	setAction(14,13,177);
	setAction(14,14,178);
	setAction(14,15,179);
	setAction(14,19,181);
	setAction(14,18,180);
	setAction(14,21,183);
	setAction(14,20,182);
	setAction(14,22,184);
	setAction(14,25,186);
	setAction(14,24,185);
	setAction(14,26,187);

      newActionTable(15,18);
	setAction(15,1,188);
	setAction(15,5,189);
	setAction(15,6,190);
	setAction(15,8,191);
	setAction(15,9,192);
	setAction(15,10,193);
	setAction(15,12,194);
	setAction(15,13,195);
	setAction(15,14,196);
	setAction(15,15,197);
	setAction(15,19,199);
	setAction(15,18,198);
	setAction(15,21,201);
	setAction(15,20,200);
	setAction(15,22,202);
	setAction(15,25,204);
	setAction(15,24,203);
	setAction(15,26,205);

      newActionTable(16,18);
	setAction(16,1,206);
	setAction(16,5,207);
	setAction(16,6,208);
	setAction(16,8,209);
	setAction(16,9,210);
	setAction(16,10,211);
	setAction(16,12,212);
	setAction(16,13,213);
	setAction(16,14,214);
	setAction(16,15,215);
	setAction(16,19,217);
	setAction(16,18,216);
	setAction(16,21,219);
	setAction(16,20,218);
	setAction(16,22,220);
	setAction(16,25,222);
	setAction(16,24,221);
	setAction(16,26,223);

      newActionTable(17,18);
	setAction(17,1,224);
	setAction(17,5,225);
	setAction(17,6,226);
	setAction(17,8,227);
	setAction(17,9,228);
	setAction(17,10,229);
	setAction(17,12,230);
	setAction(17,13,231);
	setAction(17,14,232);
	setAction(17,15,233);
	setAction(17,19,235);
	setAction(17,18,234);
	setAction(17,21,237);
	setAction(17,20,236);
	setAction(17,22,238);
	setAction(17,25,240);
	setAction(17,24,239);
	setAction(17,26,241);

      newActionTable(18,4);
	setAction(18,5,242);
	setAction(18,23,245);
	setAction(18,22,243);
	setAction(18,25,244);

      newActionTable(19,3);
	setAction(19,5,246);
	setAction(19,22,247);
	setAction(19,25,248);

      newActionTable(20,1);
	setAction(20,5,249);

      newActionTable(21,12);
	setAction(21,21,251);
	setAction(21,5,258);
	setAction(21,6,261);
	setAction(21,8,256);
	setAction(21,9,259);
	setAction(21,24,252);
	setAction(21,10,260);
	setAction(21,26,250);
	setAction(21,12,253);
	setAction(21,13,254);
	setAction(21,14,255);
	setAction(21,15,257);

      newActionTable(22,1);
	setAction(22,5,262);

      newActionTable(23,1);
	setAction(23,5,263);

      newActionTable(24,1);
	setAction(24,5,264);

      newActionTable(25,12);
	setAction(25,21,274);
	setAction(25,5,265);
	setAction(25,6,266);
	setAction(25,8,267);
	setAction(25,24,275);
	setAction(25,9,268);
	setAction(25,10,269);
	setAction(25,26,276);
	setAction(25,12,270);
	setAction(25,13,271);
	setAction(25,14,272);
	setAction(25,15,273);

      newActionTable(26,1);
	setAction(26,5,277);

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

      newActionTable(28,7);
	setAction(28,17,279);
	setAction(28,19,283);
	setAction(28,18,282);
	setAction(28,20,284);
	setAction(28,5,281);
	setAction(28,22,280);
	setAction(28,24,285);

      newActionTable(29,20);
	setAction(29,1,286);
	setAction(29,5,287);
	setAction(29,6,288);
	setAction(29,8,289);
	setAction(29,9,290);
	setAction(29,10,291);
	setAction(29,12,292);
	setAction(29,13,293);
	setAction(29,14,294);
	setAction(29,15,295);
	setAction(29,19,297);
	setAction(29,18,296);
	setAction(29,21,299);
	setAction(29,20,298);
	setAction(29,22,300);
	setAction(29,25,302);
	setAction(29,24,301);
	setAction(29,27,304);
	setAction(29,26,303);
	setAction(29,28,305);

      newActionTable(30,20);
	setAction(30,1,306);
	setAction(30,5,307);
	setAction(30,6,308);
	setAction(30,8,309);
	setAction(30,9,310);
	setAction(30,10,311);
	setAction(30,12,312);
	setAction(30,13,313);
	setAction(30,14,314);
	setAction(30,15,315);
	setAction(30,19,317);
	setAction(30,18,316);
	setAction(30,21,319);
	setAction(30,20,318);
	setAction(30,22,320);
	setAction(30,25,322);
	setAction(30,24,321);
	setAction(30,27,324);
	setAction(30,26,323);
	setAction(30,28,325);

      newActionTable(31,1);
	setAction(31,5,326);

      newActionTable(32,15);
	setAction(32,5,330);
	setAction(32,6,341);
	setAction(32,8,337);
	setAction(32,9,339);
	setAction(32,10,340);
	setAction(32,12,334);
	setAction(32,13,335);
	setAction(32,14,336);
	setAction(32,15,338);
	setAction(32,19,328);
	setAction(32,18,329);
	setAction(32,21,332);
	setAction(32,20,327);
	setAction(32,24,333);
	setAction(32,26,331);

      newActionTable(33,15);
	setAction(33,5,342);
	setAction(33,6,343);
	setAction(33,8,344);
	setAction(33,9,345);
	setAction(33,10,346);
	setAction(33,12,347);
	setAction(33,13,348);
	setAction(33,14,349);
	setAction(33,15,350);
	setAction(33,19,352);
	setAction(33,18,351);
	setAction(33,21,354);
	setAction(33,20,353);
	setAction(33,24,355);
	setAction(33,26,356);

      newActionTable(34,15);
	setAction(34,5,357);
	setAction(34,6,358);
	setAction(34,8,359);
	setAction(34,9,360);
	setAction(34,10,361);
	setAction(34,12,362);
	setAction(34,13,363);
	setAction(34,14,364);
	setAction(34,15,365);
	setAction(34,19,367);
	setAction(34,18,366);
	setAction(34,21,369);
	setAction(34,20,368);
	setAction(34,24,370);
	setAction(34,26,371);

      newActionTable(35,1);
	setAction(35,5,372);

      newActionTable(36,20);
	setAction(36,1,373);
	setAction(36,5,374);
	setAction(36,6,375);
	setAction(36,8,376);
	setAction(36,9,377);
	setAction(36,10,378);
	setAction(36,12,379);
	setAction(36,13,380);
	setAction(36,14,381);
	setAction(36,15,382);
	setAction(36,19,384);
	setAction(36,18,383);
	setAction(36,21,386);
	setAction(36,20,385);
	setAction(36,22,387);
	setAction(36,25,389);
	setAction(36,24,388);
	setAction(36,27,391);
	setAction(36,26,390);
	setAction(36,28,392);

      newActionTable(37,1);
	setAction(37,5,393);

      newActionTable(38,2);
	setAction(38,5,394);
	setAction(38,8,395);

      newActionTable(39,4);
	setAction(39,19,430);
	setAction(39,18,431);
	setAction(39,5,432);
	setAction(39,20,429);

      newActionTable(40,18);
	setAction(40,1,436);
	setAction(40,5,437);
	setAction(40,6,438);
	setAction(40,8,439);
	setAction(40,9,440);
	setAction(40,10,441);
	setAction(40,12,442);
	setAction(40,13,443);
	setAction(40,14,444);
	setAction(40,15,445);
	setAction(40,19,434);
	setAction(40,18,435);
	setAction(40,21,446);
	setAction(40,20,433);
	setAction(40,22,447);
	setAction(40,25,449);
	setAction(40,24,448);
	setAction(40,26,450);

      newActionTable(41,18);
	setAction(41,1,453);
	setAction(41,5,454);
	setAction(41,6,455);
	setAction(41,8,456);
	setAction(41,9,457);
	setAction(41,10,458);
	setAction(41,12,459);
	setAction(41,13,460);
	setAction(41,14,461);
	setAction(41,15,462);
	setAction(41,19,464);
	setAction(41,18,463);
	setAction(41,21,465);
	setAction(41,20,451);
	setAction(41,22,466);
	setAction(41,25,468);
	setAction(41,24,467);
	setAction(41,26,469);

      newActionTable(42,18);
	setAction(42,1,471);
	setAction(42,5,472);
	setAction(42,6,473);
	setAction(42,8,474);
	setAction(42,9,475);
	setAction(42,10,476);
	setAction(42,12,477);
	setAction(42,13,478);
	setAction(42,14,479);
	setAction(42,15,480);
	setAction(42,19,482);
	setAction(42,18,481);
	setAction(42,21,484);
	setAction(42,20,483);
	setAction(42,22,485);
	setAction(42,25,487);
	setAction(42,24,486);
	setAction(42,26,488);

      newActionTable(43,16);
	setAction(43,1,489);
	setAction(43,2,490);
	setAction(43,5,491);
	setAction(43,6,492);
	setAction(43,7,493);
	setAction(43,8,494);
	setAction(43,9,495);
	setAction(43,10,496);
	setAction(43,11,497);
	setAction(43,12,498);
	setAction(43,13,499);
	setAction(43,14,500);
	setAction(43,15,501);
	setAction(43,21,502);
	setAction(43,24,503);
	setAction(43,26,504);

      newActionTable(44,1);
	setAction(44,5,505);

      newActionTable(45,16);
	setAction(45,1,506);
	setAction(45,2,507);
	setAction(45,5,508);
	setAction(45,6,509);
	setAction(45,7,510);
	setAction(45,8,511);
	setAction(45,9,512);
	setAction(45,10,513);
	setAction(45,11,514);
	setAction(45,12,515);
	setAction(45,13,516);
	setAction(45,14,517);
	setAction(45,15,518);
	setAction(45,21,519);
	setAction(45,24,520);
	setAction(45,26,521);

      newActionTable(46,3);
	setAction(46,5,533);
	setAction(46,22,534);
	setAction(46,25,535);

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

      newActionTable(48,2);
	setAction(48,17,538);
	setAction(48,5,537);

      newActionTable(49,3);
	setAction(49,17,540);
	setAction(49,5,539);
	setAction(49,22,541);

      newActionTable(50,1);
	setAction(50,5,543);

      newActionTable(51,4);
	setAction(51,19,545);
	setAction(51,18,546);
	setAction(51,20,544);
	setAction(51,25,547);

      newActionTable(52,18);
	setAction(52,1,548);
	setAction(52,5,549);
	setAction(52,6,550);
	setAction(52,8,551);
	setAction(52,9,552);
	setAction(52,10,553);
	setAction(52,12,554);
	setAction(52,13,555);
	setAction(52,14,556);
	setAction(52,15,557);
	setAction(52,19,559);
	setAction(52,18,558);
	setAction(52,21,561);
	setAction(52,20,560);
	setAction(52,22,562);
	setAction(52,25,564);
	setAction(52,24,563);
	setAction(52,26,565);

      newActionTable(53,3);
	setAction(53,5,566);
	setAction(53,22,567);
	setAction(53,25,568);

      newActionTable(54,12);
	setAction(54,21,570);
	setAction(54,6,578);
	setAction(54,8,575);
	setAction(54,9,579);
	setAction(54,24,571);
	setAction(54,10,580);
	setAction(54,11,577);
	setAction(54,26,569);
	setAction(54,12,572);
	setAction(54,13,573);
	setAction(54,14,574);
	setAction(54,15,576);

      newActionTable(55,1);
	setAction(55,25,581);

      newActionTable(56,7);
	setAction(56,16,582);
	setAction(56,19,584);
	setAction(56,18,583);
	setAction(56,20,585);
	setAction(56,22,586);
	setAction(56,25,588);
	setAction(56,24,587);

      newActionTable(57,2);
	setAction(57,22,590);
	setAction(57,25,589);

      newActionTable(58,2);
	setAction(58,22,591);
	setAction(58,25,592);

      newActionTable(59,1);
	setAction(59,16,593);

      newActionTable(60,7);
	setAction(60,16,594);
	setAction(60,19,596);
	setAction(60,18,595);
	setAction(60,20,597);
	setAction(60,22,598);
	setAction(60,25,600);
	setAction(60,24,599);

      newActionTable(61,12);
	setAction(61,21,602);
	setAction(61,6,612);
	setAction(61,8,607);
	setAction(61,9,610);
	setAction(61,24,603);
	setAction(61,10,611);
	setAction(61,11,609);
	setAction(61,26,601);
	setAction(61,12,604);
	setAction(61,13,605);
	setAction(61,14,606);
	setAction(61,15,608);

      newActionTable(62,2);
	setAction(62,22,613);
	setAction(62,25,614);

      newActionTable(63,1);
	setAction(63,25,627);

      newActionTable(64,3);
	setAction(64,5,628);
	setAction(64,22,629);
	setAction(64,25,630);

      newActionTable(65,18);
	setAction(65,1,631);
	setAction(65,5,632);
	setAction(65,6,633);
	setAction(65,8,634);
	setAction(65,9,635);
	setAction(65,10,636);
	setAction(65,12,637);
	setAction(65,13,638);
	setAction(65,14,639);
	setAction(65,15,640);
	setAction(65,19,642);
	setAction(65,18,641);
	setAction(65,21,644);
	setAction(65,20,643);
	setAction(65,22,645);
	setAction(65,25,647);
	setAction(65,24,646);
	setAction(65,26,648);

      newActionTable(66,1);
	setAction(66,27,649);

      newActionTable(67,2);
	setAction(67,27,650);
	setAction(67,28,651);

      newActionTable(68,1);
	setAction(68,27,655);

      newActionTable(69,18);
	setAction(69,1,656);
	setAction(69,5,657);
	setAction(69,6,658);
	setAction(69,8,659);
	setAction(69,9,660);
	setAction(69,10,661);
	setAction(69,12,662);
	setAction(69,13,663);
	setAction(69,14,664);
	setAction(69,15,665);
	setAction(69,19,667);
	setAction(69,18,666);
	setAction(69,21,669);
	setAction(69,20,668);
	setAction(69,22,670);
	setAction(69,25,672);
	setAction(69,24,671);
	setAction(69,26,673);

      newActionTable(70,4);
	setAction(70,1,674);
	setAction(70,19,676);
	setAction(70,18,677);
	setAction(70,20,675);

      newActionTable(71,1);
	setAction(71,1,678);

    }

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

  static void initializeGotoTables ()
    {
      newGotoTables(23);

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

      newGotoTable(1,0);

      newGotoTable(2,2);
	setGoto(2,16,5);
	setGoto(2,2,80);

      newGotoTable(3,3);
	setGoto(3,3,79);
	setGoto(3,6,7);
	setGoto(3,25,8);

      newGotoTable(4,13);
	setGoto(4,17,6);
	setGoto(4,18,22);
	setGoto(4,3,11);
	setGoto(4,4,28);
	setGoto(4,21,23);
	setGoto(4,5,13);
	setGoto(4,23,25);
	setGoto(4,6,7);
	setGoto(4,22,24);
	setGoto(4,8,21);
	setGoto(4,25,8);
	setGoto(4,24,14);
	setGoto(4,10,29);

      newGotoTable(5,2);
	setGoto(5,7,74);
	setGoto(5,25,75);

      newGotoTable(6,3);
	setGoto(6,3,73);
	setGoto(6,6,7);
	setGoto(6,25,8);

      newGotoTable(7,1);
	setGoto(7,9,60);

      newGotoTable(8,3);
	setGoto(8,3,58);
	setGoto(8,6,7);
	setGoto(8,25,8);

      newGotoTable(9,2);
	setGoto(9,19,48);
	setGoto(9,20,49);

      newGotoTable(10,5);
	setGoto(10,3,34);
	setGoto(10,6,7);
	setGoto(10,25,8);
	setGoto(10,14,33);
	setGoto(10,15,37);

      newGotoTable(11,3);
	setGoto(11,3,44);
	setGoto(11,6,7);
	setGoto(11,25,8);

      newGotoTable(12,1);
	setGoto(12,15,39);

      newGotoTable(13,3);
	setGoto(13,3,47);
	setGoto(13,6,7);
	setGoto(13,25,8);

      newGotoTable(14,3);
	setGoto(14,3,46);
	setGoto(14,6,7);
	setGoto(14,25,8);

      newGotoTable(15,3);
	setGoto(15,3,45);
	setGoto(15,6,7);
	setGoto(15,25,8);

      newGotoTable(16,4);
	setGoto(16,3,11);
	setGoto(16,6,7);
	setGoto(16,25,8);
	setGoto(16,8,52);

      newGotoTable(17,2);
	setGoto(17,5,54);
	setGoto(17,24,14);

      newGotoTable(18,2);
	setGoto(18,5,57);
	setGoto(18,24,14);

      newGotoTable(19,8);
	setGoto(19,3,11);
	setGoto(19,6,7);
	setGoto(19,8,21);
	setGoto(19,25,8);
	setGoto(19,10,65);
	setGoto(19,11,62);
	setGoto(19,12,64);
	setGoto(19,13,66);

      newGotoTable(20,5);
	setGoto(20,3,11);
	setGoto(20,6,7);
	setGoto(20,8,21);
	setGoto(20,25,8);
	setGoto(20,10,69);

      newGotoTable(21,8);
	setGoto(21,3,11);
	setGoto(21,6,7);
	setGoto(21,8,21);
	setGoto(21,25,8);
	setGoto(21,10,65);
	setGoto(21,11,71);
	setGoto(21,12,64);
	setGoto(21,13,66);

      newGotoTable(22,2);
	setGoto(22,7,77);
	setGoto(22,25,75);

    }

  /* ************ */
  /* 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,1);
      setTables(7,7,1);
      setTables(8,8,1);
      setTables(9,9,5);
      setTables(10,4,6);
      setTables(11,10,7);
      setTables(12,4,8);
      setTables(13,11,1);
      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,9);
      setTables(23,21,10);
      setTables(24,22,1);
      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,1);
      setTables(32,30,1);
      setTables(33,31,1);
      setTables(34,32,11);
      setTables(35,33,1);
      setTables(36,34,12);
      setTables(37,35,1);
      setTables(38,36,1);
      setTables(39,37,1);
      setTables(40,38,12);
      setTables(41,4,13);
      setTables(42,4,14);
      setTables(43,4,15);
      setTables(44,39,1);
      setTables(45,40,1);
      setTables(46,41,1);
      setTables(47,42,1);
      setTables(48,43,1);
      setTables(49,44,1);
      setTables(50,45,1);
      setTables(51,4,16);
      setTables(52,46,1);
      setTables(53,47,17);
      setTables(54,48,1);
      setTables(55,49,1);
      setTables(56,47,18);
      setTables(57,50,1);
      setTables(58,51,1);
      setTables(59,52,1);
      setTables(60,53,1);
      setTables(61,54,19);
      setTables(62,55,1);
      setTables(63,56,1);
      setTables(64,57,1);
      setTables(65,58,1);
      setTables(66,59,1);
      setTables(67,60,1);
      setTables(68,61,20);
      setTables(69,62,1);
      setTables(70,54,21);
      setTables(71,63,1);
      setTables(72,64,1);
      setTables(73,65,1);
      setTables(74,66,1);
      setTables(75,67,1);
      setTables(76,9,22);
      setTables(77,68,1);
      setTables(78,69,1);
      setTables(79,70,1);
      setTables(80,71,1);
    }
}

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

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

  Stack lhs;
  Stack rhs;
}

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

  Stack symbols;
}

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

  Stack sortList;
}

class OsfV1UntaggedPsiTerm extends OsfV1Body_opt 
{
  OsfV1UntaggedPsiTerm (ParseNode node)
    {
      super(node);
    }

  SortExpression sort;
}

class OsfV1PsiTerm extends OsfV1UntaggedPsiTerm 
{
  OsfV1PsiTerm (ParseNode node)
    {
      super(node);
    }

  String tag;
}

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

  Stack keys;
  Stack subterms;
}

class OsfV1SubTerms extends OsfV1Body_opt 
{
  OsfV1SubTerms (ParseNode node)
    {
      super(node);
    }

  
}

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

  Object key;
  Object psiterm;
}

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

  Object feature;
}

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

  ArrayList args;
}

class OsfV1FileList extends ParseNode 
{
  OsfV1FileList (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 ************************* */
/* ************************************************************************ */

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

