/*===========================================================================*/
/*   (Lalr/rewrite.scm)                                                      */
/*   Bigloo (2.6b)                                                           */
/*   Inria -- Sophia Antipolis (c)       Mon Dec 15 12:14:36 CET 2003        */
/*===========================================================================*/
/* COMPILATION: (/users/serrano/prgm/project/bigloo/bin/bigloo -O4 -mklib -cc gcc-2.95 -fsharing -q -s -copt -DBGL_NO_PIC -unsafe -c Lalr/rewrite.scm -indent -o objs/obj_u/Lalr/rewrite.c)*/
/* GC selection */
#define THE_GC BOEHM_GC

#include <bigloo.h>
#include <signal.h>

BGL_EXPORTED_DECL obj_t BGl_modulezd2initializa7ationz75zz__lalr_rewritez00(long, char *);
extern obj_t BGl_modulezd2initializa7ationz75zz__errorz00(long, char *);
extern obj_t BGl_modulezd2initializa7ationz75zz__lalr_globalz00(long, char *);
static obj_t BGl_za2plistza2z00zz__lalr_rewritez00 = BUNSPEC;
extern obj_t BGl_listzd2ze3stringz31zz__r4_strings_6_7z00(obj_t);
extern long bgl_list_length(obj_t);
static long BGl_za2maxzd2ntza2zd2zz__lalr_rewritez00;
extern obj_t BGl_rempropz12z12zz__r4_symbols_6_4z00(obj_t, obj_t);
static obj_t BGl_list2000z00zz__lalr_rewritez00 = BUNSPEC;
BGL_EXPORTED_DECL obj_t BGl_rewritezd2grammarz12zc0zz__lalr_rewritez00(obj_t);
extern obj_t BGl_nitemsz00zz__lalr_globalz00;
static obj_t BGl_cnstzd2initzd2zz__lalr_rewritez00();
extern obj_t BGl_nsymsz00zz__lalr_globalz00;
extern obj_t string_to_symbol(char *);
extern obj_t bgl_reverse(obj_t);
BGL_EXPORTED_DECL obj_t BGl_cleanzd2plistzd2zz__lalr_rewritez00();
extern obj_t BGl_nvarsz00zz__lalr_globalz00;
static obj_t BGl_symbolzd2ze3symbolzf2bindingzc3zz__lalr_rewritez00(obj_t);
BGL_EXPORTED_DEF obj_t BGl_za2symvza2z00zz__lalr_rewritez00 = BUNSPEC;
extern obj_t make_vector(int, obj_t);
static obj_t BGl_importedzd2moduleszd2initz00zz__lalr_rewritez00();
static obj_t BGl_list1987z00zz__lalr_rewritez00 = BUNSPEC;
extern obj_t BGl_ntermsz00zz__lalr_globalz00;
static obj_t BGl_list1994z00zz__lalr_rewritez00 = BUNSPEC;
static obj_t BGl_requirezd2initializa7ationz75zz__lalr_rewritez00 = BUNSPEC;
static obj_t BGl__cleanzd2plistzd2zz__lalr_rewritez00(obj_t);
extern obj_t BGl_memqz00zz__r4_pairs_and_lists_6_3z00(obj_t, obj_t);
extern bool_t BGl_listzf3zf3zz__r4_pairs_and_lists_6_3z00(obj_t);
static obj_t BGl_setzd2symzd2noz12z12zz__lalr_rewritez00(obj_t);
extern obj_t BGl_nrulesz00zz__lalr_globalz00;
static obj_t BGl_symbol1989z00zz__lalr_rewritez00 = BUNSPEC;
static obj_t BGl_symbol1988z00zz__lalr_rewritez00 = BUNSPEC;
extern obj_t string_to_keyword(char *);
static obj_t BGl_symbol1984z00zz__lalr_rewritez00 = BUNSPEC;
static obj_t BGl_symbol1983z00zz__lalr_rewritez00 = BUNSPEC;
static obj_t BGl_symbol1982z00zz__lalr_rewritez00 = BUNSPEC;
static obj_t BGl_keyword1995z00zz__lalr_rewritez00 = BUNSPEC;
static obj_t BGl_keyword1996z00zz__lalr_rewritez00 = BUNSPEC;
static obj_t BGl_keyword1997z00zz__lalr_rewritez00 = BUNSPEC;
static long BGl_za2maxzd2termza2zd2zz__lalr_rewritez00;
static long BGl_setzd2ntzd2noz12z12zz__lalr_rewritez00(obj_t);
static obj_t BGl__rewritezd2grammarz12zc0zz__lalr_rewritez00(obj_t, obj_t);
static obj_t BGl_toplevelzd2initzd2zz__lalr_rewritez00();
extern obj_t BGl_putpropz12z12zz__r4_symbols_6_4z00(obj_t, obj_t, obj_t);
extern obj_t BGl_2zb2zb2zz__r4_numbers_6_5z00(obj_t, obj_t);
extern obj_t BGl_getpropz00zz__r4_symbols_6_4z00(obj_t, obj_t);
static bool_t BGl_makezd2symzd2tablez00zz__lalr_rewritez00();
extern obj_t BGl_grammarz00zz__lalr_globalz00;
extern obj_t BGl_stringzd2ze3listz31zz__r4_strings_6_7z00(obj_t);
static obj_t *__cnst;


DEFINE_EXPORT_PROCEDURE( BGl_rewritezd2grammarz12zd2envz12zz__lalr_rewritez00, BgL_bgl__rewriteza7d2grammarza712za7c0za7za7__lalr_rewriteza7002011z00, BGl__rewritezd2grammarz12zc0zz__lalr_rewritez00, 0L, 1 );
DEFINE_STRING( BGl_string2004z00zz__lalr_rewritez00, BgL_bgl_string2004za700za7za7__lalr_rewriteza7002012z00, "Bad right-hand side", 19 );
DEFINE_STRING( BGl_string2003z00zz__lalr_rewritez00, BgL_bgl_string2003za700za7za7__lalr_rewriteza7002013z00, "Invalid symbol in right-hand side", 33 );
DEFINE_STRING( BGl_string2002z00zz__lalr_rewritez00, BgL_bgl_string2002za700za7za7__lalr_rewriteza7002014z00, "Undefined symbol", 16 );
DEFINE_EXPORT_PROCEDURE( BGl_cleanzd2plistzd2envz00zz__lalr_rewritez00, BgL_bgl__cleanza7d2plistza7d2za7za7__lalr_rewriteza7002015za7, BGl__cleanzd2plistzd2zz__lalr_rewritez00, 0L, 0 );
DEFINE_STRING( BGl_string1999z00zz__lalr_rewritez00, BgL_bgl_string1999za700za7za7__lalr_rewriteza7002016z00, "Invalid semantic action", 23 );
DEFINE_STRING( BGl_string1998z00zz__lalr_rewritez00, BgL_bgl_string1998za700za7za7__lalr_rewriteza7002017z00, "Bad terminal", 12 );
DEFINE_STRING( BGl_string1993z00zz__lalr_rewritez00, BgL_bgl_string1993za700za7za7__lalr_rewriteza7002018z00, "Ill-formed grammar", 18 );
DEFINE_STRING( BGl_string1992z00zz__lalr_rewritez00, BgL_bgl_string1992za700za7za7__lalr_rewriteza7002019z00, "Bad rule specification", 22 );
DEFINE_STRING( BGl_string1991z00zz__lalr_rewritez00, BgL_bgl_string1991za700za7za7__lalr_rewriteza7002020z00, "LHS must be a symbol", 20 );
DEFINE_STRING( BGl_string1990z00zz__lalr_rewritez00, BgL_bgl_string1990za700za7za7__lalr_rewriteza7002021z00, "Non-terminal defined twice", 26 );
DEFINE_STRING( BGl_string1986z00zz__lalr_rewritez00, BgL_bgl_string1986za700za7za7__lalr_rewriteza7002022z00, "Grammar symbol already defined", 30 );
DEFINE_STRING( BGl_string1985z00zz__lalr_rewritez00, BgL_bgl_string1985za700za7za7__lalr_rewriteza7002023z00, "lalr-grammar", 12 );



/* module-initialization */
BGL_EXPORTED_DEF obj_t BGl_modulezd2initializa7ationz75zz__lalr_rewritez00(long BgL_checksumz00_740, char * BgL_fromz00_741)
{ AN_OBJECT;
{ 
if(
CBOOL(BGl_requirezd2initializa7ationz75zz__lalr_rewritez00))
{ 
BGl_requirezd2initializa7ationz75zz__lalr_rewritez00 = 
BBOOL(((bool_t)0)); 
BGl_cnstzd2initzd2zz__lalr_rewritez00(); 
BGl_importedzd2moduleszd2initz00zz__lalr_rewritez00(); 
BGl_toplevelzd2initzd2zz__lalr_rewritez00(); 
return BUNSPEC;}  else 
{ 
return BUNSPEC;} } 
}



/* cnst-init */
obj_t BGl_cnstzd2initzd2zz__lalr_rewritez00()
{ AN_OBJECT;
{ /* ./Lalr/rewrite.scm 11 */
BGl_symbol1982z00zz__lalr_rewritez00 = 
string_to_symbol("nt?"); 
BGl_symbol1983z00zz__lalr_rewritez00 = 
string_to_symbol("prec"); 
BGl_symbol1984z00zz__lalr_rewritez00 = 
string_to_symbol("sym-no"); 
BGl_symbol1988z00zz__lalr_rewritez00 = 
string_to_symbol("*eoi*"); 
BGl_symbol1989z00zz__lalr_rewritez00 = 
string_to_symbol("*start*"); 
{ /* ./Lalr/rewrite.scm 125 */
obj_t BgL_auxz00_753;
BgL_auxz00_753 = 
MAKE_PAIR(BGl_symbol1989z00zz__lalr_rewritez00, BNIL); 
BGl_list1987z00zz__lalr_rewritez00 = 
MAKE_PAIR(BGl_symbol1988z00zz__lalr_rewritez00, BgL_auxz00_753); } 
BGl_keyword1995z00zz__lalr_rewritez00 = 
string_to_keyword("left:"); 
BGl_keyword1996z00zz__lalr_rewritez00 = 
string_to_keyword("right:"); 
BGl_keyword1997z00zz__lalr_rewritez00 = 
string_to_keyword("none:"); 
{ /* ./Lalr/rewrite.scm 166 */
obj_t BgL_auxz00_759;
{ /* ./Lalr/rewrite.scm 166 */
obj_t BgL_auxz00_760;
BgL_auxz00_760 = 
MAKE_PAIR(BGl_keyword1997z00zz__lalr_rewritez00, BNIL); 
BgL_auxz00_759 = 
MAKE_PAIR(BGl_keyword1996z00zz__lalr_rewritez00, BgL_auxz00_760); } 
BGl_list1994z00zz__lalr_rewritez00 = 
MAKE_PAIR(BGl_keyword1995z00zz__lalr_rewritez00, BgL_auxz00_759); } 
{ /* ./Lalr/rewrite.scm 197 */
obj_t BgL_auxz00_764;
BgL_auxz00_764 = 
BBOOL(((bool_t)0)); 
return ( 
BGl_list2000z00zz__lalr_rewritez00 = 
MAKE_PAIR(BgL_auxz00_764, BNIL), BUNSPEC) ;} } 
}



/* toplevel-init */
obj_t BGl_toplevelzd2initzd2zz__lalr_rewritez00()
{ AN_OBJECT;
{ /* ./Lalr/rewrite.scm 11 */
BGl_za2plistza2z00zz__lalr_rewritez00 = BFALSE; 
BGl_za2symvza2z00zz__lalr_rewritez00 = BFALSE; 
BGl_za2maxzd2termza2zd2zz__lalr_rewritez00 = ((long)0); 
return ( 
BGl_za2maxzd2ntza2zd2zz__lalr_rewritez00 = ((long)1), BUNSPEC) ;} 
}



/* clean-plist */
BGL_EXPORTED_DEF obj_t BGl_cleanzd2plistzd2zz__lalr_rewritez00()
{ AN_OBJECT;
{ /* ./Lalr/rewrite.scm 48 */
{ 
obj_t BgL_lz00_358;
{ /* ./Lalr/rewrite.scm 49 */
bool_t BgL_auxz00_767;
BgL_lz00_358 = BGl_za2plistza2z00zz__lalr_rewritez00; 
BgL_loopz00_359:
if(
PAIRP(BgL_lz00_358))
{ /* ./Lalr/rewrite.scm 51 */
obj_t BgL_symz00_361;
BgL_symz00_361 = 
CAR(BgL_lz00_358); 
{ /* ./Lalr/rewrite.scm 52 */
bool_t BgL_testz00_771;
{ /* ./Lalr/rewrite.scm 52 */
obj_t BgL_auxz00_772;
BgL_auxz00_772 = 
BGl_getpropz00zz__r4_symbols_6_4z00(BgL_symz00_361, BGl_symbol1982z00zz__lalr_rewritez00); 
BgL_testz00_771 = 
CBOOL(BgL_auxz00_772); } 
if(BgL_testz00_771)
{ /* ./Lalr/rewrite.scm 52 */
BGl_rempropz12z12zz__r4_symbols_6_4z00(BgL_symz00_361, BGl_symbol1982z00zz__lalr_rewritez00); }  else 
{ /* ./Lalr/rewrite.scm 52 */BFALSE; } } 
{ /* ./Lalr/rewrite.scm 54 */
bool_t BgL_testz00_776;
{ /* ./Lalr/rewrite.scm 54 */
obj_t BgL_auxz00_777;
BgL_auxz00_777 = 
BGl_getpropz00zz__r4_symbols_6_4z00(BgL_symz00_361, BGl_symbol1983z00zz__lalr_rewritez00); 
BgL_testz00_776 = 
CBOOL(BgL_auxz00_777); } 
if(BgL_testz00_776)
{ /* ./Lalr/rewrite.scm 54 */
BGl_rempropz12z12zz__r4_symbols_6_4z00(BgL_symz00_361, BGl_symbol1983z00zz__lalr_rewritez00); }  else 
{ /* ./Lalr/rewrite.scm 54 */BFALSE; } } 
BGl_rempropz12z12zz__r4_symbols_6_4z00(BgL_symz00_361, BGl_symbol1984z00zz__lalr_rewritez00); 
{ 
obj_t BgL_lz00_782;
BgL_lz00_782 = 
CDR(BgL_lz00_358); 
BgL_lz00_358 = BgL_lz00_782; 
goto BgL_loopz00_359;} }  else 
{ /* ./Lalr/rewrite.scm 50 */
BgL_auxz00_767 = ((bool_t)0)
; } 
return 
BBOOL(BgL_auxz00_767);} } } 
}



/* _clean-plist */
obj_t BGl__cleanzd2plistzd2zz__lalr_rewritez00(obj_t BgL_envz00_737)
{ AN_OBJECT;
{ /* ./Lalr/rewrite.scm 48 */
return 
BGl_cleanzd2plistzd2zz__lalr_rewritez00();} 
}



/* make-sym-table */
bool_t BGl_makezd2symzd2tablez00zz__lalr_rewritez00()
{ AN_OBJECT;
{ /* ./Lalr/rewrite.scm 62 */
{ /* ./Lalr/rewrite.scm 63 */
int BgL_auxz00_786;
BgL_auxz00_786 = 
(int)(BGl_za2maxzd2termza2zd2zz__lalr_rewritez00); 
BGl_za2symvza2z00zz__lalr_rewritez00 = 
make_vector(BgL_auxz00_786, BFALSE); } 
{ 
obj_t BgL_lz00_365;
BgL_lz00_365 = BGl_za2plistza2z00zz__lalr_rewritez00; 
BgL_loopz00_366:
if(
PAIRP(BgL_lz00_365))
{ /* ./Lalr/rewrite.scm 66 */
obj_t BgL_symz00_368;
BgL_symz00_368 = 
CAR(BgL_lz00_365); 
{ /* ./Lalr/rewrite.scm 67 */
obj_t BgL_arg1028z00_369;
BgL_arg1028z00_369 = 
BGl_getpropz00zz__r4_symbols_6_4z00(BgL_symz00_368, BGl_symbol1984z00zz__lalr_rewritez00); 
{ 
int BgL_auxz00_793;
BgL_auxz00_793 = 
CINT(BgL_arg1028z00_369); 
VECTOR_SET(BGl_za2symvza2z00zz__lalr_rewritez00,BgL_auxz00_793,BgL_symz00_368); } } 
{ 
obj_t BgL_lz00_796;
BgL_lz00_796 = 
CDR(BgL_lz00_365); 
BgL_lz00_365 = BgL_lz00_796; 
goto BgL_loopz00_366;} }  else 
{ /* ./Lalr/rewrite.scm 65 */
return ((bool_t)0);} } } 
}



/* set-nt-no! */
long BGl_setzd2ntzd2noz12z12zz__lalr_rewritez00(obj_t BgL_symz00_1)
{ AN_OBJECT;
{ /* ./Lalr/rewrite.scm 77 */
{ /* ./Lalr/rewrite.scm 78 */
long BgL_xz00_371;
BgL_xz00_371 = BGl_za2maxzd2ntza2zd2zz__lalr_rewritez00; 
BGl_putpropz12z12zz__r4_symbols_6_4z00(BgL_symz00_1, BGl_symbol1982z00zz__lalr_rewritez00, BTRUE); 
BGl_putpropz12z12zz__r4_symbols_6_4z00(BgL_symz00_1, BGl_symbol1984z00zz__lalr_rewritez00, 
BINT(BGl_za2maxzd2ntza2zd2zz__lalr_rewritez00)); 
{ /* ./Lalr/rewrite.scm 81 */
obj_t BgL_auxz00_801;
BgL_auxz00_801 = 
BGl_2zb2zb2zz__r4_numbers_6_5z00(
BINT(BGl_za2maxzd2ntza2zd2zz__lalr_rewritez00), 
BINT(((long)1))); 
BGl_za2maxzd2ntza2zd2zz__lalr_rewritez00 = 
(long)CINT(BgL_auxz00_801); } 
BGl_za2plistza2z00zz__lalr_rewritez00 = 
MAKE_PAIR(BgL_symz00_1, BGl_za2plistza2z00zz__lalr_rewritez00); 
return BgL_xz00_371;} } 
}



/* set-sym-no! */
obj_t BGl_setzd2symzd2noz12z12zz__lalr_rewritez00(obj_t BgL_symz00_2)
{ AN_OBJECT;
{ /* ./Lalr/rewrite.scm 85 */
{ /* ./Lalr/rewrite.scm 86 */
obj_t BgL_xz00_372;
BgL_xz00_372 = 
BGl_getpropz00zz__r4_symbols_6_4z00(BgL_symz00_2, BGl_symbol1984z00zz__lalr_rewritez00); 
if(
CBOOL(BgL_xz00_372))
{ /* ./Lalr/rewrite.scm 87 */
FAILURE(BGl_string1985z00zz__lalr_rewritez00,BGl_string1986z00zz__lalr_rewritez00,BgL_symz00_2);}  else 
{ /* ./Lalr/rewrite.scm 89 */
long BgL_yz00_373;
BgL_yz00_373 = BGl_za2maxzd2termza2zd2zz__lalr_rewritez00; 
BGl_putpropz12z12zz__r4_symbols_6_4z00(BgL_symz00_2, BGl_symbol1984z00zz__lalr_rewritez00, 
BINT(BGl_za2maxzd2termza2zd2zz__lalr_rewritez00)); 
BGl_za2plistza2z00zz__lalr_rewritez00 = 
MAKE_PAIR(BgL_symz00_2, BGl_za2plistza2z00zz__lalr_rewritez00); 
{ /* ./Lalr/rewrite.scm 92 */
obj_t BgL_auxz00_814;
BgL_auxz00_814 = 
BGl_2zb2zb2zz__r4_numbers_6_5z00(
BINT(BGl_za2maxzd2termza2zd2zz__lalr_rewritez00), 
BINT(((long)1))); 
BGl_za2maxzd2termza2zd2zz__lalr_rewritez00 = 
(long)CINT(BgL_auxz00_814); } 
return 
BINT(BgL_yz00_373);} } } 
}



/* symbol->symbol/binding */
obj_t BGl_symbolzd2ze3symbolzf2bindingzc3zz__lalr_rewritez00(obj_t BgL_symz00_4)
{ AN_OBJECT;
{ /* ./Lalr/rewrite.scm 99 */
{ 
obj_t BgL_lz00_375;obj_t BgL_prefixz00_376;
{ /* ./Lalr/rewrite.scm 100 */
obj_t BgL_arg1050z00_378;
{ /* ./Lalr/rewrite.scm 100 */
obj_t BgL_arg1054z00_380;
BgL_arg1054z00_380 = 
SYMBOL_TO_STRING(BgL_symz00_4); 
BgL_arg1050z00_378 = 
BGl_stringzd2ze3listz31zz__r4_strings_6_7z00(BgL_arg1054z00_380); } 
BgL_lz00_375 = BgL_arg1050z00_378; 
BgL_prefixz00_376 = BNIL; 
BgL_loopz00_377:
if(
NULLP(BgL_lz00_375))
{ /* ./Lalr/rewrite.scm 102 */
return BgL_symz00_4;}  else 
{ /* ./Lalr/rewrite.scm 104 */
obj_t BgL_cz00_382;obj_t BgL_rz00_383;
BgL_cz00_382 = 
CAR(BgL_lz00_375); 
BgL_rz00_383 = 
CDR(BgL_lz00_375); 
{ /* ./Lalr/rewrite.scm 106 */
bool_t BgL_testz00_826;
{ /* ./Lalr/rewrite.scm 106 */
unsigned char BgL_auxz00_827;
BgL_auxz00_827 = 
(unsigned char)CCHAR(BgL_cz00_382); 
BgL_testz00_826 = 
(BgL_auxz00_827==((unsigned char)'@')); } 
if(BgL_testz00_826)
{ /* ./Lalr/rewrite.scm 106 */
if(
NULLP(BgL_rz00_383))
{ /* ./Lalr/rewrite.scm 107 */
return BgL_symz00_4;}  else 
{ /* ./Lalr/rewrite.scm 109 */
obj_t BgL_arg1061z00_386;obj_t BgL_arg1064z00_387;
{ /* ./Lalr/rewrite.scm 109 */
obj_t BgL_arg1067z00_388;
BgL_arg1067z00_388 = 
BGl_listzd2ze3stringz31zz__r4_strings_6_7z00(
bgl_reverse(BgL_prefixz00_376)); 
{ /* ./Lalr/rewrite.scm 109 */
char * BgL_auxz00_834;
BgL_auxz00_834 = 
BSTRING_TO_STRING(BgL_arg1067z00_388); 
BgL_arg1061z00_386 = 
string_to_symbol(BgL_auxz00_834); } } 
{ /* ./Lalr/rewrite.scm 110 */
obj_t BgL_arg1079z00_390;
BgL_arg1079z00_390 = 
BGl_listzd2ze3stringz31zz__r4_strings_6_7z00(BgL_rz00_383); 
{ /* ./Lalr/rewrite.scm 110 */
char * BgL_auxz00_838;
BgL_auxz00_838 = 
BSTRING_TO_STRING(BgL_arg1079z00_390); 
BgL_arg1064z00_387 = 
string_to_symbol(BgL_auxz00_838); } } 
return 
MAKE_PAIR(BgL_arg1061z00_386, BgL_arg1064z00_387);} }  else 
{ /* ./Lalr/rewrite.scm 111 */
obj_t BgL_arg1084z00_391;
BgL_arg1084z00_391 = 
MAKE_PAIR(BgL_cz00_382, BgL_prefixz00_376); 
{ 
obj_t BgL_prefixz00_844;obj_t BgL_lz00_843;
BgL_lz00_843 = BgL_rz00_383; 
BgL_prefixz00_844 = BgL_arg1084z00_391; 
BgL_prefixz00_376 = BgL_prefixz00_844; 
BgL_lz00_375 = BgL_lz00_843; 
goto BgL_loopz00_377;} } } } } } } 
}



/* rewrite-grammar! */
BGL_EXPORTED_DEF obj_t BGl_rewritezd2grammarz12zc0zz__lalr_rewritez00(obj_t BgL_gramz00_5)
{ AN_OBJECT;
{ /* ./Lalr/rewrite.scm 117 */
{ /* ./Lalr/rewrite.scm 123 */
obj_t BgL_preczd2levelzd2_392;obj_t BgL_nozd2ruleszd2_393;obj_t BgL_nozd2itemszd2_394;obj_t BgL_terminalsz00_395;obj_t BgL_thezd2ruleszd2_396;
BgL_preczd2levelzd2_392 = BUNSPEC; 
BgL_nozd2ruleszd2_393 = BUNSPEC; 
BgL_nozd2itemszd2_394 = BUNSPEC; 
BgL_terminalsz00_395 = BUNSPEC; 
BgL_thezd2ruleszd2_396 = BUNSPEC; 
BgL_thezd2ruleszd2_396 = 
CDR(BgL_gramz00_5); 
BgL_terminalsz00_395 = 
CAR(BgL_gramz00_5); 
BgL_nozd2itemszd2_394 = 
BINT(((long)0)); 
BgL_nozd2ruleszd2_393 = 
BINT(((long)0)); 
BgL_preczd2levelzd2_392 = 
BINT(((long)0)); 
BGl_za2plistza2z00zz__lalr_rewritez00 = BGl_list1987z00zz__lalr_rewritez00; 
BGl_za2maxzd2ntza2zd2zz__lalr_rewritez00 = ((long)1); 
{ 
obj_t BgL_lz00_397;
BgL_lz00_397 = BgL_thezd2ruleszd2_396; 
BgL_loopz00_398:
if(
PAIRP(BgL_lz00_397))
{ /* ./Lalr/rewrite.scm 131 */
obj_t BgL_prodsz00_400;
BgL_prodsz00_400 = 
CAR(BgL_lz00_397); 
if(
PAIRP(BgL_prodsz00_400))
{ /* ./Lalr/rewrite.scm 133 */
obj_t BgL_lhsz00_402;
BgL_lhsz00_402 = 
CAR(BgL_prodsz00_400); 
if(
SYMBOLP(BgL_lhsz00_402))
{ /* ./Lalr/rewrite.scm 135 */
bool_t BgL_testz00_858;
{ /* ./Lalr/rewrite.scm 135 */
obj_t BgL_auxz00_859;
BgL_auxz00_859 = 
BGl_getpropz00zz__r4_symbols_6_4z00(BgL_lhsz00_402, BGl_symbol1982z00zz__lalr_rewritez00); 
BgL_testz00_858 = 
CBOOL(BgL_auxz00_859); } 
if(BgL_testz00_858)
{ /* ./Lalr/rewrite.scm 135 */
FAILURE(BGl_string1985z00zz__lalr_rewritez00,BGl_string1990z00zz__lalr_rewritez00,BgL_lhsz00_402);}  else 
{ /* ./Lalr/rewrite.scm 135 */
BGl_setzd2ntzd2noz12z12zz__lalr_rewritez00(BgL_lhsz00_402); 
{ 
obj_t BgL_lz00_864;
BgL_lz00_864 = 
CDR(BgL_lz00_397); 
BgL_lz00_397 = BgL_lz00_864; 
goto BgL_loopz00_398;} } }  else 
{ /* ./Lalr/rewrite.scm 134 */
FAILURE(BGl_string1985z00zz__lalr_rewritez00,BGl_string1991z00zz__lalr_rewritez00,BgL_lhsz00_402);} }  else 
{ /* ./Lalr/rewrite.scm 132 */
FAILURE(BGl_string1985z00zz__lalr_rewritez00,BGl_string1992z00zz__lalr_rewritez00,BgL_prodsz00_400);} }  else 
{ /* ./Lalr/rewrite.scm 130 */
if(
NULLP(BgL_lz00_397))
{ /* ./Lalr/rewrite.scm 148 */BFALSE; }  else 
{ /* ./Lalr/rewrite.scm 148 */
FAILURE(BGl_string1985z00zz__lalr_rewritez00,BGl_string1993z00zz__lalr_rewritez00,BgL_lz00_397);} } } 
{ /* ./Lalr/rewrite.scm 151 */
obj_t BgL_auxz00_871;
BgL_auxz00_871 = 
BGl_2zb2zb2zz__r4_numbers_6_5z00(
BINT(BGl_za2maxzd2ntza2zd2zz__lalr_rewritez00), 
BINT(((long)1))); 
BGl_za2maxzd2termza2zd2zz__lalr_rewritez00 = 
(long)CINT(BgL_auxz00_871); } 
BGl_putpropz12z12zz__r4_symbols_6_4z00(BGl_symbol1988z00zz__lalr_rewritez00, BGl_symbol1984z00zz__lalr_rewritez00, 
BINT(BGl_za2maxzd2ntza2zd2zz__lalr_rewritez00)); 
BGl_putpropz12z12zz__r4_symbols_6_4z00(BGl_symbol1989z00zz__lalr_rewritez00, BGl_symbol1984z00zz__lalr_rewritez00, 
BINT(((long)0))); 
BGl_putpropz12z12zz__r4_symbols_6_4z00(BGl_symbol1989z00zz__lalr_rewritez00, BGl_symbol1982z00zz__lalr_rewritez00, BTRUE); 
{ 
obj_t BgL_l1003z00_407;
BgL_l1003z00_407 = BgL_terminalsz00_395; 
BgL_forzd2each1004zd2_408:
if(
PAIRP(BgL_l1003z00_407))
{ /* ./Lalr/rewrite.scm 160 */
{ /* ./Lalr/rewrite.scm 163 */
obj_t BgL_tz00_410;
BgL_tz00_410 = 
CAR(BgL_l1003z00_407); 
if(
SYMBOLP(BgL_tz00_410))
{ /* ./Lalr/rewrite.scm 163 */
BGl_setzd2symzd2noz12z12zz__lalr_rewritez00(BgL_tz00_410); }  else 
{ /* ./Lalr/rewrite.scm 165 */
bool_t BgL_test1121z00_412;
if(
PAIRP(BgL_tz00_410))
{ /* ./Lalr/rewrite.scm 166 */
obj_t BgL_auxz00_889;
BgL_auxz00_889 = 
BGl_memqz00zz__r4_pairs_and_lists_6_3z00(
CAR(BgL_tz00_410), BGl_list1994z00zz__lalr_rewritez00); 
BgL_test1121z00_412 = 
CBOOL(BgL_auxz00_889); }  else 
{ /* ./Lalr/rewrite.scm 165 */
BgL_test1121z00_412 = ((bool_t)0); } 
if(BgL_test1121z00_412)
{ /* ./Lalr/rewrite.scm 165 */
{ /* ./Lalr/rewrite.scm 167 */
long BgL_za71za7_666;
BgL_za71za7_666 = 
(long)CINT(BgL_preczd2levelzd2_392); 
{ /* ./Lalr/rewrite.scm 167 */
long BgL_auxz00_895;
BgL_auxz00_895 = 
(BgL_za71za7_666+((long)1)); 
BgL_preczd2levelzd2_392 = 
BINT(BgL_auxz00_895); } } 
{ 
obj_t BgL_l1005z00_413;
{ /* ./Lalr/rewrite.scm 174 */
obj_t BgL_arg1124z00_415;
BgL_arg1124z00_415 = 
CDR(BgL_tz00_410); 
{ /* ./Lalr/rewrite.scm 168 */
bool_t BgL_auxz00_899;
BgL_l1005z00_413 = BgL_arg1124z00_415; 
BgL_forzd2each1006zd2_414:
if(
PAIRP(BgL_l1005z00_413))
{ /* ./Lalr/rewrite.scm 168 */
{ /* ./Lalr/rewrite.scm 170 */
obj_t BgL_innerzd2tzd2_417;
BgL_innerzd2tzd2_417 = 
CAR(BgL_l1005z00_413); 
if(
SYMBOLP(BgL_innerzd2tzd2_417))
{ /* ./Lalr/rewrite.scm 170 */((bool_t)0); }  else 
{ /* ./Lalr/rewrite.scm 170 */
FAILURE(BGl_string1985z00zz__lalr_rewritez00,BGl_string1998z00zz__lalr_rewritez00,BgL_innerzd2tzd2_417);} 
BGl_setzd2symzd2noz12z12zz__lalr_rewritez00(BgL_innerzd2tzd2_417); 
{ /* ./Lalr/rewrite.scm 173 */
obj_t BgL_arg1133z00_419;obj_t BgL_arg1134z00_420;
BgL_arg1133z00_419 = BGl_symbol1983z00zz__lalr_rewritez00; 
{ /* ./Lalr/rewrite.scm 173 */
obj_t BgL_arg1137z00_421;
BgL_arg1137z00_421 = 
CAR(BgL_tz00_410); 
BgL_arg1134z00_420 = 
MAKE_PAIR(BgL_arg1137z00_421, BgL_preczd2levelzd2_392); } 
BGl_putpropz12z12zz__r4_symbols_6_4z00(BgL_innerzd2tzd2_417, BgL_arg1133z00_419, BgL_arg1134z00_420); } } 
{ 
obj_t BgL_l1005z00_910;
BgL_l1005z00_910 = 
CDR(BgL_l1005z00_413); 
BgL_l1005z00_413 = BgL_l1005z00_910; 
goto BgL_forzd2each1006zd2_414;} }  else 
{ /* ./Lalr/rewrite.scm 168 */
BgL_auxz00_899 = ((bool_t)1); } 
BBOOL(BgL_auxz00_899); } } } }  else 
{ /* ./Lalr/rewrite.scm 165 */
FAILURE(BGl_string1985z00zz__lalr_rewritez00,BGl_string1998z00zz__lalr_rewritez00,BgL_tz00_410);} } } 
{ 
obj_t BgL_l1003z00_914;
BgL_l1003z00_914 = 
CDR(BgL_l1003z00_407); 
BgL_l1003z00_407 = BgL_l1003z00_914; 
goto BgL_forzd2each1004zd2_408;} }  else 
{ /* ./Lalr/rewrite.scm 160 */((bool_t)1); } } 
{ 
obj_t BgL_lz00_427;
BgL_lz00_427 = BgL_thezd2ruleszd2_396; 
BgL_loopz00_428:
if(
PAIRP(BgL_lz00_427))
{ /* ./Lalr/rewrite.scm 183 */
obj_t BgL_rulesz00_430;
BgL_rulesz00_430 = 
CAR(BgL_lz00_427); 
{ /* ./Lalr/rewrite.scm 184 */

{ 
obj_t BgL_rhszd2lzd2_432;
BgL_rhszd2lzd2_432 = 
CDR(BgL_rulesz00_430); 
BgL_loopzd21zd2_433:
if(
NULLP(BgL_rhszd2lzd2_432))
{ /* ./Lalr/rewrite.scm 187 */
{ 
obj_t BgL_lz00_921;
BgL_lz00_921 = 
CDR(BgL_lz00_427); 
BgL_lz00_427 = BgL_lz00_921; 
goto BgL_loopz00_428;} }  else 
{ /* ./Lalr/rewrite.scm 187 */
if(
PAIRP(BgL_rhszd2lzd2_432))
{ /* ./Lalr/rewrite.scm 189 */
{ /* ./Lalr/rewrite.scm 190 */
obj_t BgL_rhszf2actionzf2_438;
BgL_rhszf2actionzf2_438 = 
CAR(BgL_rhszd2lzd2_432); 
BgL_nozd2ruleszd2_393 = 
BGl_2zb2zb2zz__r4_numbers_6_5z00(BgL_nozd2ruleszd2_393, 
BINT(((long)1))); 
if(
PAIRP(BgL_rhszf2actionzf2_438))
{ /* ./Lalr/rewrite.scm 193 */
obj_t BgL_actionz00_440;
BgL_actionz00_440 = 
CDR(BgL_rhszf2actionzf2_438); 
if(
BGl_listzf3zf3zz__r4_pairs_and_lists_6_3z00(BgL_actionz00_440))
{ /* ./Lalr/rewrite.scm 194 */((bool_t)0); }  else 
{ /* ./Lalr/rewrite.scm 194 */
FAILURE(BGl_string1985z00zz__lalr_rewritez00,BGl_string1999z00zz__lalr_rewritez00,BgL_rhszf2actionzf2_438);} 
if(
NULLP(BgL_actionz00_440))
{ /* ./Lalr/rewrite.scm 196 */
SET_CDR(BgL_rhszf2actionzf2_438, BGl_list2000z00zz__lalr_rewritez00); }  else 
{ /* ./Lalr/rewrite.scm 196 */BFALSE; } 
{ 
obj_t BgL_rhsz00_443;
BgL_rhsz00_443 = 
CAR(BgL_rhszf2actionzf2_438); 
BgL_loopzd22zd2_444:
if(
NULLP(BgL_rhsz00_443))
{ /* ./Lalr/rewrite.scm 200 */
{ /* ./Lalr/rewrite.scm 202 */
long BgL_arg1189z00_447;
{ /* ./Lalr/rewrite.scm 202 */
obj_t BgL_auxz00_939;
{ /* ./Lalr/rewrite.scm 202 */
obj_t BgL_auxz00_940;
{ /* ./Lalr/rewrite.scm 202 */
long BgL_auxz00_941;
BgL_auxz00_941 = 
bgl_list_length(
CAR(BgL_rhszf2actionzf2_438)); 
BgL_auxz00_940 = 
BINT(BgL_auxz00_941); } 
BgL_auxz00_939 = 
BGl_2zb2zb2zz__r4_numbers_6_5z00(BgL_auxz00_940, 
BINT(((long)1))); } 
BgL_arg1189z00_447 = 
(long)CINT(BgL_auxz00_939); } 
BgL_nozd2itemszd2_394 = 
BGl_2zb2zb2zz__r4_numbers_6_5z00(BgL_nozd2itemszd2_394, 
BINT(BgL_arg1189z00_447)); } 
{ 
obj_t BgL_rhszd2lzd2_950;
BgL_rhszd2lzd2_950 = 
CDR(BgL_rhszd2lzd2_432); 
BgL_rhszd2lzd2_432 = BgL_rhszd2lzd2_950; 
goto BgL_loopzd21zd2_433;} }  else 
{ /* ./Lalr/rewrite.scm 200 */
if(
PAIRP(BgL_rhsz00_443))
{ /* ./Lalr/rewrite.scm 204 */
{ /* ./Lalr/rewrite.scm 205 */
obj_t BgL_symz00_453;
BgL_symz00_453 = 
CAR(BgL_rhsz00_443); 
if(
SYMBOLP(BgL_symz00_453))
{ /* ./Lalr/rewrite.scm 207 */
obj_t BgL_symzf2varzf2_455;
BgL_symzf2varzf2_455 = 
BGl_symbolzd2ze3symbolzf2bindingzc3zz__lalr_rewritez00(BgL_symz00_453); 
{ /* ./Lalr/rewrite.scm 207 */
obj_t BgL_thezd2symzd2_456;
if(
SYMBOLP(BgL_symzf2varzf2_455))
{ /* ./Lalr/rewrite.scm 208 */
BgL_thezd2symzd2_456 = BgL_symzf2varzf2_455; }  else 
{ /* ./Lalr/rewrite.scm 208 */
BgL_thezd2symzd2_456 = 
CAR(BgL_symzf2varzf2_455); } 
{ /* ./Lalr/rewrite.scm 208 */

SET_CAR(BgL_rhsz00_443, BgL_symzf2varzf2_455); 
{ /* ./Lalr/rewrite.scm 212 */
bool_t BgL_testz00_962;
{ /* ./Lalr/rewrite.scm 212 */
obj_t BgL_auxz00_963;
BgL_auxz00_963 = 
BGl_getpropz00zz__r4_symbols_6_4z00(BgL_thezd2symzd2_456, BGl_symbol1984z00zz__lalr_rewritez00); 
BgL_testz00_962 = 
CBOOL(BgL_auxz00_963); } 
if(BgL_testz00_962)
{ /* ./Lalr/rewrite.scm 212 */((bool_t)0); }  else 
{ /* ./Lalr/rewrite.scm 212 */
FAILURE(BGl_string1985z00zz__lalr_rewritez00,BGl_string2002z00zz__lalr_rewritez00,BgL_thezd2symzd2_456);} } 
{ 
obj_t BgL_rhsz00_967;
BgL_rhsz00_967 = 
CDR(BgL_rhsz00_443); 
BgL_rhsz00_443 = BgL_rhsz00_967; 
goto BgL_loopzd22zd2_444;} } } }  else 
{ /* ./Lalr/rewrite.scm 206 */
FAILURE(BGl_string1985z00zz__lalr_rewritez00,BGl_string2003z00zz__lalr_rewritez00,BgL_rhsz00_443);} } }  else 
{ /* ./Lalr/rewrite.scm 204 */
FAILURE(BGl_string1985z00zz__lalr_rewritez00,BGl_string2004z00zz__lalr_rewritez00,BgL_rhsz00_443);} } } }  else 
{ /* ./Lalr/rewrite.scm 192 */BFALSE; } } }  else 
{ /* ./Lalr/rewrite.scm 189 */
FAILURE(BGl_string1985z00zz__lalr_rewritez00,BGl_string1992z00zz__lalr_rewritez00,BgL_lz00_427);} } } } }  else 
{ /* ./Lalr/rewrite.scm 182 */BFALSE; } } 
BGl_makezd2symzd2tablez00zz__lalr_rewritez00(); 
{ /* ./Lalr/rewrite.scm 226 */
obj_t BgL_startzd2symzd2_459;
{ /* ./Lalr/rewrite.scm 226 */
obj_t BgL_pairz00_723;
BgL_pairz00_723 = BgL_thezd2ruleszd2_396; 
{ /* ./Lalr/rewrite.scm 226 */
obj_t BgL_auxz00_975;
BgL_auxz00_975 = 
CAR(BgL_pairz00_723); 
BgL_startzd2symzd2_459 = 
CAR(BgL_auxz00_975); } } 
{ /* ./Lalr/rewrite.scm 228 */
obj_t BgL_arg1233z00_460;
{ /* ./Lalr/rewrite.scm 228 */
obj_t BgL_arg1236z00_461;obj_t BgL_arg1237z00_462;
BgL_arg1236z00_461 = BGl_symbol1989z00zz__lalr_rewritez00; 
{ /* ./Lalr/rewrite.scm 228 */
obj_t BgL_arg1240z00_463;
{ /* ./Lalr/rewrite.scm 228 */
obj_t BgL_arg1244z00_465;obj_t BgL_arg1245z00_466;
{ /* ./Lalr/rewrite.scm 228 */
obj_t BgL_arg1249z00_467;
BgL_arg1249z00_467 = 
MAKE_PAIR(BGl_symbol1988z00zz__lalr_rewritez00, BNIL); 
BgL_arg1244z00_465 = 
MAKE_PAIR(BgL_startzd2symzd2_459, BgL_arg1249z00_467); } 
BgL_arg1245z00_466 = 
MAKE_PAIR(BgL_startzd2symzd2_459, BNIL); 
BgL_arg1240z00_463 = 
MAKE_PAIR(BgL_arg1244z00_465, BgL_arg1245z00_466); } 
BgL_arg1237z00_462 = 
MAKE_PAIR(BgL_arg1240z00_463, BNIL); } 
BgL_arg1233z00_460 = 
MAKE_PAIR(BgL_arg1236z00_461, BgL_arg1237z00_462); } 
BGl_grammarz00zz__lalr_globalz00 = 
MAKE_PAIR(BgL_arg1233z00_460, BgL_thezd2ruleszd2_396); } } 
BGl_nrulesz00zz__lalr_globalz00 = 
BGl_2zb2zb2zz__r4_numbers_6_5z00(BgL_nozd2ruleszd2_393, 
BINT(((long)2))); 
BGl_nitemsz00zz__lalr_globalz00 = 
BGl_2zb2zb2zz__r4_numbers_6_5z00(BgL_nozd2itemszd2_394, 
BINT(((long)3))); 
BGl_ntermsz00zz__lalr_globalz00 = 
BINT(BGl_za2maxzd2termza2zd2zz__lalr_rewritez00); 
BGl_nvarsz00zz__lalr_globalz00 = 
BINT(BGl_za2maxzd2ntza2zd2zz__lalr_rewritez00); 
return ( 
BGl_nsymsz00zz__lalr_globalz00 = 
BGl_2zb2zb2zz__r4_numbers_6_5z00(BGl_ntermsz00zz__lalr_globalz00, BGl_nvarsz00zz__lalr_globalz00), BUNSPEC) ;} } 
}



/* _rewrite-grammar! */
obj_t BGl__rewritezd2grammarz12zc0zz__lalr_rewritez00(obj_t BgL_envz00_738, obj_t BgL_gramz00_739)
{ AN_OBJECT;
{ /* ./Lalr/rewrite.scm 117 */
return 
BGl_rewritezd2grammarz12zc0zz__lalr_rewritez00(BgL_gramz00_739);} 
}



/* imported-modules-init */
obj_t BGl_importedzd2moduleszd2initz00zz__lalr_rewritez00()
{ AN_OBJECT;
{ /* ./Lalr/rewrite.scm 11 */
BGl_modulezd2initializa7ationz75zz__errorz00(((long)11084), "__lalr_rewrite"); 
return 
BGl_modulezd2initializa7ationz75zz__lalr_globalz00(((long)27747), "__lalr_rewrite");} 
}

