Logo Search packages:      
Sourcecode: maria version File versions

marde.tab.C

/* A Bison parser, made by GNU Bison 1.875a.  */

/* Skeleton parser for Yacc-like parsing with Bison,
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.  */

/* As a special exception, when this file is copied by Bison into a
   Bison output file, you may use that output file without restriction.
   This special exception was added by the Free Software Foundation
   in version 1.24 of Bison.  */

/* Written by Richard Stallman by simplifying the original so called
   ``semantic'' parser.  */

/* All symbols defined below should begin with yy or YY, to avoid
   infringing on user name space.  This should be done even for local
   variables, as they might otherwise be expanded by user macros.
   There are some unavoidable exceptions within include files to
   define necessary library symbols; they are noted "INFRINGES ON
   USER NAME SPACE" below.  */

/* Identify Bison output.  */
#define YYBISON 1

/* Skeleton name.  */
#define YYSKELETON_NAME "yacc.c"

/* Pure parsers.  */
#define YYPURE 0

/* Using locations.  */
#define YYLSP_NEEDED 0

/* If NAME_PREFIX is specified substitute the variables and functions
   names.  */
#define yyparse deparse
#define yylex   delex
#define yyerror deerror
#define yylval  delval
#define yychar  dechar
#define yydebug dedebug
#define yynerrs denerrs


/* Tokens.  */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
   /* Put the tokens into the symbol table, so that GDB and other debuggers
      know about them.  */
   enum yytokentype {
     RELEASE = 258,
     UNTIL = 259,
     EQUIV = 260,
     IMPL = 261,
     OR = 262,
     XOR = 263,
     AND = 264,
     NEXT = 265,
     GLOBALLY = 266,
     FINALLY = 267,
     EQ = 268,
     NE = 269,
     LE = 270,
     GE = 271,
     ROR = 272,
     ROL = 273,
     IS = 274,
     MAP = 275,
     MAX_ = 276,
     MIN_ = 277,
     CARDINALITY = 278,
     EQUALS = 279,
     SUBSET = 280,
     UNION = 281,
     MINUS = 282,
     INTERSECT = 283,
     ATOM_ = 284,
     NUMBER = 285,
     STATE = 286,
     COMP = 287,
     CHARACTER = 288,
     NAME = 289,
     TRUE_ = 290,
     FALSE_ = 291,
     UNDEFINED = 292,
     FATAL = 293,
     EMPTY = 294,
     PLACE = 295,
     TRANS = 296,
     IN_ = 297,
     OUT_ = 298,
     GATE = 299,
     MODEL = 300,
     GRAPH = 301,
     LSTS = 302,
     UNFOLD = 303,
     BREADTH = 304,
     DEPTH = 305,
     STRONG = 306,
     PATH = 307,
     TERMINAL = 308,
     COMPONENTS = 309,
     CD = 310,
     TRANSLATOR = 311,
     COMPILEDIR = 312,
     VISUAL = 313,
     DUMP = 314,
     DUMPGRAPH = 315,
     EVAL = 316,
     HIDE = 317,
     SUBNET = 318,
     SHOW = 319,
     SUCC = 320,
     PRED = 321,
     GO = 322,
     STATS = 323,
     TIME = 324,
     HELP = 325,
     LOG = 326,
     FUNCTION = 327,
     PROMPT = 328,
     EXIT = 329
   };
#endif
#define RELEASE 258
#define UNTIL 259
#define EQUIV 260
#define IMPL 261
#define OR 262
#define XOR 263
#define AND 264
#define NEXT 265
#define GLOBALLY 266
#define FINALLY 267
#define EQ 268
#define NE 269
#define LE 270
#define GE 271
#define ROR 272
#define ROL 273
#define IS 274
#define MAP 275
#define MAX_ 276
#define MIN_ 277
#define CARDINALITY 278
#define EQUALS 279
#define SUBSET 280
#define UNION 281
#define MINUS 282
#define INTERSECT 283
#define ATOM_ 284
#define NUMBER 285
#define STATE 286
#define COMP 287
#define CHARACTER 288
#define NAME 289
#define TRUE_ 290
#define FALSE_ 291
#define UNDEFINED 292
#define FATAL 293
#define EMPTY 294
#define PLACE 295
#define TRANS 296
#define IN_ 297
#define OUT_ 298
#define GATE 299
#define MODEL 300
#define GRAPH 301
#define LSTS 302
#define UNFOLD 303
#define BREADTH 304
#define DEPTH 305
#define STRONG 306
#define PATH 307
#define TERMINAL 308
#define COMPONENTS 309
#define CD 310
#define TRANSLATOR 311
#define COMPILEDIR 312
#define VISUAL 313
#define DUMP 314
#define DUMPGRAPH 315
#define EVAL 316
#define HIDE 317
#define SUBNET 318
#define SHOW 319
#define SUCC 320
#define PRED 321
#define GO 322
#define STATS 323
#define TIME 324
#define HELP 325
#define LOG 326
#define FUNCTION 327
#define PROMPT 328
#define EXIT 329




/* Copy the first part of user declarations.  */
#line 3 "marde.y"

#ifndef BSD
# ifdef __APPLE__
#  define BSD
# elif defined __FreeBSD__||defined __OpenBSD__||defined __NetBSD__
#  define BSD
# elif defined _AIX
#  define BSD
# endif
#endif
#ifdef __WIN32
# undef __STRICT_ANSI__
# include <io.h>
# undef chdir
# define chdir(path) _chdir (path)
#elif !defined __CYGWIN__ && !defined BSD
# include <alloca.h>
#endif
#include <unistd.h> // for chdir(2)
#include <stdlib.h> // for getenv(3)

#include "util.h"
#include "StringBuffer.h"
#include "VariableStackMap.h"
#include "Printer.h"

#include "allExpressions.h"
#include "ExpressionSet.h"

#include "Transition.h"
#include "Place.h"
#include "Arc.h"
#include "Net.h"
#include "GlobalMarking.h"
#include "VariableDefinition.h"
#include "VariableSet.h"
#include "Function.h"

#include "Quantifier.h"

#include "typedefs.h"
#include "allTypes.h"
#include "allValues.h"
#include "Valuation.h"

# include <set>
# include <map>
# include <list>
# include <stack>

# ifndef NDEBUG
#  define ASSERT1(x) x
# else
#  define ASSERT1(x)
# endif

  /** @file marde.y
   * Parser for the query language
   */

  /* Copyright © 1999-2003 Marko Mäkelä (msmakela@tcs.hut.fi).

  This file is part of MARIA, a reachability analyzer and model checker
  for high-level Petri nets.

  MARIA is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2, or (at your option)
  any later version.

  MARIA is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  General Public License for more details.

  The GNU General Public License is often shipped with GNU software, and
  is generally kept in a file called COPYING or LICENSE.  If you do not
  have a copy of the license, write to the Free Software Foundation,
  59 Temple Place, Suite 330, Boston, MA 02111 USA. */

  /** flag: exiting */
  bool exiting = false;
  /** character to display on its own line before the prompt (0=none) */
  static char promptchar = 0;
  /** warning flag (true=print warnings) */
  extern bool dewarnings;
  /** Maximum range size of quantifications */
  extern card_t maxRange;
#ifndef BUILTIN_LTL
  /** Translator for property automata */
  extern char* translator;
#endif // !BUILTIN_LTL
#ifdef EXPR_COMPILE
  /** name of the compilation directory (NULL=don't compile) */
  extern char* compiledir;
#endif // EXPR_COMPILE

  /** read a command line */
  const char* deline (void);
  /** reset the parser and the lexical analyzer */
  void dereset ();
  /** reset the lexical analyzer */
  extern void delexreset ();

  /** lexical analyzer function
   * @return            a terminal symbol, and set yylval to its semantic value
   */
  extern int delex ();

  /** flag: expecting a command keyword */
  bool command = true;
  /** The state being examined */
  static card_t currentState = CARD_T_MAX;
  /** Visualization level */
  static card_t visual;
  /** Flag: hide/reveal */
  static bool hide;

  /** The printer object */
  extern class Printer thePrinter;
  /** The Petri Net */
  extern class Net* net;
  /** Selected Petri Net */
  extern class Net* subnet;
  /** Selected Petri Net as a path from the root net */
  extern unsigned* modulepath;

  /** Flag: has a complaint been made about a net not being loaded? */
  extern bool notloaded;
  /** Flag: apply modular analysis */
  extern bool modular;
  /** Parameters of the function that is currently being processed */
  static class VariableDefinition** currentParameters = NULL;
  /** Arity of the function that is currently being processed */
  static unsigned currentArity = 0;
  /** Function being invoked */
  static std::stack< class Function*, std::list<class Function*> >
    functionStack;
  /** The transition that is currently being processed */
  static class Transition* currentTransition = NULL;
  /** The context transition */
  static class Transition* currentContextTransition = NULL;
  /** The type definition that is currently being processed */
  static const class Type* currentType = NULL;
  /** The context type of currentType (StructType or VectorType or NULL) */
  static const class Type* currentContextType = NULL;
  /** Struct or vector component number currently being parsed */
  static card_t currentComponent;
  /** Type context */
00366   struct TypeContext
  {
    /** Context type (@see currentContextType), may be NULL */
00369     const class Type* context;
    /** Component type (@see currentContext) */
00371     const class Type* component;
    /** Number of current component (@see currentComponent)
     * , meaningless if context==NULL */
00374     card_t numComponent;
  };
  /** Stack of types, used e.g. when parsing quantifier conditions */
  static std::stack< struct TypeContext, std::list<struct TypeContext> >
    typeStack;
  /** Flag: is an output arc being parsed? */
  static bool isOutputArc = false;

  /** Flag: has an empty list component been parsed? */
  static bool emptyParsed = false;

  typedef std::pair<const class Type*,card_t> StructLevel;
  /** Stack for parsing structs and vectors */
  static std::stack< StructLevel, std::list<StructLevel> > structLevels;

  /** Open a model
   * @param filename    name of the net to be analyzed
   * @param graphfile   base name for the reachability graph files
   * @param regen flag: regenerate the graph files
   * @return            false on error, true otherwise
   */
  extern bool model (const char* filename, const char* graphfile, bool regen);

  /** Analyze the safety properties of the model
   * @param breadth     flag: search breadth first instead of depth
   * @param expr  the safety formula to analyze (optional)
   * @param visual      visualization level for counterexample
   */
  extern void safety (bool breadth, class Expression* expr, card_t visual);

  /** Generate an LSTS of the model when generating the state space
   * @param filebase    base file name (NULL=disable LSTS generation)
   */
  extern void lsts (const char* filebase);

  /** Unfold the model
   * @param ffilename   output format and file name (NULL=default,stdout)
   */
  extern void unfold (const char* ffilename);

  /** Dump the syntax tree of the model
   * @param visual      visualization level
   */
  extern void dump (card_t visual);

  /** Dump the reachability graph of the model
   * @param visual      visualization level
   */
  extern void dumpgraph (card_t visual);

  /** Perform exhaustive reachability analysis
   * @param state state to start the analysis with
   * @param breadth     flag: go breadth-first instead of depth-first
   */
  extern void analyze (card_t state, bool breadth);

  /** Check if graphless model checking is selected
   * @return      true if purely state-based approach should be applied
   */
  extern bool isGraphless ();

  /** Check if a state number exists
   * @param state the state
   * @return            true if the state exists
   */
  extern bool isState (card_t state);

  /** Show a state
   * @param state the state
   * @param visual      visualization level
   */
  extern void show (card_t state, card_t visual);

  /** Show a path specified as a state list
   * @param sl          the state list
   * @param visual      visualization level
   */
  extern void show (const card_t* states, card_t visual);

  /** Show the successors of a state
   * @param state the state
   * @param seq         flag: fully expand deterministic sequences
   * @param visual      visualization level
   */
  extern void succ (card_t state, bool seq, card_t visual);

  /** Show the predecessors of a state
   * @param state the state
   * @param seq         flag: fully expand deterministic sequences
   * @param visual      visualization level
   */
  extern void pred (card_t state, bool seq, card_t visual);

  /** Display statistics */
  extern void stats (void);

  /** Display execution times */
  extern void showtimes (void);

  /** Compute strongly connected components
   * @param state state in which to start the search
   * @param cond  condition for the states to be included in the search
   */
  extern void strong (card_t state, class Expression* cond);
  /** Display non-trivial terminal strongly connected components */
  extern void terminal ();
  /** Display all strongly connected components
   * @param visual      visualization level
   */
  extern void allcomps (card_t visual);
  /** Show the nodes of a strongly connected component fulfilling a condition
   * @param comp  the component
   * @param cond  the condition
   * @param visual      visualization level
   */
  extern void comp_show (card_t comp,
                   class Expression* cond,
                   card_t visual);
  /** Show the successors of a strongly connected component
   * @param comp  the component
   * @param visual      visualization level
   */
  extern void comp_succ (card_t comp, card_t visual);
  /** Show the predecessors of a strongly connected component
   * @param comp  the component
   * @param visual      visualization level
   */
  extern void comp_pred (card_t comp, card_t visual);
  /** Show the shortest path from a state to a strongly connected component
   * @param state the state
   * @param comp  the component
   * @param pathc path condition (must hold in every state on the path)
   * @param visual      visualization level
   */
  extern void path_sc (card_t state, card_t comp,
                   class Expression* pathc,
                   card_t visual);
  /** Show the shortest path from a strongly connected component to a state
   * @param comp  the component
   * @param state the state
   * @param pathc path condition (must hold in every state on the path)
   * @param visual      visualization level
   */
  extern void path_cs (card_t comp, card_t state,
                   class Expression* pathc,
                   card_t visual);
  /** Show the shortest path from a state to a state
   * @param state the source state
   * @param dest  the target state
   * @param pathc path condition (must hold in every state on the path)
   * @param visual      visualization level
   */
  extern void path_ss (card_t state, card_t dest,
                   class Expression* pathc,
                   card_t visual);
  /** Show the shortest path from a state to a state where a condition holds
   * @param state the source state
   * @param cond  the condition
   * @param pathc path condition (must hold in every state on the path)
   * @param visual      visualization level
   */
  extern void path_se (card_t state, class Expression& cond,
                   class Expression* pathc,
                   card_t visual);
  /** Show the shortest path from a state where a condition holds to a state
   * @param state the target state
   * @param cond  the condition
   * @param pathc path condition (must hold in every state on the path)
   * @param visual      visualization level
   */
  extern void rpath_se (card_t state, class Expression& cond,
                  class Expression* pathc,
                  card_t visual);
  /** Show the shortest path from a state to a loop state, plus the loop
   * @param state the source state
   * @param loop  amount and number of states in the loop
   * @param pathc path condition (must hold in every state on the path)
   * @param visual      visualization level
   */
  extern void path_sl (card_t state,
                   const card_t* loop,
                   class Expression* pathc,
                   card_t visual);

  /** Evaluate a formula in the current state
   * @param state state in which to evaluate the formula
   * @param expr  formula to be evaluated
   * @param visual      visualization level for counterexample
   */
  extern void eval (card_t state, class Expression* expr, card_t visual);

  /** Fire an anonymous transition
   * @param trans the anonymous transition
   * @param state state in which to fire the transition
   * @param visual      visualization level for counterexample
   */
  extern void fireTransition (class Transition& trans,
                        card_t state,
                        card_t visual);

  /** Display a short help message */
  static void help (void);

  /** Confirm the selection of a subnet */
  static void go_subnet (void);

  /** Derive a net from modulepath */
  static const class Net* getSubnet (void);

  /** Determine whether a model has been loaded
   * @return            true if a model has been loaded
   */
  static bool isNet (void);

  /** Display a type name in an error message
   * @param type  type to be displayed
   */
  static void printType (const class Type& type);

  /** Push the type context on structLevels
   * @param type  new type context
   */
  static void pushTypeContext (const class Type* type);
  /** Restore the type context from structLevels */
  static void popTypeContext ();

  /** Get the parameter of the currently parsed function by name
   * @param name  name of the parameter
   * @return            the corresponding VariableDefinition, or NULL
   */
  static const class VariableDefinition* getParameter (char* name);

  /** Add a parameter to the function definition being parsed
   * @param type  type of the parameter
   * @param name  name of the parameter
   */
  static void addParameter (const class Type* type, char* name);

  /** Get a Function by name
   * @param name  the function name
   * @return            a Function object
   */
  static class Function* getFunction (const char* name);

  /** Get a zero-arity Function by name
   * @param name  the function name
   * @return            a Function object
   */
  static class Function* getConstantFunction (const char* name);

  /** Get a Constant by name
   * @param name  the constant name
   * @return            a Constant object
   */
  static const class Constant* getConstant (const char* name);

  /** Get a VariableDefinition by name
   * @param name  the variable name
   * @return            a VariableDefinition object
   */
  static const class VariableDefinition* getVariable (char* name);

  /** Get a state proposition by name
   * @param name  the proposition name
   * @return            the corresponding proposition, or NULL
   */
  static const class Expression* getProposition (char* name);

  /** Resolve a name to a constant or variable
   * @param name  the name
   * @return            the resolved expression, or NULL
   */
  static class Expression* resolveName (char* name);

  /** Ensure that the formula is a set-valued expression
   * @param expr  formula to be checked
   * @param type  expected type of the formula
   * @return            expr, pointer to a Marking object, or NULL
   */
  static class Expression* ensureSet (class Expression* expr,
                              const class Type* type = 0);

  /** Ensure that the formula is a marking expression, converting if needed
   * @param expr  formula to be checked
   * @param type  expected type of the expression
   * @return            pointer to a Marking object, or NULL
   */
  static class Marking* ensureMarking (class Expression* expr,
                               const class Type* type);

  /** Ensure that the formula is not a marking expression
   * @param expr  formula to be checked
   * @return            expr or NULL
   */
  static class Expression* noMarking (class Expression* expr);

  /** Ensure that the formula is a basic expression
   * @param expr  formula to be checked
   * @return            expr or NULL
   */
  static class Expression* ensureExpr (class Expression* expr);

  /** Ensure that the formula is a boolean expression
   * @param expr  formula to be checked
   * @param undefined   flag: allow the formula to be Undefined
   * @return            expr or NULL
   */
  static class Expression* ensureBool (class Expression* expr,
                               bool undefined = false);

  /** Ensure that the formula is a signed integer expression
   * @param expr  formula to be checked
   * @return            expr or NULL
   */
  static class Expression* ensureInt (class Expression* expr);

  /** Ensure that the formula is an unsigned integer expression
   * @param expr  formula to be checked
   * @return            expr or NULL
   */
  static class Expression* ensureCard (class Expression* expr);

  /** Ensure that the formula is a signed or unsigned integer expression
   * @param expr  formula to be checked
   * @return            expr or NULL
   */
  static class Expression* ensureIntCard (class Expression* expr);

  /** Ensure that the formula is a buffer expression
   * @param expr  formula to be checked
   * @return            expr or NULL
   */
  static class Expression* ensureBuffer (class Expression* expr);

  /** Ensure that the formula is a basic expression of ordered type
   * @param expr  formula to be checked
   * @return            expr or NULL
   */
  static class Expression* ensureOrdered (class Expression* expr);

  /** Convert an integer to an enumeration value if possible
   * @param type  type of the enumeration value
   * @param value numerical value to be converted to the enumeration type
   * @return            a constant having the enumeration value or NULL
   */
  static class Expression* enumValue (const class EnumType& type,
                              card_t value);

  /** Ensure that a named component matches a struct being parsed
   * @param name  name of the component
   * @param expr  initialization expression for the component
   * @return            expr or NULL
   */
  static class Expression* namedComponent (char* name, class Expression* expr);

  /** Begin parsing a non-determinism expression
   * @param type  type of the expression
   * @param hidden      flag: hide the variable from transition instances
   * @param name  name of the non-deterministic variable (optional)
   */
  static void beginAny (const class Type*& type, char* name, bool hidden);

  /** End parsing a non-determinisim expression
   * @param type  type of the expression
   * @param name  name of the non-deterministic variable (optional)
   * @param condition   quantification condition (optional)
   * @return            a Variable expression for the variable, or NULL
   */
  static class Variable* endAny (const class Type* type, char* name,
                         class Expression* condition);

  /** Begin parsing a quantifier expression
   * @param name  name of the quantifier variable
   * @param type  type of the quantifier variable
   */
  static void beginQuantifier (char* name, const class Type* type);

  /** Continue parsing a quantifier expression
   *  (after parsing an optional condition)
   * @param type  type of the quantifier variable
   */
  static void continueQuantifier (ASSERT1 (const class Type* type));

  /** End parsing a quantifier expression
   * @param name  name of the quantifier variable
   * @param type  type of the quantifier variable
   * @param condition   quantification condition (optional)
   * @param kind  quantification kind (1=sum, 2=forall, 3=exists)
   * @param expr  marking expression
   * @return            expr augmented with the quantifier, or NULL if failed
   */
  static class Expression* endQuantifier (char* name, const class Type* type,
                                class Expression* condition,
                                unsigned kind,
                                class Expression* expr);

  /** Declare a quantified variable
   * @param prefix      prefix of the quantified variable
   * @param quant name of the quantifier variable
   * @param p           flag: use a predecessor value of the quantifier
   * @return            a quantified variable, or NULL if failed
   */
  static class Expression* quantifierVariable (char* prefix,
                                     char* quant,
                                     bool p);

  /** Try to make expr compatible with type if expr is a Constant
   * @param expr  expression to be made compatible
   * @param type  type to be made compatible with
   * @param casting     flag: typecasting in progress (suppress a warning)
   * @return            true if expr is not a Constant or
   *              if the conversion succeeded
   */
  static bool makeCompatible (class Expression*& expr,
                        const class Type& type,
                        bool casting = false);

  /** Determine whether an expression is compatible with a type
   * @param expr  expression to be checked
   * @param type  the type
   * @return            true if the expression is compatible with the type
   */
  static bool isCompatible (class Expression*& expr,
                      const class Type* type);

  /** Determine whether an expression is compatible with
   * the struct component being parsed
   * @param expr  expression to be checked
   * @param s           the struct whose current component is considered
   * @return            true if the expression is compatible with the struct
   */
  static bool isCompatible (class Expression*& expr,
                      const class StructExpression& s);

  /** Ensure that the type is ordered
   * @param type  type to be checked
   * @return            true if the type is ordered
   */
  static bool isOrdered (const class Type& type);

  /** Check a valuation
   * @param v           valuation to be checked
   * @return            true if the valuation is OK
   */
  static bool check (const class Valuation& v);

  /** Perform constant folding
   * @param expr  expression to be folded
   * @return            expr or a new Constant, or NULL in case of error
   */
  static class Expression* fold (class Expression* expr);

  /** Define a function
   * @param type  type of the function
   * @param name  name of the function
   * @param expr  body of the function
   */
  static void defun (const class Type* type,
                 char* name,
                 class Expression* expr);

  /** Create a RelopExpression or optimize it
   * @param equal flag: equality comparison (instead of less-than)
   * @param left  left-hand-side of RelopExpression
   * @param right right-hand-side of RelopExpression
   * @return            RelopExpression or a Boolean constant
   */
  static class Expression* newRelopExpression (bool equal,
                                     class Expression* left,
                                     class Expression* right);

  /** Create a BinopExpression
   * @param op          operator
   * @param left  left-hand-side of BinopExpression
   * @param right right-hand-side of BinopExpression
   * @return            BinopExpression
   */
  static class Expression* newBinopExpression (enum BinopExpression::Op op,
                                     class Expression* left,
                                     class Expression* right);

  /** Create a NotExpression or optimize it
   * @param expr  an expression
   * @return            a negation of the expression
   */
  static class Expression* newNotExpression (class Expression* expr);

  /** Create a BooleanBinop or optimize it
   * @param conj  flag: conjunction (instead of disjunction)
   * @param left  left-hand-side of BooleanBinop
   * @param right right-hand-side of BooleanBinop
   * @return            left, right, Boolean constant, or a BooleanBinop
   */
  static class Expression* newBooleanBinop (bool conj,
                                  class Expression* left,
                                  class Expression* right);

  /** Create a SetExpression or optimize it
   * @param op          operator
   * @param left  left-hand-side of SetExpression
   * @param right right-hand-side of SetExpression
   */
  static class Expression* newSetExpression (enum SetExpression::Op op,
                                   class Expression* left,
                                   class Expression* right);

  /** Create a CardinalityExpression or optimize it
   * @param op          operator
   * @param expr  the multi-set expression
   */
  static class Expression* newCardinalityExpression
    (enum CardinalityExpression::Op op,
     class Expression* expr);

  /** Create a BufferUnop from a buffer expression
   * @param op          operator
   * @param expr  the buffer expression
   * @return            a BufferUnop object, or NULL
   */
  static class Expression* newBufferUnop (enum BufferUnop::Op op,
                                class Expression* expr);

  /** Variable stack map to be used with variable scoping */
  static class VariableStackMap currentVariables;

  /**
   * generic compiler warning reporting function
   * @param s           warning message
   */
  extern void dewarn (const char* s);

  /**
   * generic parser error reporting function
   * @param s           error message
   */
  extern void deerror (const char* s);


/* Enabling traces.  */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif

/* Enabling verbose error messages.  */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif

#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 698 "marde.y"
typedef union YYSTYPE {
  card_t i;
  card_t* ia;
  bool flag;
  char_t c;
  char* s;
  class Expression* expr;
  class ExpressionList* exprList;
  const class Place* place;
  class Marking* marking;
  const class Type* type;
} YYSTYPE;
/* Line 191 of yacc.c.  */
#line 941 "marde.tab.c"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif



/* Copy the second part of user declarations.  */


/* Line 214 of yacc.c.  */
#line 953 "marde.tab.c"

#if ! defined (yyoverflow) || YYERROR_VERBOSE

/* The parser invokes alloca or malloc; define the necessary symbols.  */

# if YYSTACK_USE_ALLOCA
#  define YYSTACK_ALLOC alloca
# else
#  ifndef YYSTACK_USE_ALLOCA
#   if defined (alloca) || defined (_ALLOCA_H)
#    define YYSTACK_ALLOC alloca
#   else
#    ifdef __GNUC__
#     define YYSTACK_ALLOC __builtin_alloca
#    endif
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's `empty if-body' warning. */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# else
#  if defined (__STDC__) || defined (__cplusplus)
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#   define YYSIZE_T size_t
#  endif
#  define YYSTACK_ALLOC malloc
#  define YYSTACK_FREE free
# endif
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */


#if (! defined (yyoverflow) \
     && (! defined (__cplusplus) \
       || (YYSTYPE_IS_TRIVIAL)))

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  short yyss;
  YYSTYPE yyvs;
  };

/* The size of the maximum gap between one aligned stack and the next.  */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)

/* The size of an array large to enough to hold all stacks, each with
   N elements.  */
# define YYSTACK_BYTES(N) \
     ((N) * (sizeof (short) + sizeof (YYSTYPE))                   \
      + YYSTACK_GAP_MAXIMUM)

/* Copy COUNT objects from FROM to TO.  The source and destination do
   not overlap.  */
# ifndef YYCOPY
#  if 1 < __GNUC__
#   define YYCOPY(To, From, Count) \
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
#  else
#   define YYCOPY(To, From, Count)        \
      do                            \
      {                             \
        register YYSIZE_T yyi;            \
        for (yyi = 0; yyi < (Count); yyi++)     \
          (To)[yyi] = (From)[yyi];        \
      }                             \
      while (0)
#  endif
# endif

/* Relocate STACK from its old location to the new one.  The
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
   elements in the stack, and YYPTR gives the new location of the
   stack.  Advance YYPTR to a properly aligned location for the next
   stack.  */
# define YYSTACK_RELOCATE(Stack)                            \
    do                                                      \
      {                                                     \
      YYSIZE_T yynewbytes;                                  \
      YYCOPY (&yyptr->Stack, Stack, yysize);                      \
      Stack = &yyptr->Stack;                                \
      yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
      yyptr += yynewbytes / sizeof (*yyptr);                      \
      }                                                     \
    while (0)

#endif

#if defined (__STDC__) || defined (__cplusplus)
   typedef signed char yysigned_char;
#else
   typedef short yysigned_char;
#endif

/* YYFINAL -- State number of the termination state. */
#define YYFINAL  98
/* YYLAST -- Last index in YYTABLE.  */
#define YYLAST   2435

/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS  100
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS  84
/* YYNRULES -- Number of rules. */
#define YYNRULES  275
/* YYNRULES -- Number of states. */
#define YYNSTATES  418

/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
#define YYUNDEFTOK  2
#define YYMAXUTOK   329

#define YYTRANSLATE(YYX)                                    \
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
static const unsigned char yytranslate[] =
{
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,    34,     2,    31,     2,    30,    17,     2,
      47,    96,    28,    26,    94,    27,    45,    29,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     4,    93,
      20,    95,    21,     3,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,    46,     2,    99,    16,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,    97,    15,    98,    33,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     1,     2,     5,     6,
       7,     8,     9,    10,    11,    12,    13,    14,    18,    19,
      22,    23,    24,    25,    32,    35,    36,    37,    38,    39,
      40,    41,    42,    43,    44,    48,    49,    50,    51,    52,
      53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
      63,    64,    65,    66,    67,    68,    69,    70,    71,    72,
      73,    74,    75,    76,    77,    78,    79,    80,    81,    82,
      83,    84,    85,    86,    87,    88,    89,    90,    91,    92
};

#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
   YYRHS.  */
static const unsigned short yyprhs[] =
{
       0,     0,     3,     4,     6,     8,     9,    13,    15,    19,
      22,    25,    28,    30,    32,    35,    39,    42,    45,    49,
      53,    58,    61,    65,    70,    74,    79,    83,    85,    87,
      89,    91,    93,    96,    98,   100,   103,   104,   109,   110,
     116,   118,   121,   123,   125,   128,   131,   133,   136,   137,
     140,   143,   146,   149,   152,   156,   160,   164,   168,   171,
     174,   177,   179,   182,   185,   189,   193,   195,   198,   201,
     203,   204,   207,   208,   211,   214,   217,   218,   221,   222,
     224,   227,   228,   233,   236,   241,   243,   246,   247,   252,
     255,   257,   261,   262,   264,   266,   269,   271,   273,   276,
     279,   285,   291,   296,   301,   307,   313,   314,   318,   320,
     322,   324,   325,   327,   328,   330,   332,   334,   336,   338,
     339,   345,   346,   354,   357,   362,   365,   366,   367,   372,
     373,   378,   379,   384,   385,   390,   391,   393,   397,   400,
     403,   404,   410,   414,   416,   420,   421,   422,   428,   430,
     434,   436,   438,   440,   444,   446,   447,   452,   453,   457,
     458,   460,   463,   467,   469,   473,   474,   476,   478,   480,
     482,   484,   486,   488,   491,   492,   498,   500,   502,   504,
     506,   508,   510,   512,   514,   515,   520,   521,   526,   527,
     532,   536,   539,   540,   545,   546,   552,   556,   560,   564,
     568,   572,   576,   580,   584,   588,   592,   596,   599,   602,
     605,   608,   611,   614,   617,   620,   623,   626,   630,   634,
     638,   642,   646,   650,   651,   652,   663,   664,   672,   676,
     677,   683,   686,   690,   694,   698,   702,   706,   709,   712,
     715,   719,   723,   725,   729,   733,   737,   741,   745,   748,
     751,   754,   758,   762,   763,   764,   772,   776,   780,   781,
     789,   790,   798,   799,   809,   810,   811,   814,   815,   820,
     823,   825,   829,   831,   834,   836
};

/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const short yyrhs[] =
{
     101,     0,    -1,    -1,   102,    -1,    93,    -1,    -1,    93,
     103,   104,    -1,   104,    -1,   102,    93,   104,    -1,   102,
      93,    -1,    63,   131,    -1,    64,   131,    -1,   110,    -1,
     111,    -1,   109,   112,    -1,   109,    79,   112,    -1,   109,
      79,    -1,   109,    82,    -1,   109,    82,   107,    -1,   109,
      82,    50,    -1,   109,    82,    50,   159,    -1,   109,    50,
      -1,   109,    50,   159,    -1,   109,    83,   115,   113,    -1,
     109,    83,    50,    -1,   109,    84,   115,   113,    -1,   109,
      84,    50,    -1,   117,    -1,   120,    -1,   125,    -1,    86,
      -1,    87,    -1,    89,   130,    -1,    88,    -1,   126,    -1,
      90,   134,    -1,    -1,   109,    59,   105,   138,    -1,    -1,
     109,    49,    59,   106,   138,    -1,    91,    -1,    91,   159,
      -1,    92,    -1,    49,    -1,   107,    49,    -1,   107,     1,
      -1,    49,    -1,   108,    49,    -1,    -1,   109,    76,    -1,
      65,   130,    -1,    66,   130,    -1,   109,    77,    -1,   109,
      78,    -1,   109,    67,   113,    -1,   109,    68,   113,    -1,
     109,    67,   161,    -1,   109,    68,   161,    -1,    73,   130,
      -1,    74,   130,    -1,    75,   130,    -1,    69,    -1,    69,
     159,    -1,    69,    49,    -1,    69,    49,   159,    -1,    69,
     159,    49,    -1,    71,    -1,   109,    72,    -1,    49,   161,
      -1,   161,    -1,    -1,   113,    49,    -1,    -1,   114,    49,
      -1,   114,    50,    -1,   114,   129,    -1,    -1,   115,    34,
      -1,    -1,    58,    -1,    80,   115,    -1,    -1,    80,   115,
     118,   119,    -1,   116,   129,    -1,   119,    94,   116,   131,
      -1,    81,    -1,    81,    29,    -1,    -1,    81,    29,   121,
     122,    -1,    81,   122,    -1,   124,    -1,   122,    29,   123,
      -1,    -1,   124,    -1,    45,    -1,    45,    45,    -1,    48,
      -1,   129,    -1,    85,   114,    -1,   109,    49,    -1,   109,
      70,    50,   114,   127,    -1,   109,    70,    49,    50,   127,
      -1,   109,    70,   108,   127,    -1,   109,    70,   159,   127,
      -1,   109,    70,   159,    49,   127,    -1,   109,    70,    49,
     159,   127,    -1,    -1,   127,    94,   158,    -1,   129,    -1,
      52,    -1,     1,    -1,    -1,   129,    -1,    -1,   129,    -1,
      93,    -1,    94,    -1,    12,    -1,    95,    -1,    -1,   128,
     131,   133,   135,   161,    -1,    -1,   128,   131,    47,   137,
      96,   136,   161,    -1,   128,   131,    -1,   137,   132,   128,
     131,    -1,   137,   132,    -1,    -1,    -1,   138,    97,   142,
      98,    -1,    -1,   138,    60,   139,   145,    -1,    -1,   138,
      61,   140,   145,    -1,    -1,   138,    62,   141,   149,    -1,
      -1,   143,    -1,   142,   132,   143,    -1,   142,   132,    -1,
     128,   131,    -1,    -1,   128,   129,    34,   144,   155,    -1,
      97,   146,    98,    -1,   147,    -1,   146,    93,   147,    -1,
      -1,    -1,   116,   181,     4,   148,   152,    -1,   150,    -1,
     149,    94,   150,    -1,   159,    -1,   161,    -1,   151,    -1,
     152,    94,   151,    -1,   161,    -1,    -1,   153,    94,   154,
     151,    -1,    -1,    47,   158,    96,    -1,    -1,   159,    -1,
      52,     4,    -1,    52,     4,   159,    -1,   156,    -1,   157,
      94,   156,    -1,    -1,   159,    -1,   161,    -1,     1,    -1,
       4,    -1,     9,    -1,    11,    -1,     1,    -1,   129,    12,
      -1,    -1,   129,    47,   162,   177,    96,    -1,    53,    -1,
      54,    -1,   182,    -1,    52,    -1,    48,    -1,    51,    -1,
      55,    -1,    56,    -1,    -1,    97,   163,   157,    98,    -1,
      -1,    32,   128,   164,   161,    -1,    -1,   129,    95,   165,
     161,    -1,   161,    32,   131,    -1,    44,   161,    -1,    -1,
     128,    34,   166,   155,    -1,    -1,   128,   129,    34,   167,
     155,    -1,   161,    20,   161,    -1,   161,    18,   161,    -1,
     161,    21,   161,    -1,   161,    23,   161,    -1,   161,    19,
     161,    -1,   161,    22,   161,    -1,   161,    26,   161,    -1,
     161,    27,   161,    -1,   161,    29,   161,    -1,   161,    28,
     161,    -1,   161,    30,   161,    -1,    33,   161,    -1,    31,
     128,    -1,    20,   128,    -1,    21,   128,    -1,    15,   161,
      -1,    26,   161,    -1,    27,   161,    -1,    28,   161,    -1,
      29,   161,    -1,    30,   161,    -1,   161,    25,   161,    -1,
     161,    24,   161,    -1,   161,    17,   161,    -1,   161,    16,
     161,    -1,   161,    15,   161,    -1,   161,     3,   180,    -1,
      -1,    -1,   161,    45,    97,    46,   168,   158,    99,   169,
     158,    98,    -1,    -1,   161,    45,    97,   129,   170,   158,
      98,    -1,   161,    45,   129,    -1,    -1,   161,    46,   171,
     159,    99,    -1,    34,   161,    -1,   161,    11,   161,    -1,
     161,     9,   161,    -1,   161,     8,   161,    -1,   161,    10,
     161,    -1,   161,     7,   161,    -1,    14,   161,    -1,    13,
     161,    -1,    12,   161,    -1,   161,     6,   161,    -1,   161,
       5,   161,    -1,    57,    -1,   161,    40,   161,    -1,   161,
      43,   161,    -1,   161,    42,   161,    -1,   161,    41,   161,
      -1,   161,    39,   161,    -1,    38,   161,    -1,    37,   161,
      -1,    36,   161,    -1,    47,   153,    96,    -1,   161,    31,
     161,    -1,    -1,    -1,   128,   129,   172,   155,   173,   160,
     161,    -1,    45,   129,   130,    -1,     4,   129,   130,    -1,
      -1,    40,   131,    97,   153,    98,   174,   161,    -1,    -1,
      35,   131,    97,   153,    98,   175,   161,    -1,    -1,    35,
     131,    31,   131,    97,   153,    98,   176,   161,    -1,    -1,
      -1,   178,   161,    -1,    -1,   177,    94,   179,   161,    -1,
     177,    94,    -1,   161,    -1,   180,     4,   161,    -1,   131,
      -1,   183,   181,    -1,    58,    -1,   183,    58,    -1
};

/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
static const unsigned short yyrline[] =
{
       0,   802,   802,   804,   808,   812,   811,   816,   819,   822,
     826,   834,   842,   844,   846,   848,   850,   853,   856,   859,
     862,   865,   868,   871,   874,   877,   880,   883,   885,   887,
     889,   892,   895,   908,   911,   913,   916,   915,   926,   925,
     935,   938,   951,   956,   959,   969,   974,   977,   989,   991,
     996,   999,  1002,  1005,  1008,  1021,  1034,  1042,  1050,  1056,
    1067,  1078,  1081,  1084,  1087,  1090,  1093,  1096,  1101,  1104,
    1109,  1111,  1124,  1126,  1137,  1140,  1148,  1150,  1154,  1156,
    1160,  1169,  1168,  1174,  1188,  1204,  1207,  1211,  1210,  1218,
    1224,  1226,  1229,  1231,  1235,  1237,  1240,  1247,  1265,  1268,
    1279,  1282,  1285,  1298,  1304,  1307,  1312,  1314,  1325,  1347,
    1350,  1355,  1357,  1362,  1364,  1368,  1368,  1371,  1373,  1378,
    1377,  1383,  1382,  1394,  1402,  1410,  1417,  1420,  1422,  1425,
    1424,  1429,  1428,  1433,  1432,  1439,  1441,  1444,  1451,  1461,
    1478,  1477,  1484,  1488,  1490,  1493,  1496,  1495,  1514,  1516,
    1520,  1545,  1550,  1553,  1563,  1567,  1566,  1579,  1581,  1586,
    1588,  1591,  1594,  1599,  1665,  1751,  1753,  1758,  1763,  1766,
    1769,  1772,  1777,  1780,  1800,  1799,  1827,  1833,  1839,  1842,
    1845,  1851,  1857,  1860,  1864,  1863,  1994,  1993,  2011,  2010,
    2070,  2104,  2108,  2107,  2113,  2112,  2117,  2120,  2123,  2126,
    2129,  2132,  2135,  2159,  2178,  2181,  2184,  2187,  2193,  2210,
    2218,  2226,  2232,  2238,  2257,  2260,  2263,  2266,  2269,  2272,
    2275,  2278,  2281,  2311,  2324,  2310,  2348,  2347,  2390,  2438,
    2437,  2493,  2496,  2506,  2516,  2526,  2532,  2535,  2543,  2551,
    2559,  2570,  2581,  2584,  2587,  2590,  2593,  2596,  2599,  2602,
    2605,  2608,  2611,  2667,  2669,  2666,  2673,  2676,  2680,  2679,
    2728,  2727,  2780,  2779,  2831,  2849,  2849,  2882,  2881,  2918,
    2924,  2932,  2955,  2971,  2976,  2978
};
#endif

#if YYDEBUG || YYERROR_VERBOSE
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
  "$end", "error", "$undefined", "'?'", "':'", "RELEASE", "UNTIL", "EQUIV", 
  "IMPL", "OR", "XOR", "AND", "NEXT", "GLOBALLY", "FINALLY", "'|'", "'^'", 
  "'&'", "EQ", "NE", "'<'", "'>'", "LE", "GE", "ROR", "ROL", "'+'", "'-'", 
  "'*'", "'/'", "'%'", "'#'", "IS", "'~'", "'!'", "MAP", "MAX_", "MIN_", 
  "CARDINALITY", "EQUALS", "SUBSET", "UNION", "MINUS", "INTERSECT", 
  "ATOM_", "'.'", "'['", "'('", "NUMBER", "STATE", "COMP", "CHARACTER", 
  "NAME", "TRUE_", "FALSE_", "UNDEFINED", "FATAL", "EMPTY", "PLACE", 
  "TRANS", "IN_", "OUT_", "GATE", "MODEL", "GRAPH", "LSTS", "UNFOLD", 
  "BREADTH", "DEPTH", "STRONG", "PATH", "TERMINAL", "COMPONENTS", "CD", 
  "TRANSLATOR", "COMPILEDIR", "VISUAL", "DUMP", "DUMPGRAPH", "EVAL", 
  "HIDE", "SUBNET", "SHOW", "SUCC", "PRED", "GO", "STATS", "TIME", "HELP", 
  "LOG", "FUNCTION", "PROMPT", "EXIT", "';'", "','", "'='", "')'", "'{'", 
  "'}'", "']'", "$accept", "script", "statements", "@1", "statement", 
  "@2", "@3", "statelist", "statelist_", "_opt_visual", "analyze", 
  "strong", "eval", "state_", "state", "_opt_exclam", "_opt_place", 
  "hide", "@4", "hide_list", "subnet", "@5", "subnet_list", 
  "subnet_elem_", "subnet_elem", "go", "path", "path_expr", 
  "typereference", "name_", "_opt_name", "name", "delim", "next_eq", 
  "function", "@6", "@7", "param_list", "trans", "@8", "@9", "@10", 
  "_list_var_expr", "var_expr", "@11", "trans_places", 
  "_list_place_marking", "place_marking", "@12", "gate_list", "gate", 
  "marking", "marking_list", "marking_list_", "@13", "_opt_expr", 
  "_opt__expr", "struct_expr", "expr_", "expr", "quantifier", "formula", 
  "@14", "@15", "@16", "@17", "@18", "@19", "@20", "@21", "@22", "@23", 
  "@24", "@25", "@26", "@27", "@28", "arg_list", "@29", "@30", 
  "colon_formula", "placename_", "placename", "_nopt_place", 0
};
#endif

# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
   token YYLEX-NUM.  */
static const unsigned short yytoknum[] =
{
       0,   256,   257,    63,    58,   258,   259,   260,   261,   262,
     263,   264,   265,   266,   267,   124,    94,    38,   268,   269,
      60,    62,   270,   271,   272,   273,    43,    45,    42,    47,
      37,    35,   274,   126,    33,   275,   276,   277,   278,   279,
     280,   281,   282,   283,   284,    46,    91,    40,   285,   286,
     287,   288,   289,   290,   291,   292,   293,   294,   295,   296,
     297,   298,   299,   300,   301,   302,   303,   304,   305,   306,
     307,   308,   309,   310,   311,   312,   313,   314,   315,   316,
     317,   318,   319,   320,   321,   322,   323,   324,   325,   326,
     327,   328,   329,    59,    44,    61,    41,   123,   125,    93
};
# endif

/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
static const unsigned char yyr1[] =
{
       0,   100,   101,   101,   102,   103,   102,   102,   102,   102,
     104,   104,   104,   104,   104,   104,   104,   104,   104,   104,
     104,   104,   104,   104,   104,   104,   104,   104,   104,   104,
     104,   104,   104,   104,   104,   104,   105,   104,   106,   104,
     104,   104,   104,   107,   107,   107,   108,   108,   109,   109,
     110,   110,   110,   110,   110,   110,   110,   110,   110,   110,
     110,   111,   111,   111,   111,   111,   111,   111,   112,   112,
     113,   113,   114,   114,   114,   114,   115,   115,   116,   116,
     117,   118,   117,   119,   119,   120,   120,   121,   120,   120,
     122,   122,   123,   123,   124,   124,   124,   124,   125,   125,
     126,   126,   126,   126,   126,   126,   127,   127,   128,   129,
     129,   130,   130,   131,   131,   132,   132,   133,   133,   135,
     134,   136,   134,   137,   137,   137,   137,   138,   138,   139,
     138,   140,   138,   141,   138,   142,   142,   142,   142,   143,
     144,   143,   145,   146,   146,   147,   148,   147,   149,   149,
     150,   151,   152,   152,   153,   154,   153,   155,   155,   156,
     156,   156,   156,   157,   157,   158,   158,   159,   160,   160,
     160,   160,   161,   161,   162,   161,   161,   161,   161,   161,
     161,   161,   161,   161,   163,   161,   164,   161,   165,   161,
     161,   161,   166,   161,   167,   161,   161,   161,   161,   161,
     161,   161,   161,   161,   161,   161,   161,   161,   161,   161,
     161,   161,   161,   161,   161,   161,   161,   161,   161,   161,
     161,   161,   161,   168,   169,   161,   170,   161,   161,   171,
     161,   161,   161,   161,   161,   161,   161,   161,   161,   161,
     161,   161,   161,   161,   161,   161,   161,   161,   161,   161,
     161,   161,   161,   172,   173,   161,   161,   161,   174,   161,
     175,   161,   176,   161,   177,   178,   177,   179,   177,   177,
     180,   180,   181,   182,   183,   183
};

/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
static const unsigned char yyr2[] =
{
       0,     2,     0,     1,     1,     0,     3,     1,     3,     2,
       2,     2,     1,     1,     2,     3,     2,     2,     3,     3,
       4,     2,     3,     4,     3,     4,     3,     1,     1,     1,
       1,     1,     2,     1,     1,     2,     0,     4,     0,     5,
       1,     2,     1,     1,     2,     2,     1,     2,     0,     2,
       2,     2,     2,     2,     3,     3,     3,     3,     2,     2,
       2,     1,     2,     2,     3,     3,     1,     2,     2,     1,
       0,     2,     0,     2,     2,     2,     0,     2,     0,     1,
       2,     0,     4,     2,     4,     1,     2,     0,     4,     2,
       1,     3,     0,     1,     1,     2,     1,     1,     2,     2,
       5,     5,     4,     4,     5,     5,     0,     3,     1,     1,
       1,     0,     1,     0,     1,     1,     1,     1,     1,     0,
       5,     0,     7,     2,     4,     2,     0,     0,     4,     0,
       4,     0,     4,     0,     4,     0,     1,     3,     2,     2,
       0,     5,     3,     1,     3,     0,     0,     5,     1,     3,
       1,     1,     1,     3,     1,     0,     4,     0,     3,     0,
       1,     2,     3,     1,     3,     0,     1,     1,     1,     1,
       1,     1,     1,     2,     0,     5,     1,     1,     1,     1,
       1,     1,     1,     1,     0,     4,     0,     4,     0,     4,
       3,     2,     0,     4,     0,     5,     3,     3,     3,     3,
       3,     3,     3,     3,     3,     3,     3,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     3,     3,     3,
       3,     3,     3,     0,     0,    10,     0,     7,     3,     0,
       5,     2,     3,     3,     3,     3,     3,     2,     2,     2,
       3,     3,     1,     3,     3,     3,     3,     3,     2,     2,
       2,     3,     3,     0,     0,     7,     3,     3,     0,     7,
       0,     7,     0,     9,     0,     0,     2,     0,     4,     2,
       1,     3,     1,     2,     1,     2
};

/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
   means the default is an error.  */
static const unsigned short yydefact[] =
{
      48,     0,     0,     0,     0,     0,    66,     0,     0,     0,
      76,     0,    72,    30,    31,    33,     0,     0,     0,    42,
       5,     0,     3,     7,     0,    12,    13,    27,    28,    29,
      34,   110,   109,   114,    10,    11,   112,    50,    51,   172,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,   180,     0,   181,   179,   176,   177,
     182,   183,   242,   274,   184,     0,   108,    62,   167,   178,
       0,    58,    59,    60,    81,    87,    94,    96,    89,    90,
      97,     0,    32,     0,   108,    35,    41,    48,     1,    48,
       0,     0,    36,     0,     0,     0,    67,    49,    52,    53,
       0,    17,    76,    76,    14,    69,     0,   239,   238,   237,
     211,   209,   210,   212,   213,   214,   215,   216,   208,   186,
     207,   231,     0,   250,   249,   248,     0,   191,     0,     0,
     154,    64,     0,   192,   253,   173,   174,   188,    65,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,   229,   275,   272,   273,    77,    78,     0,    95,     0,
      73,    74,    75,     0,     6,     8,    38,    68,    22,   127,
      54,    56,    55,    57,     0,    72,   106,   106,     0,    15,
      43,     0,     0,    24,    70,    26,    70,   257,     0,     0,
       0,     0,   256,   155,   251,   179,   163,     0,   160,   157,
     194,   157,   265,     0,   270,   222,   241,   240,   236,   234,
     233,   235,   232,   221,   220,   219,   197,   200,   196,   198,
     201,   199,   218,   217,   202,   203,   205,   204,   206,   252,
     190,   247,   243,   246,   245,   244,     0,   228,     0,    79,
       0,    82,    88,    91,    93,   117,     0,   118,   119,   127,
      37,    71,   106,   106,     0,    47,   102,   106,   103,    20,
      45,    44,    23,    25,   187,     0,     0,     0,     0,     0,
       0,   185,     0,   193,   157,   254,     0,     0,   189,     0,
     223,   226,     0,    83,    78,     0,     0,     0,    39,   129,
     131,   133,     0,   101,   105,   100,     0,   104,     0,   260,
     258,   156,   151,   162,   164,     0,   166,   195,     0,   267,
     175,   266,   271,     0,     0,   230,     0,   123,   115,   116,
     121,     0,   120,     0,     0,     0,     0,     0,   136,   107,
       0,     0,     0,   158,   168,   169,   170,   171,     0,     0,
       0,     0,    84,     0,     0,    78,   130,   132,   134,   148,
     150,   114,   139,   128,     0,   262,   261,   259,   255,   268,
     224,   227,   122,   124,     0,     0,   143,     0,   140,   137,
       0,     0,     0,    78,   142,   149,   157,   263,     0,   146,
     144,   141,   225,     0,   152,   147,     0,   153
};

/* YYDEFGOTO[NTERM-NUM]. */
static const short yydefgoto[] =
{
      -1,    21,    22,    97,    23,   199,   279,   212,   206,    24,
      25,    26,   114,   200,    91,    84,   394,    27,   186,   271,
      28,   187,    88,   273,    89,    29,    30,   286,    75,    76,
      37,   183,   351,   278,    95,   317,   373,   316,   280,   353,
     354,   355,   357,   358,   406,   376,   395,   396,   413,   378,
     379,   331,   415,   139,   298,   303,   226,   227,   335,   336,
     368,    78,   232,   142,   218,   233,   229,   304,   343,   401,
     344,   268,   231,   338,   362,   361,   400,   306,   307,   369,
     235,   184,    79,    80
};

/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
   STATE-NUM.  */
#define YYPACT_NINF -273
static const short yypact[] =
{
     333,    29,    29,   170,   170,   928,  -273,   170,   170,   170,
    -273,   337,  -273,  -273,  -273,  -273,   170,    26,  1299,  -273,
      58,     5,   -55,  -273,  1818,  -273,  -273,  -273,  -273,  -273,
    -273,  -273,  -273,  -273,  -273,  -273,  -273,  -273,  -273,   266,
      26,  2034,  2034,  2034,  2034,    26,    26,  2034,  2034,  2034,
    2034,  2034,    26,    26,  2034,  2034,    71,  2034,  2034,  2034,
      48,  2034,    26,  2034,  -273,  1373,  -273,   295,  -273,  -273,
    -273,  -273,  -273,  -273,  -273,    12,   254,    -6,  2127,  -273,
     491,  -273,  -273,  -273,    50,    60,   103,  -273,    33,  -273,
    -273,   431,  -273,   276,  -273,  -273,  -273,  2322,  -273,  2030,
    1002,  1447,  -273,  1076,  1076,  1904,  -273,  -273,  -273,  -273,
    1150,   147,    53,   110,  -273,  2127,   591,  2307,  2307,  2307,
     799,  -273,  -273,   799,   799,   799,   799,   799,  -273,  -273,
     799,   799,   -14,   799,   799,   799,    66,    22,   591,   117,
    2127,  -273,  1521,  -273,   132,  -273,  -273,  -273,  -273,  2034,
    2034,  2034,  2034,  2034,  2034,  2034,  2034,  2034,  2034,  2034,
    2034,  2034,  2034,  2034,  2034,  2034,  2034,  2034,  2034,  2034,
    2034,  2034,  2034,  2034,   691,  2034,  2034,  2034,  2034,  2034,
      95,  -273,  -273,  -273,  -273,  -273,   120,    18,  -273,   343,
    -273,  -273,  -273,   262,  -273,  -273,  -273,  2127,  -273,  -273,
     136,  2127,   136,  2127,   853,  -273,   141,   152,  2034,  -273,
    -273,  1596,   175,  -273,   180,  -273,   180,  -273,  2034,    48,
    2034,  2034,  -273,  -273,  -273,   272,  -273,   -21,  -273,   178,
    -273,   178,   127,  2034,  2127,   213,  2167,  2167,  2205,  2205,
    2242,  2275,  2307,  2338,   537,   636,   433,   433,   730,   730,
     730,   730,  2389,  2389,  1478,  1478,   881,   881,   881,   881,
    -273,   604,   289,   161,   161,    22,    41,  -273,  2034,  -273,
      26,   165,    33,  -273,  -273,  -273,   109,  -273,  -273,  -273,
     122,  -273,  -273,  -273,    36,  -273,   192,  -273,   192,  -273,
    -273,  -273,   136,   136,    22,   193,     1,    97,  2034,  1670,
    1521,  -273,  1962,  -273,   178,  -273,   185,  2034,  2167,  2034,
    -273,  -273,   200,  -273,   120,   164,   116,  2034,   122,  -273,
    -273,  -273,    13,   192,   192,   192,  1224,   192,  2034,  -273,
    -273,  -273,  2127,  -273,  -273,   195,  -273,  -273,   163,   186,
    -273,  2127,  2127,   779,  1745,  -273,   199,  -273,  -273,  -273,
    -273,   168,  2127,   205,   205,  2034,    19,   -18,  -273,  -273,
     100,  2034,  2034,  -273,  -273,  -273,  -273,  -273,  2034,  2034,
     206,   210,  -273,  2034,   164,    -4,  -273,  -273,   222,  -273,
    -273,   286,  -273,  -273,    56,  -273,   799,   799,  2127,  2127,
    -273,  -273,  2127,  -273,    52,   -70,  -273,  2034,  -273,  -273,
    2034,  1745,   318,    -4,  -273,  -273,   178,   799,   227,  -273,
    -273,  -273,  -273,  2034,  -273,   232,  2034,  -273
};

/* YYPGOTO[NTERM-NUM].  */
static const short yypgoto[] =
{
    -273,  -273,  -273,  -273,   190,  -273,  -273,  -273,  -273,  -273,
    -273,  -273,   217,  -100,   131,   -81,  -175,  -273,  -273,  -273,
    -273,  -273,   153,  -273,   150,  -273,  -273,  -125,    -5,    -1,
      17,    96,   -16,  -273,  -273,  -273,  -273,  -273,    69,  -273,
    -273,  -273,  -273,   -33,  -273,    -2,  -273,   -50,  -273,  -273,
     -43,  -272,  -273,  -186,  -273,  -213,    62,  -273,   -32,     4,
    -273,    77,  -273,  -273,  -273,  -273,  -273,  -273,  -273,  -273,
    -273,  -273,  -273,  -273,  -273,  -273,  -273,  -273,  -273,  -273,
    -273,   -38,  -273,  -273
};

/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
   positive, shift that token.  If negative, reduce the rule which
   number is the opposite.  If zero, do what YYDEFACT says.
   If YYTABLE_NINF, syntax error.  */
#define YYTABLE_NINF -270
static const short yytable[] =
{
      33,    33,    36,    36,   202,    98,    36,    36,    36,    77,
      90,   270,    93,    31,    31,    36,    94,   219,   305,    31,
      31,    38,    96,   403,    81,    82,    83,    31,   404,  -113,
      31,   214,   216,    92,   296,   297,  -106,    31,    99,   116,
     121,   122,    31,   148,    94,    94,   143,   128,   129,    31,
     -80,    94,    94,    31,   269,    33,  -113,    31,    -4,    33,
     -86,   138,   189,    86,    32,    32,    87,   180,   181,   141,
      32,    32,    31,   300,   144,   348,   349,   301,    32,    33,
     383,    32,   288,   220,   185,   190,   191,   310,    32,  -145,
     192,   337,    33,    32,  -145,   223,    31,    34,    35,   329,
      32,   115,  -113,   213,    32,   198,  -135,  -135,    32,   207,
      31,  -135,  -113,  -113,   292,    36,   293,  -113,   117,   118,
     119,   120,  -113,    32,   123,   124,   125,   126,   127,  -106,
    -106,   130,   131,   217,   133,   134,   135,    36,   137,   346,
     140,   414,   360,   -80,   417,  -113,   228,    32,   188,  -138,
    -138,    -4,   132,   -86,  -138,   222,   136,   323,   324,   325,
     215,    32,   327,   221,   364,    31,   230,   365,  -113,    31,
    -111,    31,   366,    33,   367,   -18,   290,   197,   269,   267,
     201,   203,   319,   320,   321,   281,    90,   115,    90,   193,
     285,   223,   266,   411,   223,   330,   210,   211,   385,  -113,
      31,   287,  -126,  -126,   179,  -126,   180,   181,   283,   348,
     349,   223,   350,   224,   185,   289,    32,   309,    33,   322,
      32,  -264,    32,  -264,   291,   302,   234,   236,   237,   238,
     239,   240,   241,   242,   243,   244,   245,   246,   247,   248,
     249,   250,   251,   252,   253,   254,   255,   256,   257,   258,
     259,    32,   261,   262,   263,   264,   265,  -113,  -113,   314,
    -113,  -125,  -125,  -111,  -125,   311,   145,  -110,   -18,   313,
     260,   315,   312,  -109,   275,    94,   299,    31,  -110,   339,
    -269,   340,  -269,   192,  -109,   197,   326,   194,  -113,   195,
     328,   363,  -113,  -113,   359,   294,  -109,   140,   140,   345,
    -110,   146,   375,   333,   228,   390,  -109,  -109,   391,   276,
     308,   370,   371,  -110,    33,   295,   397,   356,  -110,  -109,
     398,    94,   409,  -113,  -109,   412,   416,   209,    32,  -109,
     177,   178,   179,    -2,   180,   181,   284,   -85,    31,   274,
     272,   384,  -109,   -92,    31,    33,   374,  -109,   318,   147,
      94,   399,   377,   410,   405,   381,   402,   277,     0,   380,
       0,  -110,   334,     0,     0,     0,    85,  -109,     0,   408,
       0,  -113,   -92,    33,     0,   332,     0,     0,     0,   356,
       0,     0,    86,    94,   341,    87,   342,     0,    86,    32,
    -109,    87,     0,    33,   352,    32,     1,     2,     3,     4,
       0,   380,     5,     0,     6,   140,     7,     8,     9,     0,
       0,   347,     0,    10,    11,     0,     0,     0,    12,    13,
      14,    15,    16,    17,    18,    19,    20,     0,     0,     0,
     -85,   -98,    31,     0,     0,     0,   -92,     0,   386,   387,
       0,     0,   372,     0,     0,   388,   389,     0,     0,     0,
     392,     0,   382,   162,   163,   164,   165,   166,   167,   168,
     169,   170,   171,   172,   173,   174,     0,     0,     0,     0,
     393,     0,   175,   176,   177,   178,   179,   407,   180,   181,
     190,   191,     0,    32,     0,     0,     0,     0,     0,     0,
     332,  -113,    31,   332,  -113,  -113,  -113,  -113,  -113,  -113,
    -113,  -113,  -113,     0,     0,     0,  -113,  -113,  -113,  -113,
    -113,  -113,  -113,  -113,  -113,  -113,  -113,  -113,  -113,  -113,
    -113,  -113,  -113,  -113,   -98,     0,     0,     0,     0,     0,
    -113,  -113,  -113,  -113,  -113,     0,  -113,  -113,     0,     0,
    -113,     0,     0,    32,     0,     0,     0,     0,     0,   182,
       0,  -113,  -113,  -113,   159,   160,   161,   162,   163,   164,
     165,   166,   167,   168,   169,   170,   171,   172,   173,   174,
       0,     0,     0,     0,     0,     0,   175,   176,   177,   178,
     179,     0,   180,   181,  -113,  -113,     0,  -113,  -113,  -113,
    -113,  -111,    31,     0,  -111,  -111,  -111,  -111,  -111,  -111,
    -111,  -111,  -111,     0,     0,     0,  -111,  -111,  -111,  -111,
    -111,  -111,  -111,  -111,  -111,  -111,  -111,  -111,  -111,  -111,
    -111,  -111,  -111,  -111,     0,     0,     0,     0,     0,     0,
    -111,  -111,  -111,  -111,  -111,     0,  -111,  -111,     0,     0,
    -111,     0,     0,    32,   176,   177,   178,   179,     0,   180,
     181,  -111,  -111,  -111,   160,   161,   162,   163,   164,   165,
     166,   167,   168,   169,   170,   171,   172,   173,   174,     0,
       0,     0,     0,     0,     0,   175,   176,   177,   178,   179,
       0,   180,   181,     0,  -111,  -111,     0,  -111,  -111,  -111,
    -111,  -113,    31,     0,  -113,  -113,  -113,  -113,  -113,  -113,
    -113,  -113,  -113,     0,     0,     0,  -113,  -113,  -113,  -113,
    -113,  -113,  -113,  -113,  -113,  -113,  -113,  -113,  -113,  -113,
    -113,  -113,  -113,  -113,     0,     0,     0,     0,     0,     0,
    -113,  -113,  -113,  -113,  -113,     0,  -113,  -113,     0,     0,
    -113,     0,     0,    32,     0,     0,     0,     0,     0,     0,
       0,  -113,  -113,  -113,   166,   167,   168,   169,   170,   171,
     172,   173,   174,     0,     0,     0,     0,     0,     0,   175,
     176,   177,   178,   179,     0,   180,   181,     0,     0,     0,
      39,     0,     0,    40,  -113,  -113,     0,  -113,  -113,  -113,
    -113,    41,    42,    43,    44,     0,     0,     0,     0,    45,
      46,     0,     0,     0,     0,    47,    48,    49,    50,    51,
      52,    53,    54,    55,    56,    57,    58,    59,     0,    60,
       0,     0,     0,    61,    62,     0,    63,    64,     0,     0,
      66,    67,    68,    69,    70,    71,    72,    73,   175,   176,
     177,   178,   179,     0,   180,   181,     0,     0,     0,     0,
       0,     0,     0,   -46,    39,     0,     0,    40,     0,     0,
       0,     0,     0,     0,     0,    41,    42,    43,    44,     0,
       0,     0,     0,    45,    46,     0,    74,     0,  -165,    47,
      48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
      58,    59,     0,    60,     0,     0,     0,    61,    62,     0,
      63,    64,   -46,   282,    66,    67,    68,    69,    70,    71,
      72,    73,   173,   174,     0,     0,     0,     0,     0,     0,
     175,   176,   177,   178,   179,     0,   180,   181,   -61,    39,
       0,     0,    40,     0,     0,     0,     0,     0,     0,     0,
      41,    42,    43,    44,     0,     0,   -46,   -46,    45,    46,
      74,     0,     0,     0,    47,    48,    49,    50,    51,    52,
      53,    54,    55,    56,    57,    58,    59,     0,    60,     0,
       0,     0,    61,    62,     0,    63,    64,    65,     0,    66,
      67,    68,    69,    70,    71,    72,    73,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,   -99,    39,     0,     0,    40,     0,     0,     0,
       0,     0,     0,     0,    41,    42,    43,    44,     0,     0,
       0,   -61,    45,    46,     0,    74,     0,     0,    47,    48,
      49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
      59,     0,    60,     0,     0,     0,    61,    62,     0,    63,
      64,     0,     0,    66,    67,    68,    69,    70,    71,    72,
      73,   196,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,   -70,    39,     0,     0,
      40,     0,     0,     0,     0,     0,     0,     0,    41,    42,
      43,    44,     0,     0,     0,   -99,    45,    46,     0,    74,
       0,     0,    47,    48,    49,    50,    51,    52,    53,    54,
      55,    56,    57,    58,    59,     0,    60,     0,     0,     0,
      61,    62,     0,    63,    64,   -70,     0,    66,    67,    68,
      69,    70,    71,    72,    73,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     -16,    39,     0,     0,    40,     0,     0,     0,     0,     0,
       0,     0,    41,    42,    43,    44,     0,     0,     0,   -70,
      45,    46,     0,    74,     0,     0,    47,    48,    49,    50,
      51,    52,    53,    54,    55,    56,    57,    58,    59,     0,
      60,     0,     0,     0,    61,    62,     0,    63,    64,   208,
       0,    66,    67,    68,    69,    70,    71,    72,    73,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,  -165,    39,     0,     0,    40,     0,
       0,     0,     0,     0,     0,     0,    41,    42,    43,    44,
       0,     0,     0,   -16,    45,    46,     0,    74,     0,     0,
      47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
      57,    58,    59,     0,    60,     0,     0,     0,    61,    62,
       0,    63,    64,     0,     0,    66,    67,    68,    69,    70,
      71,    72,    73,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,   -40,
      39,     0,     0,    40,     0,     0,     0,     0,     0,     0,
       0,    41,    42,    43,    44,     0,     0,  -165,  -165,    45,
      46,    74,     0,     0,     0,    47,    48,    49,    50,    51,
      52,    53,    54,    55,    56,    57,    58,    59,     0,    60,
       0,     0,     0,    61,    62,     0,    63,    64,     0,     0,
      66,    67,    68,    69,    70,    71,    72,    73,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,   -63,    39,     0,     0,    40,     0,     0,
       0,     0,     0,     0,     0,    41,    42,    43,    44,     0,
       0,     0,   -40,    45,    46,     0,    74,     0,     0,    47,
      48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
      58,    59,     0,    60,     0,     0,     0,    61,    62,     0,
      63,    64,     0,     0,    66,    67,    68,    69,    70,    71,
      72,    73,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,   -21,    39,     0,
       0,    40,     0,     0,     0,     0,     0,     0,     0,    41,
      42,    43,    44,     0,     0,     0,   -63,    45,    46,     0,
      74,     0,     0,    47,    48,    49,    50,    51,    52,    53,
      54,    55,    56,    57,    58,    59,     0,    60,     0,     0,
       0,    61,    62,     0,    63,    64,     0,     0,    66,    67,
      68,    69,    70,    71,    72,    73,   170,   171,   172,   173,
     174,     0,     0,     0,     0,     0,     0,   175,   176,   177,
     178,   179,    39,   180,   181,    40,     0,     0,     0,     0,
       0,     0,     0,    41,    42,    43,    44,     0,     0,     0,
     -21,    45,    46,     0,    74,     0,     0,    47,    48,    49,
      50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
       0,    60,     0,     0,     0,    61,    62,     0,    63,    64,
       0,     0,    66,   225,    68,    69,    70,    71,    72,    73,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,   -19,    39,     0,     0,
      40,     0,     0,     0,     0,     0,     0,     0,    41,    42,
      43,    44,     0,     0,     0,  -159,    45,    46,    74,  -159,
       0,     0,    47,    48,    49,    50,    51,    52,    53,    54,
      55,    56,    57,    58,    59,     0,    60,     0,     0,     0,
      61,    62,     0,    63,    64,     0,     0,    66,    67,    68,
      69,    70,    71,    72,    73,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,    39,     0,     0,    40,     0,     0,     0,     0,     0,
       0,     0,    41,    42,    43,    44,     0,     0,     0,   -19,
      45,    46,     0,    74,     0,     0,    47,    48,    49,    50,
      51,    52,    53,    54,    55,    56,    57,    58,    59,     0,
      60,     0,     0,     0,    61,    62,     0,    63,    64,     0,
       0,    66,    67,    68,    69,    70,    71,    72,    73,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,    39,     0,     0,    40,
       0,     0,     0,     0,     0,     0,     0,    41,    42,    43,
      44,     0,     0,     0,  -161,    45,    46,    74,  -161,     0,
       0,    47,    48,    49,    50,    51,    52,    53,    54,    55,
      56,    57,    58,    59,     0,    60,     0,     0,     0,    61,
      62,     0,    63,    64,     0,     0,    66,    67,    68,    69,
      70,    71,    72,    73,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,    39,
       0,     0,    40,     0,     0,     0,     0,     0,     0,     0,
      41,    42,    43,    44,     0,     0,     0,     0,    45,    46,
       0,     0,    74,  -165,    47,    48,    49,    50,    51,    52,
      53,    54,    55,    56,    57,    58,    59,     0,    60,     0,
       0,     0,    61,    62,     0,    63,    64,   100,   101,    66,
      67,    68,    69,    70,    71,    72,    73,   102,     0,     0,
       0,     0,     0,     0,     0,   103,   104,     0,   105,     0,
     106,     0,     0,     0,   107,   108,   109,   110,     0,     0,
     111,   112,   113,     0,     0,    39,     0,     0,    40,     0,
       0,     0,     0,     0,     0,    74,    41,    42,    43,    44,
       0,     0,     0,     0,    45,    46,     0,     0,     0,     0,
      47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
      57,    58,    59,     0,    60,     0,     0,     0,    61,    62,
       0,    63,    64,   204,   205,    66,    67,    68,    69,    70,
      71,    72,    73,    39,     0,     0,    40,     0,     0,     0,
       0,     0,     0,     0,    41,    42,    43,    44,     0,     0,
       0,     0,    45,    46,     0,     0,     0,     0,    47,    48,
      49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
      59,    74,    60,     0,     0,     0,    61,    62,     0,    63,
      64,     0,     0,    66,    67,    68,    69,    70,    71,    72,
      73,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      -9,     0,     0,     0,     0,    39,     0,     0,    40,     0,
       0,     0,     0,     0,     0,     0,    41,    42,    43,    44,
       0,     0,     0,     0,    45,    46,     0,     0,  -165,    74,
      47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
      57,    58,    59,     0,    60,     0,     0,     0,    61,    62,
       0,    63,    64,     0,     0,    66,    67,    68,    69,    70,
      71,    72,    73,     1,     2,     3,     4,     0,     0,     5,
       0,     6,     0,     7,     8,     9,     0,     0,     0,     0,
      10,    11,     0,     0,     0,    12,    13,    14,    15,    16,
      17,    18,    19,    -9,     0,     0,     0,     0,     0,     0,
     149,    74,   150,   151,   152,   153,   154,   155,   156,     0,
       0,     0,   157,   158,   159,   160,   161,   162,   163,   164,
     165,   166,   167,   168,   169,   170,   171,   172,   173,   174,
       0,     0,     0,     0,     0,     0,   175,   176,   177,   178,
     179,     0,   180,   181,   152,   153,   154,   155,   156,     0,
       0,     0,   157,   158,   159,   160,   161,   162,   163,   164,
     165,   166,   167,   168,   169,   170,   171,   172,   173,   174,
       0,     0,     0,     0,     0,     0,   175,   176,   177,   178,
     179,     0,   180,   181,   154,   155,   156,     0,     0,     0,
     157,   158,   159,   160,   161,   162,   163,   164,   165,   166,
     167,   168,   169,   170,   171,   172,   173,   174,     0,     0,
       0,     0,     0,     0,   175,   176,   177,   178,   179,     0,
     180,   181,   155,   156,     0,     0,     0,   157,   158,   159,
     160,   161,   162,   163,   164,   165,   166,   167,   168,   169,
     170,   171,   172,   173,   174,     0,     0,     0,     0,     0,
       0,   175,   176,   177,   178,   179,   156,   180,   181,     0,
     157,   158,   159,   160,   161,   162,   163,   164,   165,   166,
     167,   168,   169,   170,   171,   172,   173,   174,     0,     0,
       0,     0,     0,     0,   175,   176,   177,   178,   179,     0,
     180,   181,   157,   158,   159,   160,   161,   162,   163,   164,
     165,   166,   167,   168,   169,   170,   171,   172,   173,   174,
       0,     0,     0,     0,     0,     0,   175,   176,   177,   178,
     179,     0,   180,   181,   158,   159,   160,   161,   162,   163,
     164,   165,   166,   167,   168,   169,   170,   171,   172,   173,
     174,     0,     0,     0,     0,     0,     0,   175,   176,   177,
     178,   179,     0,   180,   181,     1,     2,     3,     4,     0,
       0,     5,     0,     6,     0,     7,     8,     9,     0,     0,
       0,     0,    10,    11,     0,     0,     0,    12,    13,    14,
      15,    16,    17,    18,    19,   168,   169,   170,   171,   172,
     173,   174,     0,     0,     0,     0,     0,     0,   175,   176,
     177,   178,   179,     0,   180,   181
};

static const short yycheck[] =
{
       1,     2,     3,     4,   104,     0,     7,     8,     9,     5,
      11,   186,    17,     1,     1,    16,    17,    31,   231,     1,
       1,     4,    18,    93,     7,     8,     9,     1,    98,     0,
       1,   112,   113,    16,   220,   221,     0,     1,    93,    40,
      45,    46,     1,    49,    45,    46,    34,    52,    53,     1,
       0,    52,    53,     1,    58,    56,     4,     1,     0,    60,
       0,    62,    29,    45,    52,    52,    48,    45,    46,    65,
      52,    52,     1,    94,    75,    93,    94,    98,    52,    80,
      98,    52,   207,    97,    34,    49,    50,    46,    52,    93,
      91,   304,    93,    52,    98,    94,     1,     1,     2,    98,
      52,    24,    31,    50,    52,   101,    93,    94,    52,   105,
       1,    98,    93,    94,   214,   116,   216,    98,    41,    42,
      43,    44,    93,    52,    47,    48,    49,    50,    51,    93,
      94,    54,    55,   116,    57,    58,    59,   138,    61,   314,
      63,   413,   328,    93,   416,    97,   142,    52,    45,    93,
      94,    93,    56,    93,    98,   138,    60,   282,   283,   284,
      50,    52,   287,    97,     1,     1,    34,     4,    97,     1,
       0,     1,     9,   174,    11,     0,     1,   100,    58,   180,
     103,   104,    60,    61,    62,    49,   187,   110,   189,    93,
      49,    94,    97,   406,    94,    98,    49,    50,    98,     0,
       1,    49,    93,    94,    43,    96,    45,    46,   204,    93,
      94,    94,    96,    96,    34,   211,    52,     4,   219,    97,
      52,    94,    52,    96,    49,    47,   149,   150,   151,   152,
     153,   154,   155,   156,   157,   158,   159,   160,   161,   162,
     163,   164,   165,   166,   167,   168,   169,   170,   171,   172,
     173,    52,   175,   176,   177,   178,   179,    93,    94,    94,
      96,    93,    94,    93,    96,   266,    12,     1,    93,   270,
     174,   276,   268,     1,    12,   276,     4,     1,    12,    94,
      94,    96,    96,   284,    12,   208,    94,    97,    12,    99,
      97,    96,    93,    94,   326,   218,     1,   220,   221,    99,
      34,    47,    97,   299,   300,    99,    34,    12,    98,    47,
     233,   343,   344,    47,   315,   219,    94,   322,    52,    47,
      34,   322,     4,    47,    52,    98,    94,   110,    52,    34,
      41,    42,    43,     0,    45,    46,   205,     0,     1,   189,
     187,   357,    47,     0,     1,   346,   351,    52,   279,    95,
     351,   384,   354,   403,   397,   356,   394,    95,    -1,   355,
      -1,    95,   300,    -1,    -1,    -1,    29,    95,    -1,   401,
      -1,    95,    29,   374,    -1,   298,    -1,    -1,    -1,   384,
      -1,    -1,    45,   384,   307,    48,   309,    -1,    45,    52,
      95,    48,    -1,   394,   317,    52,    63,    64,    65,    66,
      -1,   397,    69,    -1,    71,   328,    73,    74,    75,    -1,
      -1,   315,    -1,    80,    81,    -1,    -1,    -1,    85,    86,
      87,    88,    89,    90,    91,    92,    93,    -1,    -1,    -1,
      93,     0,     1,    -1,    -1,    -1,    93,    -1,   361,   362,
      -1,    -1,   346,    -1,    -1,   368,   369,    -1,    -1,    -1,
     373,    -1,   356,    20,    21,    22,    23,    24,    25,    26,
      27,    28,    29,    30,    31,    32,    -1,    -1,    -1,    -1,
     374,    -1,    39,    40,    41,    42,    43,   400,    45,    46,
      49,    50,    -1,    52,    -1,    -1,    -1,    -1,    -1,    -1,
     413,     0,     1,   416,     3,     4,     5,     6,     7,     8,
       9,    10,    11,    -1,    -1,    -1,    15,    16,    17,    18,
      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
      29,    30,    31,    32,    93,    -1,    -1,    -1,    -1,    -1,
      39,    40,    41,    42,    43,    -1,    45,    46,    -1,    -1,
      49,    -1,    -1,    52,    -1,    -1,    -1,    -1,    -1,    58,
      -1,    60,    61,    62,    17,    18,    19,    20,    21,    22,
      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
      -1,    -1,    -1,    -1,    -1,    -1,    39,    40,    41,    42,
      43,    -1,    45,    46,    93,    94,    -1,    96,    97,    98,
      99,     0,     1,    -1,     3,     4,     5,     6,     7,     8,
       9,    10,    11,    -1,    -1,    -1,    15,    16,    17,    18,
      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
      29,    30,    31,    32,    -1,    -1,    -1,    -1,    -1,    -1,
      39,    40,    41,    42,    43,    -1,    45,    46,    -1,    -1,
      49,    -1,    -1,    52,    40,    41,    42,    43,    -1,    45,
      46,    60,    61,    62,    18,    19,    20,    21,    22,    23,
      24,    25,    26,    27,    28,    29,    30,    31,    32,    -1,
      -1,    -1,    -1,    -1,    -1,    39,    40,    41,    42,    43,
      -1,    45,    46,    -1,    93,    94,    -1,    96,    97,    98,
      99,     0,     1,    -1,     3,     4,     5,     6,     7,     8,
       9,    10,    11,    -1,    -1,    -1,    15,    16,    17,    18,
      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
      29,    30,    31,    32,    -1,    -1,    -1,    -1,    -1,    -1,
      39,    40,    41,    42,    43,    -1,    45,    46,    -1,    -1,
      49,    -1,    -1,    52,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    60,    61,    62,    24,    25,    26,    27,    28,    29,
      30,    31,    32,    -1,    -1,    -1,    -1,    -1,    -1,    39,
      40,    41,    42,    43,    -1,    45,    46,    -1,    -1,    -1,
       1,    -1,    -1,     4,    93,    94,    -1,    96,    97,    98,
      99,    12,    13,    14,    15,    -1,    -1,    -1,    -1,    20,
      21,    -1,    -1,    -1,    -1,    26,    27,    28,    29,    30,
      31,    32,    33,    34,    35,    36,    37,    38,    -1,    40,
      -1,    -1,    -1,    44,    45,    -1,    47,    48,    -1,    -1,
      51,    52,    53,    54,    55,    56,    57,    58,    39,    40,
      41,    42,    43,    -1,    45,    46,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,     0,     1,    -1,    -1,     4,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    12,    13,    14,    15,    -1,
      -1,    -1,    -1,    20,    21,    -1,    97,    -1,    99,    26,
      27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
      37,    38,    -1,    40,    -1,    -1,    -1,    44,    45,    -1,
      47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
      57,    58,    31,    32,    -1,    -1,    -1,    -1,    -1,    -1,
      39,    40,    41,    42,    43,    -1,    45,    46,     0,     1,
      -1,    -1,     4,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      12,    13,    14,    15,    -1,    -1,    93,    94,    20,    21,
      97,    -1,    -1,    -1,    26,    27,    28,    29,    30,    31,
      32,    33,    34,    35,    36,    37,    38,    -1,    40,    -1,
      -1,    -1,    44,    45,    -1,    47,    48,    49,    -1,    51,
      52,    53,    54,    55,    56,    57,    58,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,     0,     1,    -1,    -1,     4,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    12,    13,    14,    15,    -1,    -1,
      -1,    93,    20,    21,    -1,    97,    -1,    -1,    26,    27,
      28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
      38,    -1,    40,    -1,    -1,    -1,    44,    45,    -1,    47,
      48,    -1,    -1,    51,    52,    53,    54,    55,    56,    57,
      58,    59,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,     0,     1,    -1,    -1,
       4,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    12,    13,
      14,    15,    -1,    -1,    -1,    93,    20,    21,    -1,    97,
      -1,    -1,    26,    27,    28,    29,    30,    31,    32,    33,
      34,    35,    36,    37,    38,    -1,    40,    -1,    -1,    -1,
      44,    45,    -1,    47,    48,    49,    -1,    51,    52,    53,
      54,    55,    56,    57,    58,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       0,     1,    -1,    -1,     4,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    12,    13,    14,    15,    -1,    -1,    -1,    93,
      20,    21,    -1,    97,    -1,    -1,    26,    27,    28,    29,
      30,    31,    32,    33,    34,    35,    36,    37,    38,    -1,
      40,    -1,    -1,    -1,    44,    45,    -1,    47,    48,    49,
      -1,    51,    52,    53,    54,    55,    56,    57,    58,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,     0,     1,    -1,    -1,     4,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    12,    13,    14,    15,
      -1,    -1,    -1,    93,    20,    21,    -1,    97,    -1,    -1,
      26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
      36,    37,    38,    -1,    40,    -1,    -1,    -1,    44,    45,
      -1,    47,    48,    -1,    -1,    51,    52,    53,    54,    55,
      56,    57,    58,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     0,
       1,    -1,    -1,     4,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    12,    13,    14,    15,    -1,    -1,    93,    94,    20,
      21,    97,    -1,    -1,    -1,    26,    27,    28,    29,    30,
      31,    32,    33,    34,    35,    36,    37,    38,    -1,    40,
      -1,    -1,    -1,    44,    45,    -1,    47,    48,    -1,    -1,
      51,    52,    53,    54,    55,    56,    57,    58,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,     0,     1,    -1,    -1,     4,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    12,    13,    14,    15,    -1,
      -1,    -1,    93,    20,    21,    -1,    97,    -1,    -1,    26,
      27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
      37,    38,    -1,    40,    -1,    -1,    -1,    44,    45,    -1,
      47,    48,    -1,    -1,    51,    52,    53,    54,    55,    56,
      57,    58,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,     0,     1,    -1,
      -1,     4,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    12,
      13,    14,    15,    -1,    -1,    -1,    93,    20,    21,    -1,
      97,    -1,    -1,    26,    27,    28,    29,    30,    31,    32,
      33,    34,    35,    36,    37,    38,    -1,    40,    -1,    -1,
      -1,    44,    45,    -1,    47,    48,    -1,    -1,    51,    52,
      53,    54,    55,    56,    57,    58,    28,    29,    30,    31,
      32,    -1,    -1,    -1,    -1,    -1,    -1,    39,    40,    41,
      42,    43,     1,    45,    46,     4,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    12,    13,    14,    15,    -1,    -1,    -1,
      93,    20,    21,    -1,    97,    -1,    -1,    26,    27,    28,
      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
      -1,    40,    -1,    -1,    -1,    44,    45,    -1,    47,    48,
      -1,    -1,    51,    52,    53,    54,    55,    56,    57,    58,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,     0,     1,    -1,    -1,
       4,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    12,    13,
      14,    15,    -1,    -1,    -1,    94,    20,    21,    97,    98,
      -1,    -1,    26,    27,    28,    29,    30,    31,    32,    33,
      34,    35,    36,    37,    38,    -1,    40,    -1,    -1,    -1,
      44,    45,    -1,    47,    48,    -1,    -1,    51,    52,    53,
      54,    55,    56,    57,    58,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,     1,    -1,    -1,     4,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    12,    13,    14,    15,    -1,    -1,    -1,    93,
      20,    21,    -1,    97,    -1,    -1,    26,    27,    28,    29,
      30,    31,    32,    33,    34,    35,    36,    37,    38,    -1,
      40,    -1,    -1,    -1,    44,    45,    -1,    47,    48,    -1,
      -1,    51,    52,    53,    54,    55,    56,    57,    58,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,     1,    -1,    -1,     4,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    12,    13,    14,
      15,    -1,    -1,    -1,    94,    20,    21,    97,    98,    -1,
      -1,    26,    27,    28,    29,    30,    31,    32,    33,    34,
      35,    36,    37,    38,    -1,    40,    -1,    -1,    -1,    44,
      45,    -1,    47,    48,    -1,    -1,    51,    52,    53,    54,
      55,    56,    57,    58,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     1,
      -1,    -1,     4,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      12,    13,    14,    15,    -1,    -1,    -1,    -1,    20,    21,
      -1,    -1,    97,    98,    26,    27,    28,    29,    30,    31,
      32,    33,    34,    35,    36,    37,    38,    -1,    40,    -1,
      -1,    -1,    44,    45,    -1,    47,    48,    49,    50,    51,
      52,    53,    54,    55,    56,    57,    58,    59,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    67,    68,    -1,    70,    -1,
      72,    -1,    -1,    -1,    76,    77,    78,    79,    -1,    -1,
      82,    83,    84,    -1,    -1,     1,    -1,    -1,     4,    -1,
      -1,    -1,    -1,    -1,    -1,    97,    12,    13,    14,    15,
      -1,    -1,    -1,    -1,    20,    21,    -1,    -1,    -1,    -1,
      26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
      36,    37,    38,    -1,    40,    -1,    -1,    -1,    44,    45,
      -1,    47,    48,    49,    50,    51,    52,    53,    54,    55,
      56,    57,    58,     1,    -1,    -1,     4,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    12,    13,    14,    15,    -1,    -1,
      -1,    -1,    20,    21,    -1,    -1,    -1,    -1,    26,    27,
      28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
      38,    97,    40,    -1,    -1,    -1,    44,    45,    -1,    47,
      48,    -1,    -1,    51,    52,    53,    54,    55,    56,    57,
      58,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       0,    -1,    -1,    -1,    -1,     1,    -1,    -1,     4,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    12,    13,    14,    15,
      -1,    -1,    -1,    -1,    20,    21,    -1,    -1,    96,    97,
      26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
      36,    37,    38,    -1,    40,    -1,    -1,    -1,    44,    45,
      -1,    47,    48,    -1,    -1,    51,    52,    53,    54,    55,
      56,    57,    58,    63,    64,    65,    66,    -1,    -1,    69,
      -1,    71,    -1,    73,    74,    75,    -1,    -1,    -1,    -1,
      80,    81,    -1,    -1,    -1,    85,    86,    87,    88,    89,
      90,    91,    92,    93,    -1,    -1,    -1,    -1,    -1,    -1,
       3,    97,     5,     6,     7,     8,     9,    10,    11,    -1,
      -1,    -1,    15,    16,    17,    18,    19,    20,    21,    22,
      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
      -1,    -1,    -1,    -1,    -1,    -1,    39,    40,    41,    42,
      43,    -1,    45,    46,     7,     8,     9,    10,    11,    -1,
      -1,    -1,    15,    16,    17,    18,    19,    20,    21,    22,
      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
      -1,    -1,    -1,    -1,    -1,    -1,    39,    40,    41,    42,
      43,    -1,    45,    46,     9,    10,    11,    -1,    -1,    -1,
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
      25,    26,    27,    28,    29,    30,    31,    32,    -1,    -1,
      -1,    -1,    -1,    -1,    39,    40,    41,    42,    43,    -1,
      45,    46,    10,    11,    -1,    -1,    -1,    15,    16,    17,
      18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
      28,    29,    30,    31,    32,    -1,    -1,    -1,    -1,    -1,
      -1,    39,    40,    41,    42,    43,    11,    45,    46,    -1,
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
      25,    26,    27,    28,    29,    30,    31,    32,    -1,    -1,
      -1,    -1,    -1,    -1,    39,    40,    41,    42,    43,    -1,
      45,    46,    15,    16,    17,    18,    19,    20,    21,    22,
      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
      -1,    -1,    -1,    -1,    -1,    -1,    39,    40,    41,    42,
      43,    -1,    45,    46,    16,    17,    18,    19,    20,    21,
      22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
      32,    -1,    -1,    -1,    -1,    -1,    -1,    39,    40,    41,
      42,    43,    -1,    45,    46,    63,    64,    65,    66,    -1,
      -1,    69,    -1,    71,    -1,    73,    74,    75,    -1,    -1,
      -1,    -1,    80,    81,    -1,    -1,    -1,    85,    86,    87,
      88,    89,    90,    91,    92,    26,    27,    28,    29,    30,
      31,    32,    -1,    -1,    -1,    -1,    -1,    -1,    39,    40,
      41,    42,    43,    -1,    45,    46
};

/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
   symbol of state STATE-NUM.  */
static const unsigned char yystos[] =
{
       0,    63,    64,    65,    66,    69,    71,    73,    74,    75,
      80,    81,    85,    86,    87,    88,    89,    90,    91,    92,
      93,   101,   102,   104,   109,   110,   111,   117,   120,   125,
     126,     1,    52,   129,   131,   131,   129,   130,   130,     1,
       4,    12,    13,    14,    15,    20,    21,    26,    27,    28,
      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
      40,    44,    45,    47,    48,    49,    51,    52,    53,    54,
      55,    56,    57,    58,    97,   128,   129,   159,   161,   182,
     183,   130,   130,   130,   115,    29,    45,    48,   122,   124,
     129,   114,   130,   128,   129,   134,   159,   103,     0,    93,
      49,    50,    59,    67,    68,    70,    72,    76,    77,    78,
      79,    82,    83,    84,   112,   161,   129,   161,   161,   161,
     161,   128,   128,   161,   161,   161,   161,   161,   128,   128,
     161,   161,   131,   161,   161,   161,   131,   161,   129,   153,
     161,   159,   163,    34,   129,    12,    47,    95,    49,     3,
       5,     6,     7,     8,     9,    10,    11,    15,    16,    17,
      18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
      28,    29,    30,    31,    32,    39,    40,    41,    42,    43,
      45,    46,    58,   131,   181,    34,   118,   121,    45,    29,
      49,    50,   129,   131,   104,   104,    59,   161,   159,   105,
     113,   161,   113,   161,    49,    50,   108,   159,    49,   112,
      49,    50,   107,    50,   115,    50,   115,   130,   164,    31,
      97,    97,   130,    94,    96,    52,   156,   157,   159,   166,
      34,   172,   162,   165,   161,   180,   161,   161,   161,   161,
     161,   161,   161,   161,   161,   161,   161,   161,   161,   161,
     161,   161,   161,   161,   161,   161,   161,   161,   161,   161,
     131,   161,   161,   161,   161,   161,    97,   129,   171,    58,
     116,   119,   122,   123,   124,    12,    47,    95,   133,   106,
     138,    49,    50,   159,   114,    49,   127,    49,   127,   159,
       1,    49,   113,   113,   161,   131,   153,   153,   154,     4,
      94,    98,    47,   155,   167,   155,   177,   178,   161,     4,
      46,   129,   159,   129,    94,   128,   137,   135,   138,    60,
      61,    62,    97,   127,   127,   127,    94,   127,    97,    98,
      98,   151,   161,   159,   156,   158,   159,   155,   173,    94,
      96,   161,   161,   168,   170,    99,   116,   131,    93,    94,
      96,   132,   161,   139,   140,   141,   128,   142,   143,   158,
     153,   175,   174,    96,     1,     4,     9,    11,   160,   179,
     158,   158,   131,   136,   128,    97,   145,   145,   149,   150,
     159,   129,   131,    98,   132,    98,   161,   161,   161,   161,
      99,    98,   161,   131,   116,   146,   147,    94,    34,   143,
     176,   169,   181,    93,    98,   150,   144,   161,   158,     4,
     147,   155,    98,   148,   151,   152,    94,   151
};

#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
#endif
#if ! defined (YYSIZE_T) && defined (size_t)
# define YYSIZE_T size_t
#endif
#if ! defined (YYSIZE_T)
# if defined (__STDC__) || defined (__cplusplus)
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# endif
#endif
#if ! defined (YYSIZE_T)
# define YYSIZE_T unsigned int
#endif

#define yyerrok         (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY         (-2)
#define YYEOF           0

#define YYACCEPT  goto yyacceptlab
#define YYABORT         goto yyabortlab
#define YYERROR         goto yyerrlab1


/* Like YYERROR except do call yyerror.  This remains here temporarily
   to ease the transition to the new meaning of YYERROR, for GCC.
   Once GCC version 2 has supplanted version 1, this can go.  */

#define YYFAIL          goto yyerrlab

#define YYRECOVERING()  (!!yyerrstatus)

#define YYBACKUP(Token, Value)                              \
do                                              \
  if (yychar == YYEMPTY && yylen == 1)                      \
    {                                           \
      yychar = (Token);                               \
      yylval = (Value);                               \
      yytoken = YYTRANSLATE (yychar);                       \
      YYPOPSTACK;                               \
      goto yybackup;                                  \
    }                                           \
  else                                                \
    {                                                 \
      yyerror ("syntax error: cannot back up");\
      YYERROR;                                        \
    }                                           \
while (0)

#define YYTERROR  1
#define YYERRCODE 256

/* YYLLOC_DEFAULT -- Compute the default location (before the actions
   are run).  */

#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N)         \
  Current.first_line   = Rhs[1].first_line;      \
  Current.first_column = Rhs[1].first_column;    \
  Current.last_line    = Rhs[N].last_line;       \
  Current.last_column  = Rhs[N].last_column;
#endif

/* YYLEX -- calling `yylex' with the right arguments.  */

#ifdef YYLEX_PARAM
# define YYLEX yylex (YYLEX_PARAM)
#else
# define YYLEX yylex ()
#endif

/* Enable debugging if requested.  */
#if YYDEBUG

# ifndef YYFPRINTF
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
#  define YYFPRINTF fprintf
# endif

# define YYDPRINTF(Args)                  \
do {                                \
  if (yydebug)                            \
    YYFPRINTF Args;                       \
} while (0)

# define YYDSYMPRINT(Args)                \
do {                                \
  if (yydebug)                            \
    yysymprint Args;                      \
} while (0)

# define YYDSYMPRINTF(Title, Token, Value, Location)        \
do {                                            \
  if (yydebug)                                        \
    {                                           \
      YYFPRINTF (stderr, "%s ", Title);                     \
      yysymprint (stderr,                             \
                  Token, Value);    \
      YYFPRINTF (stderr, "\n");                             \
    }                                           \
} while (0)

/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (cinluded).                                                   |
`------------------------------------------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yy_stack_print (short *bottom, short *top)
#else
static void
yy_stack_print (bottom, top)
    short *bottom;
    short *top;
#endif
{
  YYFPRINTF (stderr, "Stack now");
  for (/* Nothing. */; bottom <= top; ++bottom)
    YYFPRINTF (stderr, " %d", *bottom);
  YYFPRINTF (stderr, "\n");
}

# define YY_STACK_PRINT(Bottom, Top)                        \
do {                                            \
  if (yydebug)                                        \
    yy_stack_print ((Bottom), (Top));                       \
} while (0)


/*------------------------------------------------.
| Report that the YYRULE is going to be reduced.  |
`------------------------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yy_reduce_print (int yyrule)
#else
static void
yy_reduce_print (yyrule)
    int yyrule;
#endif
{
  int yyi;
  unsigned int yylineno = yyrline[yyrule];
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
             yyrule - 1, yylineno);
  /* Print the symbols being reduced, and their result.  */
  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
}

# define YY_REDUCE_PRINT(Rule)            \
do {                          \
  if (yydebug)                      \
    yy_reduce_print (Rule);         \
} while (0)

/* Nonzero means print parse trace.  It is left uninitialized so that
   multiple parsers can coexist.  */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YYDSYMPRINT(Args)
# define YYDSYMPRINTF(Title, Token, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */


/* YYINITDEPTH -- initial size of the parser's stacks.  */
#ifndef     YYINITDEPTH
# define YYINITDEPTH 200
#endif

/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
   if the built-in stack extension method is used).

   Do not make this value too large; the results are undefined if
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
   evaluated with infinite-precision integer arithmetic.  */

#if YYMAXDEPTH == 0
# undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif



#if YYERROR_VERBOSE

# ifndef yystrlen
#  if defined (__GLIBC__) && defined (_STRING_H)
#   define yystrlen strlen
#  else
/* Return the length of YYSTR.  */
static YYSIZE_T
#   if defined (__STDC__) || defined (__cplusplus)
yystrlen (const char *yystr)
#   else
yystrlen (yystr)
     const char *yystr;
#   endif
{
  register const char *yys = yystr;

  while (*yys++ != '\0')
    continue;

  return yys - yystr - 1;
}
#  endif
# endif

# ifndef yystpcpy
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
#   define yystpcpy stpcpy
#  else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   YYDEST.  */
static char *
#   if defined (__STDC__) || defined (__cplusplus)
yystpcpy (char *yydest, const char *yysrc)
#   else
yystpcpy (yydest, yysrc)
     char *yydest;
     const char *yysrc;
#   endif
{
  register char *yyd = yydest;
  register const char *yys = yysrc;

  while ((*yyd++ = *yys++) != '\0')
    continue;

  return yyd - 1;
}
#  endif
# endif

#endif /* !YYERROR_VERBOSE */



#if YYDEBUG
/*--------------------------------.
| Print this symbol on YYOUTPUT.  |
`--------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
#else
static void
yysymprint (yyoutput, yytype, yyvaluep)
    FILE *yyoutput;
    int yytype;
    YYSTYPE *yyvaluep;
#endif
{
  /* Pacify ``unused variable'' warnings.  */
  (void) yyvaluep;

  if (yytype < YYNTOKENS)
    {
      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
# ifdef YYPRINT
      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# endif
    }
  else
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);

  switch (yytype)
    {
      default:
        break;
    }
  YYFPRINTF (yyoutput, ")");
}

#endif /* ! YYDEBUG */
/*-----------------------------------------------.
| Release the memory associated to this symbol.  |
`-----------------------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yydestruct (int yytype, YYSTYPE *yyvaluep)
#else
static void
yydestruct (yytype, yyvaluep)
    int yytype;
    YYSTYPE *yyvaluep;
#endif
{
  /* Pacify ``unused variable'' warnings.  */
  (void) yyvaluep;

  switch (yytype)
    {

      default:
        break;
    }
}


/* Prevent warnings from -Wmissing-prototypes.  */

#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
int yyparse (void *YYPARSE_PARAM);
# else
int yyparse ();
# endif
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
int yyparse (void);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */



/* The lookahead symbol.  */
int yychar;

/* The semantic value of the lookahead symbol.  */
YYSTYPE yylval;

/* Number of syntax errors so far.  */
int yynerrs;



/*----------.
| yyparse.  |
`----------*/

#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
int yyparse (void *YYPARSE_PARAM)
# else
int yyparse (YYPARSE_PARAM)
  void *YYPARSE_PARAM;
# endif
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
int
yyparse (void)
#else
int
yyparse ()

#endif
#endif
{
  
  register int yystate;
  register int yyn;
  int yyresult;
  /* Number of tokens to shift before error messages enabled.  */
  int yyerrstatus;
  /* Lookahead token as an internal (translated) token number.  */
  int yytoken = 0;

  /* Three stacks and their tools:
     `yyss': related to states,
     `yyvs': related to semantic values,
     `yyls': related to locations.

     Refer to the stacks thru separate pointers, to allow yyoverflow
     to reallocate them elsewhere.  */

  /* The state stack.  */
  short     yyssa[YYINITDEPTH];
  short *yyss = yyssa;
  register short *yyssp;

  /* The semantic value stack.  */
  YYSTYPE yyvsa[YYINITDEPTH];
  YYSTYPE *yyvs = yyvsa;
  register YYSTYPE *yyvsp;



#define YYPOPSTACK   (yyvsp--, yyssp--)

  YYSIZE_T yystacksize = YYINITDEPTH;

  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;


  /* When reducing, the number of symbols on the RHS of the reduced
     rule.  */
  int yylen;

  YYDPRINTF ((stderr, "Starting parse\n"));

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY;           /* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */

  yyssp = yyss;
  yyvsp = yyvs;

  goto yysetstate;

/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate.  |
`------------------------------------------------------------*/
 yynewstate:
  /* In all cases, when you get here, the value and location stacks
     have just been pushed. so pushing a state here evens the stacks.
     */
  yyssp++;

 yysetstate:
  *yyssp = yystate;

  if (yyss + yystacksize - 1 <= yyssp)
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYSIZE_T yysize = yyssp - yyss + 1;

#ifdef yyoverflow
      {
      /* Give user a chance to reallocate the stack. Use copies of
         these so that the &'s don't force the real ones into
         memory.  */
      YYSTYPE *yyvs1 = yyvs;
      short *yyss1 = yyss;


      /* Each stack pointer address is followed by the size of the
         data in use in that stack, in bytes.  This used to be a
         conditional around just the two extra args, but that might
         be undefined if yyoverflow is a macro.  */
      yyoverflow ("parser stack overflow",
                &yyss1, yysize * sizeof (*yyssp),
                &yyvs1, yysize * sizeof (*yyvsp),

                &yystacksize);

      yyss = yyss1;
      yyvs = yyvs1;
      }
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
      goto yyoverflowlab;
# else
      /* Extend the stack our own way.  */
      if (YYMAXDEPTH <= yystacksize)
      goto yyoverflowlab;
      yystacksize *= 2;
      if (YYMAXDEPTH < yystacksize)
      yystacksize = YYMAXDEPTH;

      {
      short *yyss1 = yyss;
      union yyalloc *yyptr =
        (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
      if (! yyptr)
        goto yyoverflowlab;
      YYSTACK_RELOCATE (yyss);
      YYSTACK_RELOCATE (yyvs);

#  undef YYSTACK_RELOCATE
      if (yyss1 != yyssa)
        YYSTACK_FREE (yyss1);
      }
# endif
#endif /* no yyoverflow */

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;


      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
              (unsigned long int) yystacksize));

      if (yyss + yystacksize - 1 <= yyssp)
      YYABORT;
    }

  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

  goto yybackup;

/*-----------.
| yybackup.  |
`-----------*/
yybackup:

/* Do appropriate processing given the current state.  */
/* Read a lookahead token if we need one and don't already have one.  */
/* yyresume: */

  /* First try to decide what to do without reference to lookahead token.  */

  yyn = yypact[yystate];
  if (yyn == YYPACT_NINF)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = YYLEX;
    }

  if (yychar <= YYEOF)
    {
      yychar = yytoken = YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
    }

  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yyn == 0 || yyn == YYTABLE_NINF)
      goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));

  /* Discard the token being shifted unless it is eof.  */
  if (yychar != YYEOF)
    yychar = YYEMPTY;

  *++yyvsp = yylval;


  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;

  yystate = yyn;
  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- Do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     `$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];


  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
        case 4:
#line 809 "marde.y"
    { command = true; dewarn ("extraneous semicolon"); ;}
    break;

  case 5:
#line 812 "marde.y"
    { command = true; dewarn ("extraneous semicolon"); ;}
    break;

  case 6:
#line 814 "marde.y"
    { command = true; ;}
    break;

  case 7:
#line 817 "marde.y"
    { command = true; ;}
    break;

  case 8:
#line 820 "marde.y"
    { command = true; ;}
    break;

  case 10:
#line 827 "marde.y"
    {
        if (yyvsp[0].s) {
          currentState = model (yyvsp[0].s, 0, true) ? 0 : CARD_T_MAX;
          delete[] yyvsp[0].s;
        }
      ;}
    break;

  case 11:
#line 835 "marde.y"
    {
        if (yyvsp[0].s) {
          currentState = model (0, yyvsp[0].s, false) ? 0 : CARD_T_MAX;
          delete[] yyvsp[0].s;
        }
      ;}
    break;

  case 16:
#line 851 "marde.y"
    { eval (currentState, resolveName (newString ("eval")), visual); ;}
    break;

  case 17:
#line 854 "marde.y"
    { show (currentState, visual); ;}
    break;

  case 18:
#line 857 "marde.y"
    { if (yyvsp[0].ia) { show (yyvsp[0].ia, visual); delete[] yyvsp[0].ia; } ;}
    break;

  case 19:
#line 860 "marde.y"
    { comp_show (yyvsp[0].i, 0, visual); ;}
    break;

  case 20:
#line 863 "marde.y"
    { if ((yyvsp[0].expr = ensureBool (yyvsp[0].expr))) comp_show (yyvsp[-1].i, yyvsp[0].expr, visual); ;}
    break;

  case 21:
#line 866 "marde.y"
    { comp_show (yyvsp[0].i, 0, visual); ;}
    break;

  case 22:
#line 869 "marde.y"
    { if ((yyvsp[0].expr = ensureBool (yyvsp[0].expr))) comp_show (yyvsp[-1].i, yyvsp[0].expr, visual); ;}
    break;

  case 23:
#line 872 "marde.y"
    { succ (yyvsp[0].i, yyvsp[-1].flag, visual); ;}
    break;

  case 24:
#line 875 "marde.y"
    { comp_succ (yyvsp[0].i, visual); ;}
    break;

  case 25:
#line 878 "marde.y"
    { pred (yyvsp[0].i, yyvsp[-1].flag, visual); ;}
    break;

  case 26:
#line 881 "marde.y"
    { comp_pred (yyvsp[0].i, visual); ;}
    break;

  case 30:
#line 890 "marde.y"
    { stats (); ;}
    break;

  case 31:
#line 893 "marde.y"
    { showtimes (); ;}
    break;

  case 32:
#line 896 "marde.y"
    {
        FILE* f = thePrinter.getOutput ();
        if (f != stderr)
          fclose (f);
        if (!yyvsp[0].s)
          f = stderr;
        else if (!(f = fopen (yyvsp[0].s, "w+")))
          perror (yyvsp[0].s), f = stderr;
        thePrinter.setOutput (f);
        delete[] yyvsp[0].s;
      ;}
    break;

  case 33:
#line 909 "marde.y"
    { help (); ;}
    break;

  case 36:
#line 916 "marde.y"
    { currentTransition = isNet () ? new class Transition () : 0; ;}
    break;

  case 37:
#line 918 "marde.y"
    {
        if (currentTransition) {
          fireTransition (*currentTransition, currentState, visual);
          delete currentTransition; currentTransition = 0;
        }
      ;}
    break;

  case 38:
#line 926 "marde.y"
    { currentTransition = isState (yyvsp[-1].i) ? new class Transition () : 0; ;}
    break;

  case 39:
#line 928 "marde.y"
    {
        if (currentTransition) {
          fireTransition (*currentTransition, currentState, visual);
          delete currentTransition; currentTransition = 0;
        }
      ;}
    break;

  case 40:
#line 936 "marde.y"
    { promptchar = 0; ;}
    break;

  case 41:
#line 939 "marde.y"
    {
        if (!yyvsp[0].expr);
        else if (yyvsp[0].expr->getKind () != Expression::eConstant ||
               yyvsp[0].expr->getType ()->getKind () != Type::tChar)
          deerror ("prompt: character constant expected");
        else
          promptchar = char (char_t (static_cast<const class LeafValue&>
                               (static_cast<class Constant*>
                              (yyvsp[0].expr)->getValue ())));
        yyvsp[0].expr->destroy ();
      ;}
    break;

  case 42:
#line 952 "marde.y"
    { exiting = true; YYABORT; ;}
    break;

  case 43:
#line 957 "marde.y"
    { yyval.ia = new card_t[2]; yyval.ia[0] = 1; yyval.ia[1] = yyvsp[0].i; ;}
    break;

  case 44:
#line 960 "marde.y"
    {
        if ((yyval.ia = yyvsp[-1].ia)) {
          yyval.ia = new card_t[*yyval.ia + 2];
          memcpy (yyval.ia, yyvsp[-1].ia, (1 + *yyvsp[-1].ia) * sizeof *yyvsp[-1].ia);
          delete[] yyvsp[-1].ia;
          yyval.ia[++(*yyval.ia)] = yyvsp[0].i;
        }
      ;}
    break;

  case 45:
#line 970 "marde.y"
    { delete[] yyvsp[-1].ia; yyval.ia = 0; ;}
    break;

  case 46:
#line 975 "marde.y"
    { yyval.ia = new card_t[2]; yyval.ia[0] = 1; yyval.ia[1] = yyvsp[0].i; ;}
    break;

  case 47:
#line 978 "marde.y"
    {
        if ((yyval.ia = yyvsp[-1].ia)) {
          yyval.ia = new card_t[*yyval.ia + 2];
          memcpy (yyval.ia, yyvsp[-1].ia, (1 + *yyvsp[-1].ia) * sizeof *yyvsp[-1].ia);
          delete[] yyvsp[-1].ia;
          yyval.ia[++(*yyval.ia)] = yyvsp[0].i;
        }
      ;}
    break;

  case 48:
#line 989 "marde.y"
    { visual = 0; ;}
    break;

  case 49:
#line 992 "marde.y"
    { visual++; ;}
    break;

  case 50:
#line 997 "marde.y"
    { lsts (yyvsp[0].s); delete[] yyvsp[0].s; ;}
    break;

  case 51:
#line 1000 "marde.y"
    { unfold (yyvsp[0].s); delete[] yyvsp[0].s; ;}
    break;

  case 52:
#line 1003 "marde.y"
    { dump (visual); ;}
    break;

  case 53:
#line 1006 "marde.y"
    { dumpgraph (visual); ;}
    break;

  case 54:
#line 1009 "marde.y"
    {
        if (!yyvsp[0].i && isGraphless ())
          safety (true, 0, visual);
        else if (visual) {
          thePrinter.printRaw ("ignoring `visual' in graph generation");
          thePrinter.finish ();
          analyze (yyvsp[0].i, true);
        }
        else
          analyze (yyvsp[0].i, true);
      ;}
    break;

  case 55:
#line 1022 "marde.y"
    {
        if (!yyvsp[0].i && isGraphless ())
          safety (false, 0, visual);
        else if (visual) {
          thePrinter.printRaw ("ignoring `visual' in graph generation");
          thePrinter.finish ();
          analyze (yyvsp[0].i, false);
        }
        else
          analyze (yyvsp[0].i, false);
      ;}
    break;

  case 56:
#line 1035 "marde.y"
    {
        if ((yyvsp[0].expr = ensureBool (yyvsp[0].expr))) {
          currentState = CARD_T_MAX;
          safety (true, yyvsp[0].expr, visual);
        }
      ;}
    break;

  case 57:
#line 1043 "marde.y"
    {
        if ((yyvsp[0].expr = ensureBool (yyvsp[0].expr))) {
          currentState = CARD_T_MAX;
          safety (false, yyvsp[0].expr, visual);
        }
      ;}
    break;

  case 58:
#line 1051 "marde.y"
    {
        if (!yyvsp[0].s && (yyvsp[0].s = getenv ("HOME"))) yyvsp[0].s = newString (yyvsp[0].s);
        if (yyvsp[0].s && chdir (yyvsp[0].s)) perror (yyvsp[0].s); delete[] yyvsp[0].s;
      ;}
    break;

  case 59:
#line 1057 "marde.y"
    {
#ifdef BUILTIN_LTL
        if (yyvsp[0].s) deerror ("the LTL translator has been built in");
        delete[] yyvsp[0].s;
#else // BUILTIN_LTL
        delete[] translator;
        translator = yyvsp[0].s;
#endif // BUILTIN_LTL
      ;}
    break;

  case 60:
#line 1068 "marde.y"
    {
#ifdef EXPR_COMPILE
        delete[] compiledir; compiledir = yyvsp[0].s;
#else // EXPR_COMPILE
        delete[] yyvsp[0].s; deerror ("no support for code generator");
#endif // EXPR_COMPILE
      ;}
    break;

  case 61:
#line 1079 "marde.y"
    { strong (currentState, 0); ;}
    break;

  case 62:
#line 1082 "marde.y"
    { if ((yyvsp[0].expr = ensureBool (yyvsp[0].expr))) strong (currentState, yyvsp[0].expr); ;}
    break;

  case 63:
#line 1085 "marde.y"
    { strong (yyvsp[0].i, 0); ;}
    break;

  case 64:
#line 1088 "marde.y"
    { if ((yyvsp[0].expr = ensureBool (yyvsp[0].expr))) strong (yyvsp[-1].i, yyvsp[0].expr); ;}
    break;

  case 65:
#line 1091 "marde.y"
    { if ((yyvsp[-1].expr = ensureBool (yyvsp[-1].expr))) strong (yyvsp[0].i, yyvsp[-1].expr); ;}
    break;

  case 66:
#line 1094 "marde.y"
    { terminal (); ;}
    break;

  case 67:
#line 1097 "marde.y"
    { allcomps (visual); ;}
    break;

  case 68:
#line 1102 "marde.y"
    { eval (yyvsp[-1].i, yyvsp[0].expr, visual); ;}
    break;

  case 69:
#line 1105 "marde.y"
    { eval (currentState, yyvsp[0].expr, visual); ;}
    break;

  case 70:
#line 1109 "marde.y"
    { yyval.i = currentState; ;}
    break;

  case 71:
#line 1112 "marde.y"
    {
        if ((yyval.i = yyvsp[-1].i) != currentState) {
          thePrinter.printRaw ("ignoring extraneous state qualifier ");
          thePrinter.printState (yyvsp[0].i);
          thePrinter.finish ();
        }
        else
          yyval.i = yyvsp[0].i;
      ;}
    break;

  case 72:
#line 1124 "marde.y"
    { yyval.i = currentState; ;}
    break;

  case 73:
#line 1127 "marde.y"
    {
        if ((yyval.i = yyvsp[-1].i) != currentState) {
          thePrinter.printRaw ("ignoring extraneous state qualifier ");
          thePrinter.printState (yyvsp[0].i);
          thePrinter.finish ();
        }
        else
          yyval.i = yyvsp[0].i;
      ;}
    break;

  case 74:
#line 1138 "marde.y"
    { deerror ("expecting a state number"); yyval.i = yyvsp[-1].i; ;}
    break;

  case 75:
#line 1141 "marde.y"
    {
        deerror ("expecting a state number");
        delete[] yyvsp[0].s; yyval.i = yyvsp[-1].i;
      ;}
    break;

  case 76:
#line 1148 "marde.y"
    { yyval.flag = false; ;}
    break;

  case 77:
#line 1151 "marde.y"
    { if (yyvsp[-1].flag) deerror ("ignoring extraneous `!'"); yyval.flag = true; ;}
    break;

  case 80:
#line 1161 "marde.y"
    {
        if (isNet ())
          for (unsigned place = subnet->getNumPlaces (); place--; )
            if (const class Place* p = subnet->getPlace (place))
            p->setSuppressed (hide = !yyvsp[0].flag);
      ;}
    break;

  case 81:
#line 1169 "marde.y"
    { if (isNet ()) hide = !yyvsp[0].flag; ;}
    break;

  case 83:
#line 1175 "marde.y"
    {
        if (subnet && yyvsp[0].s) {
          if (const class Place* p = subnet->getPlace (yyvsp[0].s))
            p->setSuppressed (hide);
          else {
            thePrinter.printRaw ("undefined place ");
            thePrinter.printQuoted (yyvsp[0].s);
            thePrinter.finish ();
          }
        }
        delete[] yyvsp[0].s;
      ;}
    break;

  case 84:
#line 1189 "marde.y"
    {
        if (subnet && yyvsp[0].s) {
          if (const class Place* p = subnet->getPlace (yyvsp[0].s))
            p->setSuppressed (hide);
          else {
            thePrinter.printRaw ("undefined place ");
            thePrinter.printQuoted (yyvsp[0].s);
            thePrinter.finish ();
          }
        }
        delete[] yyvsp[0].s;
      ;}
    break;

  case 85:
#line 1205 "marde.y"
    { delete[] modulepath; modulepath = 0; subnet = net; ;}
    break;

  case 86:
#line 1208 "marde.y"
    { delete[] modulepath; modulepath = 0; subnet = net; ;}
    break;

  case 87:
#line 1211 "marde.y"
    {
        for (subnet = net; subnet && subnet->getParent (); )
          subnet = subnet->getParent ();
      ;}
    break;

  case 88:
#line 1216 "marde.y"
    { go_subnet (); ;}
    break;

  case 89:
#line 1220 "marde.y"
    { go_subnet (); ;}
    break;

  case 95:
#line 1238 "marde.y"
    { if (subnet) subnet = subnet->getParent (); ;}
    break;

  case 96:
#line 1241 "marde.y"
    {
        subnet = subnet && yyvsp[0].i < subnet->getNumChildren ()
          ? &const_cast<class Net&>(subnet->getChild (yyvsp[0].i))
          : 0;
      ;}
    break;

  case 97:
#line 1248 "marde.y"
    {
        if (subnet && yyvsp[0].s) {
          const class Net* parent = subnet;
          subnet = 0;
          for (unsigned i = parent->getNumChildren (); !subnet && i--; ) {
            const class Net* child = &parent->getChild (i);
            if (child->getName () && !strcmp (child->getName (), yyvsp[0].s))
            subnet = const_cast<class Net*>(child);
          }
        }
        else
          subnet = 0;
        delete[] yyvsp[0].s;
      ;}
    break;

  case 98:
#line 1266 "marde.y"
    { if (isState (yyvsp[0].i)) currentState = yyvsp[0].i; ;}
    break;

  case 99:
#line 1269 "marde.y"
    {
        if (visual) {
          thePrinter.printRaw ("ignoring extraneous `visual'");
          thePrinter.finish ();
        }
        if (isState (yyvsp[0].i)) currentState = yyvsp[0].i;
      ;}
    break;

  case 100:
#line 1280 "marde.y"
    { path_sc (yyvsp[-1].i, yyvsp[-2].i, yyvsp[0].expr, visual); ;}
    break;

  case 101:
#line 1283 "marde.y"
    { path_cs (yyvsp[-1].i, yyvsp[-2].i, yyvsp[0].expr, visual); ;}
    break;

  case 102:
#line 1286 "marde.y"
    {
        if (!yyvsp[-1].ia || !*yyvsp[-1].ia)
          yyvsp[0].expr->destroy ();
        else if (*yyvsp[-1].ia <= 2) {
          card_t src = *yyvsp[-1].ia >= 2 ? yyvsp[-1].ia[2] : currentState, dest = yyvsp[-1].ia[1];
          path_ss (src, dest, yyvsp[0].expr, visual);
        }
        else
          path_sl (currentState, yyvsp[-1].ia, yyvsp[0].expr, visual);
        delete[] yyvsp[-1].ia;
      ;}
    break;

  case 103:
#line 1299 "marde.y"
    {
        if ((yyvsp[-1].expr = ensureBool (yyvsp[-1].expr)))
          path_se (currentState, *yyvsp[-1].expr, yyvsp[0].expr, visual);
      ;}
    break;

  case 104:
#line 1305 "marde.y"
    { if ((yyvsp[-2].expr = ensureBool (yyvsp[-2].expr))) path_se (yyvsp[-1].i, *yyvsp[-2].expr, yyvsp[0].expr, visual); ;}
    break;

  case 105:
#line 1308 "marde.y"
    { if ((yyvsp[-1].expr = ensureBool (yyvsp[-1].expr))) rpath_se (yyvsp[-2].i, *yyvsp[-1].expr, yyvsp[0].expr, visual); ;}
    break;

  case 106:
#line 1312 "marde.y"
    { yyval.expr = NULL; ;}
    break;

  case 107:
#line 1315 "marde.y"
    {
        if ((yyval.expr = yyvsp[-2].expr)) {
          deerror ("ignoring extraneous path condition");
          yyvsp[0].expr->destroy ();
        }
        else
          yyval.expr = ensureBool (yyvsp[0].expr);
      ;}
    break;

  case 108:
#line 1326 "marde.y"
    {
        if (!yyvsp[0].s || !isNet ()) yyval.type = NULL;
        else if ((yyval.type = subnet->getType (yyvsp[0].s)));
        else if (!strcmp (yyvsp[0].s, "bool"))
          yyval.type = &Net::getBoolType ();
        else if (!strcmp (yyvsp[0].s, "int"))
          yyval.type = &Net::getIntType ();
        else if (!strcmp (yyvsp[0].s, "unsigned"))
          yyval.type = &Net::getCardType ();
        else if (!strcmp (yyvsp[0].s, "char"))
          yyval.type = &Net::getCharType ();
        else {
          thePrinter.printRaw ("undefined type ");
          thePrinter.printQuoted (yyvsp[0].s);
          thePrinter.finish ();
        }
        delete[] yyvsp[0].s;
      ;}
    break;

  case 109:
#line 1348 "marde.y"
    { yyval.s = yyvsp[0].s; ;}
    break;

  case 110:
#line 1351 "marde.y"
    { yyval.s = NULL; ;}
    break;

  case 111:
#line 1355 "marde.y"
    { yyval.s = NULL; ;}
    break;

  case 112:
#line 1358 "marde.y"
    { yyval.s = yyvsp[0].s; ;}
    break;

  case 113:
#line 1362 "marde.y"
    { deerror ("missing name"); yyval.s = NULL; ;}
    break;

  case 114:
#line 1365 "marde.y"
    { yyval.s = yyvsp[0].s; ;}
    break;

  case 119:
#line 1378 "marde.y"
    { currentType = yyvsp[-2].type; ;}
    break;

  case 120:
#line 1380 "marde.y"
    { defun (yyvsp[-4].type, yyvsp[-3].s, yyvsp[0].expr); ;}
    break;

  case 121:
#line 1383 "marde.y"
    {
        currentType = yyvsp[-4].type;
        if (emptyParsed && currentArity)
          deerror ("extraneous delimiter after formal parameter list");
        emptyParsed = false;
      ;}
    break;

  case 122:
#line 1390 "marde.y"
    { defun (yyvsp[-6].type, yyvsp[-5].s, yyvsp[0].expr); ;}
    break;

  case 123:
#line 1395 "marde.y"
    {
        if (currentArity || currentParameters)
          delete[] yyvsp[0].s;
        else
          addParameter (yyvsp[-1].type, yyvsp[0].s), emptyParsed = false;
      ;}
    break;

  case 124:
#line 1403 "marde.y"
    {
        if (yyvsp[-1].type && yyvsp[0].s && emptyParsed)
          deerror ("extraneous delimiter in parameter list");
        addParameter (yyvsp[-1].type, yyvsp[0].s);
        emptyParsed = false;
      ;}
    break;

  case 125:
#line 1411 "marde.y"
    {
        if (emptyParsed)
          deerror ("extraneous delimiter in parameter list");
        emptyParsed = true;
      ;}
    break;

  case 126:
#line 1417 "marde.y"
    { if (!currentArity && !currentParameters) emptyParsed = true; ;}
    break;

  case 129:
#line 1425 "marde.y"
    { isOutputArc = false; ;}
    break;

  case 131:
#line 1429 "marde.y"
    { isOutputArc = true; ;}
    break;

  case 133:
#line 1433 "marde.y"
    { currentType = &Net::getBoolType (); ;}
    break;

  case 134:
#line 1435 "marde.y"
    { currentType = NULL; ;}
    break;

  case 135:
#line 1439 "marde.y"
    { yyval.flag = false; ;}
    break;

  case 136:
#line 1442 "marde.y"
    { yyval.flag = true; ;}
    break;

  case 137:
#line 1445 "marde.y"
    {
        if (!yyvsp[-2].flag)
          deerror ("extraneous delimiter before variable definition");
        yyval.flag = true;
      ;}
    break;

  case 138:
#line 1452 "marde.y"
    {
        if (!yyvsp[-1].flag)
          deerror ("extraneous delimiter in variable definition list");
        yyval.flag = false;
      ;}
    break;

  case 139:
#line 1462 "marde.y"
    {
        if (yyvsp[-1].type && yyvsp[0].s && currentTransition) {
          if (currentTransition->getVariable (yyvsp[0].s)) {
            thePrinter.printRaw ("redefinition of variable ");
            thePrinter.printQuoted (yyvsp[0].s);
            thePrinter.finish ();
            delete[] yyvsp[0].s;
          }
          else
            currentTransition->addVariable (yyvsp[0].s, *yyvsp[-1].type, false, false);
        }
        else
          delete[] yyvsp[0].s;
      ;}
    break;

  case 140:
#line 1478 "marde.y"
    { beginAny (yyvsp[-2].type, yyvsp[-1].s, false); ;}
    break;

  case 141:
#line 1480 "marde.y"
    { endAny (yyvsp[-4].type, yyvsp[-3].s, yyvsp[0].expr)->destroy (); ;}
    break;

  case 146:
#line 1496 "marde.y"
    { currentType = yyvsp[-1].place ? &yyvsp[-1].place->getType () : NULL; ;}
    break;

  case 147:
#line 1498 "marde.y"
    {
        if (!yyvsp[-3].place || !currentTransition)
          yyvsp[0].marking->destroy ();
        else if (yyvsp[0].marking) {
          if (class Arc* arc =
            currentTransition->getArc (isOutputArc, *yyvsp[-3].place))
            arc->append (*yyvsp[0].marking);
          else
            currentTransition->addArc (*new class Arc
                               (isOutputArc, *yyvsp[0].marking, *yyvsp[-3].place));
        }
        currentType = NULL;
      ;}
    break;

  case 150:
#line 1521 "marde.y"
    {
        if ((yyvsp[0].expr = ensureBool (ensureExpr (yyvsp[0].expr), true)) && currentTransition) {
          if (yyvsp[0].expr->getKind () == Expression::eConstant) {
            const class Value& v =
            static_cast<const class Constant*>(yyvsp[0].expr)->getValue ();
            assert (v.getKind () == Value::vLeaf);
            if (bool (static_cast<const class LeafValue&>(v))) {
            dewarn ("gate is constantly enabled");
            yyvsp[0].expr->destroy ();
            }
            else {
            dewarn ("gate is constantly disabled");
            currentTransition->addGate (*yyvsp[0].expr);
            }
          }
          else
            currentTransition->addGate (*yyvsp[0].expr);
        }
        else
          yyvsp[0].expr->destroy ();
      ;}
    break;

  case 151:
#line 1546 "marde.y"
    { yyval.marking = ensureMarking (yyvsp[0].expr, currentType); ;}
    break;

  case 152:
#line 1551 "marde.y"
    { yyval.marking = yyvsp[0].marking; ;}
    break;

  case 153:
#line 1554 "marde.y"
    {
        if ((yyval.marking = yyvsp[-2].marking) && yyvsp[0].marking)
          yyval.marking->append (*yyvsp[0].marking);
        else if (yyvsp[0].marking)
          yyval.marking = yyvsp[0].marking;
      ;}
    break;

  case 154:
#line 1564 "marde.y"
    { yyval.expr = yyvsp[0].expr; ;}
    break;

  case 155:
#line 1567 "marde.y"
    { yyvsp[-1].expr = ensureMarking (yyvsp[-1].expr, currentType); ;}
    break;

  case 156:
#line 1569 "marde.y"
    {
        assert (!yyvsp[-3].expr || yyvsp[-3].expr->getKind () == Expression::eMarking);
        if ((yyval.expr = yyvsp[-3].expr) && yyvsp[0].marking)
          static_cast<class Marking*>(yyval.expr)->append (*yyvsp[0].marking);
        else if (yyvsp[0].marking)
          yyval.expr = yyvsp[0].marking;
      ;}
    break;

  case 157:
#line 1579 "marde.y"
    { yyval.expr = NULL; ;}
    break;

  case 158:
#line 1582 "marde.y"
    { yyval.expr = yyvsp[-1].expr; ;}
    break;

  case 159:
#line 1586 "marde.y"
    { yyval.expr = NULL; ;}
    break;

  case 160:
#line 1589 "marde.y"
    { yyval.expr = yyvsp[0].expr; ;}
    break;

  case 161:
#line 1592 "marde.y"
    { yyval.expr = namedComponent (yyvsp[-1].s, NULL); ;}
    break;

  case 162:
#line 1595 "marde.y"
    { yyval.expr = namedComponent (yyvsp[-2].s, yyvsp[0].expr); ;}
    break;

  case 163:
#line 1600 "marde.y"
    {
        if (currentContextType && !YYRECOVERING ()) {
          assert (!currentComponent);

          switch (currentContextType->getKind ()) {
          case Type::tVector:
            {
            const class VectorType* type =
              static_cast<const class VectorType*>(currentContextType);
            class VectorExpression* v = new class VectorExpression (*type);

            if (!yyvsp[0].expr) {
              deerror ("missing expression for first vector component");
              v->destroy (), yyval.expr = NULL;
            }
            else if (isCompatible (yyvsp[0].expr, currentType))
              yyval.expr = v, v->setComponent (currentComponent, *yyvsp[0].expr);
            else
              v->destroy (), yyvsp[0].expr->destroy (), yyval.expr = NULL;
            }
            break;
          case Type::tBuffer:
            {
            const class BufferType* type =
              static_cast<const class BufferType*>(currentContextType);
            class BufferExpression* b = new class BufferExpression (*type);

            if (!yyvsp[0].expr)
              yyval.expr = b;
            else if (isCompatible (yyvsp[0].expr, currentType))
              yyval.expr = b, b->append (*yyvsp[0].expr);
            else
              b->destroy (), yyvsp[0].expr->destroy (), yyval.expr = NULL;
            }
            break;
          case Type::tStruct:
            {
            if (!yyvsp[0].expr &&
                !static_cast<const class StructType*>(currentContextType)
                ->getSize ())
              yyval.expr = (new class Constant
                  (*new class StructValue
                   (*currentContextType)))->cse ();
            else {
              class StructExpression* s =
                new class StructExpression (*currentContextType);

              if (isCompatible (yyvsp[0].expr, *s))
                yyval.expr = s, s->append (*yyvsp[0].expr), currentType = s->getNextType ();
              else
                s->destroy (), yyvsp[0].expr->destroy (),
                  yyval.expr = NULL, currentType = NULL;
            }
            }
            break;
          default:
            assert (false);
          }
        }
        else
          yyvsp[0].expr->destroy (), yyval.expr = NULL;

        currentComponent++;
      ;}
    break;

  case 164:
#line 1666 "marde.y"
    {
        if ((yyval.expr = yyvsp[-2].expr) && currentContextType && !YYRECOVERING ()) {
          assert (currentComponent > 0);
          switch (currentContextType->getKind ()) {
          case Type::tVector:
            {
            assert (yyval.expr->getKind () == Expression::eVector);
            class VectorExpression* v =
              static_cast<class VectorExpression*>(yyval.expr);
            const class VectorType* type =
              static_cast<const class VectorType*>(currentContextType);

            if (currentComponent < type->getSize ()) {
              if (!yyvsp[0].expr) {
                thePrinter.printRaw ("missing array item ");
                thePrinter.print (currentComponent);
                thePrinter.finish ();
                yyval.expr->destroy (), yyval.expr = NULL;
              }
              else if (isCompatible (yyvsp[0].expr, currentType))
                v->setComponent (currentComponent, *yyvsp[0].expr);
              else
                yyval.expr->destroy (), yyvsp[0].expr->destroy (), yyval.expr = NULL;
            }
            else {
              thePrinter.printRaw ("too many items for array ");
              printType (*type);
              thePrinter.finish ();
              yyval.expr->destroy (), yyvsp[0].expr->destroy (), yyval.expr = NULL;
            }
            }
            break;
          case Type::tBuffer:
            {
            assert (yyval.expr->getKind () == Expression::eBuffer);
            class BufferExpression* b =
              static_cast<class BufferExpression*>(yyval.expr);
            const class BufferType* type =
              static_cast<const class BufferType*>(currentContextType);

            if (b->hasCapacity ()) {
              if (!yyvsp[0].expr || !b->getSize ()) {
                thePrinter.printRaw ("missing buffer item ");
                thePrinter.print (yyvsp[0].expr ? currentComponent : 0);
                thePrinter.finish ();
                yyval.expr->destroy (), yyvsp[0].expr->destroy (), yyval.expr = NULL;
              }
              else if (isCompatible (yyvsp[0].expr, currentType))
                b->append (*yyvsp[0].expr);
              else
                yyval.expr->destroy (), yyvsp[0].expr->destroy (), yyval.expr = NULL;
            }
            else {
              thePrinter.printRaw ("too many items for buffer ");
              printType (*type);
              thePrinter.finish ();
              yyval.expr->destroy (), yyvsp[0].expr->destroy (), yyval.expr = NULL;
            }
            }
            break;
          case Type::tStruct:
            {
            assert (yyval.expr->getKind () == Expression::eStruct);
            class StructExpression* s =
              static_cast<class StructExpression*>(yyval.expr);

            if (isCompatible (yyvsp[0].expr, *s))
              s->append (*yyvsp[0].expr), currentType = s->getNextType ();
            else
              yyval.expr->destroy (), yyvsp[0].expr->destroy (),
                yyval.expr = NULL, currentType = NULL;
            }
            break;
          default:
            assert (false);
          }
        }
        else
          yyval.expr->destroy (), yyvsp[0].expr->destroy (), yyval.expr = NULL;

        currentComponent++;
      ;}
    break;

  case 165:
#line 1751 "marde.y"
    { yyval.expr = NULL; deerror ("missing expression"); ;}
    break;

  case 166:
#line 1754 "marde.y"
    { yyval.expr = yyvsp[0].expr; ;}
    break;

  case 167:
#line 1759 "marde.y"
    { yyval.expr = ensureExpr (yyvsp[0].expr); ;}
    break;

  case 168:
#line 1764 "marde.y"
    { yyval.i = 0; ;}
    break;

  case 169:
#line 1767 "marde.y"
    { yyval.i = 1; ;}
    break;

  case 170:
#line 1770 "marde.y"
    { yyval.i = 2; ;}
    break;

  case 171:
#line 1773 "marde.y"
    { yyval.i = 3; ;}
    break;

  case 172:
#line 1778 "marde.y"
    { yyval.expr = NULL; ;}
    break;

  case 173:
#line 1781 "marde.y"
    {
        yyval.expr = NULL;
        if (yyvsp[-1].s) {
          if (class Function* f = getFunction (yyvsp[-1].s)) {
            if (!(yyval.expr = fold (f->expand (NULL)))) {
            thePrinter.printRaw ("could not expand nullary function ");
            thePrinter.printQuoted (f->getName ());
            thePrinter.finish ();
            }
          }
          else {
            thePrinter.printRaw ("there is no nullary function ");
            thePrinter.printQuoted (yyvsp[-1].s);
            thePrinter.finish ();
          }
        }
      ;}
    break;

  case 174:
#line 1800 "marde.y"
    {
        class Function* f = NULL;
        if (yyvsp[-1].s && !(f = getFunction (yyvsp[-1].s))) {
          thePrinter.printRaw ("there is no function ");
          thePrinter.printQuoted (yyvsp[-1].s);
          thePrinter.finish ();
        }
        delete[] yyvsp[-1].s;
        functionStack.push (f);
      ;}
    break;

  case 175:
#line 1811 "marde.y"
    {
        assert (!functionStack.empty ());
        if (class Function* f = functionStack.top ()) {
          yyval.expr = NULL;
          if (yyvsp[-1].exprList && !(yyval.expr = fold (f->expand (yyvsp[-1].exprList)))) {
            thePrinter.printRaw ("could not expand function ");
            thePrinter.printQuoted (f->getName ());
            thePrinter.finish ();
          }
        }
        else
          yyval.expr = NULL;
        yyvsp[-1].exprList->destroy ();
        functionStack.pop ();
      ;}
    break;

  case 176:
#line 1828 "marde.y"
    {
        yyval.expr = (new class Constant
            (*new class LeafValue (Net::getBoolType (), true)))->cse ();
      ;}
    break;

  case 177:
#line 1834 "marde.y"
    {
        yyval.expr = (new class Constant
            (*new class LeafValue (Net::getBoolType (), false)))->cse ();
      ;}
    break;

  case 178:
#line 1840 "marde.y"
    { yyval.expr = yyvsp[0].place ? (new class PlaceContents (*yyvsp[0].place))->cse () : NULL; ;}
    break;

  case 179:
#line 1843 "marde.y"
    { yyval.expr = resolveName (yyvsp[0].s); ;}
    break;

  case 180:
#line 1846 "marde.y"
    {
        yyval.expr = (new class Constant
            (*new class LeafValue (Net::getCardType (), yyvsp[0].i)))->cse ();
      ;}
    break;

  case 181:
#line 1852 "marde.y"
    {
        yyval.expr = (new class Constant
            (*new class LeafValue (Net::getCharType (), yyvsp[0].c)))->cse ();
      ;}
    break;

  case 182:
#line 1858 "marde.y"
    { yyval.expr = (new class Undefined (Undefined::fError))->cse (); ;}
    break;

  case 183:
#line 1861 "marde.y"
    { yyval.expr = (new class Undefined (Undefined::fFatalError))->cse (); ;}
    break;

  case 184:
#line 1864 "marde.y"
    {
        structLevels.push (StructLevel
                       (currentContextType, currentComponent));

        if (!currentType) {
          deerror ("cannot determine type of structured expression");
          currentContextType = NULL, currentComponent = 0;
        }
        else {
          assert (!structLevels.empty () || !currentComponent);
          currentContextType = currentType;
          currentComponent = 0;

          switch (currentType->getKind ()) {
          case Type::tStruct:
            currentType =
            static_cast<const class StructType*>(currentContextType)
            ->getSize ()
            ? &(*static_cast<const class StructType*>(currentContextType))
            [currentComponent]
            : NULL;
            break;
          case Type::tVector:
            currentType =
            &static_cast<const class VectorType*>(currentContextType)
            ->getItemType ();

            if (dewarnings) {
            const class Type& indexType =
              static_cast<const class VectorType*>(currentContextType)
              ->getIndexType ();

            switch (indexType.getKind ()) {
            case Type::tInt:
            case Type::tCard:
            case Type::tBool:
            case Type::tChar:
            case Type::tEnum:
            case Type::tId:
              if (const class Constraint* constraint =
                  indexType.getConstraint ()) {
                if (constraint->size () <= 1)
                  break;
              }
              else
                break;
            default:
              dewarn ("initializing an array indexed by something else"
                    " than a simple continuous type");
            }
            }

            break;
          case Type::tBuffer:
            currentType =
            &static_cast<const class BufferType*>(currentContextType)
            ->getItemType ();

            break;
          default:
            deerror ("cannot determine type of structured expression");
            currentType = currentContextType = NULL;
          }
        }
      ;}
    break;

  case 185:
#line 1931 "marde.y"
    {
        yyval.expr = yyvsp[-1].expr;
        if (currentContextType) {
          if (yyval.expr) {
            switch (yyval.expr->getKind ()) {
            case Expression::eStruct:
            {
              class StructExpression* s =
                static_cast<class StructExpression*>(yyval.expr);
              if (s->getNextType ()) {
                thePrinter.printRaw ("structure ");
                printType (*currentContextType);
                thePrinter.printRaw (" not fully initialized");
                thePrinter.finish ();
                yyval.expr->destroy (), yyval.expr = NULL;
              }
            }
            break;

            case Expression::eConstant:
            case Expression::eBuffer:
            break;

            case Expression::eVector:
            {
              card_t diff =
                static_cast<const class VectorType*>(currentContextType)
                ->getSize () - currentComponent;

              if (diff) {
                thePrinter.print (diff);
                thePrinter.printRaw (diff == 1
                               ? " element of array "
                               : " elements of array ");
                printType (*currentContextType);
                thePrinter.printRaw (" left uninitialized");
                thePrinter.finish ();

                yyval.expr->destroy (), yyval.expr = NULL;
              }
            }
            break;

            default:
            assert (false);
            }
          }

          StructLevel p = structLevels.top ();
          currentType = currentContextType;
          currentContextType = p.first;
          currentComponent = p.second;
        }
        else
          currentComponent = 0;

        structLevels.pop ();

        if (yyval.expr)
          yyval.expr = fold (yyval.expr);
      ;}
    break;

  case 186:
#line 1994 "marde.y"
    { pushTypeContext (yyvsp[0].type); ;}
    break;

  case 187:
#line 1996 "marde.y"
    {
        if ((yyval.expr = yyvsp[0].expr) && yyval.expr->getKind () == Expression::eMarking &&
            yyval.expr->getType () == currentType);
        else if ((yyval.expr = noMarking (yyval.expr)) && currentType) {
          if (!yyval.expr->getType ()) {
            deerror ("expression to cast has no type");
            yyval.expr->destroy (), yyval.expr = NULL;
          }
          else
            makeCompatible (yyval.expr, *currentType, true);
        }
        popTypeContext ();
      ;}
    break;

  case 188:
#line 2011 "marde.y"
    {
        StructLevel p (currentContextType, currentComponent);
        structLevels.push (p);
        currentContextType = currentType;
        currentType = NULL, currentComponent = 0;

        if (yyvsp[-1].s && currentContextType &&
            currentContextType->getKind () == Type::tUnion) {
          const class UnionType* u =
            static_cast<const class UnionType*>(currentContextType);

          if ((currentType = (*u)[yyvsp[-1].s]))
            currentComponent = u->getIndex (yyvsp[-1].s);
          else {
            thePrinter.printRaw ("type ");
            printType (*u);
            thePrinter.printRaw (" does not have component ");
            thePrinter.printQuoted (yyvsp[-1].s);
            thePrinter.finish ();
          }
        }
        else if (yyvsp[-1].s)
          deerror ("cannot assign the component of a non-union type");

        delete[] yyvsp[-1].s;
      ;}
    break;

  case 189:
#line 2038 "marde.y"
    {
        if ((yyvsp[0].expr = ensureExpr (yyvsp[0].expr)) && currentType) {
          const class UnionType* u =
            static_cast<const class UnionType*>(currentContextType);

          if (isCompatible (yyvsp[0].expr, currentType))
            yyval.expr = fold (new class UnionExpression (*u, *yyvsp[0].expr,
                                        currentComponent));
          else {
            thePrinter.printRaw ("type mismatch for ");
            printType (*u);
            thePrinter.printRaw (" component ");
            thePrinter.printQuoted (u->getComponentName (currentComponent));
            thePrinter.finish ();

            yyvsp[0].expr->destroy (), yyval.expr = NULL;
          }
        }
        else
          yyvsp[0].expr->destroy (), yyval.expr = NULL;

        assert (!structLevels.empty ());
        StructLevel p = structLevels.top ();
        currentType = currentContextType;
        currentContextType = p.first;
        currentComponent = p.second;
        structLevels.pop ();

        if (yyval.expr)
          yyval.expr = fold (yyval.expr);
      ;}
    break;

  case 190:
#line 2071 "marde.y"
    {
        if ((yyvsp[-2].expr = ensureExpr (yyvsp[-2].expr)) && yyvsp[0].s) {
          if (yyvsp[-2].expr->getType () && yyvsp[-2].expr->getType ()->getKind () == Type::tUnion) {
            const class UnionType* u =
            static_cast<const class UnionType*>(yyvsp[-2].expr->getType ());

            if ((*u)[yyvsp[0].s])
            yyval.expr = fold (new class UnionTypeExpression (*yyvsp[-2].expr,
                                            u->getIndex (yyvsp[0].s)));
            else {
            thePrinter.printRaw ("type ");
            printType (*u);
            thePrinter.printRaw (" does not have component ");
            thePrinter.printQuoted (yyvsp[0].s);
            thePrinter.finish ();

            yyvsp[-2].expr->destroy (), yyval.expr = NULL;
            }
          }
          else {
            deerror ("cannot determine the component of a non-union value");
            yyvsp[-2].expr->destroy (), yyval.expr = NULL;
          }
        }
        else
          yyvsp[-2].expr->destroy (), yyval.expr = NULL;

        delete[] yyvsp[0].s;

        if (yyval.expr)
          yyval.expr = fold (yyval.expr);
      ;}
    break;

  case 191:
#line 2105 "marde.y"
    { if ((yyval.expr = noMarking (yyvsp[0].expr))) (yyval.expr = yyval.expr->cse ())->setAtomic (true); ;}
    break;

  case 192:
#line 2108 "marde.y"
    { beginAny (yyvsp[-1].type, NULL, false); ;}
    break;

  case 193:
#line 2110 "marde.y"
    { yyval.expr = endAny (yyvsp[-3].type, NULL, yyvsp[0].expr); ;}
    break;

  case 194:
#line 2113 "marde.y"
    { beginAny (yyvsp[-2].type, yyvsp[-1].s, false); ;}
    break;

  case 195:
#line 2115 "marde.y"
    { yyval.expr = endAny (yyvsp[-4].type, yyvsp[-3].s, yyvsp[0].expr); ;}
    break;

  case 196:
#line 2118 "marde.y"
    { yyval.expr = newRelopExpression (false, yyvsp[-2].expr, yyvsp[0].expr); ;}
    break;

  case 197:
#line 2121 "marde.y"
    { yyval.expr = newRelopExpression (true, yyvsp[-2].expr, yyvsp[0].expr); ;}
    break;

  case 198:
#line 2124 "marde.y"
    { yyval.expr = newRelopExpression (false, yyvsp[0].expr, yyvsp[-2].expr); ;}
    break;

  case 199:
#line 2127 "marde.y"
    { yyval.expr = newNotExpression (newRelopExpression (false, yyvsp[-2].expr, yyvsp[0].expr)); ;}
    break;

  case 200:
#line 2130 "marde.y"
    { yyval.expr = newNotExpression (newRelopExpression (true, yyvsp[-2].expr, yyvsp[0].expr)); ;}
    break;

  case 201:
#line 2133 "marde.y"
    { yyval.expr = newNotExpression (newRelopExpression (false, yyvsp[0].expr, yyvsp[-2].expr)); ;}
    break;

  case 202:
#line 2136 "marde.y"
    {
        if (yyvsp[-2].expr && yyvsp[-2].expr->getType () &&
            yyvsp[-2].expr->getType ()->getKind () == Type::tBuffer) {
          const class BufferType* type =
            static_cast<const class BufferType*>(yyvsp[-2].expr->getType ());
          if ((yyvsp[-2].expr = ensureExpr (yyvsp[-2].expr)) && (yyvsp[0].expr = ensureExpr (yyvsp[0].expr)) &&
            isCompatible (yyvsp[0].expr, &type->getItemType ())) {
            if (yyvsp[-2].expr->getKind () == Expression::eBufferIndex) {
            class BufferIndex* b = static_cast<class BufferIndex*>(yyvsp[-2].expr);
            yyval.expr = fold (new class BufferWrite (b->getBuffer (), *yyvsp[0].expr,
                                      &b->getIndex ()));
            b->destroy ();
            }
            else
            yyval.expr = fold (new class BufferWrite (*yyvsp[-2].expr, *yyvsp[0].expr, NULL));
          }
          else
            yyvsp[-2].expr->destroy (), yyvsp[0].expr->destroy (), yyval.expr = NULL;
        }
        else
          yyval.expr = newBinopExpression (BinopExpression::bPlus, yyvsp[-2].expr, yyvsp[0].expr);
      ;}
    break;

  case 203:
#line 2160 "marde.y"
    {
        if ((yyvsp[-2].expr = ensureExpr (yyvsp[-2].expr)) && yyvsp[-2].expr->getType () &&
            yyvsp[-2].expr->getType ()->getKind () == Type::tBuffer) {
          if ((yyval.expr = ensureBuffer (yyvsp[-2].expr))) {
            class Expression* i = 0;
            if (yyval.expr->getKind () == Expression::eBufferIndex) {
            class BufferIndex* b = static_cast<class BufferIndex*>(yyval.expr);
            yyval.expr = &b->getBuffer ();
            i = &b->getIndex ();
            b->destroy ();
            }
            yyval.expr = fold (new class BufferRemove (*yyval.expr, ensureCard (yyvsp[0].expr), i));
          }
        }
        else
          yyval.expr = newBinopExpression (BinopExpression::bMinus, yyvsp[-2].expr, yyvsp[0].expr);
      ;}
    break;

  case 204:
#line 2179 "marde.y"
    { yyval.expr = newBinopExpression (BinopExpression::bDiv, yyvsp[-2].expr, yyvsp[0].expr); ;}
    break;

  case 205:
#line 2182 "marde.y"
    { yyval.expr = newBinopExpression (BinopExpression::bMul, yyvsp[-2].expr, yyvsp[0].expr); ;}
    break;

  case 206:
#line 2185 "marde.y"
    { yyval.expr = newBinopExpression (BinopExpression::bMod, yyvsp[-2].expr, yyvsp[0].expr); ;}
    break;

  case 207:
#line 2188 "marde.y"
    {
        if ((yyval.expr = ensureIntCard (yyvsp[0].expr)))
          yyval.expr = fold (new class UnopExpression (UnopExpression::uNot, *yyval.expr));
      ;}
    break;

  case 208:
#line 2194 "marde.y"
    {
        if (yyvsp[0].type) {
          card_t num = yyvsp[0].type->getNumValues ();
          assert (num > 0);
          if (num == CARD_T_MAX) {
            deerror ("type has too many values to count");
            yyval.expr = NULL;
          }
          else
            yyval.expr = (new class Constant (*new class LeafValue
                              (Net::getCardType (), num)))->cse ();
        }
        else
          yyval.expr = NULL;
      ;}
    break;

  case 209:
#line 2211 "marde.y"
    {
        if (yyvsp[0].type && isOrdered (*yyvsp[0].type))
          yyval.expr = (new class Constant (yyvsp[0].type->getFirstValue ()))->cse ();
        else
          yyval.expr = NULL;
      ;}
    break;

  case 210:
#line 2219 "marde.y"
    {
        if (yyvsp[0].type && isOrdered (*yyvsp[0].type))
          yyval.expr = (new class Constant (yyvsp[0].type->getLastValue ()))->cse ();
        else
          yyval.expr = NULL;
      ;}
    break;

  case 211:
#line 2227 "marde.y"
    {
        if ((yyval.expr = ensureOrdered (yyvsp[0].expr)))
          yyval.expr = fold (new class UnopExpression (UnopExpression::uPred, *yyval.expr));
      ;}
    break;

  case 212:
#line 2233 "marde.y"
    {
        if ((yyval.expr = ensureOrdered (yyvsp[0].expr)))
          yyval.expr = fold (new class UnopExpression (UnopExpression::uSucc, *yyval.expr));
      ;}
    break;

  case 213:
#line 2239 "marde.y"
    {
        if ((yyvsp[0].expr = ensureExpr (yyvsp[0].expr)) && yyvsp[0].expr->getType () &&
            yyvsp[0].expr->getType ()->getKind () == Type::tBuffer) {
          if ((yyval.expr = ensureBuffer (yyvsp[0].expr))) {
            class Expression* i = 0;
            if (yyval.expr->getKind () == Expression::eBufferIndex) {
            class BufferIndex* b = static_cast<class BufferIndex*>(yyval.expr);
            yyval.expr = &b->getBuffer ();
            i = &b->getIndex ();
            b->destroy ();
            }
            yyval.expr = fold (new class BufferRemove (*yyval.expr, 0, i));
          }
        }
        else if ((yyval.expr = ensureIntCard (yyvsp[0].expr)))
          yyval.expr = fold (new class UnopExpression (UnopExpression::uNeg, *yyval.expr));
      ;}
    break;

  case 214:
#line 2258 "marde.y"
    { yyval.expr = newBufferUnop (BufferUnop::bPeek, yyvsp[0].expr); ;}
    break;

  case 215:
#line 2261 "marde.y"
    { yyval.expr = newBufferUnop (BufferUnop::bUsed, yyvsp[0].expr); ;}
    break;

  case 216:
#line 2264 "marde.y"
    { yyval.expr = newBufferUnop (BufferUnop::bFree, yyvsp[0].expr); ;}
    break;

  case 217:
#line 2267 "marde.y"
    { yyval.expr = newBinopExpression (BinopExpression::bRol, yyvsp[-2].expr, yyvsp[0].expr); ;}
    break;

  case 218:
#line 2270 "marde.y"
    { yyval.expr = newBinopExpression (BinopExpression::bRor, yyvsp[-2].expr, yyvsp[0].expr); ;}
    break;

  case 219:
#line 2273 "marde.y"
    { yyval.expr = newBinopExpression (BinopExpression::bAnd, yyvsp[-2].expr, yyvsp[0].expr); ;}
    break;

  case 220:
#line 2276 "marde.y"
    { yyval.expr = newBinopExpression (BinopExpression::bXor, yyvsp[-2].expr, yyvsp[0].expr); ;}
    break;

  case 221:
#line 2279 "marde.y"
    { yyval.expr = newBinopExpression (BinopExpression::bOr, yyvsp[-2].expr, yyvsp[0].expr); ;}
    break;

  case 222:
#line 2282 "marde.y"
    {
        yyvsp[-2].expr = noMarking (yyvsp[-2].expr);
        if (yyvsp[-2].expr && yyvsp[0].exprList) {
          if (!yyvsp[-2].expr->getType ()) {
            deerror ("left-hand-side of ? has no type");
            yyvsp[-2].expr->destroy (); yyvsp[0].exprList->destroy (); yyval.expr = NULL;
          }
          else if (yyvsp[-2].expr->getType ()->getNumValues () != yyvsp[0].exprList->size ()) {
            thePrinter.printRaw ("left-hand-side of ? has ");
            thePrinter.print (yyvsp[-2].expr->getType ()->getNumValues ());
            thePrinter.printRaw ("!=");
            thePrinter.print (yyvsp[0].exprList->size ());
            thePrinter.printRaw (" possible values");
            thePrinter.finish ();
            yyvsp[-2].expr->destroy (); yyvsp[0].exprList->destroy (); yyval.expr = NULL;
          }
          else if (yyvsp[-2].expr->getType ()->getNumValues () == 1) {
            dewarn ("left-hand-side of ? has only one possible value");
            yyval.expr = (*yyvsp[0].exprList)[0].copy (); yyvsp[-2].expr->destroy (); yyvsp[0].exprList->destroy ();
          }
          else
            yyval.expr = fold (new class IfThenElse (*yyvsp[-2].expr, *yyvsp[0].exprList));
        }
        else {
          yyvsp[-2].expr->destroy (); yyvsp[0].exprList->destroy (); yyval.expr = NULL;
        }
      ;}
    break;

  case 223:
#line 2311 "marde.y"
    {
        if ((yyvsp[-3].expr = ensureExpr (yyvsp[-3].expr))) {
          if (!yyvsp[-3].expr->getType () ||
            yyvsp[-3].expr->getType ()->getKind () != Type::tVector) {
            deerror ("left-hand-side of .{[index]expr} is not an array");
            yyvsp[-3].expr->destroy (), yyvsp[-3].expr = NULL;
          }
          else
            pushTypeContext (&static_cast<const class VectorType*>
                         (yyvsp[-3].expr->getType ())->getIndexType ());
        }
      ;}
    break;

  case 224:
#line 2324 "marde.y"
    {
        if (yyvsp[-6].expr)
          currentType = &static_cast<const class VectorType*>(yyvsp[-6].expr->getType ())
            ->getItemType ();
      ;}
    break;

  case 225:
#line 2330 "marde.y"
    {
        if (yyvsp[-9].expr) {
          currentType = yyvsp[-9].expr->getType ();
          const class VectorType& type =
            *static_cast<const class VectorType*>(currentType);

          if (makeCompatible (yyvsp[-4].expr, type.getIndexType ()) &&
            makeCompatible (yyvsp[-1].expr, type.getItemType ()))
            yyval.expr = fold (new class VectorAssign (*yyvsp[-9].expr, *yyvsp[-4].expr, *yyvsp[-1].expr));
          else
            yyvsp[-4].expr->destroy (), yyvsp[-1].expr->destroy (), yyvsp[-9].expr->destroy (), yyval.expr = NULL;
          popTypeContext ();
        }
        else
          yyvsp[-4].expr->destroy (), yyvsp[-1].expr->destroy (), yyval.expr = NULL;
      ;}
    break;

  case 226:
#line 2348 "marde.y"
    {
        if ((yyvsp[-3].expr = ensureExpr (yyvsp[-3].expr)) && yyvsp[0].s) {
          if (!yyvsp[-3].expr->getType () ||
            yyvsp[-3].expr->getType ()->getKind () != Type::tStruct) {
            deerror ("left-hand-side of .{comp expr} is not a struct");
            yyvsp[-3].expr->destroy (), yyvsp[-3].expr = NULL;
          }
          const class StructType& type =
            *static_cast<const class StructType*>(yyvsp[-3].expr->getType ());
          if (const class Type* ct = type[yyvsp[0].s])
            pushTypeContext (ct);
          else {
            thePrinter.printRaw ("type ");
            printType (type);
            thePrinter.printRaw (" does not have component ");
            thePrinter.printQuoted (yyvsp[0].s);
            thePrinter.finish ();

            yyvsp[-3].expr->destroy (), yyvsp[-3].expr = NULL;
          }
        }
        else
          yyvsp[-3].expr->destroy (), yyvsp[-3].expr = NULL;
      ;}
    break;

  case 227:
#line 2373 "marde.y"
    {
        if (yyvsp[-6].expr) {
          const class StructType& type =
            *static_cast<const class StructType*>(yyvsp[-6].expr->getType ());
          currentType = type[yyvsp[-3].s];
          if (makeCompatible (yyvsp[-1].expr, *currentType))
            yyval.expr =
            fold (new class StructAssign (*yyvsp[-6].expr, type.getIndex (yyvsp[-3].s), *yyvsp[-1].expr));
          else
            yyvsp[-1].expr->destroy (), yyvsp[-6].expr->destroy (), yyval.expr = NULL;
          popTypeContext ();
        }
        else
          yyvsp[-1].expr->destroy (), yyval.expr = NULL;
        delete[] yyvsp[-3].s;
      ;}
    break;

  case 228:
#line 2391 "marde.y"
    {
        yyvsp[-2].expr = ensureExpr (yyvsp[-2].expr);
        if (yyvsp[-2].expr && yyvsp[0].s) {
          if (yyvsp[-2].expr->getType () &&
            yyvsp[-2].expr->getType ()->getKind () == Type::tStruct) {
            const class StructType *s =
            static_cast<const class StructType*>(yyvsp[-2].expr->getType ());
            if ((*s)[yyvsp[0].s])
            yyval.expr = fold (new class StructComponent (*yyvsp[-2].expr, s->getIndex (yyvsp[0].s)));
            else {
            thePrinter.printRaw ("type ");
            printType (*s);
            thePrinter.printRaw (" does not have component ");
            thePrinter.printQuoted (yyvsp[0].s);
            thePrinter.finish ();

            yyvsp[-2].expr->destroy (), yyval.expr = NULL;
            }
          }
          else if (yyvsp[-2].expr->getType () &&
                 yyvsp[-2].expr->getType ()->getKind () == Type::tUnion) {
            const class UnionType *u =
            static_cast<const class UnionType*>(yyvsp[-2].expr->getType ());
            if ((*u)[yyvsp[0].s])
            yyval.expr = fold (new class UnionComponent (*yyvsp[-2].expr, u->getIndex (yyvsp[0].s)));
            else {
            thePrinter.printRaw ("type ");
            printType (*u);
            thePrinter.printRaw (" does not have component ");
            thePrinter.printQuoted (yyvsp[0].s);
            thePrinter.finish ();

            yyvsp[-2].expr->destroy (), yyval.expr = NULL;
            }
          }
          else {
            deerror ("only unions and structs have components");
            yyvsp[-2].expr->destroy (), yyval.expr = NULL;
          }
        }
        else
          yyvsp[-2].expr->destroy (), yyval.expr = NULL;

        delete[] yyvsp[0].s;
      ;}
    break;

  case 229:
#line 2438 "marde.y"
    {
        if ((yyvsp[-1].expr = ensureExpr (yyvsp[-1].expr)) && yyvsp[-1].expr->getType ()) {
          switch (yyvsp[-1].expr->getType ()->getKind ()) {
          case Type::tVector:
            {
            const class VectorType* type =
              static_cast<const class VectorType*>(yyvsp[-1].expr->getType ());
            pushTypeContext (&type->getIndexType ());
            }
            break;
          case Type::tBuffer:
            if (yyvsp[-1].expr->getKind () == Expression::eBufferIndex)
            deerror ("a buffer index has already been specified");
            break;
          default:
            deerror ("only vector-typed expressions can be indexed");
            yyvsp[-1].expr->destroy (), yyvsp[-1].expr = NULL;
          }
        }
        else if (yyvsp[-1].expr) {
          deerror ("no type for indexed expression");
          yyvsp[-1].expr->destroy (), yyvsp[-1].expr = NULL;
        }
      ;}
    break;

  case 230:
#line 2463 "marde.y"
    {
        if (yyvsp[-4].expr) {
          switch (yyvsp[-4].expr->getType ()->getKind ()) {
          case Type::tVector:
            {
            const class VectorType* type =
              static_cast<const class VectorType*>(yyvsp[-4].expr->getType ());
            popTypeContext ();

            if (isCompatible (yyvsp[-1].expr, &type->getIndexType ()))
              yyval.expr = fold (new class VectorIndex (*yyvsp[-4].expr, *yyvsp[-1].expr));
            else
              yyval.expr = NULL, yyvsp[-4].expr->destroy (), yyvsp[-1].expr->destroy ();
            }
            break;
          case Type::tBuffer:
            yyvsp[-1].expr = ensureCard (yyvsp[-1].expr);
            if (yyvsp[-4].expr->getKind () == Expression::eBufferIndex)
            yyvsp[-1].expr->destroy (), yyval.expr = yyvsp[-4].expr;
            else
            yyval.expr = yyvsp[-1].expr ? (new class BufferIndex (*yyvsp[-4].expr, *yyvsp[-1].expr))->cse () : yyvsp[-4].expr;
            break;
          default:
            assert (false);
          }
        }
        else
          yyval.expr = NULL, yyvsp[-1].expr->destroy ();
      ;}
    break;

  case 231:
#line 2494 "marde.y"
    { yyval.expr = newNotExpression (yyvsp[0].expr); ;}
    break;

  case 232:
#line 2497 "marde.y"
    {
        yyvsp[-2].expr = ensureBool (yyvsp[-2].expr); yyvsp[0].expr = ensureBool (yyvsp[0].expr, true);
        if (yyvsp[-2].expr && yyvsp[0].expr)
          yyval.expr = newBooleanBinop (true, yyvsp[-2].expr, yyvsp[0].expr);
        else {
          yyvsp[-2].expr->destroy (); yyvsp[0].expr->destroy (); yyval.expr = NULL;
        }
      ;}
    break;

  case 233:
#line 2507 "marde.y"
    {
        yyvsp[-2].expr = ensureBool (yyvsp[-2].expr); yyvsp[0].expr = ensureBool (yyvsp[0].expr, true);
        if (yyvsp[-2].expr && yyvsp[0].expr)
          yyval.expr = newBooleanBinop (false, yyvsp[-2].expr, yyvsp[0].expr);
        else {
          yyvsp[-2].expr->destroy (); yyvsp[0].expr->destroy (); yyval.expr = NULL;
        }
      ;}
    break;

  case 234:
#line 2517 "marde.y"
    {
        yyvsp[-2].expr = ensureBool (yyvsp[-2].expr); yyvsp[0].expr = ensureBool (yyvsp[0].expr, true);
        if (yyvsp[-2].expr && yyvsp[0].expr)
          yyval.expr = newBooleanBinop (false, newNotExpression (yyvsp[-2].expr), yyvsp[0].expr);
        else {
          yyvsp[-2].expr->destroy (); yyvsp[0].expr->destroy (); yyval.expr = NULL;
        }
      ;}
    break;

  case 235:
#line 2527 "marde.y"
    {
        yyval.expr = newNotExpression
          (newRelopExpression (true, ensureBool (yyvsp[-2].expr), ensureBool (yyvsp[0].expr)));
      ;}
    break;

  case 236:
#line 2533 "marde.y"
    { yyval.expr = newRelopExpression (true, ensureBool (yyvsp[-2].expr), ensureBool (yyvsp[0].expr)); ;}
    break;

  case 237:
#line 2536 "marde.y"
    {
        yyvsp[0].expr = ensureBool (yyvsp[0].expr);
        yyval.expr = yyvsp[0].expr
          ? (new class TemporalUnop (TemporalUnop::Finally, *yyvsp[0].expr))->cse ()
          : NULL;
      ;}
    break;

  case 238:
#line 2544 "marde.y"
    {
        yyvsp[0].expr = ensureBool (yyvsp[0].expr);
        yyval.expr = yyvsp[0].expr
          ? (new class TemporalUnop (TemporalUnop::Globally, *yyvsp[0].expr))->cse ()
          : NULL;
      ;}
    break;

  case 239:
#line 2552 "marde.y"
    {
        yyvsp[0].expr = ensureBool (yyvsp[0].expr);
        yyval.expr = yyvsp[0].expr
          ? (new class TemporalUnop (TemporalUnop::Next, *yyvsp[0].expr))->cse ()
          : NULL;
      ;}
    break;

  case 240:
#line 2560 "marde.y"
    {
        yyvsp[-2].expr = ensureBool (yyvsp[-2].expr); yyvsp[0].expr = ensureBool (yyvsp[0].expr);
        if (yyvsp[-2].expr && yyvsp[0].expr)
          yyval.expr = (new class TemporalBinop
              (TemporalBinop::Until, *yyvsp[-2].expr, *yyvsp[0].expr))->cse ();
        else {
          yyvsp[-2].expr->destroy (); yyvsp[0].expr->destroy (); yyval.expr = NULL;
        }
      ;}
    break;

  case 241:
#line 2571 "marde.y"
    {
        yyvsp[-2].expr = ensureBool (yyvsp[-2].expr); yyvsp[0].expr = ensureBool (yyvsp[0].expr);
        if (yyvsp[-2].expr && yyvsp[0].expr)
          yyval.expr = (new class TemporalBinop
              (TemporalBinop::Release, *yyvsp[-2].expr, *yyvsp[0].expr))->cse ();
        else {
          yyvsp[-2].expr->destroy (); yyvsp[0].expr->destroy (); yyval.expr = NULL;
        }
      ;}
    break;

  case 242:
#line 2582 "marde.y"
    { yyval.expr = (new class EmptySet)->cse (); ;}
    break;

  case 243:
#line 2585 "marde.y"
    { yyval.expr = newSetExpression (SetExpression::sSubset, yyvsp[-2].expr, yyvsp[0].expr); ;}
    break;

  case 244:
#line 2588 "marde.y"
    { yyval.expr = newSetExpression (SetExpression::sIntersection, yyvsp[-2].expr, yyvsp[0].expr); ;}
    break;

  case 245:
#line 2591 "marde.y"
    { yyval.expr = newSetExpression (SetExpression::sMinus, yyvsp[-2].expr, yyvsp[0].expr); ;}
    break;

  case 246:
#line 2594 "marde.y"
    { yyval.expr = newSetExpression (SetExpression::sUnion, yyvsp[-2].expr, yyvsp[0].expr); ;}
    break;

  case 247:
#line 2597 "marde.y"
    { yyval.expr = newSetExpression (SetExpression::sEquals, yyvsp[-2].expr, yyvsp[0].expr); ;}
    break;

  case 248:
#line 2600 "marde.y"
    { yyval.expr = newCardinalityExpression (CardinalityExpression::cCard, yyvsp[0].expr); ;}
    break;

  case 249:
#line 2603 "marde.y"
    { yyval.expr = newCardinalityExpression (CardinalityExpression::cMin, yyvsp[0].expr); ;}
    break;

  case 250:
#line 2606 "marde.y"
    { yyval.expr = newCardinalityExpression (CardinalityExpression::cMax, yyvsp[0].expr); ;}
    break;

  case 251:
#line 2609 "marde.y"
    { yyval.expr = yyvsp[-1].expr; ;}
    break;

  case 252:
#line 2612 "marde.y"
    {
        yyvsp[-2].expr = ensureCard (yyvsp[-2].expr);
        class Marking* m = ensureMarking (yyvsp[0].expr, currentType);

        if ((yyval.expr = m) && yyvsp[-2].expr) {
          if (yyvsp[-2].expr->getKind () == Expression::eConstant) {
            const class Value& v =
            static_cast<class Constant*>(yyvsp[-2].expr)->getValue ();
            assert (v.getKind () == Value::vLeaf);
            card_t mult = card_t (static_cast<const class LeafValue&>(v));
            if (!mult) {
            deerror ("zero multiplicity");
            yyvsp[-2].expr->destroy (), m->destroy ();
            yyval.expr = m = NULL;
            }
            else if (mult == 1)
            yyvsp[-2].expr->destroy ();
            else {
            for (;;) {
              if (class Expression* c = m->getMultiplicity ()) {
                class Expression* card =
                  fold (new class BinopExpression (BinopExpression::bMul,
                                           *yyvsp[-2].expr, *c));
                m->setMultiplicity (card);
              }
              else
                m->setMultiplicity (yyvsp[-2].expr);

              if ((m = const_cast<class Marking*>(m->getNext ())))
                yyvsp[-2].expr = (new class Constant
                    (*new class LeafValue
                     (*yyvsp[-2].expr->getType (), mult)))->cse ();
              else
                break;
            }
            }
          }
          else {
            if (m->getNext ())
            yyval.expr = m = static_cast<class Marking*>
              ((new class Marking (m->getPlace (), m))->cse ());

            class Expression* card = yyvsp[-2].expr;

            if (class Expression* c = m->getMultiplicity ())
            card = fold
              (new class BinopExpression (BinopExpression::bMul, *yyvsp[-2].expr, *c));
            m->setMultiplicity (card);
          }
        }
        else
          yyvsp[-2].expr->destroy ();
      ;}
    break;

  case 253:
#line 2667 "marde.y"
    { beginQuantifier (yyvsp[0].s, yyvsp[-1].type); ;}
    break;

  case 254:
#line 2669 "marde.y"
    { continueQuantifier (ASSERT1 (yyvsp[-3].type)); ;}
    break;

  case 255:
#line 2671 "marde.y"
    { yyval.expr = endQuantifier (yyvsp[-5].s, yyvsp[-6].type, yyvsp[-3].expr, yyvsp[-1].i, yyvsp[0].expr); ;}
    break;

  case 256:
#line 2674 "marde.y"
    { yyval.expr = quantifierVariable (yyvsp[-1].s, yyvsp[0].s, false); ;}
    break;

  case 257:
#line 2677 "marde.y"
    { yyval.expr = quantifierVariable (yyvsp[-1].s, yyvsp[0].s, true); ;}
    break;

  case 258:
#line 2680 "marde.y"
    {
        if (yyvsp[-1].expr && yyvsp[-1].expr->getKind () == Expression::eEmptySet) {
          dewarn ("any subset of an empty set is an empty set");
          delete[] yyvsp[-3].s, yyvsp[-3].s = NULL;
        }
        else if ((yyvsp[-1].expr = ensureSet (yyvsp[-1].expr)) && yyvsp[-3].s && yyvsp[-1].expr->getType ())
          currentVariables.push (new class VariableDefinition
                           (yyvsp[-3].s, *yyvsp[-1].expr->getType (), false));
        else
          delete[] yyvsp[-3].s, yyvsp[-3].s = NULL;
      ;}
    break;

  case 259:
#line 2692 "marde.y"
    {
        yyvsp[0].expr = ensureBool (ensureExpr (yyvsp[0].expr));
        if ((yyval.expr = yyvsp[-3].expr) && yyvsp[0].expr && yyvsp[-5].s) {
          yyvsp[0].expr = yyvsp[0].expr->cse ();
          if (dewarnings) {
            class VariableSet vars;
            vars.insert (*currentVariables.top ());
            if (!yyvsp[0].expr->depends (vars, false)) {
            thePrinter.printRaw ("Warning:subset is independent of ");
            thePrinter.printQuoted (currentVariables.top ()->getName ());
            thePrinter.finish ();
            }
          }
          if (yyvsp[0].expr->getKind () == Expression::eConstant) {
            const class Value& v =
            static_cast<class Constant*>(yyvsp[0].expr)->getValue ();
            assert (v.getKind () == Value::vLeaf);
            bool result = bool (static_cast<const class LeafValue&>(v));
            yyvsp[0].expr->destroy ();
            dewarn (result
                  ? "subset criterion always passes"
                  : "subset criterion always fails");
            if (!result)
            yyval.expr->destroy (), yyval.expr = (new class EmptySet)->cse ();
          }
          else
            yyval.expr = (new class Submarking
                (*currentVariables.top (), *yyvsp[-3].expr, *yyvsp[0].expr))->cse ();
        }
        else
          yyvsp[0].expr->destroy ();
        if (yyvsp[-5].s)
          currentVariables.pop ();
      ;}
    break;

  case 260:
#line 2728 "marde.y"
    {
        if (yyvsp[-1].expr && yyvsp[-1].expr->getKind () == Expression::eEmptySet) {
          dewarn ("any subset of an empty set is an empty set");
          delete[] yyvsp[-3].s, yyvsp[-3].s = NULL;
        }
        else if ((yyvsp[-1].expr = ensureSet (yyvsp[-1].expr)) && yyvsp[-3].s && yyvsp[-1].expr->getType ())
          currentVariables.push (new class VariableDefinition
                           (yyvsp[-3].s, *yyvsp[-1].expr->getType (), false));
        else
          delete[] yyvsp[-3].s, yyvsp[-3].s = NULL;
      ;}
    break;

  case 261:
#line 2740 "marde.y"
    {
        yyvsp[0].expr = ensureExpr (yyvsp[0].expr);
        if ((yyval.expr = yyvsp[-3].expr) && yyvsp[-5].s && yyvsp[0].expr) {
          yyvsp[0].expr = yyvsp[0].expr->cse ();
          if (dewarnings) {
            class VariableSet vars;
            vars.insert (*currentVariables.top ());
            if (!yyvsp[0].expr->depends (vars, false)) {
            thePrinter.printRaw ("Warning:mapping is independent of ");
            thePrinter.printQuoted (currentVariables.top ()->getName ());
            thePrinter.finish ();
            }
            else if (yyvsp[0].expr->getKind () == Expression::eVariable &&
                   &static_cast<class Variable*>(yyvsp[0].expr)->getVariable () ==
                   currentVariables.top ()) {
            thePrinter.printRaw ("Warning:mapping has no effect");
            thePrinter.finish ();
            }
          }

          if (yyvsp[0].expr->getKind () == Expression::eVariable &&
            &static_cast<class Variable*>(yyvsp[0].expr)->getVariable () ==
            currentVariables.top ()) {
            currentVariables.pop ();
            delete &static_cast<class Variable*>(yyvsp[0].expr)->getVariable ();
            yyvsp[-5].s = 0;
            yyvsp[0].expr->destroy ();
            yyval.expr = yyvsp[-3].expr;
          }
          else
            yyval.expr = (new class Mapping
                (*currentVariables.top (), NULL, *yyvsp[-3].expr, *yyvsp[0].expr))->cse ();
        }
        else
          yyvsp[0].expr->destroy ();
        if (yyvsp[-5].s)
          currentVariables.pop ();
      ;}
    break;

  case 262:
#line 2780 "marde.y"
    {
        if (yyvsp[-1].expr && yyvsp[-1].expr->getKind () == Expression::eEmptySet) {
          dewarn ("any subset of an empty set is an empty set");
          delete[] yyvsp[-5].s, yyvsp[-5].s = NULL;
          delete[] yyvsp[-3].s, yyvsp[-3].s = NULL;
        }
        else if ((yyvsp[-1].expr = ensureSet (yyvsp[-1].expr)) && yyvsp[-5].s && yyvsp[-3].s && yyvsp[-1].expr->getType ()) {
          currentVariables.push (new class VariableDefinition
                           (yyvsp[-5].s, Net::getCardType (), false));
          currentVariables.push (new class VariableDefinition
                           (yyvsp[-3].s, *yyvsp[-1].expr->getType (), false));
        }
        else {
          delete[] yyvsp[-5].s, yyvsp[-5].s = NULL;
          delete[] yyvsp[-3].s, yyvsp[-3].s = NULL;
        }
      ;}
    break;

  case 263:
#line 2798 "marde.y"
    {
        yyvsp[0].expr = yyvsp[0].expr ? ensureMarking (yyvsp[0].expr, yyvsp[0].expr->getType ()) : 0;
        yyval.expr = yyvsp[-3].expr;
        if (yyvsp[-7].s && yyvsp[-5].s) {
          class VariableDefinition* token = currentVariables.top ();
          currentVariables.pop ();
          class VariableDefinition* mult = currentVariables.top ();
          currentVariables.pop ();
          if (yyval.expr && yyvsp[0].expr) {
            yyvsp[0].expr = yyvsp[0].expr->cse ();
            if (dewarnings) {
            class VariableSet vars;
            vars.insert (*token);
            vars.insert (*mult);
            if (!yyvsp[0].expr->depends (vars, false)) {
              thePrinter.printRaw ("Warning:mapping depends neither on ");
              thePrinter.printQuoted (token->getName ());
              thePrinter.printRaw (" nor ");
              thePrinter.printQuoted (mult->getName ());
              thePrinter.finish ();
            }
            }
            yyval.expr = (new class Mapping (*token, mult, *yyvsp[-3].expr, *yyvsp[0].expr))->cse ();
          }
          else
            yyvsp[0].expr->destroy ();
        }
        else
          yyvsp[0].expr->destroy ();
      ;}
    break;

  case 264:
#line 2831 "marde.y"
    {
        if (class Function* f = functionStack.top ()) {
          if (!f->getArity ())
            yyval.exprList = new class ExpressionList;
          else {
            thePrinter.printRaw ("function ");
            thePrinter.printQuoted (f->getName ());
            thePrinter.printRaw (" expects ");
            thePrinter.print (f->getArity ());
            thePrinter.printRaw (", not zero arguments");
            thePrinter.finish ();
            yyval.exprList = NULL;
          }
        }
        else
          yyval.exprList = NULL;
      ;}
    break;

  case 265:
#line 2849 "marde.y"
    {
        const class Type* type = NULL;

        if (class Function* f = functionStack.top ()) {
          if (f->getArity ())
            type = &(*f)[0].getType ();
          else {
            thePrinter.printRaw ("function ");
            thePrinter.printQuoted (f->getName ());
            thePrinter.printRaw (" takes no arguments");
            thePrinter.finish ();
          }
        }

        pushTypeContext (type);
      ;}
    break;

  case 266:
#line 2866 "marde.y"
    {
        if (currentType &&
            isCompatible ((yyvsp[0].expr = noMarking (yyvsp[0].expr)), currentType)) {
          if (functionStack.top ())
            (yyval.exprList = new class ExpressionList)->append (*yyvsp[0].expr);
          else {
            yyvsp[0].expr->destroy (); yyval.exprList = NULL;
          }
        }
        else {
          yyvsp[0].expr->destroy (); yyval.exprList = NULL;
        }
        popTypeContext ();
      ;}
    break;

  case 267:
#line 2882 "marde.y"
    {
        const class Type* type = NULL;

        if (class Function* f = functionStack.top ()) {
          if (yyvsp[-1].exprList) {
            if (f->getArity () > yyvsp[-1].exprList->size ())
            type = &(*f)[yyvsp[-1].exprList->size ()].getType ();
            else {
            thePrinter.printRaw ("function ");
            thePrinter.printQuoted (f->getName ());
            thePrinter.printRaw (" takes only ");
            thePrinter.print (f->getArity ());
            thePrinter.printRaw (" arguments");
            thePrinter.finish ();
            }
          }
        }

        pushTypeContext (type);
      ;}
    break;

  case 268:
#line 2903 "marde.y"
    {
        if ((yyval.exprList = yyvsp[-3].exprList) && currentType &&
            isCompatible ((yyvsp[0].expr = noMarking (yyvsp[0].expr)), currentType)) {
          if (functionStack.top ())
            yyval.exprList->append (*yyvsp[0].expr);
          else {
            yyval.exprList->destroy (); yyvsp[0].expr->destroy (); yyval.exprList = NULL;
          }
        }
        else {
          yyval.exprList->destroy (); yyvsp[0].expr->destroy (); yyval.exprList = NULL;
        }
        popTypeContext ();
      ;}
    break;

  case 269:
#line 2919 "marde.y"
    { if ((yyval.exprList = yyvsp[-1].exprList)) deerror ("extraneous comma in argument list"); ;}
    break;

  case 270:
#line 2925 "marde.y"
    {
        if (yyvsp[0].expr)
          (yyval.exprList = new class ExpressionList)->prepend (*yyvsp[0].expr);
        else
          yyval.exprList = NULL;
      ;}
    break;

  case 271:
#line 2933 "marde.y"
    {
        if ((yyval.exprList = yyvsp[-2].exprList) && yyvsp[0].expr) {
          if (yyval.exprList->getType () && yyvsp[0].expr->getType () &&
            yyval.exprList->getType () != yyvsp[0].expr->getType ()) {
            deerror ("incompatible types in ?: expression");
            yyval.exprList->destroy (), yyvsp[0].expr->destroy (), yyval.exprList = NULL;
          }
          else if ((yyvsp[0].expr = yyval.exprList->isSet ()
                  ? ensureMarking (yyvsp[0].expr, yyval.exprList->getType ()
                               ? yyval.exprList->getType ()
                               : yyvsp[0].expr->getType ())
                  : noMarking (yyvsp[0].expr)))
            yyval.exprList->prepend (*yyvsp[0].expr);
          else
            yyval.exprList->destroy (), yyvsp[0].expr->destroy (), yyval.exprList = NULL;
        }
        else
          yyval.exprList->destroy (), yyvsp[0].expr->destroy (), yyval.exprList = NULL;
      ;}
    break;

  case 272:
#line 2956 "marde.y"
    {
        if (yyvsp[0].s && isNet ()) {
          if (!(yyval.place = subnet->getPlace (yyvsp[0].s))) {
            thePrinter.printRaw ("undefined place ");
            thePrinter.printQuoted (yyvsp[0].s);
            thePrinter.finish ();
          }
        }
        else
          yyval.place = NULL;
        delete[] yyvsp[0].s;
      ;}
    break;

  case 273:
#line 2972 "marde.y"
    { yyval.place = yyvsp[0].place; ;}
    break;

  case 275:
#line 2979 "marde.y"
    { deerror ("ignoring extraneous `place'"); ;}
    break;


    }

/* Line 999 of yacc.c.  */
#line 5202 "marde.tab.c"

  yyvsp -= yylen;
  yyssp -= yylen;


  YY_STACK_PRINT (yyss, yyssp);

  *++yyvsp = yyval;


  /* Now `shift' the result of the reduction.  Determine what state
     that goes to, based on the state we popped back to and the rule
     number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTOKENS];

  goto yynewstate;


/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
#if YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (YYPACT_NINF < yyn && yyn < YYLAST)
      {
        YYSIZE_T yysize = 0;
        int yytype = YYTRANSLATE (yychar);
        char *yymsg;
        int yyx, yycount;

        yycount = 0;
        /* Start YYX at -YYN if negative to avoid negative indexes in
           YYCHECK.  */
        for (yyx = yyn < 0 ? -yyn : 0;
             yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
          if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
            yysize += yystrlen (yytname[yyx]) + 15, yycount++;
        yysize += yystrlen ("syntax error, unexpected ") + 1;
        yysize += yystrlen (yytname[yytype]);
        yymsg = (char *) YYSTACK_ALLOC (yysize);
        if (yymsg != 0)
          {
            char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
            yyp = yystpcpy (yyp, yytname[yytype]);

            if (yycount < 5)
            {
              yycount = 0;
              for (yyx = yyn < 0 ? -yyn : 0;
                   yyx < (int) (sizeof (yytname) / sizeof (char *));
                   yyx++)
                if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
                  {
                  const char *yyq = ! yycount ? ", expecting " : " or ";
                  yyp = yystpcpy (yyp, yyq);
                  yyp = yystpcpy (yyp, yytname[yyx]);
                  yycount++;
                  }
            }
            yyerror (yymsg);
            YYSTACK_FREE (yymsg);
          }
        else
          yyerror ("syntax error; also virtual memory exhausted");
      }
      else
#endif /* YYERROR_VERBOSE */
      yyerror ("syntax error");
    }



  if (yyerrstatus == 3)
    {
      /* If just tried and failed to reuse lookahead token after an
       error, discard it.  */

      /* Return failure if at end of input.  */
      if (yychar == YYEOF)
        {
        /* Pop the error token.  */
          YYPOPSTACK;
        /* Pop the rest of the stack.  */
        while (yyss < yyssp)
          {
            YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
            yydestruct (yystos[*yyssp], yyvsp);
            YYPOPSTACK;
          }
        YYABORT;
        }

      YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
      yydestruct (yytoken, &yylval);
      yychar = YYEMPTY;

    }

  /* Else will try to reuse lookahead token after shifting the error
     token.  */
  goto yyerrlab1;


/*----------------------------------------------------.
| yyerrlab1 -- error raised explicitly by an action.  |
`----------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */

  for (;;)
    {
      yyn = yypact[yystate];
      if (yyn != YYPACT_NINF)
      {
        yyn += YYTERROR;
        if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
          {
            yyn = yytable[yyn];
            if (0 < yyn)
            break;
          }
      }

      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
      YYABORT;

      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
      yydestruct (yystos[yystate], yyvsp);
      yyvsp--;
      yystate = *--yyssp;

      YY_STACK_PRINT (yyss, yyssp);
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  YYDPRINTF ((stderr, "Shifting error token, "));

  *++yyvsp = yylval;


  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;

/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;

#ifndef yyoverflow
/*----------------------------------------------.
| yyoverflowlab -- parser overflow comes here.  |
`----------------------------------------------*/
yyoverflowlab:
  yyerror ("parser stack overflow");
  yyresult = 2;
  /* Fall through.  */
#endif

yyreturn:
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
  return yyresult;
}


#line 2982 "marde.y"


#include "cmdline.h"

const char*
deline (void)
{
  static class StringBuffer prompt1, prompt2;
  prompt1.create (0);
  class Printer printer;
  printer.setOutput (&prompt1);
  assert (subnet == getSubnet ());

  if (modulepath) {
    const class Net* n = net;
    for (unsigned i = 1; i <= *modulepath; ) {
      n = &n->getChild (modulepath[i]);
      if (n->getName ())
      printer.print (n->getName ());
      else
      printer.print (modulepath[i]);
      if (++i <= *modulepath)
      printer.delimiter ('/');
    }
    assert (n == subnet);
  }

  /* print the state number */
  if (currentState != CARD_T_MAX)
    printer.printState (currentState);
  /* copy prompt1 to prompt2 */
  memcpy (prompt2.create (prompt1.getLength ()), prompt1.getString (),
        prompt1.getLength ());
  printer.delimiter ('$'); // prompt1 terminator
  printer.setOutput (&prompt2);
  printer.delimiter ('>'); // prompt2 terminator
  extern volatile bool interrupted;
  if (interrupted)
    fputs ("[Interrupt]\n", stderr);
  interrupted = true;
  if (promptchar)
    putc (promptchar, stderr), putc ('\n', stderr);
  const char* line = cmdline (prompt1.getString (), prompt2.getString ());
  interrupted = false;
  return line;
}

#ifdef HAS_READLINE
/** Duplicate a string
 * @param s string to be duplicated
 * @return  a copy of the string allocated with malloc ()
 */
inline static char*
dupstr (const char* s)
{
  size_t length = strlen (s) + 1;
  char* r = static_cast<char*>(malloc (length));
  if (r)
    memcpy (r, s, length);
  return r;
}

/** flag: is quoting desired? */
extern int rl_filename_completion_desired;
/** character to be appended to completed words (0 or ' ') */
extern int rl_completion_append_character;
/** Iterate through all file names starting with given text
 * @param text          text to be completed
 * @param state         flag: if state==0, start from the beginning
 * @return        a file name, or NULL if no match
 */
extern "C" char* filename_completion_function (const char* text, int state);

/** Iterate through all keywords starting with given text
 * @param text          text to be completed
 * @param state         flag: if state==0, start from the beginning
 * @return        a command name, or NULL if no match
 */
extern "C" char*
marde_keywords (const char* text, int state)
{
  /** Keywords of the language */
  static const char* keywords[] = {
    "model \"", "graph \"", "breadth", "depth", "strong", "path",
    "terminal", "components", "cd", "translator \"", "compiledir \"",
    "visual", "dump", "dumpgraph", "eval", "hide", "show",
    "succ", "pred", "go", "stats", "time", "help", "log",
    "function", "exit", "prompt", "union", "is", "until",
    "release", "subset", "intersect", "equals", "minus", "atom",
    "empty", "place \"", "true", "false", "undefined", "fatal",
    "cardinality", "min", "max"
  };

  /** Number of the last keyword searched */
  static unsigned i;
  /** Length of the string */
  static size_t length;

  if (!state) {
    i = 0;
    length = strlen (text);
  }
  else {
    assert (i <= (sizeof keywords) / sizeof *keywords);
    assert (length == strlen (text));
  }

  while (i < (sizeof keywords) / sizeof *keywords) {
    const char* name = keywords[i++];
    if (!strncmp (name, text, length)) {
      if (name[strlen (name) - 1] == '"')
      rl_completion_append_character = 0;
      return dupstr (name);
    }
  }

  return NULL;
}

/** Iterate through place names starting with given text
 * @param text          text to be completed
 * @param state         flag: if state==0, start from the beginning
 * @return        a place name, or NULL if no match
 */
extern "C" char*
marde_placenames (const char* text, int state)
{
  /** Number of the last place searched */
  static unsigned place;
  /** Length of the string */
  static size_t length;

  if (!state) {
    place = 0;
    length = strlen (text);
    rl_filename_completion_desired = 1;
  }
  else {
    assert (subnet && place <= subnet->getNumPlaces ());
    assert (length == strlen (text));
    assert (rl_filename_completion_desired);
  }

  if (!subnet)
    return NULL;

  while (place < subnet->getNumPlaces ())
    if (const class Place* p = subnet->getPlace (place++))
      if (!strncmp (p->getName (), text, length))
      return dupstr (p->getName ());

  return NULL;
}

/** Iterate through type names starting with given text
 * @param text          text to be completed
 * @param state         flag: if state==0, start from the beginning
 * @return        a type name, or NULL if no match
 */
extern "C" char*
marde_typenames (const char* text, int state)
{
  /** Last type searched */
  static Net::TypeMap::const_iterator type;
  /** Length of the string */
  static size_t length;

  if (!subnet)
    return NULL;

  if (!state) {
    type = subnet->beginTypename ();
    length = strlen (text);
    rl_filename_completion_desired = 1;
  }
  else {
    assert (length == strlen (text));
    assert (rl_filename_completion_desired);
  }

  while (type != subnet->endTypename ()) {
    const char* name = (type++)->first;
    if (!strncmp (name, text, length))
      return dupstr (name);
  }

  return NULL;
}

/** Iterate through other names starting with given text
 * @param text          text to be completed
 * @param state         flag: if state==0, start from the beginning
 * @return        a name
 */
extern "C" char*
marde_othernames (const char*, int)
{
  return NULL;
}

/** Completion function of readline
 * @param word          word to be completed
 * @param completer     the completion function
 */
extern "C" char **
completion_matches (const char* word,
                char* (*completer) (const char*, int));

/** Complete place or type names
 * @param word          word to be completed
 * @param start         start offset of the string to be completed
 * @param end           end offset of the string to be completed
 */
extern "C" char**
marde_completer (const char* word, int start, int end)
{
  /** The line gathered so far */
  extern char* rl_line_buffer;
  assert (start >= 0 && start <= end);
  assert (size_t (end - start) == strlen (word));
  assert (size_t (end) <= strlen (rl_line_buffer));
  rl_completion_append_character = ' ';

  if ((start >= 6 && !memcmp (&rl_line_buffer[start - 6], "place ", 6)) ||
      (start >= 7 && !memcmp (&rl_line_buffer[start - 7], "place \"", 7)))
    return completion_matches (word, marde_placenames);
  if ((start >= 3 && !memcmp (&rl_line_buffer[start - 3], "is ", 3)) ||
      (start >= 4 && !memcmp (&rl_line_buffer[start - 4], "is \"", 4)))
    return completion_matches (word, marde_typenames);
  if ((start >= 3 && !memcmp (&rl_line_buffer[start - 3], "cd ", 3)) ||
      (start >= 4 && (!memcmp (&rl_line_buffer[start - 4], "cd \"", 4) ||
                  !memcmp (&rl_line_buffer[start - 4], "log ", 4))) ||
      (start >= 5 && !memcmp (&rl_line_buffer[start - 5], "log \"", 5)) ||
      (start >= 6 && (!memcmp (&rl_line_buffer[start - 6], "model ", 6) ||
                  !memcmp (&rl_line_buffer[start - 6], "graph ", 6))) ||
      (start >= 7 && (!memcmp (&rl_line_buffer[start - 7], "model \"", 7) ||
                  !memcmp (&rl_line_buffer[start - 7], "graph \"", 7) ||
                  !memcmp (&rl_line_buffer[start - 7], "depth \"", 7))) ||
      (start >= 9 && (!memcmp (&rl_line_buffer[start - 9],
                         "breadth \"", 9))) ||
      (start >= 11 && (!memcmp (&rl_line_buffer[start - 11],
                        "translator ", 11) ||
                   !memcmp (&rl_line_buffer[start - 11],
                        "compiledir ", 11))) ||
      (start >= 12 && (!memcmp (&rl_line_buffer[start - 12],
                        "translator \"", 12) ||
                   !memcmp (&rl_line_buffer[start - 12],
                        "compiledir \"", 12))))
    return completion_matches (word, filename_completion_function);
  return completion_matches (word, marde_keywords);
}
#endif // HAS_READLINE

void
dereset ()
{
  command = true;
  delete[] currentParameters;
  currentParameters = 0;
  while (!functionStack.empty ()) functionStack.pop ();
  currentContextTransition = 0;
  currentType = currentContextType = 0;
  currentComponent = 0;
  while (!typeStack.empty ()) typeStack.pop ();
  emptyParsed = false;
  while (!structLevels.empty ()) structLevels.pop ();
  if (currentState == CARD_T_MAX) currentState = 0;
  delexreset ();
#ifdef HAS_READLINE
  init_cmdline ("marde", marde_completer, marde_othernames);
#endif // HAS_READLINE
}

static void
help (void)
{
  fputs ("Query language commands:\n"
       "\tmodel \"MODELNAME\"\n"
       "\tgraph \"GRAPHFILE\"\n"
       "\t(breadth|depth) [STATE]\n"
       "\t(breadth|depth) \"MODELNAME\"\n"
       "\tlsts [\"OUTFILE\"]\n"
       "\tunfold M?([lmpr](OUTFILE)?)?\n"
       "\thide [!][[place] PLACENAME (, [place] PLACENAME)*]\n"
       "\t[visual] [STATE] [eval] formula\n"
       "\t[visual] show [STATE]\n"
       "\t[visual] [show] COMP [expr]\n"
       "\t[visual] (succ|pred)[!] [STATE]\n"
       "\t[visual] (succ|pred) COMP\n"
       "\t[go] STATE\n"
       "\tstrong [STATE] [expr]\n"
       "\tterminal\n"
       "\t[visual] components\n"
       "\t[visual] path (STATE|COMP|expr) [STATE]\n"
       "\t[visual] path STATE (COMP|expr)\n"
       "\t[visual] [STATE] trans {transition-definition}\n"
       "\t[visual] dump[graph]\n"
       "\tsubnet [[(..|NAME|NUMBER)] (/ (..|NAME|NUMBER))*]\n"
       "\tstats\n"
       "\ttime\n"
       "\tcd \"DIRECTORY\"\n"
       "\ttranslator [\"COMMAND\"]\n"
       "\tcompiledir [\"DIRECTORY\"]\n"
       "\thelp\n"
       "\tfunction {function-definition}\n"
       "\tlog [\"LOGFILE\"]\n"
       "\tprompt ['c']\n"
       "\texit\n",
       stderr);
}

static void
go_subnet (void)
{
  if (!net) {
    if (!notloaded) {
      notloaded = true;
      deerror ("no model has been loaded");
    }
  }
  else if (!subnet && net)
    deerror ("no such net");
  else if (!modular)
    deerror ("modular analysis not specified");
  else {
    /** distance from the root net */
    unsigned moddepth;
    unsigned i;
    const class Net* n;
    for (moddepth = 0, n = subnet; (n = n->getParent ()); moddepth++);
    delete[] modulepath; modulepath = 0;
    if (moddepth) {
      /** array of module path components */
      *(modulepath = new unsigned[moddepth + 1]) = moddepth;
      for (n = subnet, i = moddepth + 1; --i; n = n->getParent ()) {
      const class Net* parent = n->getParent ();
      for (unsigned child = parent->getNumChildren (); child--; ) {
        if (&parent->getChild (child) == n) {
          modulepath[i] = child;
          goto found;
        }
      }
      assert (false);
      found:
      continue;
      }
      assert (n == net);
    }
    currentState = 0;
    return;
  }
  /* restore the previously selected subnet */
  subnet = const_cast<class Net*>(getSubnet ());
}

static const class Net*
getSubnet (void)
{
  const class Net* n = net;
  if (modulepath)
    for (unsigned i = 1; i <= *modulepath; i++)
      n = &n->getChild (modulepath[i]);
  return n;
}

static bool
isNet (void)
{
  assert (subnet == getSubnet ());
  if (net)
    return true;
  if (!notloaded) {
    notloaded = true;
    deerror ("no model has been loaded");
  }
  return false;
}

static void
printType (const class Type& type)
{
  if (const char* name = type.getName ())
    thePrinter.print (name);
  else
    type.display (thePrinter);
}

static void pushTypeContext (const class Type* type)
{
  StructLevel p (currentContextType, currentComponent);
  structLevels.push (p);
  StructLevel q (currentType, 0);
  structLevels.push (q);

  currentType = type;
  currentContextType = NULL, currentComponent = 0;
}

static void popTypeContext ()
{
  StructLevel p = structLevels.top ();
  structLevels.pop ();
  currentType = p.first;
  assert (!p.second);
  p = structLevels.top ();
  structLevels.pop ();
  currentContextType = p.first;
  currentComponent = p.second;
}

static const class VariableDefinition*
getParameter (char* name)
{
  for (unsigned i = 0; i < currentArity; i++) {
    if (!strcmp (currentParameters[i]->getName (), name))
      return currentParameters[i];
  }

  return NULL;
}

static void
addParameter (const class Type* type, char* name)
{
  if (!type || !name) {
    delete[] name;
    return;
  }

  if (getParameter (name)) {
    thePrinter.printRaw ("ignoring redefinition of parameter ");
    thePrinter.printQuoted (name);
    thePrinter.finish ();
    delete[] name;
    return;
  }

  if (dewarnings) {
    const char* shadow = 0;
    if (getConstant (name) || getConstantFunction (name))
      shadow = " shadows a constant";
    else if (subnet->getType (name))
      shadow = " shadows a type name";

    if (shadow) {
      thePrinter.printRaw ("Warning:parameter ");
      thePrinter.printQuoted (name);
      thePrinter.printRaw (shadow);
      thePrinter.finish ();
    }
  }

  class VariableDefinition** v =
    new class VariableDefinition*[currentArity + 1];
  assert (!currentArity || currentParameters);
  assert (currentArity || !currentParameters);

  memcpy (v, currentParameters, currentArity * sizeof *v);
  delete[] currentParameters;
  currentParameters = v;
  currentParameters[currentArity++] =
    new class VariableDefinition (name, *type, false);
}

static class Function*
getFunction (const char* name)
{
  if (!isNet ())
    return NULL;
  class Function* f = currentContextTransition
    ? currentContextTransition->getFunction (name)
    : NULL;
  return f ? f : subnet->getFunction (name);
}

static class Function*
getConstantFunction (const char* name)
{
  if (!isNet ())
    return NULL;
  class Function* f = currentContextTransition
    ? currentContextTransition->getFunction (name)
    : NULL;
  if (!f || f->getArity ())
    f = subnet->getFunction (name);
  return f && f->getArity () ? NULL : f;
}

static const class Constant*
getConstant (const char* name)
{
  if (!isNet ())
    return NULL;
  const class Constant* c = currentContextTransition
    ? currentContextTransition->getConstant (name)
    : NULL;
  return c ? c : subnet->getConstant (name);
}

static const class Expression*
getProposition (char* name)
{
  if (subnet)
    for (unsigned i = subnet->getNumProps (); i--; )
      if (!strcmp (subnet->getPropName (i), name))
      return &subnet->getProp (i);
  return 0;
}

static const class VariableDefinition*
getVariable (char* name)
{
  assert (name != NULL);

  const class VariableDefinition* v = getParameter (name);
  const class Function* f = getConstantFunction (name);
  const class Constant* c = getConstant (name);

  if (v || (v = currentVariables.find (name)))
    goto found;

  if (!currentTransition) {
    if (currentContextTransition &&
      (v = currentContextTransition->getVariable (name)));
    else if (!f && !c &&
           !(currentType && currentType->getKind () == Type::tEnum &&
             static_cast<const class EnumType*>(currentType)
             ->getValue (name)) &&
           !getProposition (name)) {
      thePrinter.printRaw ("undefined variable ");
      thePrinter.printQuoted (name);
      thePrinter.finish ();
    }
    delete[] name;
  }
  else if ((v = currentTransition->getVariable (name))) {
  found:
    delete[] name;
  }
  else if (f || c)
    delete[] name;
  else if (!currentType) {
    thePrinter.printRaw ("cannot determine the type of variable ");
    thePrinter.printQuoted (name);
    thePrinter.finish ();
    delete[] name;
  }
  else {
    assert (currentType != NULL);

    if (dewarnings && subnet->getType (name)) {
      thePrinter.printRaw ("Warning:variable ");
      thePrinter.printQuoted (name);
      thePrinter.printRaw (" shadows a type name");
      thePrinter.finish ();
    }

    if (currentType->getKind () != Type::tEnum ||
      !static_cast<const class EnumType*>(currentType)->getValue (name))
      v = &currentTransition->addVariable (name, *currentType, false, false);
    else
      delete[] name;
  }

  return v;
}

static class Expression*
resolveName (char* name)
{
  const class Constant* c = getConstant (name);
  class Function* f = getConstantFunction (name);
  const card_t*const i =
    (currentType && currentType->getKind () == Type::tEnum)
    ? static_cast<const class EnumType*>(currentType)->getValue (name)
    : NULL;
  const class Expression* prop = getProposition (name);

  if (const class VariableDefinition* d = getVariable (name))
    return static_cast<class Variable*>((new class Variable (*d))->cse ());
  else if (c)
    return (const_cast<class Constant*>(c)->copy ())->cse ();
  else if (class Expression* expr = f ? f->expand (NULL) : NULL)
    return fold (expr);
  if (i)
    return enumValue (*static_cast<const class EnumType*>(currentType), *i);
  if (prop)
    return (const_cast<class Expression*>(prop)->copy ())->cse ();

  return NULL;
}

static class Expression*
ensureSet (class Expression* expr,
         const class Type* type)
{
  return !expr || expr->isSet () ? expr : ensureMarking (expr, type);
}

static class Marking*
ensureMarking (class Expression* expr,
             const class Type* type)
{
  if (!expr)
    return NULL;
  else if (expr->getKind () == Expression::eUndefined) {
    deerror ("undefined marking expressions are not allowed");
    expr->destroy ();
    return NULL;
  }

  assert (expr->getType () || expr->getKind () == Expression::eEmptySet);

  if (expr->getKind () == Expression::eMarking)
    return static_cast<class Marking*>(expr);
  else if (expr->isSet () || expr->isBasic ()) {
    if (!type || makeCompatible (expr, *type)) {
      class Marking* m = new class Marking (NULL);
      m->setToken (expr);
      return m;
    }
    else
      return NULL;
  }
  else {
    deerror ("marking expression expected");
    expr->destroy ();
    return NULL;
  }
}

static class Expression*
noMarking (class Expression* expr)
{
  if (expr && expr->isSet ()) {
    deerror ("marking expression not allowed here");
    expr->destroy ();
    return NULL;
  }

  return expr;
}

static class Expression*
ensureExpr (class Expression* expr)
{
  expr = noMarking (expr);

  if (expr && !expr->isBasic ()) {
    deerror ("basic expression expected");
    expr->destroy (); return NULL;
  }

  return expr;
}

static class Expression*
ensureBool (class Expression* expr, bool undefined)
{
  expr = noMarking (expr);

  if (!expr)
    return NULL;

  if (expr->getKind () == Expression::eUndefined) {
    if (undefined)
      return expr;
    deerror ("undefined or fatal expression is not meaningful here");
    expr->destroy (); return NULL;
  }

  if (!expr->getType ()) {
    deerror ("expression has no type");
    expr->destroy (); return NULL;
  }

  if (expr->getType ()->getKind () != Type::tBool) {
    deerror ("boolean expression expected");
    expr->destroy (); return NULL;
  }

  return expr;
}

static class Expression*
ensureInt (class Expression* expr)
{
  expr = ensureExpr (expr);

  if (!expr)
    return NULL;

  if (!expr->getType ()) {
    deerror ("expression has no type");
    expr->destroy (); return NULL;
  }

  switch (expr->getType ()->getKind ()) {
  case Type::tInt:
    return expr;
  case Type::tEnum:
  case Type::tChar:
  case Type::tCard:
  case Type::tBool:
    if (!makeCompatible (expr, Net::getIntType (), true));
    else if (expr->getType () == &Net::getIntType ())
      return expr;
    /* fall through */
  default:
    deerror ("signed integer expression expected");
    expr->destroy ();
    return NULL;
  }
}

static class Expression*
ensureCard (class Expression* expr)
{
  expr = ensureExpr (expr);

  if (!expr)
    return NULL;

  if (!expr->getType ()) {
    deerror ("expression has no type");
    expr->destroy (); return NULL;
  }

  switch (expr->getType ()->getKind ()) {
  case Type::tCard:
    return expr;
  case Type::tEnum:
  case Type::tChar:
  case Type::tInt:
  case Type::tBool:
    if (!makeCompatible (expr, Net::getCardType (), true));
    else if (expr->getType () == &Net::getCardType ())
      return expr;
    /* fall through */
  default:
    deerror ("unsigned integer expression expected");
    expr->destroy ();
    return NULL;
  }
}

static class Expression*
ensureIntCard (class Expression* expr)
{
  expr = ensureExpr (expr);

  if (!expr)
    return NULL;

  if (!expr->getType ()) {
    deerror ("expression has no type");
    expr->destroy (); return NULL;
  }

  switch (expr->getType ()->getKind ()) {
  case Type::tCard:
  case Type::tInt:
    return expr;
  case Type::tEnum:
  case Type::tChar:
  case Type::tBool:
    if (!makeCompatible (expr, Net::getCardType (), true));
    else if (expr->getType () == &Net::getCardType () ||
           expr->getType () == &Net::getIntType ())
      return expr;
    /* fall through */
  default:
    deerror ("integer expression expected");
    expr->destroy ();
    return NULL;
  }
}

static class Expression*
ensureBuffer (class Expression* expr)
{
  expr = ensureExpr (expr);

  if (!expr)
    return NULL;

  if (!expr->getType ()) {
    deerror ("expression has no type");
    expr->destroy (); return NULL;
  }

  if (expr->getType ()->getKind () != Type::tBuffer) {
    deerror ("buffer expression expected");
    expr->destroy (); return NULL;
  }

  return expr;
}

static class Expression*
ensureOrdered (class Expression* expr)
{
  expr = ensureExpr (expr);

  if (!expr)
    return NULL;

  if (!expr->getType ()) {
    deerror ("expression has no type");
    expr->destroy (); return NULL;
  }

  if (!isOrdered (*expr->getType ())) {
    expr->destroy (); return NULL;
  }

  return expr;
}

static class Expression*
enumValue (const class EnumType& type, card_t value)
{
  class LeafValue* e = new class LeafValue (type, value);
  if (type.isConstrained (*e))
    return (new class Constant (*e))->cse ();
  else {
    thePrinter.printRaw ("enumeration constant ");
    if (const char* c = type.getEnumName (value)) {
      thePrinter.print (c);
      thePrinter.delimiter ('=');
    }
    thePrinter.print (value);
    thePrinter.printRaw (" out of range for type ");
    printType (type);
    thePrinter.finish ();
    delete e;
    return NULL;
  }
}

static class Expression*
namedComponent (char* name, class Expression* expr)
{
  if (!name) {
    expr->destroy ();
    return NULL;
  }

  if (!currentContextType || currentContextType->getKind () != Type::tStruct) {
    thePrinter.printRaw ("named component ");
    thePrinter.printQuoted (name);
    thePrinter.printRaw (" can only be used with a struct");
    thePrinter.finish ();
    expr->destroy ();
    delete[] name;
    return NULL;
  }

  const class StructType& type =
    static_cast<const class StructType&>(*currentContextType);

  if (currentComponent < type.getSize ()) {
    const char* comp = type.getComponentName (currentComponent);
    if (strcmp (name, comp)) {
      thePrinter.printRaw ("expecting named component ");
      thePrinter.printQuoted (comp);
      thePrinter.printRaw (" instead of ");
      thePrinter.printQuoted (name);
      thePrinter.finish ();
      expr->destroy ();
      delete[] name;
      return NULL;
    }
  }
  else {
    thePrinter.printRaw ("extraneous named component ");
    thePrinter.printQuoted (name);
    thePrinter.printRaw (" at end of struct");
    thePrinter.finish ();
    expr->destroy ();
    delete[] name;
    return NULL;
  }

  delete[] name;
  return expr;
}

static void
beginAny (const class Type*& type, char* name,
        bool hidden)
{
  if (type) {
    if (currentTransition) {
      if (name && currentTransition->getVariable (name)) {
      thePrinter.printRaw ("output variable ");
      thePrinter.printQuoted (name);
      thePrinter.printRaw (" shadows another variable");
      thePrinter.finish ();
      type = NULL; delete[] name;
      }
      else {
      if (name)
        currentTransition->addVariable (name, *type, true, hidden);
      card_t size = type->getNumValues ();
      if (!size || size == CARD_T_MAX || (maxRange && size > maxRange)) {
        thePrinter.printRaw ("type ");
        printType (*type);
        thePrinter.printRaw (" has too many (");
        thePrinter.print (size);
        thePrinter.printRaw (") values for non-determinism");
        if (size && size < CARD_T_MAX)
          thePrinter.printRaw (" (try -q0)");
        thePrinter.finish ();
      }
      }
    }
    else {
      deerror ("non-determinism is only allowed on output arcs");
      type = NULL; delete[] name;
    }
  }
  else
    delete[] name;

  pushTypeContext (type);
}

static class Variable*
endAny (const class Type* type,
      char* name,
      class Expression* condition)
{
  class Variable* var;
  popTypeContext ();

  if (type) {
    if (!condition || (condition = ensureBool (ensureExpr (condition)))) {
      var = static_cast<class Variable*>
      ((new class Variable
        (currentTransition->addOutputVariable
         (*type, name, condition)))->cse ());
      assert (var != NULL);
      if (dewarnings && condition) {
      class VariableSet vars;
      vars.insert (var->getVariable ());
      if (!condition->depends (vars, false)) {
        thePrinter.printRaw ("Warning:condition is independent of ");
        thePrinter.printQuoted (var->getVariable ().getName ());
        thePrinter.finish ();
        }
      }
    }
    else
      var = NULL, condition->destroy ();
  }
  else
    var = NULL, condition->destroy ();
  return var;
}

static void
beginQuantifier (char* name, const class Type* type)
{
  if (name && type) {
    if (dewarnings) {
      const char* shadow = 0;
      if (currentVariables.find (name))
        shadow = " shadows another quantifier";
      else if ((currentContextTransition &&
            currentContextTransition->getVariable (name)))
      shadow = " shadows a transition variable";
      else if (getConstant (name))
      shadow = " shadows a constant";
      else if (currentType && currentType->getKind () == Type::tEnum &&
             static_cast<const class EnumType*>(currentType)->
             getValue (name))
      shadow = " shadows an enumeration constant";
      else if (subnet->getType (name))
      shadow = " shadows a type name";

      if (shadow) {
      thePrinter.printRaw ("quantifier ");
      thePrinter.printQuoted (name);
      thePrinter.printRaw (shadow);
      thePrinter.finish ();
      }
    }

    card_t size = type->getNumValues ();
    if (!size || size == CARD_T_MAX || (maxRange && size > maxRange)) {
      thePrinter.printRaw ("type ");
      printType (*type);
      thePrinter.printRaw (" has too many (");
      thePrinter.print (size);
      thePrinter.printRaw (") values for quantification");
      if (size && size < CARD_T_MAX)
      thePrinter.printRaw (" (try -q0)");
      thePrinter.finish ();
    }
    currentVariables.push (new class VariableDefinition (name, *type, true));
  }

  struct TypeContext tc = {
    currentContextType,
    currentType,
    currentComponent
  };
  typeStack.push (tc);

  currentContextType = NULL;
  currentComponent = 0;
  currentType = type;
}

static void
continueQuantifier (ASSERT1 (const class Type* type))
{
  assert (!currentContextType);
  assert (currentType == type);
  assert (!typeStack.empty ());
  struct TypeContext tc = typeStack.top ();
  typeStack.pop ();

  currentContextType = tc.context;
  currentType = tc.component;
  currentComponent = tc.numComponent;
}

static class Expression*
endQuantifier (char* name,
             const class Type* type,
             class Expression* condition,
             unsigned kind,
             class Expression* expr)
{
  if (name && type && expr && kind) {
    class VariableDefinition* var = currentVariables.top ();
    currentVariables.pop ();

    card_t size = var->getType ().getNumValues ();
    if (!size || size == CARD_T_MAX || (maxRange && size > maxRange)) {
      condition->destroy ();
      expr->destroy ();
      delete var;
      return NULL;
    }

    if ((condition = ensureBool (ensureExpr (condition))) && dewarnings) {
      class VariableSet vars;
      vars.insert (*var);
      if (!condition->depends (vars, false)) {
      thePrinter.printRaw ("Warning:condition is independent of ");
      thePrinter.printQuoted (var->getName ());
      thePrinter.finish ();
      }
    }

    class Valuation v;
    switch (kind) {
    case 1:
      if (class Marking* m = ensureMarking (expr, currentType)) {
      expr = m->quantify (v, currentContextTransition,
                      *var, condition, false);
      m->destroy ();
      condition->destroy ();
      delete var;
      if (!expr) {
        if (check (v))
          deerror ("conflicting variables in quantification");
      }
      else
        assert (v.isOK ());
      return expr->cse ();
      }
      else
      expr = NULL;
      break;
    case 2:
    case 3:
      if ((expr = ensureBool (expr))) {
      class Expression* e =
        BooleanBinop::quantify (kind != 2,
                          *expr, v, currentContextTransition,
                          *var, condition, false);
      expr->destroy ();
      delete var;
      if (!e) {
        if (check (v))
          deerror ("conflicting variables in quantification");
      }
      else
        assert (v.isOK ());
      return e->cse ();
      }
      break;
    default:
      assert (false);
    }

    expr->destroy ();
    delete var;
    return NULL;
  }
  else {
    condition->destroy (), expr->destroy ();
    if (name && type) {
      class VariableDefinition* var = currentVariables.top ();
      currentVariables.pop ();
      delete var;
    }
    else
      delete[] name;
    return NULL;
  }
}

static class Expression*
quantifierVariable (char* prefix, char* quant, bool p)
{
  char delimiter = p ? ',' : '.';
  if (!prefix) {
    delete[] prefix;
    delete[] quant;
    return NULL;
  }
  class VariableDefinition* var;
  if (currentVariables.empty ())
    var = NULL;
  else if (quant)
    var = currentVariables.find (quant);
  else
    var = currentVariables.top ();

  if (!var) {
    thePrinter.delimiter (delimiter);
    thePrinter.print (prefix);
    if (quant) {
      thePrinter.printRaw (": quantifier ");
      thePrinter.print (quant);
      thePrinter.printRaw (" not found");
    }
    else
      thePrinter.printRaw (": no quantifier found");
    thePrinter.finish ();
  }
  else if (!var->isAggregate ()) {
    thePrinter.delimiter (delimiter);
    thePrinter.print (prefix);
    thePrinter.printRaw (": variable ");
    thePrinter.print (var->getName ());
    thePrinter.printRaw (" is not a quantifier");
    thePrinter.finish ();
  }
  else if (!currentContextTransition) {
    thePrinter.printRaw ("quantifier ");
    thePrinter.print (var->getName ());
    thePrinter.printRaw (": cannot define ");
    thePrinter.delimiter (delimiter);
    thePrinter.print (prefix);
    thePrinter.printRaw (" outside transition");
    thePrinter.finish ();
  }
  else if (!currentType) {
    if (const class VariableDefinition* qvar = var->findChild (prefix)) {
      delete[] quant;
      delete[] prefix;
      return (new class Variable (*qvar, p))->cse ();
    }
    else {
      thePrinter.printRaw ("quantifier ");
      thePrinter.print (var->getName ());
      thePrinter.printRaw (": cannot determine the type of ");
      thePrinter.delimiter (delimiter);
      thePrinter.print (prefix);
      thePrinter.finish ();
    }
  }
  else if (const class VariableDefinition* qvar =
         var->addChild (prefix, *currentType)) {
    delete[] quant;
    return (new class Variable (*qvar, p))->cse ();
  }
  else {
    thePrinter.printRaw ("quantifier ");
    thePrinter.print (var->getName ());
    thePrinter.printRaw (": contradictory type for ");
    thePrinter.delimiter (delimiter);
    thePrinter.print (prefix);
    thePrinter.finish ();
  }

  delete[] prefix;
  delete[] quant;
  return NULL;
}

static bool
makeCompatible (class Expression*& expr,
            const class Type& type,
            bool casting)
{
  if (!expr) return false;
  if (expr->getType () == &type ||
      expr->getKind () == Expression::eEmptySet)
    return true;
  assert (!!expr->getType ());
  const class Type& srcType = *expr->getType ();
  if (((Typecast::isCastable (type) &&
      Typecast::isCastable (srcType)) ||
       Type::isCompatible (srcType, type)) &&
      expr->isBasic () && !expr->isSet ()) {
    bool isConstant = expr->getKind () == Expression::eConstant;
    expr = (new class Typecast (type, *expr))->cse ();
    if (!casting && dewarnings &&
      ((!srcType.isAssignable (type) &&
        srcType.getKind () != Type::tCard &&
        srcType.getKind () != Type::tInt &&
        type.getKind () != Type::tCard &&
        type.getKind () != Type::tInt) ||
       (!isConstant && !srcType.isAlwaysAssignable (type)))) {
      thePrinter.printRaw ("Warning:implicit conversion from ");
      printType (srcType);
      thePrinter.printRaw (" to ");
      printType (type);
      thePrinter.finish ();
    }
    if (isConstant && !(expr = fold (expr))) {
      thePrinter.printRaw ("cannot convert constant from ");
      printType (srcType);
      thePrinter.printRaw (" to ");
      printType (type);
      thePrinter.finish ();
      return false;
    }
    return true;
  }
  else {
    thePrinter.printRaw ("cannot convert from ");
    printType (srcType);
    thePrinter.printRaw (" to ");
    printType (type);
    thePrinter.finish ();
    return false;
  }
}

static bool
isCompatible (class Expression*& expr,
            const class Type* type)
{
  if (!type) {
    deerror ("too many components for struct");
    return false;
  }

  if (!expr)
    return false;

  if (!expr->getType ()) {
    deerror ("expression has no type");
    return false;
  }

  return makeCompatible (expr, *type);
}

static bool
isCompatible (class Expression*& expr,
            const class StructExpression& s)
{
  const class Type* type = s.getNextType ();
  const char* structName = s.getType ()->getName ();

  if (!type) {
    if (structName) {
      thePrinter.printRaw ("too many components for struct ");
      thePrinter.printQuoted (structName);
    }
    else
      thePrinter.printRaw ("too many components for struct");
    thePrinter.finish ();
    return false;
  }

  const char* comp =
    static_cast<const class StructType*>(s.getType ())
    ->getComponentName (s.size ());

  if (!expr) {
    if (structName) {
      thePrinter.printRaw ("error in expression for struct ");
      thePrinter.printQuoted (structName);
      thePrinter.printRaw (" component ");
    }
    else
      thePrinter.printRaw ("error in expression for struct component ");
    thePrinter.printQuoted (comp);
    thePrinter.finish ();
    return false;
  }

  if (!expr->getType ()) {
    if (structName) {
      thePrinter.printRaw ("expression for struct ");
      thePrinter.printQuoted (structName);
      thePrinter.printRaw (" component ");
    }
    else
      thePrinter.printRaw ("expression for struct component ");
    thePrinter.printQuoted (comp);
    thePrinter.printRaw (" has no type");
    thePrinter.finish ();
    return false;
  }

  if (!makeCompatible (expr, *type))
    return false;

  if (!expr->getType ()->isAlwaysAssignable (*type)) {
    if (Type::isCompatible (*expr->getType (), *type))
      thePrinter.printRaw ("too broad type for struct ");
    else
      thePrinter.printRaw ("type mismatch for struct ");
    if (structName) {
      thePrinter.printQuoted (structName);
      thePrinter.printRaw (" component ");
    }
    else
      thePrinter.printRaw ("component ");
    thePrinter.printQuoted (comp);
    thePrinter.finish ();
    return false;
  }
  else if (expr->getType () != type)
    expr = (new class Typecast (*type, *expr))->cse ();

  return true;
}

static bool
isOrdered (const class Type& type)
{
  if (!type.isOrdered ()) {
    thePrinter.printRaw ("unordered type ");
    printType (type);
    thePrinter.finish ();
    return false;
  }

  return true;
}

static bool
check (const class Valuation& v)
{
  bool ok = true;

  switch (v.getError ()) {
  case errDiv0:
    ok = false, deerror ("division by zero"); break;
  case errOver:
    ok = false, deerror ("overflow"); break;
  case errMod:
    ok = false, deerror ("modulus error"); break;
  case errShift:
    ok = false, deerror ("shift error"); break;
  case errConst:
    ok = false, deerror ("constraint violation"); break;
  case errUnion:
    ok = false, deerror ("union violation"); break;
  case errBuf:
    ok = false, deerror ("buffer violation"); break;
  case errCard:
    ok = false, deerror ("cardinality overflow"); break;
  case errComp:
    assert (false);
  case errNone:
  case errVar:
  case errUndef:
  case errFatal:
    break;
  }

  return ok;
}

static class Expression*
fold (class Expression* expr)
{
  if (expr && expr->isBasic () &&
      expr->getKind () != Expression::eConstant) {
    class Valuation v;
    if (class Value* value = expr->eval (v)) {
      assert (v.isOK ());
      expr->destroy ();
      return (new class Constant (*value))->cse ();
    }
    else {
      if (!check (v)) {
      expr->destroy ();
      return NULL;
      }
      else {
      if (v.getError () == errFatal) {
        expr->destroy ();
        return (new class Undefined (Undefined::fFatalError))->cse ();
      }
      if (v.getError () == errUndef) {
        expr->destroy ();
        return (new class Undefined (Undefined::fError))->cse ();
      }

      assert (v.getError () == errVar);
      return expr->cse ();
      }
    }
  }
  else
    return expr->cse ();
}

static void
defun (const class Type* type,
       char* name,
       class Expression* expr)
{
  currentType = NULL;
  if (type && name && expr) {
    if (subnet->getFunction (name)) {
      thePrinter.printRaw ("ignoring redefinition of function ");
      thePrinter.printQuoted (name);
      thePrinter.finish ();
      delete[] name, expr->destroy ();
    }
    else if (isCompatible (expr, type)) {
      class Function* f =
      new class Function (name, currentArity, currentParameters, expr);
      subnet->addFunction (*f);

      if (dewarnings && subnet->getType (name)) {
      thePrinter.printRaw ("Warning:function ");
      thePrinter.printQuoted (name);
      thePrinter.printRaw (" shadows a type name");
      thePrinter.finish ();
      for (unsigned i = 0; i < currentArity; i++) {
        class VariableSet vars;
        vars.insert (*currentParameters[i]);
        if (!expr->depends (vars, false)) {
          thePrinter.printRaw ("Warning:function ");
          thePrinter.printQuoted (name);
          thePrinter.printRaw (" does not use parameter ");
          thePrinter.printQuoted (currentParameters[i]->getName ());
          thePrinter.finish ();
        }
      }
      }
    }
    else
      delete[] name, expr->destroy ();
  }
  else
    delete[] name, expr->destroy ();
  currentArity = 0, currentParameters = 0;
  emptyParsed = false;
}

static class Expression*
newRelopExpression (bool equal,
                class Expression* left,
                class Expression* right)
{
  left = ensureExpr (left); right = ensureExpr (right);
  if (!left || !right);
  else if (left->getType () != right->getType ()) {
    if (left->getKind () == Expression::eConstant &&
      makeCompatible (left, *right->getType ()))
      goto ok;
    if (right->getKind () == Expression::eConstant &&
      makeCompatible (right, *left->getType ()))
      goto ok;
    deerror ("expressions in comparison have different types");
  }
  else if (!left->getType ()->isOrdered () && !equal)
    deerror ("cannot compare expressions of unordered type");
  else {
  ok:
    return fold (RelopExpression::construct (equal, *left, *right));
  }

  left->destroy ();
  right->destroy ();
  return 0;
}

static class Expression*
newBinopExpression (enum BinopExpression::Op op,
                class Expression* left,
                class Expression* right)
{
  if (left && left->getType () &&
      left->getType ()->getKind () == Type::tVector) {
    bool shl = false;
    switch (op) {
    case BinopExpression::bRol:
      shl = true;
      break;
    case BinopExpression::bRor:
      shl = false;
      break;
    default:
      ensureIntCard (left)->destroy ();
      ensureIntCard (right)->destroy ();
      return NULL;
    }
    if ((left = ensureExpr (left)) && (right = ensureCard (right))) {
      size_t size =
      static_cast<const class VectorType*>(left->getType ())->getSize ();

      if (shl ||
        (right = fold (new class BinopExpression
                    (BinopExpression::bMinus,
                     *new class Constant (*new class LeafValue
                                    (Net::getCardType (),
                                     card_t (size))), *right)))) {
      if (right->getKind () == Expression::eConstant) {
        const class Value& v =
          static_cast<class Constant*>(right)->getValue ();
        assert (v.getKind () == Value::vLeaf);
        card_t amount = static_cast<const class LeafValue&>(v);
        if (!(amount %= size)) {
          right->destroy ();
          return left;
        }
      }
      return fold (new class VectorShift (*left, *right));
      }
    }
    left->destroy (), right->destroy ();
    return NULL;
  }

  left = ensureIntCard (left);
  right = ensureIntCard (right);
  if (!left || !right) {
    left->destroy (), right->destroy ();
    return NULL;
  }

  if (!(right = left->getType ()->getKind () == Type::tCard
      ? ensureCard (right) : ensureInt (right))) {
    left->destroy ();
    return NULL;
  }

  return fold (new class BinopExpression (op, *left, *right));
}

static class Expression*
newNotExpression (class Expression* expr)
{
  if ((expr = ensureBool (expr)))
    expr = fold (NotExpression::construct (*expr));
  return expr;
}

static class Expression*
newBooleanBinop (bool conj,
             class Expression* left,
             class Expression* right)
{
  assert (left && right);
  assert (left->getKind () == Expression::eUndefined ||
        (left->getType () && left->getType ()->getKind () == Type::tBool));
  assert (right->getKind () == Expression::eUndefined ||
        (right->getType () && right->getType ()->getKind () == Type::tBool));
  assert (left == left->cse ());
  assert (right == right->cse ());

  return (BooleanBinop::construct (conj, *left, *right))->cse ();
}

static class Expression*
newSetExpression (enum SetExpression::Op op,
              class Expression* left,
              class Expression* right)
{
  const class Type* type = 0;
  if (right && right->isSet ())
    type = right->getType ();
  else if (left && left->isSet ())
    type = left->getType ();
  left = ensureSet (left, type);
  right = ensureSet (right, type);
  if (!left || !right);
  else if (left->getType () == right->getType () ||
         left->getKind () == Expression::eEmptySet ||
         right->getKind () == Expression::eEmptySet)
    return SetExpression::construct (op, *left, *right);
  else
    deerror ("expressions have incompatible types");
  left->destroy (), right->destroy ();
  return NULL;
}

static class Expression*
newCardinalityExpression (enum CardinalityExpression::Op op,
                    class Expression* expr)
{
  if (class Expression* m = ensureSet (expr)) {
    if (m->getKind () == Expression::eEmptySet) {
      m->destroy ();
      dewarn ("the cardinality of an empty set is always zero");
      return (new class Constant (*new class LeafValue
                          (Net::getCardType (),
                           op == CardinalityExpression::cMin
                           ? CARD_T_MAX
                           : 0)))->cse ();
    }
    else
      return (new class CardinalityExpression (op, *m))->cse ();
  }
  else
    return NULL;
}

static class Expression*
newBufferUnop (enum BufferUnop::Op op, class Expression* expr)
{
  if (!(expr = ensureBuffer (expr)))
    return NULL;

  if (expr->getKind () == Expression::eBufferIndex) {
    class BufferIndex* b = static_cast<class BufferIndex*>(expr);
    class Expression* buffer = &b->getBuffer ();
    class Expression* i = &b->getIndex ();
    b->destroy ();
    switch (op) {
    case BufferUnop::bFree:
    case BufferUnop::bUsed:
      if (i) {
      dewarn ("ignoring meaningless buffer indexing expression");
      i->destroy (), i = NULL;
      }
      break;
    case BufferUnop::bPeek:
      break;
    }

    return fold (new class BufferUnop (op, *buffer, i));
  }

  return fold (new class BufferUnop (op, *expr, NULL));
}


Generated by  Doxygen 1.6.0   Back to index