/* A Bison parser, made by GNU Bison 3.8.2.  */

/* Bison implementation for Yacc-like parsers in C

   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 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 3 of the License, 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, see <https://www.gnu.org/licenses/>.  */

/* As a special exception, you may create a larger work that contains
   part or all of the Bison parser skeleton and distribute that work
   under terms of your choice, so long as that work isn't itself a
   parser generator using the skeleton or a modified version thereof
   as a parser skeleton.  Alternatively, if you modify or redistribute
   the parser skeleton itself, you may (at your option) remove this
   special exception, which will cause the skeleton and the resulting
   Bison output files to be licensed under the GNU General Public
   License without this special exception.

   This special exception was added by the Free Software Foundation in
   version 2.2 of Bison.  */

/* C LALR(1) parser skeleton written by Richard Stallman, by
   simplifying the original so-called "semantic" parser.  */

/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
   especially those whose name start with YY_ or yy_.  They are
   private implementation details that can be changed or removed.  */

/* 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, and Bison version.  */
#define YYBISON 30802

/* Bison version string.  */
#define YYBISON_VERSION "3.8.2"

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

/* Pure parsers.  */
#define YYPURE 0

/* Push parsers.  */
#define YYPUSH 0

/* Pull parsers.  */
#define YYPULL 1




/* First part of user prologue.  */
#line 1 "qa.y"

/*
 * Copyright (C) 2000-Thu 25 Jun 09:36:43 AEST 2020 
 * Department of Computer Science and Electrical Engineering, 
 * The University of Queensland
 */


#include <stdio.h>
#include <iostream>
#include <fstream>
#include <vector>

#include "asm_objects.h"
#include "asm_string_table.cc"
#include "code.h"
#include "code_block.h"
#include "errors.h"
#include "indexing.h"

const char *Program = "qa";

extern "C" int yylex();

int yyerror(const char *);

ASMStringTable *asm_string_table = NULL;

CodeBlock *query_code_block = NULL;
vector<CodeBlock *> *predicate_code_blocks = NULL;

CodeBlock *code_block = NULL;

LabelTable *labels = NULL;


#line 108 "qa.cc"

# ifndef YY_CAST
#  ifdef __cplusplus
#   define YY_CAST(Type, Val) static_cast<Type> (Val)
#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
#  else
#   define YY_CAST(Type, Val) ((Type) (Val))
#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
#  endif
# endif
# ifndef YY_NULLPTR
#  if defined __cplusplus
#   if 201103L <= __cplusplus
#    define YY_NULLPTR nullptr
#   else
#    define YY_NULLPTR 0
#   endif
#  else
#   define YY_NULLPTR ((void*)0)
#  endif
# endif


/* Debug traces.  */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif

/* Token kinds.  */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
  enum yytokentype
  {
    YYEMPTY = -2,
    YYEOF = 0,                     /* "end of file"  */
    YYerror = 256,                 /* error  */
    YYUNDEF = 257,                 /* "invalid token"  */
    put_x_variable = 258,          /* put_x_variable  */
    put_y_variable = 259,          /* put_y_variable  */
    put_x_value = 260,             /* put_x_value  */
    put_y_value = 261,             /* put_y_value  */
    put_constant = 262,            /* put_constant  */
    put_integer = 263,             /* put_integer  */
    put_double = 264,              /* put_double  */
    put_string = 265,              /* put_string  */
    put_list = 266,                /* put_list  */
    put_structure = 267,           /* put_structure  */
    put_x_object_variable = 268,   /* put_x_object_variable  */
    put_y_object_variable = 269,   /* put_y_object_variable  */
    put_x_object_value = 270,      /* put_x_object_value  */
    put_y_object_value = 271,      /* put_y_object_value  */
    put_quantifier = 272,          /* put_quantifier  */
    check_binder = 273,            /* check_binder  */
    put_substitution = 274,        /* put_substitution  */
    put_x_term_substitution = 275, /* put_x_term_substitution  */
    put_y_term_substitution = 276, /* put_y_term_substitution  */
    put_initial_empty_substitution = 277, /* put_initial_empty_substitution  */
    get_x_variable = 278,          /* get_x_variable  */
    get_y_variable = 279,          /* get_y_variable  */
    get_x_value = 280,             /* get_x_value  */
    get_y_value = 281,             /* get_y_value  */
    get_constant = 282,            /* get_constant  */
    get_integer = 283,             /* get_integer  */
    get_double = 284,              /* get_double  */
    get_string = 285,              /* get_string  */
    get_list = 286,                /* get_list  */
    get_structure = 287,           /* get_structure  */
    get_structure_frame = 288,     /* get_structure_frame  */
    get_x_object_variable = 289,   /* get_x_object_variable  */
    get_y_object_variable = 290,   /* get_y_object_variable  */
    get_x_object_value = 291,      /* get_x_object_value  */
    get_y_object_value = 292,      /* get_y_object_value  */
    unify_x_variable = 293,        /* unify_x_variable  */
    unify_y_variable = 294,        /* unify_y_variable  */
    unify_x_value = 295,           /* unify_x_value  */
    unify_y_value = 296,           /* unify_y_value  */
    unify_void = 297,              /* unify_void  */
    unify_constant = 298,          /* unify_constant  */
    unify_integer = 299,           /* unify_integer  */
    unify_double = 300,            /* unify_double  */
    unify_string = 301,            /* unify_string  */
    unify_x_ref = 302,             /* unify_x_ref  */
    unify_y_ref = 303,             /* unify_y_ref  */
    set_x_variable = 304,          /* set_x_variable  */
    set_y_variable = 305,          /* set_y_variable  */
    set_x_value = 306,             /* set_x_value  */
    set_y_value = 307,             /* set_y_value  */
    set_x_object_variable = 308,   /* set_x_object_variable  */
    set_y_object_variable = 309,   /* set_y_object_variable  */
    set_x_object_value = 310,      /* set_x_object_value  */
    set_y_object_value = 311,      /* set_y_object_value  */
    set_constant = 312,            /* set_constant  */
    set_integer = 313,             /* set_integer  */
    set_double = 314,              /* set_double  */
    set_string = 315,              /* set_string  */
    set_void = 316,                /* set_void  */
    set_object_void = 317,         /* set_object_void  */
    wam_allocate = 318,            /* wam_allocate  */
    wam_deallocate = 319,          /* wam_deallocate  */
    call_predicate = 320,          /* call_predicate  */
    call_address = 321,            /* call_address  */
    call_escape = 322,             /* call_escape  */
    execute_predicate = 323,       /* execute_predicate  */
    execute_address = 324,         /* execute_address  */
    execute_escape = 325,          /* execute_escape  */
    noop = 326,                    /* noop  */
    jump = 327,                    /* jump  */
    proceed = 328,                 /* proceed  */
    wam_fail = 329,                /* wam_fail  */
    halt = 330,                    /* halt  */
    wam_exit = 331,                /* wam_exit  */
    try_me_else = 332,             /* try_me_else  */
    retry_me_else = 333,           /* retry_me_else  */
    trust_me_else_fail = 334,      /* trust_me_else_fail  */
    wam_try = 335,                 /* wam_try  */
    retry = 336,                   /* retry  */
    trust = 337,                   /* trust  */
    neck_cut = 338,                /* neck_cut  */
    get_x_level = 339,             /* get_x_level  */
    get_y_level = 340,             /* get_y_level  */
    cut = 341,                     /* cut  */
    switch_on_term = 342,          /* switch_on_term  */
    switch_on_constant = 343,      /* switch_on_constant  */
    switch_on_structure = 344,     /* switch_on_structure  */
    switch_on_quantifier = 345,    /* switch_on_quantifier  */
    pseudo_instr0 = 346,           /* pseudo_instr0  */
    pseudo_instr1 = 347,           /* pseudo_instr1  */
    pseudo_instr2 = 348,           /* pseudo_instr2  */
    pseudo_instr3 = 349,           /* pseudo_instr3  */
    pseudo_instr4 = 350,           /* pseudo_instr4  */
    pseudo_instr5 = 351,           /* pseudo_instr5  */
    INTEGER_TOKEN = 352,           /* INTEGER_TOKEN  */
    DOUBLE_TOKEN = 353,            /* DOUBLE_TOKEN  */
    STRING_TOKEN = 354,            /* STRING_TOKEN  */
    ATOM_TOKEN = 355,              /* ATOM_TOKEN  */
    LABEL_TOKEN = 356,             /* LABEL_TOKEN  */
    END_TOKEN = 357                /* END_TOKEN  */
  };
  typedef enum yytokentype yytoken_kind_t;
#endif
/* Token kinds.  */
#define YYEMPTY -2
#define YYEOF 0
#define YYerror 256
#define YYUNDEF 257
#define put_x_variable 258
#define put_y_variable 259
#define put_x_value 260
#define put_y_value 261
#define put_constant 262
#define put_integer 263
#define put_double 264
#define put_string 265
#define put_list 266
#define put_structure 267
#define put_x_object_variable 268
#define put_y_object_variable 269
#define put_x_object_value 270
#define put_y_object_value 271
#define put_quantifier 272
#define check_binder 273
#define put_substitution 274
#define put_x_term_substitution 275
#define put_y_term_substitution 276
#define put_initial_empty_substitution 277
#define get_x_variable 278
#define get_y_variable 279
#define get_x_value 280
#define get_y_value 281
#define get_constant 282
#define get_integer 283
#define get_double 284
#define get_string 285
#define get_list 286
#define get_structure 287
#define get_structure_frame 288
#define get_x_object_variable 289
#define get_y_object_variable 290
#define get_x_object_value 291
#define get_y_object_value 292
#define unify_x_variable 293
#define unify_y_variable 294
#define unify_x_value 295
#define unify_y_value 296
#define unify_void 297
#define unify_constant 298
#define unify_integer 299
#define unify_double 300
#define unify_string 301
#define unify_x_ref 302
#define unify_y_ref 303
#define set_x_variable 304
#define set_y_variable 305
#define set_x_value 306
#define set_y_value 307
#define set_x_object_variable 308
#define set_y_object_variable 309
#define set_x_object_value 310
#define set_y_object_value 311
#define set_constant 312
#define set_integer 313
#define set_double 314
#define set_string 315
#define set_void 316
#define set_object_void 317
#define wam_allocate 318
#define wam_deallocate 319
#define call_predicate 320
#define call_address 321
#define call_escape 322
#define execute_predicate 323
#define execute_address 324
#define execute_escape 325
#define noop 326
#define jump 327
#define proceed 328
#define wam_fail 329
#define halt 330
#define wam_exit 331
#define try_me_else 332
#define retry_me_else 333
#define trust_me_else_fail 334
#define wam_try 335
#define retry 336
#define trust 337
#define neck_cut 338
#define get_x_level 339
#define get_y_level 340
#define cut 341
#define switch_on_term 342
#define switch_on_constant 343
#define switch_on_structure 344
#define switch_on_quantifier 345
#define pseudo_instr0 346
#define pseudo_instr1 347
#define pseudo_instr2 348
#define pseudo_instr3 349
#define pseudo_instr4 350
#define pseudo_instr5 351
#define INTEGER_TOKEN 352
#define DOUBLE_TOKEN 353
#define STRING_TOKEN 354
#define ATOM_TOKEN 355
#define LABEL_TOKEN 356
#define END_TOKEN 357

/* Value type.  */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 37 "qa.y"

  qint64 int_value;
  double double_value;

  string *label_name;
  string *atom_name;
  string *string_value;

  ASMLoc loc;

  ASMInt<Code::InstructionSizedType> *instruction;
  ASMInt<Code::ConstantSizedType> *constant;
  ASMDouble<double> *double_num;
  ASMInt<qint64> *int_num;
  ASMInt<Code::RegisterSizedType> *reg;
  ASMInt<Code::NumberSizedType> *number;
  ASMInt<Code::AddressSizedType> *address;
  ASMInt<Code::OffsetSizedType> *offset;
  ASMInt<Code::PredSizedType> *pred;
  ASMInt<Code::TableSizeSizedType> *table_size;

  vector<ConstantLabel *> *cl_list;
  ConstantLabel *cl;
  
  vector<AtomArityLabel *> *aal_list;
  AtomArityLabel *aal;

#line 390 "qa.cc"

};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif


extern YYSTYPE yylval;


int yyparse (void);



/* Symbol kind.  */
enum yysymbol_kind_t
{
  YYSYMBOL_YYEMPTY = -2,
  YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
  YYSYMBOL_YYerror = 1,                    /* error  */
  YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
  YYSYMBOL_put_x_variable = 3,             /* put_x_variable  */
  YYSYMBOL_put_y_variable = 4,             /* put_y_variable  */
  YYSYMBOL_put_x_value = 5,                /* put_x_value  */
  YYSYMBOL_put_y_value = 6,                /* put_y_value  */
  YYSYMBOL_put_constant = 7,               /* put_constant  */
  YYSYMBOL_put_integer = 8,                /* put_integer  */
  YYSYMBOL_put_double = 9,                 /* put_double  */
  YYSYMBOL_put_string = 10,                /* put_string  */
  YYSYMBOL_put_list = 11,                  /* put_list  */
  YYSYMBOL_put_structure = 12,             /* put_structure  */
  YYSYMBOL_put_x_object_variable = 13,     /* put_x_object_variable  */
  YYSYMBOL_put_y_object_variable = 14,     /* put_y_object_variable  */
  YYSYMBOL_put_x_object_value = 15,        /* put_x_object_value  */
  YYSYMBOL_put_y_object_value = 16,        /* put_y_object_value  */
  YYSYMBOL_put_quantifier = 17,            /* put_quantifier  */
  YYSYMBOL_check_binder = 18,              /* check_binder  */
  YYSYMBOL_put_substitution = 19,          /* put_substitution  */
  YYSYMBOL_put_x_term_substitution = 20,   /* put_x_term_substitution  */
  YYSYMBOL_put_y_term_substitution = 21,   /* put_y_term_substitution  */
  YYSYMBOL_put_initial_empty_substitution = 22, /* put_initial_empty_substitution  */
  YYSYMBOL_get_x_variable = 23,            /* get_x_variable  */
  YYSYMBOL_get_y_variable = 24,            /* get_y_variable  */
  YYSYMBOL_get_x_value = 25,               /* get_x_value  */
  YYSYMBOL_get_y_value = 26,               /* get_y_value  */
  YYSYMBOL_get_constant = 27,              /* get_constant  */
  YYSYMBOL_get_integer = 28,               /* get_integer  */
  YYSYMBOL_get_double = 29,                /* get_double  */
  YYSYMBOL_get_string = 30,                /* get_string  */
  YYSYMBOL_get_list = 31,                  /* get_list  */
  YYSYMBOL_get_structure = 32,             /* get_structure  */
  YYSYMBOL_get_structure_frame = 33,       /* get_structure_frame  */
  YYSYMBOL_get_x_object_variable = 34,     /* get_x_object_variable  */
  YYSYMBOL_get_y_object_variable = 35,     /* get_y_object_variable  */
  YYSYMBOL_get_x_object_value = 36,        /* get_x_object_value  */
  YYSYMBOL_get_y_object_value = 37,        /* get_y_object_value  */
  YYSYMBOL_unify_x_variable = 38,          /* unify_x_variable  */
  YYSYMBOL_unify_y_variable = 39,          /* unify_y_variable  */
  YYSYMBOL_unify_x_value = 40,             /* unify_x_value  */
  YYSYMBOL_unify_y_value = 41,             /* unify_y_value  */
  YYSYMBOL_unify_void = 42,                /* unify_void  */
  YYSYMBOL_unify_constant = 43,            /* unify_constant  */
  YYSYMBOL_unify_integer = 44,             /* unify_integer  */
  YYSYMBOL_unify_double = 45,              /* unify_double  */
  YYSYMBOL_unify_string = 46,              /* unify_string  */
  YYSYMBOL_unify_x_ref = 47,               /* unify_x_ref  */
  YYSYMBOL_unify_y_ref = 48,               /* unify_y_ref  */
  YYSYMBOL_set_x_variable = 49,            /* set_x_variable  */
  YYSYMBOL_set_y_variable = 50,            /* set_y_variable  */
  YYSYMBOL_set_x_value = 51,               /* set_x_value  */
  YYSYMBOL_set_y_value = 52,               /* set_y_value  */
  YYSYMBOL_set_x_object_variable = 53,     /* set_x_object_variable  */
  YYSYMBOL_set_y_object_variable = 54,     /* set_y_object_variable  */
  YYSYMBOL_set_x_object_value = 55,        /* set_x_object_value  */
  YYSYMBOL_set_y_object_value = 56,        /* set_y_object_value  */
  YYSYMBOL_set_constant = 57,              /* set_constant  */
  YYSYMBOL_set_integer = 58,               /* set_integer  */
  YYSYMBOL_set_double = 59,                /* set_double  */
  YYSYMBOL_set_string = 60,                /* set_string  */
  YYSYMBOL_set_void = 61,                  /* set_void  */
  YYSYMBOL_set_object_void = 62,           /* set_object_void  */
  YYSYMBOL_wam_allocate = 63,              /* wam_allocate  */
  YYSYMBOL_wam_deallocate = 64,            /* wam_deallocate  */
  YYSYMBOL_call_predicate = 65,            /* call_predicate  */
  YYSYMBOL_call_address = 66,              /* call_address  */
  YYSYMBOL_call_escape = 67,               /* call_escape  */
  YYSYMBOL_execute_predicate = 68,         /* execute_predicate  */
  YYSYMBOL_execute_address = 69,           /* execute_address  */
  YYSYMBOL_execute_escape = 70,            /* execute_escape  */
  YYSYMBOL_noop = 71,                      /* noop  */
  YYSYMBOL_jump = 72,                      /* jump  */
  YYSYMBOL_proceed = 73,                   /* proceed  */
  YYSYMBOL_wam_fail = 74,                  /* wam_fail  */
  YYSYMBOL_halt = 75,                      /* halt  */
  YYSYMBOL_wam_exit = 76,                  /* wam_exit  */
  YYSYMBOL_try_me_else = 77,               /* try_me_else  */
  YYSYMBOL_retry_me_else = 78,             /* retry_me_else  */
  YYSYMBOL_trust_me_else_fail = 79,        /* trust_me_else_fail  */
  YYSYMBOL_wam_try = 80,                   /* wam_try  */
  YYSYMBOL_retry = 81,                     /* retry  */
  YYSYMBOL_trust = 82,                     /* trust  */
  YYSYMBOL_neck_cut = 83,                  /* neck_cut  */
  YYSYMBOL_get_x_level = 84,               /* get_x_level  */
  YYSYMBOL_get_y_level = 85,               /* get_y_level  */
  YYSYMBOL_cut = 86,                       /* cut  */
  YYSYMBOL_switch_on_term = 87,            /* switch_on_term  */
  YYSYMBOL_switch_on_constant = 88,        /* switch_on_constant  */
  YYSYMBOL_switch_on_structure = 89,       /* switch_on_structure  */
  YYSYMBOL_switch_on_quantifier = 90,      /* switch_on_quantifier  */
  YYSYMBOL_pseudo_instr0 = 91,             /* pseudo_instr0  */
  YYSYMBOL_pseudo_instr1 = 92,             /* pseudo_instr1  */
  YYSYMBOL_pseudo_instr2 = 93,             /* pseudo_instr2  */
  YYSYMBOL_pseudo_instr3 = 94,             /* pseudo_instr3  */
  YYSYMBOL_pseudo_instr4 = 95,             /* pseudo_instr4  */
  YYSYMBOL_pseudo_instr5 = 96,             /* pseudo_instr5  */
  YYSYMBOL_INTEGER_TOKEN = 97,             /* INTEGER_TOKEN  */
  YYSYMBOL_DOUBLE_TOKEN = 98,              /* DOUBLE_TOKEN  */
  YYSYMBOL_STRING_TOKEN = 99,              /* STRING_TOKEN  */
  YYSYMBOL_ATOM_TOKEN = 100,               /* ATOM_TOKEN  */
  YYSYMBOL_LABEL_TOKEN = 101,              /* LABEL_TOKEN  */
  YYSYMBOL_END_TOKEN = 102,                /* END_TOKEN  */
  YYSYMBOL_103_ = 103,                     /* '/'  */
  YYSYMBOL_104_ = 104,                     /* ':'  */
  YYSYMBOL_105_ = 105,                     /* '('  */
  YYSYMBOL_106_ = 106,                     /* ')'  */
  YYSYMBOL_107_ = 107,                     /* ','  */
  YYSYMBOL_108_ = 108,                     /* '['  */
  YYSYMBOL_109_ = 109,                     /* ']'  */
  YYSYMBOL_110_ = 110,                     /* '+'  */
  YYSYMBOL_111_ = 111,                     /* '-'  */
  YYSYMBOL_YYACCEPT = 112,                 /* $accept  */
  YYSYMBOL_assembler_file = 113,           /* assembler_file  */
  YYSYMBOL_predicate_list = 114,           /* predicate_list  */
  YYSYMBOL_predicate = 115,                /* predicate  */
  YYSYMBOL_predicate_start = 116,          /* predicate_start  */
  YYSYMBOL_predicate_end = 117,            /* predicate_end  */
  YYSYMBOL_source_line_list = 118,         /* source_line_list  */
  YYSYMBOL_source_line = 119,              /* source_line  */
  YYSYMBOL_label_instance = 120,           /* label_instance  */
  YYSYMBOL_instr = 121,                    /* instr  */
  YYSYMBOL_constant_labels = 122,          /* constant_labels  */
  YYSYMBOL_constant_label_list = 123,      /* constant_label_list  */
  YYSYMBOL_constant_label = 124,           /* constant_label  */
  YYSYMBOL_atom_arity_labels = 125,        /* atom_arity_labels  */
  YYSYMBOL_atom_arity_label_list = 126,    /* atom_arity_label_list  */
  YYSYMBOL_atom_arity_label = 127,         /* atom_arity_label  */
  YYSYMBOL_quantifier_labels = 128,        /* quantifier_labels  */
  YYSYMBOL_quantifier_label_list = 129,    /* quantifier_label_list  */
  YYSYMBOL_quantifier_label = 130,         /* quantifier_label  */
  YYSYMBOL_switch_label = 131,             /* switch_label  */
  YYSYMBOL_constant = 132,                 /* constant  */
  YYSYMBOL_number = 133,                   /* number  */
  YYSYMBOL_int_num = 134,                  /* int_num  */
  YYSYMBOL_double_num = 135,               /* double_num  */
  YYSYMBOL_reg = 136,                      /* reg  */
  YYSYMBOL_address = 137,                  /* address  */
  YYSYMBOL_atom = 138,                     /* atom  */
  YYSYMBOL_table_size = 139                /* table_size  */
};
typedef enum yysymbol_kind_t yysymbol_kind_t;




#ifdef short
# undef short
#endif

/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
   <limits.h> and (if available) <stdint.h> are included
   so that the code can choose integer types of a good width.  */

#ifndef __PTRDIFF_MAX__
# include <limits.h> /* INFRINGES ON USER NAME SPACE */
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
#  define YY_STDINT_H
# endif
#endif

/* Narrow types that promote to a signed type and that can represent a
   signed or unsigned integer of at least N bits.  In tables they can
   save space and decrease cache pressure.  Promoting to a signed type
   helps avoid bugs in integer arithmetic.  */

#ifdef __INT_LEAST8_MAX__
typedef __INT_LEAST8_TYPE__ yytype_int8;
#elif defined YY_STDINT_H
typedef int_least8_t yytype_int8;
#else
typedef signed char yytype_int8;
#endif

#ifdef __INT_LEAST16_MAX__
typedef __INT_LEAST16_TYPE__ yytype_int16;
#elif defined YY_STDINT_H
typedef int_least16_t yytype_int16;
#else
typedef short yytype_int16;
#endif

/* Work around bug in HP-UX 11.23, which defines these macros
   incorrectly for preprocessor constants.  This workaround can likely
   be removed in 2023, as HPE has promised support for HP-UX 11.23
   (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
   <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>.  */
#ifdef __hpux
# undef UINT_LEAST8_MAX
# undef UINT_LEAST16_MAX
# define UINT_LEAST8_MAX 255
# define UINT_LEAST16_MAX 65535
#endif

#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
       && UINT_LEAST8_MAX <= INT_MAX)
typedef uint_least8_t yytype_uint8;
#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
typedef unsigned char yytype_uint8;
#else
typedef short yytype_uint8;
#endif

#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
typedef __UINT_LEAST16_TYPE__ yytype_uint16;
#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
       && UINT_LEAST16_MAX <= INT_MAX)
typedef uint_least16_t yytype_uint16;
#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
typedef unsigned short yytype_uint16;
#else
typedef int yytype_uint16;
#endif

#ifndef YYPTRDIFF_T
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
#  define YYPTRDIFF_T __PTRDIFF_TYPE__
#  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
# elif defined PTRDIFF_MAX
#  ifndef ptrdiff_t
#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  endif
#  define YYPTRDIFF_T ptrdiff_t
#  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
# else
#  define YYPTRDIFF_T long
#  define YYPTRDIFF_MAXIMUM LONG_MAX
# endif
#endif

#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
#  define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
#  define YYSIZE_T size_t
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# else
#  define YYSIZE_T unsigned
# endif
#endif

#define YYSIZE_MAXIMUM                                  \
  YY_CAST (YYPTRDIFF_T,                                 \
           (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
            ? YYPTRDIFF_MAXIMUM                         \
            : YY_CAST (YYSIZE_T, -1)))

#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))


/* Stored state numbers (used for stacks). */
typedef yytype_int16 yy_state_t;

/* State numbers in computations.  */
typedef int yy_state_fast_t;

#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
#  if ENABLE_NLS
#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
#  endif
# endif
# ifndef YY_
#  define YY_(Msgid) Msgid
# endif
#endif


#ifndef YY_ATTRIBUTE_PURE
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
# else
#  define YY_ATTRIBUTE_PURE
# endif
#endif

#ifndef YY_ATTRIBUTE_UNUSED
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
# else
#  define YY_ATTRIBUTE_UNUSED
# endif
#endif

/* Suppress unused-variable warnings by "using" E.  */
#if ! defined lint || defined __GNUC__
# define YY_USE(E) ((void) (E))
#else
# define YY_USE(E) /* empty */
#endif

/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
    _Pragma ("GCC diagnostic push")                                     \
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
# else
#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
    _Pragma ("GCC diagnostic push")                                     \
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# endif
# define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
    _Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif

#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
# define YY_IGNORE_USELESS_CAST_BEGIN                          \
    _Pragma ("GCC diagnostic push")                            \
    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
# define YY_IGNORE_USELESS_CAST_END            \
    _Pragma ("GCC diagnostic pop")
#endif
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
# define YY_IGNORE_USELESS_CAST_BEGIN
# define YY_IGNORE_USELESS_CAST_END
#endif


#define YY_ASSERT(E) ((void) (0 && (E)))

#if !defined yyoverflow

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

# ifdef YYSTACK_USE_ALLOCA
#  if YYSTACK_USE_ALLOCA
#   ifdef __GNUC__
#    define YYSTACK_ALLOC __builtin_alloca
#   elif defined __BUILTIN_VA_ARG_INCR
#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
#   elif defined _AIX
#    define YYSTACK_ALLOC __alloca
#   elif defined _MSC_VER
#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
#    define alloca _alloca
#   else
#    define YYSTACK_ALLOC alloca
#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
#     ifndef EXIT_SUCCESS
#      define EXIT_SUCCESS 0
#     endif
#    endif
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's 'empty if-body' warning.  */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
#  ifndef YYSTACK_ALLOC_MAXIMUM
    /* The OS might guarantee only one guard page at the bottom of the stack,
       and a page size can be as small as 4096 bytes.  So we cannot safely
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
       to allow for a few compiler-allocated temporary stack slots.  */
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
#  endif
# else
#  define YYSTACK_ALLOC YYMALLOC
#  define YYSTACK_FREE YYFREE
#  ifndef YYSTACK_ALLOC_MAXIMUM
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
#  endif
#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
       && ! ((defined YYMALLOC || defined malloc) \
             && (defined YYFREE || defined free)))
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#   ifndef EXIT_SUCCESS
#    define EXIT_SUCCESS 0
#   endif
#  endif
#  ifndef YYMALLOC
#   define YYMALLOC malloc
#   if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
#  ifndef YYFREE
#   define YYFREE free
#   if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
# endif
#endif /* !defined yyoverflow */

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

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  yy_state_t yyss_alloc;
  YYSTYPE yyvs_alloc;
};

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

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

# define YYCOPY_NEEDED 1

/* 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_alloc, Stack)                           \
    do                                                                  \
      {                                                                 \
        YYPTRDIFF_T yynewbytes;                                         \
        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
        Stack = &yyptr->Stack_alloc;                                    \
        yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
        yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
      }                                                                 \
    while (0)

#endif

#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from SRC to DST.  The source and destination do
   not overlap.  */
# ifndef YYCOPY
#  if defined __GNUC__ && 1 < __GNUC__
#   define YYCOPY(Dst, Src, Count) \
      __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
#  else
#   define YYCOPY(Dst, Src, Count)              \
      do                                        \
        {                                       \
          YYPTRDIFF_T yyi;                      \
          for (yyi = 0; yyi < (Count); yyi++)   \
            (Dst)[yyi] = (Src)[yyi];            \
        }                                       \
      while (0)
#  endif
# endif
#endif /* !YYCOPY_NEEDED */

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

/* YYNTOKENS -- Number of terminals.  */
#define YYNTOKENS  112
/* YYNNTS -- Number of nonterminals.  */
#define YYNNTS  28
/* YYNRULES -- Number of rules.  */
#define YYNRULES  138
/* YYNSTATES -- Number of states.  */
#define YYNSTATES  572

/* YYMAXUTOK -- Last valid token kind.  */
#define YYMAXUTOK   357


/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
   as returned by yylex, with out-of-bounds checking.  */
#define YYTRANSLATE(YYX)                                \
  (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
   ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
   : YYSYMBOL_YYUNDEF)

/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
   as returned by yylex.  */
static const yytype_int8 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,     2,     2,     2,     2,     2,     2,     2,
     105,   106,     2,   110,   107,   111,     2,   103,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,   104,     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,   108,     2,   109,     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,     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,     3,     4,
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
      45,    46,    47,    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,    93,    94,
      95,    96,    97,    98,    99,   100,   101,   102
};

#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
static const yytype_int16 yyrline[] =
{
       0,   204,   204,   207,   208,   211,   214,   245,   271,   272,
     275,   276,   279,   285,   292,   299,   306,   313,   320,   326,
     332,   344,   350,   357,   364,   371,   378,   385,   391,   397,
     404,   411,   418,   424,   431,   438,   445,   452,   459,   466,
     473,   485,   491,   499,   506,   513,   520,   527,   534,   540,
     546,   552,   558,   564,   570,   576,   587,   593,   599,   605,
     611,   617,   623,   629,   635,   641,   647,   653,   659,   665,
     671,   682,   688,   694,   700,   705,   713,   720,   727,   734,
     740,   746,   751,   757,   762,   767,   772,   777,   789,   799,
     804,   816,   826,   836,   841,   847,   853,   859,   883,   911,
     939,   967,   973,   980,   988,   997,  1007,  1021,  1024,  1030,
    1038,  1046,  1054,  1057,  1063,  1071,  1078,  1094,  1097,  1103,
    1111,  1119,  1133,  1134,  1144,  1151,  1156,  1161,  1168,  1175,
    1180,  1185,  1192,  1197,  1202,  1209,  1216,  1223,  1231
};
#endif

/** Accessing symbol of state STATE.  */
#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])

#if YYDEBUG || 0
/* The user-facing name of the symbol whose (internal) number is
   YYSYMBOL.  No bounds checking.  */
static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;

/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
static const char *const yytname[] =
{
  "\"end of file\"", "error", "\"invalid token\"", "put_x_variable",
  "put_y_variable", "put_x_value", "put_y_value", "put_constant",
  "put_integer", "put_double", "put_string", "put_list", "put_structure",
  "put_x_object_variable", "put_y_object_variable", "put_x_object_value",
  "put_y_object_value", "put_quantifier", "check_binder",
  "put_substitution", "put_x_term_substitution", "put_y_term_substitution",
  "put_initial_empty_substitution", "get_x_variable", "get_y_variable",
  "get_x_value", "get_y_value", "get_constant", "get_integer",
  "get_double", "get_string", "get_list", "get_structure",
  "get_structure_frame", "get_x_object_variable", "get_y_object_variable",
  "get_x_object_value", "get_y_object_value", "unify_x_variable",
  "unify_y_variable", "unify_x_value", "unify_y_value", "unify_void",
  "unify_constant", "unify_integer", "unify_double", "unify_string",
  "unify_x_ref", "unify_y_ref", "set_x_variable", "set_y_variable",
  "set_x_value", "set_y_value", "set_x_object_variable",
  "set_y_object_variable", "set_x_object_value", "set_y_object_value",
  "set_constant", "set_integer", "set_double", "set_string", "set_void",
  "set_object_void", "wam_allocate", "wam_deallocate", "call_predicate",
  "call_address", "call_escape", "execute_predicate", "execute_address",
  "execute_escape", "noop", "jump", "proceed", "wam_fail", "halt",
  "wam_exit", "try_me_else", "retry_me_else", "trust_me_else_fail",
  "wam_try", "retry", "trust", "neck_cut", "get_x_level", "get_y_level",
  "cut", "switch_on_term", "switch_on_constant", "switch_on_structure",
  "switch_on_quantifier", "pseudo_instr0", "pseudo_instr1",
  "pseudo_instr2", "pseudo_instr3", "pseudo_instr4", "pseudo_instr5",
  "INTEGER_TOKEN", "DOUBLE_TOKEN", "STRING_TOKEN", "ATOM_TOKEN",
  "LABEL_TOKEN", "END_TOKEN", "'/'", "':'", "'('", "')'", "','", "'['",
  "']'", "'+'", "'-'", "$accept", "assembler_file", "predicate_list",
  "predicate", "predicate_start", "predicate_end", "source_line_list",
  "source_line", "label_instance", "instr", "constant_labels",
  "constant_label_list", "constant_label", "atom_arity_labels",
  "atom_arity_label_list", "atom_arity_label", "quantifier_labels",
  "quantifier_label_list", "quantifier_label", "switch_label", "constant",
  "number", "int_num", "double_num", "reg", "address", "atom",
  "table_size", YY_NULLPTR
};

static const char *
yysymbol_name (yysymbol_kind_t yysymbol)
{
  return yytname[yysymbol];
}
#endif

#define YYPACT_NINF (-421)

#define yypact_value_is_default(Yyn) \
  ((Yyn) == YYPACT_NINF)

#define YYTABLE_NINF (-1)

#define yytable_value_is_error(Yyn) \
  0

/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
   STATE-NUM.  */
static const yytype_int16 yypact[] =
{
    -421,     3,   -92,  -421,  -421,  -421,  -421,   -88,   490,   -69,
     -67,   -45,   -44,   -42,   -41,   -38,   -37,   -36,   -26,   -20,
     -19,   -12,   -11,   -10,    -5,    -1,     0,     1,     2,     6,
       8,     9,    10,    11,    12,    14,    16,    17,    18,    19,
      20,    21,    22,    23,    31,    32,    34,    35,    36,    37,
      38,    39,    40,    41,    44,    45,    46,    47,    48,    49,
      50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
      60,  -421,    61,    62,    63,    64,    65,    66,  -421,    67,
    -421,  -421,  -421,  -421,    68,    69,  -421,    70,    71,    72,
    -421,    73,    74,    75,    76,    77,    78,    79,    80,    81,
      86,    87,    89,    90,    93,    96,  -421,  -421,  -421,  -421,
    -421,    94,   110,   110,   110,   110,   -13,   -55,   -28,   109,
     110,   -69,   110,   110,   110,   110,   110,   110,   -69,   110,
     110,   110,   110,   110,   110,   110,   -13,   -55,   -28,   113,
     110,   -13,   -69,   110,   110,   110,   110,   110,   110,   110,
     110,   -69,   -13,   -55,   -28,   122,   110,   110,   110,   110,
     110,   110,   110,   110,   110,   110,   -13,   -55,   -28,   123,
     -69,   -69,   -69,   -92,   131,   131,   -92,   131,   131,   131,
     -69,   128,   -69,   129,   130,   110,   110,   110,   110,   110,
     110,   110,   -69,   -69,   -69,   -69,   -69,   -69,  -421,   -92,
    -421,  -421,   125,   126,   127,   132,  -421,  -421,   138,   139,
     133,  -421,   140,   141,   134,  -421,   144,   145,   137,   142,
     146,   143,   147,   148,   149,   150,   152,   153,   154,   155,
     156,   158,   159,   160,   161,   162,   163,   164,   165,   172,
     174,   175,   176,   177,   178,   179,   180,   182,   183,   184,
     185,   186,   187,   188,   189,   190,   191,   192,   193,   194,
     195,   196,   197,   198,   203,   204,   205,   206,   207,   208,
     209,   210,   211,   212,  -421,   213,   214,   215,   217,   218,
     219,   220,   222,   224,   223,   226,   227,   228,   229,   230,
     231,   232,   233,   235,   236,   237,   238,   239,   240,   157,
     110,   110,   110,   110,  -421,  -421,   110,  -421,  -421,   110,
    -421,  -421,   110,   110,  -421,   110,   110,   110,   110,   110,
    -421,  -421,   110,   110,   110,  -421,   110,   110,   110,   110,
     110,   110,   110,   110,  -421,   -69,   110,   110,   110,   110,
     110,  -421,  -421,  -421,  -421,  -421,  -421,  -421,  -421,  -421,
    -421,  -421,  -421,  -421,  -421,  -421,  -421,  -421,  -421,  -421,
    -421,  -421,  -421,  -421,  -421,  -421,  -421,   -69,   -69,   -69,
     -69,  -421,  -421,  -421,   225,  -421,   241,  -421,  -421,  -421,
    -421,  -421,   -95,   151,   151,   151,  -421,   110,   110,   110,
     110,   110,   -69,   242,   243,   244,   245,   246,   248,   249,
     250,   251,   252,   253,   254,   255,   256,   257,   258,   259,
     260,   261,   262,   263,   268,   269,   270,   271,   273,   274,
     275,   276,   277,   278,   280,   281,   282,   283,   284,  -421,
    -421,   285,  -421,   289,   290,   291,   293,   294,   295,   296,
     297,   299,  -421,  -421,  -421,  -421,  -421,  -421,  -421,  -421,
    -421,  -421,  -421,  -421,  -421,  -421,  -421,  -421,  -421,  -421,
    -421,  -421,  -421,  -421,  -421,  -421,   110,  -421,  -421,  -421,
    -421,  -421,   -69,  -421,  -421,  -421,  -421,  -421,   -95,   173,
     292,   298,  -421,   110,   110,   110,   110,   287,   301,   305,
     306,   312,   314,   315,   310,   311,   313,   316,  -421,  -421,
    -421,   -95,   317,   318,   320,  -421,   110,   110,   110,   319,
     -95,   -95,   -95,   321,   322,   323,   -95,   324,   325,   327,
    -421,   110,   110,   328,   -13,   136,   336,   308,   337,   329,
     333,   334,   -95,   335,  -421,   339,   338,   342,   340,  -421,
     343,   345,   344,  -421,   346,  -421,   110,   347,   -13,   -95,
    -421,   -69,   336,  -421,   -69,   337,  -421,   349,   -95,  -421,
    -421,   352,  -421,   353,  -421,  -421,   354,   -95,   -95,  -421,
    -421,  -421
};

/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
   Performed when YYTABLE does not specify something else to do.  Zero
   means the default is an error.  */
static const yytype_uint8 yydefact[] =
{
       3,     0,     2,     1,   137,     4,     8,     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,     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,    74,     0,     0,     0,     0,     0,     0,    81,     0,
      83,    84,    85,    86,     0,     0,    89,     0,     0,     0,
      93,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     5,     9,    10,    11,
     128,     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,     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,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,    12,     0,
       6,   135,     0,     0,     0,     0,   125,   124,     0,     0,
       0,   129,     0,     0,     0,   132,     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,     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,   136,     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,   126,   127,     0,   130,   131,     0,
     133,   134,     0,     0,    21,     0,     0,     0,     0,     0,
      27,    28,     0,     0,     0,    32,     0,     0,     0,     0,
       0,     0,     0,     0,    41,     0,     0,     0,     0,     0,
       0,    48,    49,    50,    51,    56,    52,    53,    54,    55,
      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
      67,    68,    69,    70,    71,    72,    73,     0,     0,     0,
       0,    79,    80,    82,     0,    88,     0,    91,    92,    94,
      95,    96,     0,     0,     0,     0,   101,     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,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,   123,
     122,     0,   138,     0,     0,     0,     0,     0,     0,     0,
       0,     0,    13,    14,    15,    16,    17,    18,    19,    20,
      22,    23,    24,    25,    26,    29,    30,    31,    33,    34,
      35,    36,    37,    38,    39,    40,     0,    43,    44,    45,
      46,    47,     0,    76,    77,    78,    87,    90,     0,     0,
       0,     0,   102,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     7,    42,
      75,     0,     0,     0,     0,   103,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,   107,   112,   117,
     104,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,   108,   109,     0,     0,     0,   113,   114,
       0,     0,   118,   119,     0,   105,     0,     0,     0,     0,
      98,     0,     0,    99,     0,     0,   100,     0,     0,   110,
     111,     0,   115,     0,   120,   106,     0,     0,     0,    97,
     116,   121
};

/* YYPGOTO[NTERM-NUM].  */
static const yytype_int16 yypgoto[] =
{
    -421,  -421,  -421,  -421,  -421,  -421,  -421,  -421,  -421,  -421,
    -421,  -421,  -302,  -421,  -421,  -305,  -421,  -421,  -304,  -420,
    -112,   -62,  -114,   -97,  -113,   -76,  -111,  -359
};

/* YYDEFGOTO[NTERM-NUM].  */
static const yytype_int16 yydefgoto[] =
{
       0,     1,     2,     5,     6,   106,     8,   107,   108,   109,
     525,   533,   534,   527,   538,   539,   529,   542,   543,   431,
     535,   111,   214,   218,   202,   275,     7,   433
};

/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
   positive, shift that token.  If negative, reduce the rule whose
   number is the opposite.  If YYTABLE_NINF, syntax error.  */
static const yytype_int16 yytable[] =
{
     203,   204,   205,     3,   210,   429,   430,   220,     4,   222,
     223,   224,   225,   226,   227,     9,   229,   230,   231,   232,
     233,   234,   235,   237,   236,   434,   435,   240,   110,   241,
     243,   244,   245,   246,   247,   248,   249,   250,   112,   253,
     252,   238,   211,   256,   257,   258,   259,   260,   261,   262,
     263,   264,   265,   267,   266,   212,   213,   254,   490,   221,
     113,   114,   273,   115,   116,   277,   228,   117,   118,   119,
     215,   268,   286,   287,   288,   289,   290,   291,   292,   120,
     242,   509,   216,   217,   206,   121,   122,   207,   299,   251,
     517,   518,   519,   123,   124,   125,   523,   208,   209,   276,
     126,   278,   279,   280,   127,   128,   129,   130,   270,   271,
     272,   131,   547,   132,   133,   134,   135,   136,   281,   137,
     283,   138,   139,   140,   141,   142,   143,   144,   145,   560,
     293,   294,   295,   296,   297,   298,   146,   147,   566,   148,
     149,   150,   151,   152,   153,   154,   155,   570,   571,   156,
     157,   158,   159,   160,   161,   162,   163,   164,   165,   166,
     167,   168,   169,   170,   171,   172,   173,   174,   175,   176,
     177,   178,   179,   180,   181,   182,   183,   184,   185,   186,
     187,   188,   189,   190,   191,   192,   193,   393,   394,   395,
     396,   194,   195,   397,   196,   197,   398,   198,   200,   399,
     400,   199,   401,   402,   403,   404,   405,   201,   219,   406,
     407,   408,   239,   409,   410,   411,   412,   413,   414,   415,
     416,   255,   269,   418,   419,   420,   421,   422,   274,   282,
     284,   285,   300,   301,   302,   304,   305,   307,   308,   303,
     306,   309,   310,   311,   312,   536,   559,   562,   432,   313,
     315,   564,   314,     0,   316,   317,   318,   319,   320,   321,
     392,   322,   323,   324,   325,     0,   326,   327,   328,   329,
     330,   331,   332,   417,   436,   437,   438,   439,   440,   333,
     334,   491,   335,   336,   337,   338,   339,   340,   341,   342,
     343,   344,   345,   346,   347,   348,   349,   350,   351,   352,
     353,   354,   355,   356,   357,   423,   424,   425,   426,   358,
     359,   360,   361,   362,   363,   364,   365,   366,     0,   367,
     368,   369,   370,   371,   372,   373,   427,   374,   375,   377,
     441,   376,   378,   379,   380,   381,     0,   382,   383,   384,
     385,   386,   428,   387,   388,   389,   390,   391,   442,   443,
     444,   445,   446,   488,   447,   448,   449,   450,   451,   452,
     453,   454,   455,   456,   457,   458,   459,   460,   461,   462,
     494,   495,   496,   497,   463,   464,   465,     0,   466,   467,
     468,   469,   470,   471,     0,   472,   473,   474,   475,   476,
     477,   498,   478,   513,   514,   515,   479,   480,   481,   482,
     492,   483,   484,   485,   486,   487,   493,   499,   530,   531,
     489,   500,   502,   501,   503,   504,   505,   540,   506,     0,
     507,   510,   511,   508,   512,     0,   516,   520,     0,   521,
     522,   524,   526,   557,   528,   532,   537,   541,   544,   545,
       0,   546,   548,   549,   550,   551,     0,   552,   554,   553,
       0,   555,   556,     0,   558,   565,   567,   568,     0,     0,
     569,     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,   561,
       0,     0,   563,    10,    11,    12,    13,    14,    15,    16,
      17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
      27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
      37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
      47,    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,    93,    94,    95,    96,
      97,    98,    99,   100,   101,   102,   103,     0,     0,     0,
       0,   104,   105
};

static const yytype_int16 yycheck[] =
{
     113,   114,   115,     0,   116,   100,   101,   120,   100,   122,
     123,   124,   125,   126,   127,   103,   129,   130,   131,   132,
     133,   134,   135,   137,   136,   384,   385,   140,    97,   141,
     143,   144,   145,   146,   147,   148,   149,   150,   105,   153,
     152,   138,    97,   156,   157,   158,   159,   160,   161,   162,
     163,   164,   165,   167,   166,   110,   111,   154,   478,   121,
     105,   105,   173,   105,   105,   176,   128,   105,   105,   105,
      98,   168,   185,   186,   187,   188,   189,   190,   191,   105,
     142,   501,   110,   111,    97,   105,   105,   100,   199,   151,
     510,   511,   512,   105,   105,   105,   516,   110,   111,   175,
     105,   177,   178,   179,   105,   105,   105,   105,   170,   171,
     172,   105,   532,   105,   105,   105,   105,   105,   180,   105,
     182,   105,   105,   105,   105,   105,   105,   105,   105,   549,
     192,   193,   194,   195,   196,   197,   105,   105,   558,   105,
     105,   105,   105,   105,   105,   105,   105,   567,   568,   105,
     105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
     105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
     105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
     105,   105,   105,   105,   105,   105,   105,   300,   301,   302,
     303,   105,   105,   306,   105,   105,   309,   104,   104,   312,
     313,   105,   315,   316,   317,   318,   319,    97,    99,   322,
     323,   324,    99,   326,   327,   328,   329,   330,   331,   332,
     333,    99,    99,   336,   337,   338,   339,   340,    97,   101,
     101,   101,   107,   107,   107,    97,    97,    97,    97,   107,
     107,   107,    98,    98,   107,   109,   548,   552,    97,   107,
     107,   555,   106,    -1,   107,   107,   107,   107,   106,   106,
     103,   107,   107,   107,   106,    -1,   107,   107,   107,   107,
     107,   107,   107,   335,   387,   388,   389,   390,   391,   107,
     106,   108,   107,   107,   107,   107,   107,   107,   106,   106,
     106,   106,   106,   106,   106,   106,   106,   106,   106,   106,
     106,   106,   106,   106,   106,   367,   368,   369,   370,   106,
     106,   106,   106,   106,   106,   106,   106,   106,    -1,   107,
     107,   107,   107,   106,   106,   106,   101,   107,   106,   106,
     392,   107,   106,   106,   106,   106,    -1,   107,   107,   107,
     107,   106,   101,   107,   107,   107,   107,   107,   106,   106,
     106,   106,   106,   466,   106,   106,   106,   106,   106,   106,
     106,   106,   106,   106,   106,   106,   106,   106,   106,   106,
     483,   484,   485,   486,   106,   106,   106,    -1,   107,   106,
     106,   106,   106,   106,    -1,   107,   106,   106,   106,   106,
     106,   104,   107,   506,   507,   508,   107,   107,   107,   106,
     108,   107,   107,   107,   107,   106,   108,   106,   521,   522,
     472,   106,   100,   107,   100,   100,   106,   109,   107,    -1,
     107,   104,   104,   107,   104,    -1,   107,   106,    -1,   107,
     107,   107,   107,   546,   107,   107,   100,   100,   109,   106,
      -1,   107,   107,   104,   106,   103,    -1,   107,   103,   106,
      -1,   107,   106,    -1,   107,   106,   104,   104,    -1,    -1,
     106,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   551,
      -1,    -1,   554,     3,     4,     5,     6,     7,     8,     9,
      10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
      20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
      40,    41,    42,    43,    44,    45,    46,    47,    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,    93,    94,    95,    96,    -1,    -1,    -1,
      -1,   101,   102
};

/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
   state STATE-NUM.  */
static const yytype_uint8 yystos[] =
{
       0,   113,   114,     0,   100,   115,   116,   138,   118,   103,
       3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
      33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
      43,    44,    45,    46,    47,    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,
      93,    94,    95,    96,   101,   102,   117,   119,   120,   121,
      97,   133,   105,   105,   105,   105,   105,   105,   105,   105,
     105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
     105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
     105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
     105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
     105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
     105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
     105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
     105,   105,   105,   105,   105,   105,   105,   105,   104,   105,
     104,    97,   136,   136,   136,   136,    97,   100,   110,   111,
     132,    97,   110,   111,   134,    98,   110,   111,   135,    99,
     136,   133,   136,   136,   136,   136,   136,   136,   133,   136,
     136,   136,   136,   136,   136,   136,   132,   134,   135,    99,
     136,   132,   133,   136,   136,   136,   136,   136,   136,   136,
     136,   133,   132,   134,   135,    99,   136,   136,   136,   136,
     136,   136,   136,   136,   136,   136,   132,   134,   135,    99,
     133,   133,   133,   138,    97,   137,   137,   138,   137,   137,
     137,   133,   101,   133,   101,   101,   136,   136,   136,   136,
     136,   136,   136,   133,   133,   133,   133,   133,   133,   138,
     107,   107,   107,   107,    97,    97,   107,    97,    97,   107,
      98,    98,   107,   107,   106,   107,   107,   107,   107,   107,
     106,   106,   107,   107,   107,   106,   107,   107,   107,   107,
     107,   107,   107,   107,   106,   107,   107,   107,   107,   107,
     107,   106,   106,   106,   106,   106,   106,   106,   106,   106,
     106,   106,   106,   106,   106,   106,   106,   106,   106,   106,
     106,   106,   106,   106,   106,   106,   106,   107,   107,   107,
     107,   106,   106,   106,   107,   106,   107,   106,   106,   106,
     106,   106,   107,   107,   107,   107,   106,   107,   107,   107,
     107,   107,   103,   136,   136,   136,   136,   136,   136,   136,
     136,   136,   136,   136,   136,   136,   136,   136,   136,   136,
     136,   136,   136,   136,   136,   136,   136,   133,   136,   136,
     136,   136,   136,   133,   133,   133,   133,   101,   101,   100,
     101,   131,    97,   139,   139,   139,   136,   136,   136,   136,
     136,   133,   106,   106,   106,   106,   106,   106,   106,   106,
     106,   106,   106,   106,   106,   106,   106,   106,   106,   106,
     106,   106,   106,   106,   106,   106,   107,   106,   106,   106,
     106,   106,   107,   106,   106,   106,   106,   106,   107,   107,
     107,   107,   106,   107,   107,   107,   107,   106,   136,   133,
     131,   108,   108,   108,   136,   136,   136,   136,   104,   106,
     106,   107,   100,   100,   100,   106,   107,   107,   107,   131,
     104,   104,   104,   136,   136,   136,   107,   131,   131,   131,
     106,   107,   107,   131,   107,   122,   107,   125,   107,   128,
     136,   136,   107,   123,   124,   132,   109,   100,   126,   127,
     109,   100,   129,   130,   109,   106,   107,   131,   107,   104,
     106,   103,   107,   106,   103,   107,   106,   136,   107,   124,
     131,   133,   127,   133,   130,   106,   131,   104,   104,   106,
     131,   131
};

/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.  */
static const yytype_uint8 yyr1[] =
{
       0,   112,   113,   114,   114,   115,   116,   117,   118,   118,
     119,   119,   120,   121,   121,   121,   121,   121,   121,   121,
     121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
     121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
     121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
     121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
     121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
     121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
     121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
     121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
     121,   121,   121,   121,   121,   121,   121,   122,   122,   123,
     123,   124,   125,   125,   126,   126,   127,   128,   128,   129,
     129,   130,   131,   131,   132,   132,   132,   132,   133,   134,
     134,   134,   135,   135,   135,   136,   137,   138,   139
};

/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.  */
static const yytype_int8 yyr2[] =
{
       0,     2,     1,     0,     2,     3,     4,     7,     0,     2,
       1,     1,     2,     6,     6,     6,     6,     6,     6,     6,
       6,     4,     6,     6,     6,     6,     6,     4,     4,     6,
       6,     6,     4,     6,     6,     6,     6,     6,     6,     6,
       6,     4,     8,     6,     6,     6,     6,     6,     4,     4,
       4,     4,     4,     4,     4,     4,     4,     4,     4,     4,
       4,     4,     4,     4,     4,     4,     4,     4,     4,     4,
       4,     4,     4,     4,     1,     8,     6,     6,     6,     4,
       4,     1,     4,     1,     1,     1,     1,     6,     4,     1,
       6,     4,     4,     1,     4,     4,     4,    16,    13,    13,
      13,     4,     6,     8,    10,    12,    14,     0,     2,     1,
       3,     3,     0,     2,     1,     3,     5,     0,     2,     1,
       3,     5,     1,     1,     1,     1,     2,     2,     1,     1,
       2,     2,     1,     2,     2,     1,     1,     1,     1
};


enum { YYENOMEM = -2 };

#define yyerrok         (yyerrstatus = 0)
#define yyclearin       (yychar = YYEMPTY)

#define YYACCEPT        goto yyacceptlab
#define YYABORT         goto yyabortlab
#define YYERROR         goto yyerrorlab
#define YYNOMEM         goto yyexhaustedlab


#define YYRECOVERING()  (!!yyerrstatus)

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

/* Backward compatibility with an undocumented macro.
   Use YYerror or YYUNDEF. */
#define YYERRCODE YYUNDEF


/* 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 YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
do {                                                                      \
  if (yydebug)                                                            \
    {                                                                     \
      YYFPRINTF (stderr, "%s ", Title);                                   \
      yy_symbol_print (stderr,                                            \
                  Kind, Value); \
      YYFPRINTF (stderr, "\n");                                           \
    }                                                                     \
} while (0)


/*-----------------------------------.
| Print this symbol's value on YYO.  |
`-----------------------------------*/

static void
yy_symbol_value_print (FILE *yyo,
                       yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
{
  FILE *yyoutput = yyo;
  YY_USE (yyoutput);
  if (!yyvaluep)
    return;
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  YY_USE (yykind);
  YY_IGNORE_MAYBE_UNINITIALIZED_END
}


/*---------------------------.
| Print this symbol on YYO.  |
`---------------------------*/

static void
yy_symbol_print (FILE *yyo,
                 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
{
  YYFPRINTF (yyo, "%s %s (",
             yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));

  yy_symbol_value_print (yyo, yykind, yyvaluep);
  YYFPRINTF (yyo, ")");
}

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

static void
yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
{
  YYFPRINTF (stderr, "Stack now");
  for (; yybottom <= yytop; yybottom++)
    {
      int yybot = *yybottom;
      YYFPRINTF (stderr, " %d", yybot);
    }
  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.  |
`------------------------------------------------*/

static void
yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
                 int yyrule)
{
  int yylno = yyrline[yyrule];
  int yynrhs = yyr2[yyrule];
  int yyi;
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
             yyrule - 1, yylno);
  /* The symbols being reduced.  */
  for (yyi = 0; yyi < yynrhs; yyi++)
    {
      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
      yy_symbol_print (stderr,
                       YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
                       &yyvsp[(yyi + 1) - (yynrhs)]);
      YYFPRINTF (stderr, "\n");
    }
}

# define YY_REDUCE_PRINT(Rule)          \
do {                                    \
  if (yydebug)                          \
    yy_reduce_print (yyssp, yyvsp, 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) ((void) 0)
# define YY_SYMBOL_PRINT(Title, Kind, 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
   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
   evaluated with infinite-precision integer arithmetic.  */

#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif






/*-----------------------------------------------.
| Release the memory associated to this symbol.  |
`-----------------------------------------------*/

static void
yydestruct (const char *yymsg,
            yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
{
  YY_USE (yyvaluep);
  if (!yymsg)
    yymsg = "Deleting";
  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);

  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  YY_USE (yykind);
  YY_IGNORE_MAYBE_UNINITIALIZED_END
}


/* Lookahead token kind.  */
int yychar;

/* The semantic value of the lookahead symbol.  */
YYSTYPE yylval;
/* Number of syntax errors so far.  */
int yynerrs;




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

int
yyparse (void)
{
    yy_state_fast_t yystate = 0;
    /* Number of tokens to shift before error messages enabled.  */
    int yyerrstatus = 0;

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

    /* Their size.  */
    YYPTRDIFF_T yystacksize = YYINITDEPTH;

    /* The state stack: array, bottom, top.  */
    yy_state_t yyssa[YYINITDEPTH];
    yy_state_t *yyss = yyssa;
    yy_state_t *yyssp = yyss;

    /* The semantic value stack: array, bottom, top.  */
    YYSTYPE yyvsa[YYINITDEPTH];
    YYSTYPE *yyvs = yyvsa;
    YYSTYPE *yyvsp = yyvs;

  int yyn;
  /* The return value of yyparse.  */
  int yyresult;
  /* Lookahead symbol kind.  */
  yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;



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

  /* The number of symbols on the RHS of the reduced rule.
     Keep to zero when no symbol should be popped.  */
  int yylen = 0;

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

  yychar = YYEMPTY; /* Cause a token to be read.  */

  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 -- set current state (the top of the stack) to yystate.  |
`--------------------------------------------------------------------*/
yysetstate:
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
  YY_IGNORE_USELESS_CAST_BEGIN
  *yyssp = YY_CAST (yy_state_t, yystate);
  YY_IGNORE_USELESS_CAST_END
  YY_STACK_PRINT (yyss, yyssp);

  if (yyss + yystacksize - 1 <= yyssp)
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
    YYNOMEM;
#else
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYPTRDIFF_T yysize = yyssp - yyss + 1;

# if defined 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.  */
        yy_state_t *yyss1 = yyss;
        YYSTYPE *yyvs1 = yyvs;

        /* 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 (YY_("memory exhausted"),
                    &yyss1, yysize * YYSIZEOF (*yyssp),
                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
                    &yystacksize);
        yyss = yyss1;
        yyvs = yyvs1;
      }
# else /* defined YYSTACK_RELOCATE */
      /* Extend the stack our own way.  */
      if (YYMAXDEPTH <= yystacksize)
        YYNOMEM;
      yystacksize *= 2;
      if (YYMAXDEPTH < yystacksize)
        yystacksize = YYMAXDEPTH;

      {
        yy_state_t *yyss1 = yyss;
        union yyalloc *yyptr =
          YY_CAST (union yyalloc *,
                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
        if (! yyptr)
          YYNOMEM;
        YYSTACK_RELOCATE (yyss_alloc, yyss);
        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
#  undef YYSTACK_RELOCATE
        if (yyss1 != yyssa)
          YYSTACK_FREE (yyss1);
      }
# endif

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

      YY_IGNORE_USELESS_CAST_BEGIN
      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
                  YY_CAST (long, yystacksize)));
      YY_IGNORE_USELESS_CAST_END

      if (yyss + yystacksize - 1 <= yyssp)
        YYABORT;
    }
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */


  if (yystate == YYFINAL)
    YYACCEPT;

  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.  */

  /* First try to decide what to do without reference to lookahead token.  */
  yyn = yypact[yystate];
  if (yypact_value_is_default (yyn))
    goto yydefault;

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

  /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token\n"));
      yychar = yylex ();
    }

  if (yychar <= YYEOF)
    {
      yychar = YYEOF;
      yytoken = YYSYMBOL_YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else if (yychar == YYerror)
    {
      /* The scanner already issued an error message, process directly
         to error recovery.  But do not keep the error token as
         lookahead, it is too special and may lead us to an endless
         loop in error recovery. */
      yychar = YYUNDEF;
      yytoken = YYSYMBOL_YYerror;
      goto yyerrlab1;
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YY_SYMBOL_PRINT ("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 (yytable_value_is_error (yyn))
        goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

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

  /* Shift the lookahead token.  */
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  yystate = yyn;
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  *++yyvsp = yylval;
  YY_IGNORE_MAYBE_UNINITIALIZED_END

  /* Discard the shifted token.  */
  yychar = YYEMPTY;
  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 6: /* predicate_start: atom '/' number ':'  */
#line 215 "qa.y"
                {
		  labels = new LabelTable;

		  // Is it the query code block?
		  if ((*asm_string_table)[(yyvsp[-3].constant)->Value()] == "$query" &&
		      (yyvsp[-1].number)->Value() == 0)
		    {
		      if (query_code_block != NULL)
			{
			  Fatal(__FUNCTION__, 
				"more than one query code block");
			}
		      query_code_block = new CodeBlock(QUERY_BLOCK,
						       (yyvsp[-3].constant)->Value(),
						       (yyvsp[-1].number)->Value());

		      code_block = query_code_block;
		    }
		  else
		    {
		      code_block = new CodeBlock(PREDICATE_BLOCK,
						 (yyvsp[-3].constant)->Value(),
						 (yyvsp[-1].number)->Value());
		    }

		  delete (yyvsp[-3].constant);
		  delete (yyvsp[-1].number);
		}
#line 1896 "qa.cc"
    break;

  case 7: /* predicate_end: END_TOKEN '(' atom '/' number ')' ':'  */
#line 246 "qa.y"
                {
		  if ((yyvsp[-4].constant)->Value() != code_block->Atom() ||
		      (u_int)((yyvsp[-2].number)->Value()) != code_block->Arity())
		    {
		      Fatal(__FUNCTION__, 
			    "atom or arity mismatch in predicate");
		    }

		  delete (yyvsp[-4].constant);
		  delete (yyvsp[-2].number);

		  // Resolve all the fail label references
		  labels->ResolveFail(*code_block);

		  if (code_block->Type() == PREDICATE_BLOCK)
		    {
		      predicate_code_blocks->push_back(code_block);
		    }
		  
		  // Make it difficult to reuse the label table
		  delete labels;
		  labels = NULL;
		}
#line 1924 "qa.cc"
    break;

  case 12: /* label_instance: LABEL_TOKEN ':'  */
#line 280 "qa.y"
                {
		  labels->Resolve(*(yyvsp[-1].label_name), *code_block);
		}
#line 1932 "qa.cc"
    break;

  case 13: /* instr: put_x_variable '(' reg ',' reg ')'  */
#line 286 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 1942 "qa.cc"
    break;

  case 14: /* instr: put_y_variable '(' reg ',' reg ')'  */
#line 293 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 1952 "qa.cc"
    break;

  case 15: /* instr: put_x_value '(' reg ',' reg ')'  */
#line 300 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 1962 "qa.cc"
    break;

  case 16: /* instr: put_y_value '(' reg ',' reg ')'  */
#line 307 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 1972 "qa.cc"
    break;

  case 17: /* instr: put_constant '(' constant ',' reg ')'  */
#line 314 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].constant)->Put(*code_block); delete (yyvsp[-3].constant);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 1982 "qa.cc"
    break;

  case 18: /* instr: put_integer '(' int_num ',' reg ')'  */
#line 321 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].int_num)->Put(*code_block); delete (yyvsp[-3].int_num);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 1992 "qa.cc"
    break;

  case 19: /* instr: put_double '(' double_num ',' reg ')'  */
#line 327 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].double_num)->Put(*code_block); delete (yyvsp[-3].double_num);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2002 "qa.cc"
    break;

  case 20: /* instr: put_string '(' STRING_TOKEN ',' reg ')'  */
#line 333 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		  string* buff = (yyvsp[-3].string_value);
		  for (string::iterator iter = buff->begin();
		       iter != buff->end(); iter++)
		    code_block->Put(*iter);
		  code_block->Put('\0');
		  delete (yyvsp[-3].string_value);
		}
#line 2017 "qa.cc"
    break;

  case 21: /* instr: put_list '(' reg ')'  */
#line 345 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2026 "qa.cc"
    break;

  case 22: /* instr: put_structure '(' number ',' reg ')'  */
#line 351 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].number)->Put(*code_block); delete (yyvsp[-3].number);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2036 "qa.cc"
    break;

  case 23: /* instr: put_x_object_variable '(' reg ',' reg ')'  */
#line 358 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2046 "qa.cc"
    break;

  case 24: /* instr: put_y_object_variable '(' reg ',' reg ')'  */
#line 365 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2056 "qa.cc"
    break;

  case 25: /* instr: put_x_object_value '(' reg ',' reg ')'  */
#line 372 "qa.y"
                 {
		   (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		   (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		   (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		 }
#line 2066 "qa.cc"
    break;

  case 26: /* instr: put_y_object_value '(' reg ',' reg ')'  */
#line 379 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2076 "qa.cc"
    break;

  case 27: /* instr: put_quantifier '(' reg ')'  */
#line 386 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2085 "qa.cc"
    break;

  case 28: /* instr: check_binder '(' reg ')'  */
#line 392 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2094 "qa.cc"
    break;

  case 29: /* instr: put_substitution '(' number ',' reg ')'  */
#line 398 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].number)->Put(*code_block); delete (yyvsp[-3].number);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2104 "qa.cc"
    break;

  case 30: /* instr: put_x_term_substitution '(' reg ',' reg ')'  */
#line 405 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2114 "qa.cc"
    break;

  case 31: /* instr: put_y_term_substitution '(' reg ',' reg ')'  */
#line 412 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2124 "qa.cc"
    break;

  case 32: /* instr: put_initial_empty_substitution '(' reg ')'  */
#line 419 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2133 "qa.cc"
    break;

  case 33: /* instr: get_x_variable '(' reg ',' reg ')'  */
#line 425 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2143 "qa.cc"
    break;

  case 34: /* instr: get_y_variable '(' reg ',' reg ')'  */
#line 432 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2153 "qa.cc"
    break;

  case 35: /* instr: get_x_value '(' reg ',' reg ')'  */
#line 439 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2163 "qa.cc"
    break;

  case 36: /* instr: get_y_value '(' reg ',' reg ')'  */
#line 446 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2173 "qa.cc"
    break;

  case 37: /* instr: get_constant '(' constant ',' reg ')'  */
#line 453 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].constant)->Put(*code_block); delete (yyvsp[-3].constant);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2183 "qa.cc"
    break;

  case 38: /* instr: get_integer '(' int_num ',' reg ')'  */
#line 460 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].int_num)->Put(*code_block); delete (yyvsp[-3].int_num);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2193 "qa.cc"
    break;

  case 39: /* instr: get_double '(' double_num ',' reg ')'  */
#line 467 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].double_num)->Put(*code_block); delete (yyvsp[-3].double_num);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2203 "qa.cc"
    break;

  case 40: /* instr: get_string '(' STRING_TOKEN ',' reg ')'  */
#line 474 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		  string* buff = (yyvsp[-3].string_value);
		  for (string::iterator iter = buff->begin();
		       iter != buff->end(); iter++)
		    code_block->Put(*iter);
		  code_block->Put('\0');
		  delete (yyvsp[-3].string_value);
		}
#line 2218 "qa.cc"
    break;

  case 41: /* instr: get_list '(' reg ')'  */
#line 486 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2227 "qa.cc"
    break;

  case 42: /* instr: get_structure '(' constant ',' number ',' reg ')'  */
#line 492 "qa.y"
                {
		  (yyvsp[-7].instruction)->Put(*code_block); delete (yyvsp[-7].instruction);
		  (yyvsp[-5].constant)->Put(*code_block); delete (yyvsp[-5].constant);
		  (yyvsp[-3].number)->Put(*code_block); delete (yyvsp[-3].number);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2238 "qa.cc"
    break;

  case 43: /* instr: get_structure_frame '(' number ',' reg ')'  */
#line 500 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].number)->Put(*code_block); delete (yyvsp[-3].number);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2248 "qa.cc"
    break;

  case 44: /* instr: get_x_object_variable '(' reg ',' reg ')'  */
#line 507 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2258 "qa.cc"
    break;

  case 45: /* instr: get_y_object_variable '(' reg ',' reg ')'  */
#line 514 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2268 "qa.cc"
    break;

  case 46: /* instr: get_x_object_value '(' reg ',' reg ')'  */
#line 521 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2278 "qa.cc"
    break;

  case 47: /* instr: get_y_object_value '(' reg ',' reg ')'  */
#line 528 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2288 "qa.cc"
    break;

  case 48: /* instr: unify_x_variable '(' reg ')'  */
#line 535 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
        	}
#line 2297 "qa.cc"
    break;

  case 49: /* instr: unify_y_variable '(' reg ')'  */
#line 541 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
        	}
#line 2306 "qa.cc"
    break;

  case 50: /* instr: unify_x_value '(' reg ')'  */
#line 547 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
        	}
#line 2315 "qa.cc"
    break;

  case 51: /* instr: unify_y_value '(' reg ')'  */
#line 553 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
        	}
#line 2324 "qa.cc"
    break;

  case 52: /* instr: unify_constant '(' constant ')'  */
#line 559 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].constant)->Put(*code_block); delete (yyvsp[-1].constant);
		}
#line 2333 "qa.cc"
    break;

  case 53: /* instr: unify_integer '(' int_num ')'  */
#line 565 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].int_num)->Put(*code_block); delete (yyvsp[-1].int_num);
		}
#line 2342 "qa.cc"
    break;

  case 54: /* instr: unify_double '(' double_num ')'  */
#line 571 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].double_num)->Put(*code_block); delete (yyvsp[-1].double_num);
		}
#line 2351 "qa.cc"
    break;

  case 55: /* instr: unify_string '(' STRING_TOKEN ')'  */
#line 577 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  string* buff = (yyvsp[-1].string_value);
		  for (string::iterator iter = buff->begin();
		       iter != buff->end(); iter++)
		    code_block->Put(*iter);
		  code_block->Put('\0');
		  delete (yyvsp[-1].string_value);
		}
#line 2365 "qa.cc"
    break;

  case 56: /* instr: unify_void '(' number ')'  */
#line 588 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].number)->Put(*code_block); delete (yyvsp[-1].number);
	        }
#line 2374 "qa.cc"
    break;

  case 57: /* instr: unify_x_ref '(' reg ')'  */
#line 594 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
        	}
#line 2383 "qa.cc"
    break;

  case 58: /* instr: unify_y_ref '(' reg ')'  */
#line 600 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
        	}
#line 2392 "qa.cc"
    break;

  case 59: /* instr: set_x_variable '(' reg ')'  */
#line 606 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
        	}
#line 2401 "qa.cc"
    break;

  case 60: /* instr: set_y_variable '(' reg ')'  */
#line 612 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
	        }
#line 2410 "qa.cc"
    break;

  case 61: /* instr: set_x_value '(' reg ')'  */
#line 618 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
        	}
#line 2419 "qa.cc"
    break;

  case 62: /* instr: set_y_value '(' reg ')'  */
#line 624 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
        	}
#line 2428 "qa.cc"
    break;

  case 63: /* instr: set_x_object_variable '(' reg ')'  */
#line 630 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
        	}
#line 2437 "qa.cc"
    break;

  case 64: /* instr: set_y_object_variable '(' reg ')'  */
#line 636 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
        	}
#line 2446 "qa.cc"
    break;

  case 65: /* instr: set_x_object_value '(' reg ')'  */
#line 642 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
        	}
#line 2455 "qa.cc"
    break;

  case 66: /* instr: set_y_object_value '(' reg ')'  */
#line 648 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
	        }
#line 2464 "qa.cc"
    break;

  case 67: /* instr: set_constant '(' constant ')'  */
#line 654 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].constant)->Put(*code_block); delete (yyvsp[-1].constant);
		}
#line 2473 "qa.cc"
    break;

  case 68: /* instr: set_integer '(' int_num ')'  */
#line 660 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].int_num)->Put(*code_block); delete (yyvsp[-1].int_num);
		}
#line 2482 "qa.cc"
    break;

  case 69: /* instr: set_double '(' double_num ')'  */
#line 666 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].double_num)->Put(*code_block); delete (yyvsp[-1].double_num);
		}
#line 2491 "qa.cc"
    break;

  case 70: /* instr: set_string '(' STRING_TOKEN ')'  */
#line 672 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  string* buff = (yyvsp[-1].string_value);
		  for (string::iterator iter = buff->begin();
		       iter != buff->end(); iter++)
		    code_block->Put(*iter);
		  code_block->Put('\0');
		  delete (yyvsp[-1].string_value);
		}
#line 2505 "qa.cc"
    break;

  case 71: /* instr: set_void '(' number ')'  */
#line 683 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].number)->Put(*code_block); delete (yyvsp[-1].number);
		}
#line 2514 "qa.cc"
    break;

  case 72: /* instr: set_object_void '(' number ')'  */
#line 689 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].number)->Put(*code_block); delete (yyvsp[-1].number);
		}
#line 2523 "qa.cc"
    break;

  case 73: /* instr: wam_allocate '(' number ')'  */
#line 695 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].number)->Put(*code_block); delete (yyvsp[-1].number);
		}
#line 2532 "qa.cc"
    break;

  case 74: /* instr: wam_deallocate  */
#line 701 "qa.y"
                {
		  (yyvsp[0].instruction)->Put(*code_block); delete (yyvsp[0].instruction);
		}
#line 2540 "qa.cc"
    break;

  case 75: /* instr: call_predicate '(' atom ',' number ',' number ')'  */
#line 706 "qa.y"
                {
		  (yyvsp[-7].instruction)->Put(*code_block); delete (yyvsp[-7].instruction);
		  (yyvsp[-5].constant)->Put(*code_block); delete (yyvsp[-5].constant);
		  (yyvsp[-3].number)->Put(*code_block); delete (yyvsp[-3].number);
		  (yyvsp[-1].number)->Put(*code_block); delete (yyvsp[-1].number);
		}
#line 2551 "qa.cc"
    break;

  case 76: /* instr: call_address '(' address ',' number ')'  */
#line 714 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction); 
		  (yyvsp[-3].address)->Put(*code_block); delete (yyvsp[-3].address);
		  (yyvsp[-1].number)->Put(*code_block); delete (yyvsp[-1].number);
		}
#line 2561 "qa.cc"
    break;

  case 77: /* instr: call_escape '(' address ',' number ')'  */
#line 721 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].address)->Put(*code_block); delete (yyvsp[-3].address);
		  (yyvsp[-1].number)->Put(*code_block); delete (yyvsp[-1].number);
		}
#line 2571 "qa.cc"
    break;

  case 78: /* instr: execute_predicate '(' atom ',' number ')'  */
#line 728 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].constant)->Put(*code_block); delete (yyvsp[-3].constant);
		  (yyvsp[-1].number)->Put(*code_block); delete (yyvsp[-1].number);
		}
#line 2581 "qa.cc"
    break;

  case 79: /* instr: execute_address '(' address ')'  */
#line 735 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].address)->Put(*code_block); delete (yyvsp[-1].address);
		}
#line 2590 "qa.cc"
    break;

  case 80: /* instr: execute_escape '(' address ')'  */
#line 741 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].address)->Put(*code_block); delete (yyvsp[-1].address);
		}
#line 2599 "qa.cc"
    break;

  case 81: /* instr: noop  */
#line 747 "qa.y"
                {
		  (yyvsp[0].instruction)->Put(*code_block); delete (yyvsp[0].instruction);
		}
#line 2607 "qa.cc"
    break;

  case 82: /* instr: jump '(' address ')'  */
#line 752 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].address)->Put(*code_block); delete (yyvsp[-1].address);
		}
#line 2616 "qa.cc"
    break;

  case 83: /* instr: proceed  */
#line 758 "qa.y"
                {
		  (yyvsp[0].instruction)->Put(*code_block); delete (yyvsp[0].instruction);
		}
#line 2624 "qa.cc"
    break;

  case 84: /* instr: wam_fail  */
#line 763 "qa.y"
                {
		  (yyvsp[0].instruction)->Put(*code_block); delete (yyvsp[0].instruction);
		}
#line 2632 "qa.cc"
    break;

  case 85: /* instr: halt  */
#line 768 "qa.y"
                {
		  (yyvsp[0].instruction)->Put(*code_block); delete (yyvsp[0].instruction);
		}
#line 2640 "qa.cc"
    break;

  case 86: /* instr: wam_exit  */
#line 773 "qa.y"
                {
		  (yyvsp[0].instruction)->Put(*code_block); delete (yyvsp[0].instruction);
		}
#line 2648 "qa.cc"
    break;

  case 87: /* instr: try_me_else '(' number ',' LABEL_TOKEN ')'  */
#line 778 "qa.y"
                {
		  unsigned jump_offset_base =
		    code_block->Current() +
		      (yyvsp[-5].instruction)->SizeOf() + (yyvsp[-3].number)->SizeOf() + Code::SIZE_OF_OFFSET;

		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].number)->Put(*code_block); delete (yyvsp[-3].number);

		  labels->AddReference(*(yyvsp[-1].label_name), *code_block, jump_offset_base);
		}
#line 2663 "qa.cc"
    break;

  case 88: /* instr: retry_me_else '(' LABEL_TOKEN ')'  */
#line 790 "qa.y"
                {
		  unsigned jump_offset_base =
		    code_block->Current() +
		      (yyvsp[-3].instruction)->SizeOf() + Code::SIZE_OF_OFFSET;

		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  labels->AddReference(*(yyvsp[-1].label_name), *code_block, jump_offset_base);
		}
#line 2676 "qa.cc"
    break;

  case 89: /* instr: trust_me_else_fail  */
#line 800 "qa.y"
                {
		  (yyvsp[0].instruction)->Put(*code_block); delete (yyvsp[0].instruction);
		}
#line 2684 "qa.cc"
    break;

  case 90: /* instr: wam_try '(' number ',' LABEL_TOKEN ')'  */
#line 805 "qa.y"
                {
		  unsigned jump_offset_base =
		    code_block->Current() +
		      (yyvsp[-5].instruction)->SizeOf() + (yyvsp[-3].number)->SizeOf() + Code::SIZE_OF_OFFSET;

		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].number)->Put(*code_block); delete (yyvsp[-3].number);

		  labels->AddReference(*(yyvsp[-1].label_name), *code_block, jump_offset_base);
		}
#line 2699 "qa.cc"
    break;

  case 91: /* instr: retry '(' LABEL_TOKEN ')'  */
#line 817 "qa.y"
                {
		  unsigned jump_offset_base =
		    code_block->Current() +
		      (yyvsp[-3].instruction)->SizeOf() + Code::SIZE_OF_OFFSET;

		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  labels->AddReference(*(yyvsp[-1].label_name), *code_block, jump_offset_base);
		}
#line 2712 "qa.cc"
    break;

  case 92: /* instr: trust '(' LABEL_TOKEN ')'  */
#line 827 "qa.y"
                {
		  unsigned jump_offset_base =
		    code_block->Current() +
		      (yyvsp[-3].instruction)->SizeOf() + Code::SIZE_OF_OFFSET;

		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  labels->AddReference(*(yyvsp[-1].label_name), *code_block, jump_offset_base);
		}
#line 2725 "qa.cc"
    break;

  case 93: /* instr: neck_cut  */
#line 837 "qa.y"
                {
		  (yyvsp[0].instruction)->Put(*code_block); delete (yyvsp[0].instruction);
		}
#line 2733 "qa.cc"
    break;

  case 94: /* instr: get_x_level '(' reg ')'  */
#line 842 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2742 "qa.cc"
    break;

  case 95: /* instr: get_y_level '(' reg ')'  */
#line 848 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2751 "qa.cc"
    break;

  case 96: /* instr: cut '(' reg ')'  */
#line 854 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2760 "qa.cc"
    break;

  case 97: /* instr: switch_on_term '(' reg ',' switch_label ',' switch_label ',' switch_label ',' switch_label ',' switch_label ',' switch_label ')'  */
#line 866 "qa.y"
                {
		  // Calculate the pc value from which jumps will be offset
		  unsigned jump_offset_base =
		    code_block->Current() +
		      (yyvsp[-15].instruction)->SizeOf() + (yyvsp[-13].reg)->SizeOf() + 6 * Code::SIZE_OF_OFFSET;

		  (yyvsp[-15].instruction)->Put(*code_block); delete (yyvsp[-15].instruction);
		  (yyvsp[-13].reg)->Put(*code_block); delete (yyvsp[-13].reg);

		  labels->AddReference(*(yyvsp[-11].label_name), *code_block, jump_offset_base);
		  labels->AddReference(*(yyvsp[-9].label_name), *code_block, jump_offset_base);
		  labels->AddReference(*(yyvsp[-7].label_name), *code_block, jump_offset_base);
		  labels->AddReference(*(yyvsp[-5].label_name), *code_block, jump_offset_base);
		  labels->AddReference(*(yyvsp[-3].label_name), *code_block, jump_offset_base);
		  labels->AddReference(*(yyvsp[-1].label_name), *code_block, jump_offset_base);
		}
#line 2781 "qa.cc"
    break;

  case 98: /* instr: switch_on_constant '(' reg ',' table_size ',' '[' ATOM_TOKEN ':' switch_label constant_labels ']' ')'  */
#line 885 "qa.y"
                {
		  // Calculate the pc value from which jumps will be offset
		  unsigned jump_offset_base =
		    code_block->Current() +
		      (yyvsp[-12].instruction)->SizeOf() + (yyvsp[-10].reg)->SizeOf() + (yyvsp[-8].table_size)->SizeOf();

		  (yyvsp[-12].instruction)->Put(*code_block); delete (yyvsp[-12].instruction);
		  (yyvsp[-10].reg)->Put(*code_block); delete (yyvsp[-10].reg);
		  (yyvsp[-8].table_size)->Put(*code_block); 

		  if (*(yyvsp[-5].atom_name) != "$default")
		    {
		      Fatal(__FUNCTION__,
			    "invalid default atom in switch_on_structure");
		    }

		 ConstantSwitchTable switch_table(jump_offset_base,
							  (yyvsp[-8].table_size), (yyvsp[-3].label_name), (yyvsp[-2].cl_list));

		  switch_table.Put(*code_block, *labels);

		  delete (yyvsp[-8].table_size);
		  delete (yyvsp[-3].label_name);
		  delete (yyvsp[-2].cl_list);
		}
#line 2811 "qa.cc"
    break;

  case 99: /* instr: switch_on_structure '(' reg ',' table_size ',' '[' ATOM_TOKEN ':' switch_label atom_arity_labels ']' ')'  */
#line 913 "qa.y"
                {
		  // Calculate the pc value from which jumps will be offset
		  unsigned jump_offset_base =
		    code_block->Current() +
		      (yyvsp[-12].instruction)->SizeOf() + (yyvsp[-10].reg)->SizeOf() + (yyvsp[-8].table_size)->SizeOf();

		  (yyvsp[-12].instruction)->Put(*code_block); delete (yyvsp[-12].instruction);
		  (yyvsp[-10].reg)->Put(*code_block); delete (yyvsp[-10].reg);
		  (yyvsp[-8].table_size)->Put(*code_block);

		  if (*(yyvsp[-5].atom_name) != "$default")
		    {
		      Fatal(__FUNCTION__,
			    "invalid default atom in switch_on_structure");
		    }

		  AtomSwitchTable switch_table(jump_offset_base,
							   (yyvsp[-8].table_size), (yyvsp[-3].label_name), (yyvsp[-2].aal_list));

		  switch_table.Put(*code_block, *labels);

		  delete (yyvsp[-8].table_size);
		  delete (yyvsp[-3].label_name);
		  delete (yyvsp[-2].aal_list);
		}
#line 2841 "qa.cc"
    break;

  case 100: /* instr: switch_on_quantifier '(' reg ',' table_size ',' '[' ATOM_TOKEN ':' switch_label quantifier_labels ']' ')'  */
#line 941 "qa.y"
                {
		  // Calculate the pc value from which jumps will be offset
		  unsigned jump_offset_base =
		    code_block->Current() +
		      (yyvsp[-12].instruction)->SizeOf() + (yyvsp[-10].reg)->SizeOf() + (yyvsp[-8].table_size)->SizeOf();

		  (yyvsp[-12].instruction)->Put(*code_block); delete (yyvsp[-12].instruction);
		  (yyvsp[-10].reg)->Put(*code_block); delete (yyvsp[-10].reg);
		  (yyvsp[-8].table_size)->Put(*code_block);

		  if (*(yyvsp[-5].atom_name) != "$default")
		    {
		      Fatal(__FUNCTION__,
			    "invalid default atom in switch_on_quantifier");
		    }

		  AtomSwitchTable switch_table(jump_offset_base,
							   (yyvsp[-8].table_size), (yyvsp[-3].label_name), (yyvsp[-2].aal_list));

		  switch_table.Put(*code_block, *labels);

		  delete (yyvsp[-8].table_size);
		  delete (yyvsp[-3].label_name);
		  delete (yyvsp[-2].aal_list);
		}
#line 2871 "qa.cc"
    break;

  case 101: /* instr: pseudo_instr0 '(' number ')'  */
#line 968 "qa.y"
                {
		  (yyvsp[-3].instruction)->Put(*code_block); delete (yyvsp[-3].instruction);
		  (yyvsp[-1].number)->Put(*code_block); delete (yyvsp[-1].number);
		}
#line 2880 "qa.cc"
    break;

  case 102: /* instr: pseudo_instr1 '(' number ',' reg ')'  */
#line 974 "qa.y"
                {
		  (yyvsp[-5].instruction)->Put(*code_block); delete (yyvsp[-5].instruction);
		  (yyvsp[-3].number)->Put(*code_block); delete (yyvsp[-3].number);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2890 "qa.cc"
    break;

  case 103: /* instr: pseudo_instr2 '(' number ',' reg ',' reg ')'  */
#line 981 "qa.y"
                {
		  (yyvsp[-7].instruction)->Put(*code_block); delete (yyvsp[-7].instruction);
		  (yyvsp[-5].number)->Put(*code_block); delete (yyvsp[-5].number);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2901 "qa.cc"
    break;

  case 104: /* instr: pseudo_instr3 '(' number ',' reg ',' reg ',' reg ')'  */
#line 989 "qa.y"
                {
		  (yyvsp[-9].instruction)->Put(*code_block); delete (yyvsp[-9].instruction);
		  (yyvsp[-7].number)->Put(*code_block); delete (yyvsp[-7].number);
		  (yyvsp[-5].reg)->Put(*code_block); delete (yyvsp[-5].reg);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2913 "qa.cc"
    break;

  case 105: /* instr: pseudo_instr4 '(' number ',' reg ',' reg ',' reg ',' reg ')'  */
#line 999 "qa.y"
                {
		  (yyvsp[-11].instruction)->Put(*code_block); delete (yyvsp[-11].instruction);
		  (yyvsp[-9].number)->Put(*code_block); delete (yyvsp[-9].number);
		  (yyvsp[-7].reg)->Put(*code_block); delete (yyvsp[-7].reg);
		  (yyvsp[-5].reg)->Put(*code_block); delete (yyvsp[-5].reg);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2926 "qa.cc"
    break;

  case 106: /* instr: pseudo_instr5 '(' number ',' reg ',' reg ',' reg ',' reg ',' reg ')'  */
#line 1009 "qa.y"
                {
		  (yyvsp[-13].instruction)->Put(*code_block); delete (yyvsp[-13].instruction);
		  (yyvsp[-11].number)->Put(*code_block); delete (yyvsp[-11].number);
		  (yyvsp[-9].reg)->Put(*code_block); delete (yyvsp[-9].reg);
		  (yyvsp[-7].reg)->Put(*code_block); delete (yyvsp[-7].reg);
		  (yyvsp[-5].reg)->Put(*code_block); delete (yyvsp[-5].reg);
		  (yyvsp[-3].reg)->Put(*code_block); delete (yyvsp[-3].reg);
		  (yyvsp[-1].reg)->Put(*code_block); delete (yyvsp[-1].reg);
		}
#line 2940 "qa.cc"
    break;

  case 107: /* constant_labels: %empty  */
#line 1021 "qa.y"
                {
		  (yyval.cl_list) = NULL;
		}
#line 2948 "qa.cc"
    break;

  case 108: /* constant_labels: ',' constant_label_list  */
#line 1025 "qa.y"
                {
		  (yyval.cl_list) = (yyvsp[0].cl_list);
		}
#line 2956 "qa.cc"
    break;

  case 109: /* constant_label_list: constant_label  */
#line 1031 "qa.y"
                {
		  vector<ConstantLabel *> *tmp = new vector<ConstantLabel *>;

		  tmp->push_back((yyvsp[0].cl));

		  (yyval.cl_list) = tmp;
		}
#line 2968 "qa.cc"
    break;

  case 110: /* constant_label_list: constant_label_list ',' constant_label  */
#line 1039 "qa.y"
                {
		  (yyvsp[-2].cl_list)->push_back((yyvsp[0].cl));

		  (yyval.cl_list) = (yyvsp[-2].cl_list);
		}
#line 2978 "qa.cc"
    break;

  case 111: /* constant_label: constant ':' switch_label  */
#line 1047 "qa.y"
                {
		  (yyval.cl) = new ConstantLabel((yyvsp[-2].constant), (yyvsp[0].label_name));
		  
		}
#line 2987 "qa.cc"
    break;

  case 112: /* atom_arity_labels: %empty  */
#line 1054 "qa.y"
                {
		  (yyval.aal_list) = NULL;
		}
#line 2995 "qa.cc"
    break;

  case 113: /* atom_arity_labels: ',' atom_arity_label_list  */
#line 1058 "qa.y"
                {
		  (yyval.aal_list) = (yyvsp[0].aal_list);
		}
#line 3003 "qa.cc"
    break;

  case 114: /* atom_arity_label_list: atom_arity_label  */
#line 1064 "qa.y"
                {
		  vector<AtomArityLabel *> *tmp = new vector<AtomArityLabel *>;

		  tmp->push_back((yyvsp[0].aal));

		  (yyval.aal_list) = tmp;
		}
#line 3015 "qa.cc"
    break;

  case 115: /* atom_arity_label_list: atom_arity_label_list ',' atom_arity_label  */
#line 1072 "qa.y"
                {
		  (yyvsp[-2].aal_list)->push_back((yyvsp[0].aal));
		  (yyval.aal_list) = (yyvsp[-2].aal_list);
		}
#line 3024 "qa.cc"
    break;

  case 116: /* atom_arity_label: ATOM_TOKEN '/' number ':' switch_label  */
#line 1079 "qa.y"
                {
		  ASMStringPointer asm_atom((yyvsp[-4].atom_name));
		  const ASMLoc loc = asm_string_table->lookup(asm_atom);

		  ASMInt<Code::ConstantSizedType> *atom = 
		    new ASMInt<Code::ConstantSizedType>(loc, ConstEntry::ATOM_TYPE);

		  qint64 arity = (yyvsp[-2].number)->Value();
		  ASMInt<Code::NumberSizedType> *carity = new ASMInt<Code::NumberSizedType>(arity);
		  (yyval.aal) = new AtomArityLabel(atom, carity, (yyvsp[0].label_name));

		}
#line 3041 "qa.cc"
    break;

  case 117: /* quantifier_labels: %empty  */
#line 1094 "qa.y"
                {
		  (yyval.aal_list) = NULL;
		}
#line 3049 "qa.cc"
    break;

  case 118: /* quantifier_labels: ',' quantifier_label_list  */
#line 1098 "qa.y"
                {
		  (yyval.aal_list) = (yyvsp[0].aal_list);
		}
#line 3057 "qa.cc"
    break;

  case 119: /* quantifier_label_list: quantifier_label  */
#line 1104 "qa.y"
                {
		  vector<AtomArityLabel *> *tmp = new vector<AtomArityLabel *>;

		  tmp->push_back((yyvsp[0].aal));

		  (yyval.aal_list) = tmp;
		}
#line 3069 "qa.cc"
    break;

  case 120: /* quantifier_label_list: quantifier_label_list ',' quantifier_label  */
#line 1112 "qa.y"
                {
		  (yyvsp[-2].aal_list)->push_back((yyvsp[0].aal));

		  (yyval.aal_list) = (yyvsp[-2].aal_list);
		}
#line 3079 "qa.cc"
    break;

  case 121: /* quantifier_label: ATOM_TOKEN '/' number ':' switch_label  */
#line 1120 "qa.y"
                {
		  ASMStringPointer asm_atom((yyvsp[-4].atom_name));
		  const ASMLoc loc = asm_string_table->lookup(asm_atom);

		  ASMInt<Code::ConstantSizedType> *atom = 
		    new ASMInt<Code::ConstantSizedType>(loc, ConstEntry::ATOM_TYPE);

		  qint64 arity = (yyvsp[-2].number)->Value();
		  ASMInt<Code::NumberSizedType> *carity = new ASMInt<Code::NumberSizedType>(arity);
		  (yyval.aal) = new AtomArityLabel(atom, carity, (yyvsp[0].label_name));
		}
#line 3095 "qa.cc"
    break;

  case 123: /* switch_label: ATOM_TOKEN  */
#line 1135 "qa.y"
                {
		  if (*(yyvsp[0].atom_name) != "fail")
		    {
		      FatalS(__FUNCTION__, "invalid switch label ",
			     (yyvsp[0].atom_name)->c_str());
		    }
		}
#line 3107 "qa.cc"
    break;

  case 124: /* constant: ATOM_TOKEN  */
#line 1145 "qa.y"
                {
		  ASMStringPointer asm_atom((yyvsp[0].atom_name));
		  const ASMLoc loc = asm_string_table->lookup(asm_atom);

		  (yyval.constant) = new ASMInt<Code::ConstantSizedType>(loc, ConstEntry::ATOM_TYPE);
		}
#line 3118 "qa.cc"
    break;

  case 125: /* constant: INTEGER_TOKEN  */
#line 1152 "qa.y"
                {
                  (yyval.constant) = new ASMInt<Code::ConstantSizedType>((Code::ConstantSizedType)((yyvsp[0].int_value)), ConstEntry::INTEGER_TYPE);

                }
#line 3127 "qa.cc"
    break;

  case 126: /* constant: '+' INTEGER_TOKEN  */
#line 1157 "qa.y"
                {
                  (yyval.constant) = new ASMInt<Code::ConstantSizedType>((Code::ConstantSizedType)((yyvsp[0].int_value)), ConstEntry::INTEGER_TYPE);

                }
#line 3136 "qa.cc"
    break;

  case 127: /* constant: '-' INTEGER_TOKEN  */
#line 1162 "qa.y"
                {
                  (yyval.constant) = new ASMInt<Code::ConstantSizedType>((Code::ConstantSizedType)(-(yyvsp[0].int_value)), ConstEntry::INTEGER_TYPE);

                }
#line 3145 "qa.cc"
    break;

  case 128: /* number: INTEGER_TOKEN  */
#line 1169 "qa.y"
                { 
		  (yyval.number) = new ASMInt<Code::NumberSizedType>((yyvsp[0].int_value));

                }
#line 3154 "qa.cc"
    break;

  case 129: /* int_num: INTEGER_TOKEN  */
#line 1176 "qa.y"
                {
		  (yyval.int_num) = new ASMInt<qint64>((qint64)((yyvsp[0].int_value)), ConstEntry::INTEGER_TYPE);

		}
#line 3163 "qa.cc"
    break;

  case 130: /* int_num: '+' INTEGER_TOKEN  */
#line 1181 "qa.y"
                {
		  (yyval.int_num) = new ASMInt<qint64>((qint64)((yyvsp[0].int_value)), ConstEntry::INTEGER_TYPE);

		}
#line 3172 "qa.cc"
    break;

  case 131: /* int_num: '-' INTEGER_TOKEN  */
#line 1186 "qa.y"
                {
		  (yyval.int_num) = new ASMInt<qint64>(-(qint64)((yyvsp[0].int_value)), ConstEntry::INTEGER_TYPE);

		}
#line 3181 "qa.cc"
    break;

  case 132: /* double_num: DOUBLE_TOKEN  */
#line 1193 "qa.y"
                {
		  (yyval.double_num) = new ASMDouble<double>((double)((yyvsp[0].double_value)), ConstEntry::INTEGER_TYPE);

		}
#line 3190 "qa.cc"
    break;

  case 133: /* double_num: '+' DOUBLE_TOKEN  */
#line 1198 "qa.y"
                {
		  (yyval.double_num) = new ASMDouble<double>((double)((yyvsp[0].double_value)), ConstEntry::INTEGER_TYPE);

		}
#line 3199 "qa.cc"
    break;

  case 134: /* double_num: '-' DOUBLE_TOKEN  */
#line 1203 "qa.y"
                {
		  (yyval.double_num) = new ASMDouble<double>((double)(-(yyvsp[0].double_value)), ConstEntry::INTEGER_TYPE);

		}
#line 3208 "qa.cc"
    break;

  case 135: /* reg: INTEGER_TOKEN  */
#line 1210 "qa.y"
                {
		  (yyval.reg) = new ASMInt<Code::RegisterSizedType>((yyvsp[0].int_value));
		  
		}
#line 3217 "qa.cc"
    break;

  case 136: /* address: INTEGER_TOKEN  */
#line 1217 "qa.y"
                {
		  (yyval.address) = new ASMInt<Code::AddressSizedType>((yyvsp[0].int_value));

		}
#line 3226 "qa.cc"
    break;

  case 137: /* atom: ATOM_TOKEN  */
#line 1224 "qa.y"
                {
		  ASMStringPointer asm_atom((yyvsp[0].atom_name));
		  const ASMLoc loc = asm_string_table->lookup(asm_atom);
		  (yyval.constant) = new ASMInt<Code::PredSizedType>(loc);
		}
#line 3236 "qa.cc"
    break;

  case 138: /* table_size: INTEGER_TOKEN  */
#line 1232 "qa.y"
                {
		  (yyval.table_size) = new ASMInt<Code::TableSizeSizedType>((yyvsp[0].int_value));

		}
#line 3245 "qa.cc"
    break;


#line 3249 "qa.cc"

      default: break;
    }
  /* User semantic actions sometimes alter yychar, and that requires
     that yytoken be updated with the new translation.  We take the
     approach of translating immediately before every use of yytoken.
     One alternative is translating here after every semantic action,
     but that translation would be missed if the semantic action invokes
     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
     incorrect destructor might then be invoked immediately.  In the
     case of YYERROR or YYBACKUP, subsequent parser actions might lead
     to an incorrect destructor call or verbose syntax error message
     before the lookahead is translated.  */
  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);

  YYPOPSTACK (yylen);
  yylen = 0;

  *++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.  */
  {
    const int yylhs = yyr1[yyn] - YYNTOKENS;
    const int yyi = yypgoto[yylhs] + *yyssp;
    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
               ? yytable[yyi]
               : yydefgoto[yylhs]);
  }

  goto yynewstate;


/*--------------------------------------.
| yyerrlab -- here on detecting error.  |
`--------------------------------------*/
yyerrlab:
  /* Make sure we have latest lookahead translation.  See comments at
     user semantic actions for why this is necessary.  */
  yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
      yyerror (YY_("syntax error"));
    }

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

      if (yychar <= YYEOF)
        {
          /* Return failure if at end of input.  */
          if (yychar == YYEOF)
            YYABORT;
        }
      else
        {
          yydestruct ("Error: discarding",
                      yytoken, &yylval);
          yychar = YYEMPTY;
        }
    }

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


/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:
  /* Pacify compilers when the user code never invokes YYERROR and the
     label yyerrorlab therefore never appears in user code.  */
  if (0)
    YYERROR;
  ++yynerrs;

  /* Do not reclaim the symbols of the rule whose action triggered
     this YYERROR.  */
  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);
  yystate = *yyssp;
  goto yyerrlab1;


/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
`-------------------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */

  /* Pop stack until we find a state that shifts the error token.  */
  for (;;)
    {
      yyn = yypact[yystate];
      if (!yypact_value_is_default (yyn))
        {
          yyn += YYSYMBOL_YYerror;
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
            {
              yyn = yytable[yyn];
              if (0 < yyn)
                break;
            }
        }

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


      yydestruct ("Error: popping",
                  YY_ACCESSING_SYMBOL (yystate), yyvsp);
      YYPOPSTACK (1);
      yystate = *yyssp;
      YY_STACK_PRINT (yyss, yyssp);
    }

  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  *++yyvsp = yylval;
  YY_IGNORE_MAYBE_UNINITIALIZED_END


  /* Shift the error token.  */
  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);

  yystate = yyn;
  goto yynewstate;


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


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


/*-----------------------------------------------------------.
| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
`-----------------------------------------------------------*/
yyexhaustedlab:
  yyerror (YY_("memory exhausted"));
  yyresult = 2;
  goto yyreturnlab;


/*----------------------------------------------------------.
| yyreturnlab -- parsing is finished, clean up and return.  |
`----------------------------------------------------------*/
yyreturnlab:
  if (yychar != YYEMPTY)
    {
      /* Make sure we have latest lookahead translation.  See comments at
         user semantic actions for why this is necessary.  */
      yytoken = YYTRANSLATE (yychar);
      yydestruct ("Cleanup: discarding lookahead",
                  yytoken, &yylval);
    }
  /* Do not reclaim the symbols of the rule whose action triggered
     this YYABORT or YYACCEPT.  */
  YYPOPSTACK (yylen);
  YY_STACK_PRINT (yyss, yyssp);
  while (yyssp != yyss)
    {
      yydestruct ("Cleanup: popping",
                  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
      YYPOPSTACK (1);
    }
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif

  return yyresult;
}

#line 1238 "qa.y"

#include "lexer.cc"

#include <stdlib.h>

#include "qa_options.h"
		
QaOptions *qa_options = NULL;

int
main(int argc, char **argv)
{
  qa_options = new QaOptions(argc, argv);

  if (!qa_options->Valid())
    {
      Usage(Program, qa_options->Usage());
    }

  if (streq(qa_options->InputFile(), qa_options->OutputFile()))
    {
      Fatal(__FUNCTION__, "Input and output file names are identical");
    }

  // Should also check for suspect extensions .qg, .qi, .qs, .ql, .qx
  asm_string_table = new ASMStringTable;
  predicate_code_blocks = new vector<CodeBlock *>;

  // Read in the assembler source
  yyin = fopen(qa_options->InputFile(), "r");
  if (yyin == NULL)
    {
      perror(__FUNCTION__);
      exit(EXIT_FAILURE);
    }
      
  int result = yyparse();
  if (result)
    {
      Fatal(__FUNCTION__, "bad .qs input file");
    }
  fclose(yyin);

  // Write out the assembled object

  // First check if any compiled predicates are too big - i.e. >= 2^16
  for (vector<CodeBlock *>::iterator iter = predicate_code_blocks->begin();
       iter != predicate_code_blocks->end();
       iter++)
    {
      if ((*iter)->Current() >= (1 << (8*sizeof(Code::OffsetSizedType))))
        {
	  Fatal(__FUNCTION__, "Compiled predicate is too big");
	}
    }

  #ifdef WIN32
  ofstream ostrm(qa_options->OutputFile(), ios_base::binary);
  #else
  ofstream ostrm(qa_options->OutputFile());
  #endif


  asm_string_table->save(ostrm);

  if (query_code_block)
    {
      query_code_block->Save(ostrm);
    }
  else
    {
      IntSave<Code::OffsetSizedType>(ostrm, 0);
    }
  
  for (vector<CodeBlock *>::iterator iter = predicate_code_blocks->begin();
       iter != predicate_code_blocks->end();
       iter++)
    {
      (*iter)->Save(ostrm);
    }

  ostrm.close();

  exit(EXIT_SUCCESS);
}

int
yyerror(const char *s)
{
  Fatal(__FUNCTION__, s);
  return(1);
}