From aab51b985946740e209b419e84d803b1e774f96f Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Fri, 1 Oct 2021 14:47:50 +0900 Subject: Imported Upstream version 20170201 --- CHANGES | 30 + MANIFEST | 30 +- VERSION | 2 +- aclocal.m4 | 14 +- config.guess | 6 +- config.sub | 11 +- configure | 365 +++--- defs.h | 3 +- main.c | 11 +- package/byacc.spec | 4 +- package/debian/changelog | 6 + package/debian/copyright | 2 +- package/mingw-byacc.spec | 4 +- package/pkgsrc/Makefile | 2 +- reader.c | 200 ++- test/btyacc/expr.oxout.error | 1 + test/btyacc/expr.oxout.output | 227 ++++ test/btyacc/expr.oxout.tab.c | 2752 +++++++++++++++++++++++++++++++++++++++++ test/btyacc/expr.oxout.tab.h | 20 + test/expr.oxout.y | 1446 ++++++++++++++++++++++ test/yacc/expr.oxout.error | 1 + test/yacc/expr.oxout.output | 209 ++++ test/yacc/expr.oxout.tab.c | 1958 +++++++++++++++++++++++++++++ test/yacc/expr.oxout.tab.h | 15 + 24 files changed, 7105 insertions(+), 214 deletions(-) create mode 100644 test/btyacc/expr.oxout.error create mode 100644 test/btyacc/expr.oxout.output create mode 100644 test/btyacc/expr.oxout.tab.c create mode 100644 test/btyacc/expr.oxout.tab.h create mode 100644 test/expr.oxout.y create mode 100644 test/yacc/expr.oxout.error create mode 100644 test/yacc/expr.oxout.output create mode 100644 test/yacc/expr.oxout.tab.c create mode 100644 test/yacc/expr.oxout.tab.h diff --git a/CHANGES b/CHANGES index cef17ea..21c3989 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,33 @@ +2017-02-01 Thomas E. Dickey + + * test/btyacc/expr.oxout.error, test/btyacc/expr.oxout.output, test/btyacc/expr.oxout.tab.c, test/btyacc/expr.oxout.tab.h, test/yacc/expr.oxout.error, test/yacc/expr.oxout.output, test/yacc/expr.oxout.tab.c, test/yacc/expr.oxout.tab.h: + RCS_BASE + + * package/debian/copyright: update copyright + + * reader.c, defs.h, main.c: + avoid using regex.h since some low-end platforms do not have this + + * test/expr.oxout.y: RCS_BASE + + * configure: regen + + * aclocal.m4: quiet a strict gcc warning in CF_MKSTEMP + +2017-02-01 Tom.Shields + + * main.c, reader.c, defs.h: + process #line directives, like bison and flex + +2017-02-01 Thomas E. Dickey + + * VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile: + bump + +2016-12-31 Thomas E. Dickey + + * config.guess, config.sub: 2017-01-01 + 2016-12-02 Thomas E. Dickey * test/btyacc/quote_calc4-s.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/error.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/ok_syntax1.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c, test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/rename_debug.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c, test/btyacc/btyacc_destroy3.tab.c, btyaccpar.c: diff --git a/MANIFEST b/MANIFEST index 7426e2f..e67f197 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,4 +1,4 @@ -MANIFEST for byacc-20161202, version t20161202 +MANIFEST for byacc-20170201, version t20170201 -------------------------------------------------------------------------------- MANIFEST this file ACKNOWLEDGEMENTS original version of byacc - 1993 @@ -77,6 +77,22 @@ test/btyacc/btyacc_demo.error reference output for testing test/btyacc/btyacc_demo.output reference output for testing test/btyacc/btyacc_demo.tab.c reference output for testing test/btyacc/btyacc_demo.tab.h reference output for testing +test/btyacc/btyacc_demo2.error reference output for testing +test/btyacc/btyacc_demo2.output reference output for testing +test/btyacc/btyacc_demo2.tab.c reference output for testing +test/btyacc/btyacc_demo2.tab.h reference output for testing +test/btyacc/btyacc_destroy1.error reference output for testing +test/btyacc/btyacc_destroy1.output reference output for testing +test/btyacc/btyacc_destroy1.tab.c reference output for testing +test/btyacc/btyacc_destroy1.tab.h reference output for testing +test/btyacc/btyacc_destroy2.error reference output for testing +test/btyacc/btyacc_destroy2.output reference output for testing +test/btyacc/btyacc_destroy2.tab.c reference output for testing +test/btyacc/btyacc_destroy2.tab.h reference output for testing +test/btyacc/btyacc_destroy3.error reference output for testing +test/btyacc/btyacc_destroy3.output reference output for testing +test/btyacc/btyacc_destroy3.tab.c reference output for testing +test/btyacc/btyacc_destroy3.tab.h reference output for testing test/btyacc/calc.error reference output for testing test/btyacc/calc.output reference output for testing test/btyacc/calc.tab.c reference output for testing @@ -256,6 +272,10 @@ test/btyacc/error.error reference output for testing test/btyacc/error.output reference output for testing test/btyacc/error.tab.c reference output for testing test/btyacc/error.tab.h reference output for testing +test/btyacc/expr.oxout.error reference output for testing +test/btyacc/expr.oxout.output reference output for testing +test/btyacc/expr.oxout.tab.c reference output for testing +test/btyacc/expr.oxout.tab.h reference output for testing test/btyacc/grammar.dot reference output for testing test/btyacc/grammar.error reference output for testing test/btyacc/grammar.output reference output for testing @@ -359,6 +379,9 @@ test/btyacc/varsyntax_calc1.tab.h reference output for testing test subdirectory test/btyacc_calc1.y testcase for btyacc test/btyacc_demo.y testcase for btyacc +test/btyacc_destroy1.y btyacc test-case for %parse-param +test/btyacc_destroy2.y btyacc test-case for %parse-param +test/btyacc_destroy3.y btyacc test-case for %parse-param test/calc.y example from VMS freeware version of byacc test/calc1.y advanced example from Steve Johnson's paper. test/calc2.y test-cases and reference files for %lex-param / %parse-param @@ -403,6 +426,7 @@ test/err_syntax8.y testcase for used_reserved() test/err_syntax8a.y testcase for used_reserved() test/err_syntax9.y testcase for tokenized_start() test/error.y original version of byacc - 1993 +test/expr.oxout.y test-case for "#line" feature test/grammar.y grammar from cproto test/inherit0.y testcase for btyacc test/inherit1.y testcase for btyacc @@ -577,6 +601,10 @@ test/yacc/error.error reference output for testing test/yacc/error.output reference output for testing test/yacc/error.tab.c reference output for testing test/yacc/error.tab.h reference output for testing +test/yacc/expr.oxout.error reference output for testing +test/yacc/expr.oxout.output reference output for testing +test/yacc/expr.oxout.tab.c reference output for testing +test/yacc/expr.oxout.tab.h reference output for testing test/yacc/grammar.dot reference output for testing test/yacc/grammar.error reference output for testing test/yacc/grammar.output reference output for testing diff --git a/VERSION b/VERSION index b720a20..4a9183d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -20161202 +20170201 diff --git a/aclocal.m4 b/aclocal.m4 index 917a848..a3d6aa0 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,7 @@ -dnl $Id: aclocal.m4,v 1.41 2016/12/02 13:03:06 tom Exp $ +dnl $Id: aclocal.m4,v 1.42 2017/02/01 10:12:21 tom Exp $ dnl Macros for byacc configure script (Thomas E. Dickey) dnl --------------------------------------------------------------------------- -dnl Copyright 2004-2015,2016 Thomas E. Dickey +dnl Copyright 2004-2016,2017 Thomas E. Dickey dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the @@ -803,20 +803,26 @@ fi test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MKSTEMP version: 9 updated: 2012/10/03 04:34:49 +dnl CF_MKSTEMP version: 10 updated: 2017/01/21 11:12:16 dnl ---------- dnl Check for a working mkstemp. This creates two files, checks that they are dnl successfully created and distinct (AmigaOS apparently fails on the last). AC_DEFUN([CF_MKSTEMP],[ +AC_CHECK_HEADERS( \ +unistd.h \ +) AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[ rm -rf conftest* AC_TRY_RUN([ #include +#ifdef HAVE_UNISTD_H +#include +#endif #include #include #include #include -int main() +int main(void) { char *tmpl = "conftestXXXXXX"; char name[2][80]; diff --git a/config.guess b/config.guess index 2e9ad7f..bbd48b6 100755 --- a/config.guess +++ b/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2016-10-02' +timestamp='2017-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." diff --git a/config.sub b/config.sub index 3478c1f..7e792b4 100755 --- a/config.sub +++ b/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2016-11-19' +timestamp='2017-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -67,7 +67,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -1409,7 +1409,7 @@ case $os in | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ - | -onefs* | -tirtos* | -phoenix* | -fuchsia*) + | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1638,6 +1638,9 @@ case $basic_machine in sparc-* | *-sun) os=-sunos4.1.1 ;; + pru-*) + os=-elf + ;; *-be) os=-beos ;; diff --git a/configure b/configure index 9707e50..a636db7 100755 --- a/configure +++ b/configure @@ -3911,7 +3911,57 @@ EOF fi done -echo "$as_me:3914: checking for working mkstemp" >&5 +for ac_header in \ +unistd.h \ + +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:3919: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3925 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:3929: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:3935: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:3954: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 echo $ECHO_N "checking for working mkstemp... $ECHO_C" >&6 if test "${cf_cv_func_mkstemp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3922,15 +3972,18 @@ if test "$cross_compiling" = yes; then cf_cv_func_mkstemp=maybe else cat >conftest.$ac_ext <<_ACEOF -#line 3925 "configure" +#line 3975 "configure" #include "confdefs.h" #include +#ifdef HAVE_UNISTD_H +#include +#endif #include #include #include #include -int main() +int main(void) { char *tmpl = "conftestXXXXXX"; char name[2][80]; @@ -3960,15 +4013,15 @@ int main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:3963: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4016: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:3966: \$? = $ac_status" >&5 + echo "$as_me:4019: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:3968: \"$ac_try\"") >&5 + { (eval echo "$as_me:4021: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3971: \$? = $ac_status" >&5 + echo "$as_me:4024: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_func_mkstemp=yes @@ -3983,16 +4036,16 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:3986: result: $cf_cv_func_mkstemp" >&5 +echo "$as_me:4039: result: $cf_cv_func_mkstemp" >&5 echo "${ECHO_T}$cf_cv_func_mkstemp" >&6 if test "x$cf_cv_func_mkstemp" = xmaybe ; then - echo "$as_me:3989: checking for mkstemp" >&5 + echo "$as_me:4042: checking for mkstemp" >&5 echo $ECHO_N "checking for mkstemp... $ECHO_C" >&6 if test "${ac_cv_func_mkstemp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 3995 "configure" +#line 4048 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char mkstemp (); below. */ @@ -4023,16 +4076,16 @@ f = mkstemp; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4026: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4079: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4029: \$? = $ac_status" >&5 + echo "$as_me:4082: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4032: \"$ac_try\"") >&5 + { (eval echo "$as_me:4085: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4035: \$? = $ac_status" >&5 + echo "$as_me:4088: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mkstemp=yes else @@ -4042,7 +4095,7 @@ ac_cv_func_mkstemp=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:4045: result: $ac_cv_func_mkstemp" >&5 +echo "$as_me:4098: result: $ac_cv_func_mkstemp" >&5 echo "${ECHO_T}$ac_cv_func_mkstemp" >&6 fi @@ -4057,13 +4110,13 @@ fi for ac_func in vsnprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:4060: checking for $ac_func" >&5 +echo "$as_me:4113: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4066 "configure" +#line 4119 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -4094,16 +4147,16 @@ f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4097: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4150: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4100: \$? = $ac_status" >&5 + echo "$as_me:4153: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4103: \"$ac_try\"") >&5 + { (eval echo "$as_me:4156: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4106: \$? = $ac_status" >&5 + echo "$as_me:4159: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -4113,7 +4166,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:4116: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:4169: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 +echo "$as_me:4179: checking for maximum table size" >&5 echo $ECHO_N "checking for maximum table size... $ECHO_C" >&6 # Check whether --with-max-table-size or --without-max-table-size was given. @@ -4133,12 +4186,12 @@ if test "${with_max_table_size+set}" = set; then fi; if test -n "$with_max_table_size" then - echo "$as_me:4136: result: $with_max_table_size" >&5 + echo "$as_me:4189: result: $with_max_table_size" >&5 echo "${ECHO_T}$with_max_table_size" >&6 check=`expr "$with_max_table_size" + 0` if test "x$check" != "x$with_max_table_size" then - { { echo "$as_me:4141: error: invalid value for --with-max-table-size: $with_max_table_size" >&5 + { { echo "$as_me:4194: error: invalid value for --with-max-table-size: $with_max_table_size" >&5 echo "$as_me: error: invalid value for --with-max-table-size: $with_max_table_size" >&2;} { (exit 1); exit 1; }; } fi @@ -4148,11 +4201,11 @@ cat >>confdefs.h <&5 + echo "$as_me:4204: result: default" >&5 echo "${ECHO_T}default" >&6 fi -echo "$as_me:4155: checking if backtracking extension is wanted" >&5 +echo "$as_me:4208: checking if backtracking extension is wanted" >&5 echo $ECHO_N "checking if backtracking extension is wanted... $ECHO_C" >&6 # Check whether --enable-btyacc or --disable-btyacc was given. @@ -4160,7 +4213,7 @@ if test "${enable_btyacc+set}" = set; then enableval="$enable_btyacc" fi; -echo "$as_me:4163: result: $enable_btyacc" >&5 +echo "$as_me:4216: result: $enable_btyacc" >&5 echo "${ECHO_T}$enable_btyacc" >&6 if test "$enable_btyacc" = "yes"; then @@ -4175,7 +4228,7 @@ fi if ( test "$GCC" = yes || test "$GXX" = yes ) then -echo "$as_me:4178: checking if you want to check for gcc warnings" >&5 +echo "$as_me:4231: checking if you want to check for gcc warnings" >&5 echo $ECHO_N "checking if you want to check for gcc warnings... $ECHO_C" >&6 # Check whether --with-warnings or --without-warnings was given. @@ -4185,7 +4238,7 @@ if test "${with_warnings+set}" = set; then else cf_opt_with_warnings=no fi; -echo "$as_me:4188: result: $cf_opt_with_warnings" >&5 +echo "$as_me:4241: result: $cf_opt_with_warnings" >&5 echo "${ECHO_T}$cf_opt_with_warnings" >&6 if test "$cf_opt_with_warnings" != no ; then @@ -4207,10 +4260,10 @@ cat > conftest.i <&5 + { echo "$as_me:4263: checking for $CC __attribute__ directives..." >&5 echo "$as_me: checking for $CC __attribute__ directives..." >&6;} cat > conftest.$ac_ext <&5 + if { (eval echo "$as_me:4315: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4265: \$? = $ac_status" >&5 + echo "$as_me:4318: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4267: result: ... $cf_attribute" >&5 + test -n "$verbose" && echo "$as_me:4320: result: ... $cf_attribute" >&5 echo "${ECHO_T}... $cf_attribute" >&6 cat conftest.h >>confdefs.h case $cf_attribute in @@ -4328,12 +4381,12 @@ INTEL_COMPILER=no if test "$GCC" = yes ; then case $host_os in (linux*|gnu*) - echo "$as_me:4331: checking if this is really Intel C compiler" >&5 + echo "$as_me:4384: checking if this is really Intel C compiler" >&5 echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -no-gcc" cat >conftest.$ac_ext <<_ACEOF -#line 4336 "configure" +#line 4389 "configure" #include "confdefs.h" int @@ -4350,16 +4403,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4353: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4406: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4356: \$? = $ac_status" >&5 + echo "$as_me:4409: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4359: \"$ac_try\"") >&5 + { (eval echo "$as_me:4412: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4362: \$? = $ac_status" >&5 + echo "$as_me:4415: \$? = $ac_status" >&5 (exit $ac_status); }; }; then INTEL_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147" @@ -4370,7 +4423,7 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" - echo "$as_me:4373: result: $INTEL_COMPILER" >&5 + echo "$as_me:4426: result: $INTEL_COMPILER" >&5 echo "${ECHO_T}$INTEL_COMPILER" >&6 ;; esac @@ -4379,12 +4432,12 @@ fi CLANG_COMPILER=no if test "$GCC" = yes ; then - echo "$as_me:4382: checking if this is really Clang C compiler" >&5 + echo "$as_me:4435: checking if this is really Clang C compiler" >&5 echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Qunused-arguments" cat >conftest.$ac_ext <<_ACEOF -#line 4387 "configure" +#line 4440 "configure" #include "confdefs.h" int @@ -4401,16 +4454,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4404: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4457: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4407: \$? = $ac_status" >&5 + echo "$as_me:4460: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4410: \"$ac_try\"") >&5 + { (eval echo "$as_me:4463: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4413: \$? = $ac_status" >&5 + echo "$as_me:4466: \$? = $ac_status" >&5 (exit $ac_status); }; }; then CLANG_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" @@ -4421,12 +4474,12 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" - echo "$as_me:4424: result: $CLANG_COMPILER" >&5 + echo "$as_me:4477: result: $CLANG_COMPILER" >&5 echo "${ECHO_T}$CLANG_COMPILER" >&6 fi cat > conftest.$ac_ext <&5 + { echo "$as_me:4499: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-Wall" @@ -4459,12 +4512,12 @@ echo "$as_me: checking for $CC warning options..." >&6;} wd981 do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo "$as_me:4462: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4515: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4465: \$? = $ac_status" >&5 + echo "$as_me:4518: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4467: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:4520: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi @@ -4473,7 +4526,7 @@ echo "${ECHO_T}... -$cf_opt" >&6 elif test "$GCC" = yes then - { echo "$as_me:4476: checking for $CC warning options..." >&5 + { echo "$as_me:4529: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS= @@ -4497,12 +4550,12 @@ echo "$as_me: checking for $CC warning options..." >&6;} Wundef $cf_gcc_warnings $cf_warn_CONST Wwrite-strings do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo "$as_me:4500: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4553: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4503: \$? = $ac_status" >&5 + echo "$as_me:4556: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4505: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:4558: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 case $cf_opt in (Wcast-qual) @@ -4513,7 +4566,7 @@ echo "${ECHO_T}... -$cf_opt" >&6 ([34].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 -echo "${as_me:-configure}:4516: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 +echo "${as_me:-configure}:4569: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -4523,7 +4576,7 @@ echo "${as_me:-configure}:4516: testing feature is broken in gcc $GCC_VERSION .. ([12].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 -echo "${as_me:-configure}:4526: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 +echo "${as_me:-configure}:4579: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -4539,7 +4592,7 @@ rm -rf conftest* fi fi -echo "$as_me:4542: checking if you want to see long compiling messages" >&5 +echo "$as_me:4595: checking if you want to see long compiling messages" >&5 echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 # Check whether --enable-echo or --disable-echo was given. @@ -4573,10 +4626,10 @@ else ECHO_CC='' fi; -echo "$as_me:4576: result: $enableval" >&5 +echo "$as_me:4629: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 -echo "$as_me:4579: checking if you want to use dmalloc for testing" >&5 +echo "$as_me:4632: checking if you want to use dmalloc for testing" >&5 echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6 # Check whether --with-dmalloc or --without-dmalloc was given. @@ -4593,7 +4646,7 @@ EOF else with_dmalloc= fi; -echo "$as_me:4596: result: ${with_dmalloc:-no}" >&5 +echo "$as_me:4649: result: ${with_dmalloc:-no}" >&5 echo "${ECHO_T}${with_dmalloc:-no}" >&6 case .$with_cflags in @@ -4687,23 +4740,23 @@ fi esac if test "$with_dmalloc" = yes ; then - echo "$as_me:4690: checking for dmalloc.h" >&5 + echo "$as_me:4743: checking for dmalloc.h" >&5 echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6 if test "${ac_cv_header_dmalloc_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4696 "configure" +#line 4749 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:4700: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4753: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:4706: \$? = $ac_status" >&5 + echo "$as_me:4759: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4722,11 +4775,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4725: result: $ac_cv_header_dmalloc_h" >&5 +echo "$as_me:4778: result: $ac_cv_header_dmalloc_h" >&5 echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6 if test $ac_cv_header_dmalloc_h = yes; then -echo "$as_me:4729: checking for dmalloc_debug in -ldmalloc" >&5 +echo "$as_me:4782: checking for dmalloc_debug in -ldmalloc" >&5 echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6 if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4734,7 +4787,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4737 "configure" +#line 4790 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4753,16 +4806,16 @@ dmalloc_debug (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4756: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4809: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4759: \$? = $ac_status" >&5 + echo "$as_me:4812: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4762: \"$ac_try\"") >&5 + { (eval echo "$as_me:4815: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4765: \$? = $ac_status" >&5 + echo "$as_me:4818: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dmalloc_dmalloc_debug=yes else @@ -4773,7 +4826,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4776: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 +echo "$as_me:4829: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6 if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then cat >>confdefs.h <&5 +echo "$as_me:4844: checking if you want to use dbmalloc for testing" >&5 echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6 # Check whether --with-dbmalloc or --without-dbmalloc was given. @@ -4805,7 +4858,7 @@ EOF else with_dbmalloc= fi; -echo "$as_me:4808: result: ${with_dbmalloc:-no}" >&5 +echo "$as_me:4861: result: ${with_dbmalloc:-no}" >&5 echo "${ECHO_T}${with_dbmalloc:-no}" >&6 case .$with_cflags in @@ -4899,23 +4952,23 @@ fi esac if test "$with_dbmalloc" = yes ; then - echo "$as_me:4902: checking for dbmalloc.h" >&5 + echo "$as_me:4955: checking for dbmalloc.h" >&5 echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6 if test "${ac_cv_header_dbmalloc_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4908 "configure" +#line 4961 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:4912: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4965: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:4918: \$? = $ac_status" >&5 + echo "$as_me:4971: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4934,11 +4987,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4937: result: $ac_cv_header_dbmalloc_h" >&5 +echo "$as_me:4990: result: $ac_cv_header_dbmalloc_h" >&5 echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6 if test $ac_cv_header_dbmalloc_h = yes; then -echo "$as_me:4941: checking for debug_malloc in -ldbmalloc" >&5 +echo "$as_me:4994: checking for debug_malloc in -ldbmalloc" >&5 echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6 if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4946,7 +4999,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldbmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4949 "configure" +#line 5002 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4965,16 +5018,16 @@ debug_malloc (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4968: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5021: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4971: \$? = $ac_status" >&5 + echo "$as_me:5024: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4974: \"$ac_try\"") >&5 + { (eval echo "$as_me:5027: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4977: \$? = $ac_status" >&5 + echo "$as_me:5030: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dbmalloc_debug_malloc=yes else @@ -4985,7 +5038,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4988: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 +echo "$as_me:5041: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6 if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then cat >>confdefs.h <&5 +echo "$as_me:5056: checking if you want to use valgrind for testing" >&5 echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6 # Check whether --with-valgrind or --without-valgrind was given. @@ -5017,7 +5070,7 @@ EOF else with_valgrind= fi; -echo "$as_me:5020: result: ${with_valgrind:-no}" >&5 +echo "$as_me:5073: result: ${with_valgrind:-no}" >&5 echo "${ECHO_T}${with_valgrind:-no}" >&6 case .$with_cflags in @@ -5110,7 +5163,7 @@ fi ;; esac -echo "$as_me:5113: checking if you want to perform memory-leak testing" >&5 +echo "$as_me:5166: checking if you want to perform memory-leak testing" >&5 echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6 # Check whether --enable-leaks or --disable-leaks was given. @@ -5120,7 +5173,7 @@ if test "${enable_leaks+set}" = set; then else : ${with_no_leaks:=no} fi; -echo "$as_me:5123: result: $with_no_leaks" >&5 +echo "$as_me:5176: result: $with_no_leaks" >&5 echo "${ECHO_T}$with_no_leaks" >&6 if test "$with_no_leaks" = yes ; then @@ -5137,7 +5190,7 @@ fi # Extract the first word of "groff", so it can be a program name with args. set dummy groff; ac_word=$2 -echo "$as_me:5140: checking for $ac_word" >&5 +echo "$as_me:5193: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_GROFF_PATH+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -5154,7 +5207,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_GROFF_PATH="$ac_dir/$ac_word" - echo "$as_me:5157: found $ac_dir/$ac_word" >&5 + echo "$as_me:5210: found $ac_dir/$ac_word" >&5 break fi done @@ -5166,16 +5219,16 @@ fi GROFF_PATH=$ac_cv_path_GROFF_PATH if test -n "$GROFF_PATH"; then - echo "$as_me:5169: result: $GROFF_PATH" >&5 + echo "$as_me:5222: result: $GROFF_PATH" >&5 echo "${ECHO_T}$GROFF_PATH" >&6 else - echo "$as_me:5172: result: no" >&5 + echo "$as_me:5225: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "nroff", so it can be a program name with args. set dummy nroff; ac_word=$2 -echo "$as_me:5178: checking for $ac_word" >&5 +echo "$as_me:5231: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_NROFF_PATH+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -5192,7 +5245,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_NROFF_PATH="$ac_dir/$ac_word" - echo "$as_me:5195: found $ac_dir/$ac_word" >&5 + echo "$as_me:5248: found $ac_dir/$ac_word" >&5 break fi done @@ -5204,10 +5257,10 @@ fi NROFF_PATH=$ac_cv_path_NROFF_PATH if test -n "$NROFF_PATH"; then - echo "$as_me:5207: result: $NROFF_PATH" >&5 + echo "$as_me:5260: result: $NROFF_PATH" >&5 echo "${ECHO_T}$NROFF_PATH" >&6 else - echo "$as_me:5210: result: no" >&5 + echo "$as_me:5263: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -5220,7 +5273,7 @@ else GROFF_NOTE= fi -echo "$as_me:5223: checking for program to convert manpage to html" >&5 +echo "$as_me:5276: checking for program to convert manpage to html" >&5 echo $ECHO_N "checking for program to convert manpage to html... $ECHO_C" >&6 # Check whether --with-man2html or --without-man2html was given. @@ -5235,11 +5288,11 @@ cf_with_groff=no case $cf_man2html in (yes) - echo "$as_me:5238: result: man2html" >&5 + echo "$as_me:5291: result: man2html" >&5 echo "${ECHO_T}man2html" >&6 # Extract the first word of "man2html", so it can be a program name with args. set dummy man2html; ac_word=$2 -echo "$as_me:5242: checking for $ac_word" >&5 +echo "$as_me:5295: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_cf_man2html+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -5256,7 +5309,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_cf_man2html="$ac_dir/$ac_word" - echo "$as_me:5259: found $ac_dir/$ac_word" >&5 + echo "$as_me:5312: found $ac_dir/$ac_word" >&5 break fi done @@ -5268,10 +5321,10 @@ fi cf_man2html=$ac_cv_path_cf_man2html if test -n "$cf_man2html"; then - echo "$as_me:5271: result: $cf_man2html" >&5 + echo "$as_me:5324: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 else - echo "$as_me:5274: result: no" >&5 + echo "$as_me:5327: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -5279,11 +5332,11 @@ fi (no|groff|*/groff*) cf_with_groff=yes cf_man2html=$GROFF_PATH - echo "$as_me:5282: result: $cf_man2html" >&5 + echo "$as_me:5335: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 ;; (*) - echo "$as_me:5286: result: $cf_man2html" >&5 + echo "$as_me:5339: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 ;; esac @@ -5347,14 +5400,14 @@ case ".$cf_man2html" in cf_man2html=`echo $cf_man2html | sed -e s%NONE%$cf_path_syntax%` ;; (*) - { { echo "$as_me:5350: error: expected a pathname, not \"$cf_man2html\"" >&5 + { { echo "$as_me:5403: error: expected a pathname, not \"$cf_man2html\"" >&5 echo "$as_me: error: expected a pathname, not \"$cf_man2html\"" >&2;} { (exit 1); exit 1; }; } ;; esac MAN2HTML_PATH="$cf_man2html" - echo "$as_me:5357: checking for $cf_man2html top/bottom margins" >&5 + echo "$as_me:5410: checking for $cf_man2html top/bottom margins" >&5 echo $ECHO_N "checking for $cf_man2html top/bottom margins... $ECHO_C" >&6 # for this example, expect 3 lines of content, the remainder is head/foot @@ -5372,10 +5425,10 @@ CF_EOF cf_man2html_bot=`expr $cf_man2html_bot - 2 - $cf_man2html_top` cf_man2html_top_bot="-topm=$cf_man2html_top -botm=$cf_man2html_bot" - echo "$as_me:5375: result: $cf_man2html_top_bot" >&5 + echo "$as_me:5428: result: $cf_man2html_top_bot" >&5 echo "${ECHO_T}$cf_man2html_top_bot" >&6 - echo "$as_me:5378: checking for pagesize to use" >&5 + echo "$as_me:5431: checking for pagesize to use" >&5 echo $ECHO_N "checking for pagesize to use... $ECHO_C" >&6 for cf_block in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 do @@ -5400,7 +5453,7 @@ CF_EOF test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999 rm -rf conftest* - echo "$as_me:5403: result: $cf_man2html_page" >&5 + echo "$as_me:5456: result: $cf_man2html_page" >&5 echo "${ECHO_T}$cf_man2html_page" >&6 cat >>$MAN2HTML_TEMP <&5 +echo "$as_me:5475: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5428 "configure" +#line 5481 "configure" #include "confdefs.h" #include #include @@ -5433,13 +5486,13 @@ else #include _ACEOF -if { (eval echo "$as_me:5436: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:5489: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:5442: \$? = $ac_status" >&5 + echo "$as_me:5495: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -5461,7 +5514,7 @@ rm -f conftest.err conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line 5464 "configure" +#line 5517 "configure" #include "confdefs.h" #include @@ -5479,7 +5532,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line 5482 "configure" +#line 5535 "configure" #include "confdefs.h" #include @@ -5500,7 +5553,7 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line 5503 "configure" +#line 5556 "configure" #include "confdefs.h" #include #if ((' ' & 0x0FF) == 0x020) @@ -5526,15 +5579,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:5529: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5582: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5532: \$? = $ac_status" >&5 + echo "$as_me:5585: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:5534: \"$ac_try\"") >&5 + { (eval echo "$as_me:5587: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5537: \$? = $ac_status" >&5 + echo "$as_me:5590: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -5547,7 +5600,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi -echo "$as_me:5550: result: $ac_cv_header_stdc" >&5 +echo "$as_me:5603: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then @@ -5563,28 +5616,28 @@ for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:5566: checking for $ac_header" >&5 +echo "$as_me:5619: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5572 "configure" +#line 5625 "configure" #include "confdefs.h" $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:5578: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:5631: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:5581: \$? = $ac_status" >&5 + echo "$as_me:5634: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:5584: \"$ac_try\"") >&5 + { (eval echo "$as_me:5637: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5587: \$? = $ac_status" >&5 + echo "$as_me:5640: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else @@ -5594,7 +5647,7 @@ eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:5597: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:5650: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 +echo "$as_me:5660: checking for mode_t" >&5 echo $ECHO_N "checking for mode_t... $ECHO_C" >&6 if test "${ac_cv_type_mode_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5613 "configure" +#line 5666 "configure" #include "confdefs.h" $ac_includes_default int @@ -5625,16 +5678,16 @@ if (sizeof (mode_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:5628: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:5681: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:5631: \$? = $ac_status" >&5 + echo "$as_me:5684: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:5634: \"$ac_try\"") >&5 + { (eval echo "$as_me:5687: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5637: \$? = $ac_status" >&5 + echo "$as_me:5690: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_mode_t=yes else @@ -5644,7 +5697,7 @@ ac_cv_type_mode_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:5647: result: $ac_cv_type_mode_t" >&5 +echo "$as_me:5700: result: $ac_cv_type_mode_t" >&5 echo "${ECHO_T}$ac_cv_type_mode_t" >&6 if test $ac_cv_type_mode_t = yes; then : @@ -5737,7 +5790,7 @@ DEFS=-DHAVE_CONFIG_H : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:5740: creating $CONFIG_STATUS" >&5 +{ echo "$as_me:5793: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -5910,7 +5963,7 @@ cat >>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:5913: error: ambiguous option: $1 + { { echo "$as_me:5966: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} @@ -5929,7 +5982,7 @@ Try \`$0 --help' for more information." >&2;} ac_need_defaults=false;; # This is an error. - -*) { { echo "$as_me:5932: error: unrecognized option: $1 + -*) { { echo "$as_me:5985: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} @@ -5966,7 +6019,7 @@ do # Handling of arguments. "makefile" ) CONFIG_FILES="$CONFIG_FILES makefile" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config_h.in" ;; - *) { { echo "$as_me:5969: error: invalid argument: $ac_config_target" >&5 + *) { { echo "$as_me:6022: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac @@ -6227,7 +6280,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:6230: creating $ac_file" >&5 + { echo "$as_me:6283: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -6245,7 +6298,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:6248: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:6301: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -6258,7 +6311,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:6261: error: cannot find input file: $f" >&5 + { { echo "$as_me:6314: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -6274,7 +6327,7 @@ cat >>$CONFIG_STATUS <<\EOF if test -n "$ac_seen"; then ac_used=`grep '@datarootdir@' $ac_item` if test -z "$ac_used"; then - { echo "$as_me:6277: WARNING: datarootdir was used implicitly but not set: + { echo "$as_me:6330: WARNING: datarootdir was used implicitly but not set: $ac_seen" >&5 echo "$as_me: WARNING: datarootdir was used implicitly but not set: $ac_seen" >&2;} @@ -6283,7 +6336,7 @@ $ac_seen" >&2;} fi ac_seen=`grep '${datarootdir}' $ac_item` if test -n "$ac_seen"; then - { echo "$as_me:6286: WARNING: datarootdir was used explicitly but not set: + { echo "$as_me:6339: WARNING: datarootdir was used explicitly but not set: $ac_seen" >&5 echo "$as_me: WARNING: datarootdir was used explicitly but not set: $ac_seen" >&2;} @@ -6320,7 +6373,7 @@ s,@INSTALL@,$ac_INSTALL,;t t ac_init=`egrep '[ ]*'$ac_name'[ ]*=' $ac_file` if test -z "$ac_init"; then ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'` - { echo "$as_me:6323: WARNING: Variable $ac_name is used but was not set: + { echo "$as_me:6376: WARNING: Variable $ac_name is used but was not set: $ac_seen" >&5 echo "$as_me: WARNING: Variable $ac_name is used but was not set: $ac_seen" >&2;} @@ -6331,7 +6384,7 @@ $ac_seen" >&2;} egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out if test -s $tmp/out; then ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out` - { echo "$as_me:6334: WARNING: Some variables may not be substituted: + { echo "$as_me:6387: WARNING: Some variables may not be substituted: $ac_seen" >&5 echo "$as_me: WARNING: Some variables may not be substituted: $ac_seen" >&2;} @@ -6380,7 +6433,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue * ) ac_file_in=$ac_file.in ;; esac - test x"$ac_file" != x- && { echo "$as_me:6383: creating $ac_file" >&5 + test x"$ac_file" != x- && { echo "$as_me:6436: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the @@ -6391,7 +6444,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:6394: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:6447: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -6404,7 +6457,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:6407: error: cannot find input file: $f" >&5 + { { echo "$as_me:6460: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -6522,7 +6575,7 @@ cat >>$CONFIG_STATUS <<\EOF rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then - { echo "$as_me:6525: $ac_file is unchanged" >&5 + { echo "$as_me:6578: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ diff --git a/defs.h b/defs.h index 1fbd672..d943df5 100644 --- a/defs.h +++ b/defs.h @@ -1,4 +1,4 @@ -/* $Id: defs.h,v 1.54 2016/12/02 19:27:56 tom Exp $ */ +/* $Id: defs.h,v 1.56 2017/02/02 00:44:38 tom Exp $ */ #ifdef HAVE_CONFIG_H #include @@ -313,6 +313,7 @@ extern const char *const trailer[]; extern char *code_file_name; extern char *input_file_name; +extern size_t input_file_name_len; extern char *defines_file_name; extern char *externs_file_name; diff --git a/main.c b/main.c index 137df20..e59434d 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.57 2016/12/02 18:44:44 tom Exp $ */ +/* $Id: main.c,v 1.59 2017/02/02 00:44:38 tom Exp $ */ #include #ifndef _WIN32 @@ -48,13 +48,13 @@ const char *myname = "yacc"; int lineno; int outline; -static char empty_string[] = ""; static char default_file_prefix[] = "y"; static char *file_prefix = default_file_prefix; char *code_file_name; -char *input_file_name = empty_string; +char *input_file_name; +size_t input_file_name_len = 0; char *defines_file_name; char *externs_file_name; @@ -381,7 +381,10 @@ getargs(int argc, char *argv[]) no_more_options:; if (i + 1 != argc) usage(); - input_file_name = argv[i]; + input_file_name_len = strlen(argv[i]); + input_file_name = TMALLOC(char, input_file_name_len + 1); + NO_SPACE(input_file_name); + strcpy(input_file_name, argv[i]); } void * diff --git a/package/byacc.spec b/package/byacc.spec index 2106a35..bb56a1e 100644 --- a/package/byacc.spec +++ b/package/byacc.spec @@ -1,8 +1,8 @@ Summary: byacc - public domain Berkeley LALR Yacc parser generator %define AppProgram byacc -%define AppVersion 20161202 +%define AppVersion 20170201 %define UseProgram yacc -# $XTermId: byacc.spec,v 1.32 2016/12/02 12:58:46 tom Exp $ +# $XTermId: byacc.spec,v 1.33 2017/02/01 09:55:04 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 diff --git a/package/debian/changelog b/package/debian/changelog index b30984d..f2015d5 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,3 +1,9 @@ +byacc (20170201) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey Wed, 01 Feb 2017 04:55:04 -0500 + byacc (20161202) unstable; urgency=low * maintenance updates diff --git a/package/debian/copyright b/package/debian/copyright index 77ab795..91cbe85 100644 --- a/package/debian/copyright +++ b/package/debian/copyright @@ -36,7 +36,7 @@ skeleton.c with the bug report. Do not expect rapid responses. Files: aclocal.m4 Licence: other-BSD -Copyright: 2004-2015,2016 by Thomas E. Dickey +Copyright: 2004-2016,2017 by Thomas E. Dickey Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including diff --git a/package/mingw-byacc.spec b/package/mingw-byacc.spec index 6ea04c1..efa1cc3 100644 --- a/package/mingw-byacc.spec +++ b/package/mingw-byacc.spec @@ -1,8 +1,8 @@ Summary: byacc - public domain Berkeley LALR Yacc parser generator %define AppProgram byacc -%define AppVersion 20161202 +%define AppVersion 20170201 %define UseProgram yacc -# $XTermId: mingw-byacc.spec,v 1.14 2016/12/02 12:58:46 tom Exp $ +# $XTermId: mingw-byacc.spec,v 1.15 2017/02/01 09:55:04 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 diff --git a/package/pkgsrc/Makefile b/package/pkgsrc/Makefile index 877117d..3a5f387 100644 --- a/package/pkgsrc/Makefile +++ b/package/pkgsrc/Makefile @@ -1,7 +1,7 @@ # $NetBSD: Makefile,v 1.9 2008/07/24 17:13:00 tonnerre Exp $ # -DISTNAME= byacc-20161202 +DISTNAME= byacc-20170201 PKGREVISION= 1 CATEGORIES= devel MASTER_SITES= ftp://invisible-island.net/byacc/ diff --git a/reader.c b/reader.c index 333ee0c..efcbaa5 100644 --- a/reader.c +++ b/reader.c @@ -1,4 +1,4 @@ -/* $Id: reader.c,v 1.66 2016/12/02 20:14:34 tom Exp $ */ +/* $Id: reader.c,v 1.68 2017/02/02 01:05:36 tom Exp $ */ #include "defs.h" @@ -108,56 +108,188 @@ cachec(int c) ++cinc; } -static void -get_line(void) +typedef enum { - FILE *f = input_file; - int c; - int i; + ldSPC1, + ldSPC2, + ldNAME, + ldSPC3, + ldNUM, + ldSPC4, + ldFILE, + ldOK, + ldERR +} +LINE_DIR; - if (saw_eof || (c = getc(f)) == EOF) +/* + * Expect this pattern: + * /^[[:space:]]*#[[:space:]]* + * line[[:space:]]+ + * [[:digit:]]+ + * ([[:space:]]*|[[:space:]]+"[^"]+")/ + */ +static int +line_directive(void) +{ +#define UNLESS(what) if (what) { ld = ldERR; break; } + int n; + int line_1st = -1; + int name_1st = -1; + int name_end = -1; + LINE_DIR ld = ldSPC1; + for (n = 0; (ld <= ldOK) && (line[n] != '\0'); ++n) { - if (line) + int ch = UCH(line[n]); + switch (ld) + { + case ldSPC1: + if (isspace(ch)) + { + break; + } + else + UNLESS(ch != '#'); + ld = ldSPC2; + break; + case ldSPC2: + if (isspace(ch)) + { + break; + } + /* FALLTHRU */ + case ldNAME: + UNLESS(strncmp(line + n, "line", 4)); + n += 4; + if (line[n] == '\0') + { + ld = ldOK; + break; + } + else + UNLESS(!isspace(UCH(line[n]))); + ld = ldSPC3; + break; + case ldSPC3: + if (isspace(ch)) + { + break; + } + else + UNLESS(!isdigit(ch)); + line_1st = n; + ld = ldNUM; + /* FALLTHRU */ + case ldNUM: + if (isdigit(ch)) + { + break; + } + else + UNLESS(!isspace(ch)); + ld = ldSPC4; + break; + case ldSPC4: + if (isspace(ch)) + { + break; + } + else + UNLESS(ch != '"'); + UNLESS(line[n + 1] == '"'); + ld = ldFILE; + name_1st = n; + break; + case ldFILE: + if (ch != '"') + { + break; + } + ld = ldOK; + name_end = n; + /* FALLTHRU */ + case ldERR: + case ldOK: + break; + } + } + + if (ld == ldOK) + { + size_t need = (size_t) (name_end - name_1st); + if (need > input_file_name_len) { - FREE(line); - line = 0; + input_file_name_len = need; + input_file_name = TREALLOC(char, input_file_name, need + 1); + NO_SPACE(input_file_name); } - cptr = 0; - saw_eof = 1; - return; + memcpy(input_file_name, line + name_1st + 1, need - 1); + input_file_name[need - 1] = '\0'; } - if (line == NULL || linesize != (LINESIZE + 1)) + if (ld >= ldNUM && ld < ldERR) { - if (line) - FREE(line); - linesize = LINESIZE + 1; - line = TMALLOC(char, linesize); - NO_SPACE(line); + lineno = (int)strtol(line + line_1st, NULL, 10) - 1; } - i = 0; - ++lineno; - for (;;) + return (ld == ldOK); +#undef UNLESS +} + +static void +get_line(void) +{ + FILE *f = input_file; + int c; + int i; + + do { - line[i++] = (char)c; - if (c == '\n') - break; - if ((i + 3) >= linesize) + if (saw_eof || (c = getc(f)) == EOF) { - linesize += LINESIZE; - line = TREALLOC(char, line, linesize); + if (line) + { + FREE(line); + line = 0; + } + cptr = 0; + saw_eof = 1; + return; + } + + if (line == NULL || linesize != (LINESIZE + 1)) + { + if (line) + FREE(line); + linesize = LINESIZE + 1; + line = TMALLOC(char, linesize); NO_SPACE(line); } - c = getc(f); - if (c == EOF) + + i = 0; + ++lineno; + for (;;) { - line[i++] = '\n'; - saw_eof = 1; - break; + line[i++] = (char)c; + if (c == '\n') + break; + if ((i + 3) >= linesize) + { + linesize += LINESIZE; + line = TREALLOC(char, line, linesize); + NO_SPACE(line); + } + c = getc(f); + if (c == EOF) + { + line[i++] = '\n'; + saw_eof = 1; + break; + } } + line[i] = '\0'; } - line[i] = '\0'; + while (line_directive()); cptr = line; return; } diff --git a/test/btyacc/expr.oxout.error b/test/btyacc/expr.oxout.error new file mode 100644 index 0000000..58fdb1c --- /dev/null +++ b/test/btyacc/expr.oxout.error @@ -0,0 +1 @@ +YACC: w - line 6 of "expr.Y", the precedence of '*' has been redeclared diff --git a/test/btyacc/expr.oxout.output b/test/btyacc/expr.oxout.output new file mode 100644 index 0000000..e5021d2 --- /dev/null +++ b/test/btyacc/expr.oxout.output @@ -0,0 +1,227 @@ + 0 $accept : yyyAugNonterm $end + + 1 $$1 : + + 2 yyyAugNonterm : $$1 s + + 3 s : expr + + 4 expr : expr '*' expr + 5 | expr '+' expr + 6 | expr '/' expr + 7 | expr '-' expr + 8 | '(' expr ')' + 9 | ID + 10 | CONST + +state 0 + $accept : . yyyAugNonterm $end (0) + $$1 : . (1) + + . reduce 1 + + yyyAugNonterm goto 1 + $$1 goto 2 + + +state 1 + $accept : yyyAugNonterm . $end (0) + + $end accept + + +state 2 + yyyAugNonterm : $$1 . s (2) + + ID shift 3 + CONST shift 4 + '(' shift 5 + . error + + s goto 6 + expr goto 7 + + +state 3 + expr : ID . (9) + + . reduce 9 + + +state 4 + expr : CONST . (10) + + . reduce 10 + + +state 5 + expr : '(' . expr ')' (8) + + ID shift 3 + CONST shift 4 + '(' shift 5 + . error + + expr goto 8 + + +state 6 + yyyAugNonterm : $$1 s . (2) + + . reduce 2 + + +state 7 + s : expr . (3) + expr : expr . '*' expr (4) + expr : expr . '+' expr (5) + expr : expr . '/' expr (6) + expr : expr . '-' expr (7) + + '+' shift 9 + '-' shift 10 + '*' shift 11 + '/' shift 12 + $end reduce 3 + + +state 8 + expr : expr . '*' expr (4) + expr : expr . '+' expr (5) + expr : expr . '/' expr (6) + expr : expr . '-' expr (7) + expr : '(' expr . ')' (8) + + '+' shift 9 + '-' shift 10 + '*' shift 11 + '/' shift 12 + ')' shift 13 + . error + + +state 9 + expr : expr '+' . expr (5) + + ID shift 3 + CONST shift 4 + '(' shift 5 + . error + + expr goto 14 + + +state 10 + expr : expr '-' . expr (7) + + ID shift 3 + CONST shift 4 + '(' shift 5 + . error + + expr goto 15 + + +state 11 + expr : expr '*' . expr (4) + + ID shift 3 + CONST shift 4 + '(' shift 5 + . error + + expr goto 16 + + +state 12 + expr : expr '/' . expr (6) + + ID shift 3 + CONST shift 4 + '(' shift 5 + . error + + expr goto 17 + + +state 13 + expr : '(' expr ')' . (8) + + . reduce 8 + + +state 14 + expr : expr . '*' expr (4) + expr : expr . '+' expr (5) + expr : expr '+' expr . (5) + expr : expr . '/' expr (6) + expr : expr . '-' expr (7) + + '*' shift 11 + '/' shift 12 + $end reduce 5 + '+' reduce 5 + '-' reduce 5 + ')' reduce 5 + + +state 15 + expr : expr . '*' expr (4) + expr : expr . '+' expr (5) + expr : expr . '/' expr (6) + expr : expr . '-' expr (7) + expr : expr '-' expr . (7) + + '*' shift 11 + '/' shift 12 + $end reduce 7 + '+' reduce 7 + '-' reduce 7 + ')' reduce 7 + + +state 16 + expr : expr . '*' expr (4) + expr : expr '*' expr . (4) + expr : expr . '+' expr (5) + expr : expr . '/' expr (6) + expr : expr . '-' expr (7) + + . reduce 4 + + +state 17 + expr : expr . '*' expr (4) + expr : expr . '+' expr (5) + expr : expr . '/' expr (6) + expr : expr '/' expr . (6) + expr : expr . '-' expr (7) + + '*' shift 11 + $end reduce 6 + '+' reduce 6 + '-' reduce 6 + '/' reduce 6 + ')' reduce 6 + + +10 terminals, 5 nonterminals +11 grammar rules, 18 states + +grammar parser grammar +symbol# value# symbol + 0 0 $end + 1 256 error + 2 257 ID + 3 258 CONST + 4 43 '+' + 5 45 '-' + 6 42 '*' + 7 47 '/' + 8 40 '(' + 9 41 ')' + 10 259 $accept + 11 260 yyyAugNonterm + 12 261 s + 13 262 $$1 + 14 263 expr diff --git a/test/btyacc/expr.oxout.tab.c b/test/btyacc/expr.oxout.tab.c new file mode 100644 index 0000000..83e9ec9 --- /dev/null +++ b/test/btyacc/expr.oxout.tab.c @@ -0,0 +1,2752 @@ +/* original parser id follows */ +/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ + +#define YYBYACC 1 +#define YYMAJOR 1 +#define YYMINOR 9 +#define YYCHECK "yyyymmdd" + +#define YYEMPTY (-1) +#define yyclearin (yychar = YYEMPTY) +#define yyerrok (yyerrflag = 0) +#define YYRECOVERING() (yyerrflag != 0) +#define YYENOMEM (-2) +#define YYEOF 0 +#undef YYBTYACC +#define YYBTYACC 0 +#define YYDEBUGSTR YYPREFIX "debug" + +#ifndef yyparse +#define yyparse expr.oxout_parse +#endif /* yyparse */ + +#ifndef yylex +#define yylex expr.oxout_lex +#endif /* yylex */ + +#ifndef yyerror +#define yyerror expr.oxout_error +#endif /* yyerror */ + +#ifndef yychar +#define yychar expr.oxout_char +#endif /* yychar */ + +#ifndef yyval +#define yyval expr.oxout_val +#endif /* yyval */ + +#ifndef yylval +#define yylval expr.oxout_lval +#endif /* yylval */ + +#ifndef yydebug +#define yydebug expr.oxout_debug +#endif /* yydebug */ + +#ifndef yynerrs +#define yynerrs expr.oxout_nerrs +#endif /* yynerrs */ + +#ifndef yyerrflag +#define yyerrflag expr.oxout_errflag +#endif /* yyerrflag */ + +#ifndef yylhs +#define yylhs expr.oxout_lhs +#endif /* yylhs */ + +#ifndef yylen +#define yylen expr.oxout_len +#endif /* yylen */ + +#ifndef yydefred +#define yydefred expr.oxout_defred +#endif /* yydefred */ + +#ifndef yystos +#define yystos expr.oxout_stos +#endif /* yystos */ + +#ifndef yydgoto +#define yydgoto expr.oxout_dgoto +#endif /* yydgoto */ + +#ifndef yysindex +#define yysindex expr.oxout_sindex +#endif /* yysindex */ + +#ifndef yyrindex +#define yyrindex expr.oxout_rindex +#endif /* yyrindex */ + +#ifndef yygindex +#define yygindex expr.oxout_gindex +#endif /* yygindex */ + +#ifndef yytable +#define yytable expr.oxout_table +#endif /* yytable */ + +#ifndef yycheck +#define yycheck expr.oxout_check +#endif /* yycheck */ + +#ifndef yyname +#define yyname expr.oxout_name +#endif /* yyname */ + +#ifndef yyrule +#define yyrule expr.oxout_rule +#endif /* yyrule */ + +#if YYBTYACC + +#ifndef yycindex +#define yycindex expr.oxout_cindex +#endif /* yycindex */ + +#ifndef yyctable +#define yyctable expr.oxout_ctable +#endif /* yyctable */ + +#endif /* YYBTYACC */ + +#define YYPREFIX "expr.oxout_" + +#define YYPURE 0 + +#line 5 "expr.oxout.y" +#include +#include +#line 8 "expr.Y" + +#include "expr.oxout.h" +#include + +extern int yylex(void); +extern void yyerror(const char *); +#line 27 "expr.oxout.y" +#include +#define yyyR USHRT_MAX +#ifdef YYSTYPE +#undef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +#endif +#ifndef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +#line 31 "expr.oxout.y" +typedef union { +struct yyyOxAttrbs { +struct yyyStackItem *yyyOxStackItem; +} yyyOxAttrbs; +} YYSTYPE; +#endif /* !YYSTYPE_IS_DECLARED */ +#line 38 "expr.oxout.y" +#include +#include + +static int yyyYok = 1; + +extern yyyFT yyyRCIL[]; + +void yyyExecuteRRsection(yyyGNT *rootNode); +void yyyYoxInit(void); +void yyyDecorate(void); +struct yyyOxAttrbs; /* hack required to compensate for 'msta' behavior */ +void yyyGenIntNode(long yyyProdNum, int yyyRHSlength, int yyyNattrbs, struct yyyOxAttrbs *yyval_OxAttrbs, ...); +void yyyAdjustINRC(long yyyProdNum, int yyyRHSlength, long startP, long stopP, struct yyyOxAttrbs *yyval_OxAttrbs, ...); +void yyyCheckUnsolvedInstTrav(yyyGNT *rootNode,long *nNZrc,long *cycleSum); +void yyyUnsolvedInstSearchTrav(yyyGNT *pNode); +void yyyUnsolvedInstSearchTravAux(yyyGNT *pNode); +void yyyabort(void); + +#line 166 "expr.oxout.tab.c" + +/* compatibility with bison */ +#ifdef YYPARSE_PARAM +/* compatibility with FreeBSD */ +# ifdef YYPARSE_PARAM_TYPE +# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) +# else +# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) +# endif +#else +# define YYPARSE_DECL() yyparse(void) +#endif + +/* Parameters sent to lex. */ +#ifdef YYLEX_PARAM +# define YYLEX_DECL() yylex(void *YYLEX_PARAM) +# define YYLEX yylex(YYLEX_PARAM) +#else +# define YYLEX_DECL() yylex(void) +# define YYLEX yylex() +#endif + +/* Parameters sent to yyerror. */ +#ifndef YYERROR_DECL +#define YYERROR_DECL() yyerror(const char *s) +#endif +#ifndef YYERROR_CALL +#define YYERROR_CALL(msg) yyerror(msg) +#endif + +extern int YYPARSE_DECL(); + +#define ID 257 +#define CONST 258 +#define YYERRCODE 256 +typedef short YYINT; +static const YYINT expr.oxout_lhs[] = { -1, + 2, 0, 1, 3, 3, 3, 3, 3, 3, 3, +}; +static const YYINT expr.oxout_len[] = { 2, + 0, 2, 1, 3, 3, 3, 3, 3, 1, 1, +}; +static const YYINT expr.oxout_defred[] = { 1, + 0, 0, 9, 10, 0, 2, 0, 0, 0, 0, + 0, 0, 8, 0, 0, 4, 0, +}; +#if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING) +static const YYINT expr.oxout_stos[] = { 0, + 260, 262, 257, 258, 40, 261, 263, 263, 43, 45, + 42, 47, 41, 263, 263, 263, 263, +}; +#endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */ +static const YYINT expr.oxout_dgoto[] = { 1, + 6, 2, 7, +}; +static const YYINT expr.oxout_sindex[] = { 0, + 0, -40, 0, 0, -40, 0, -18, -24, -40, -40, + -40, -40, 0, -37, -37, 0, -39, +}; +static const YYINT expr.oxout_rindex[] = { 0, + 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, + 0, 0, 0, 2, 8, 0, 1, +}; +#if YYBTYACC +static const YYINT expr.oxout_cindex[] = { 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, +}; +#endif +static const YYINT expr.oxout_gindex[] = { 0, + 0, 0, 4, +}; +#define YYTABLESIZE 218 +static const YYINT expr.oxout_table[] = { 5, + 6, 5, 11, 0, 11, 3, 0, 7, 8, 12, + 0, 0, 14, 15, 16, 17, 13, 11, 9, 0, + 10, 0, 12, 11, 9, 0, 10, 0, 12, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 6, 5, 6, 5, 6, 5, 6, 7, 0, + 7, 0, 7, 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, + 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, 3, 4, +}; +static const YYINT expr.oxout_check[] = { 40, + 0, 0, 42, -1, 42, 0, -1, 0, 5, 47, + -1, -1, 9, 10, 11, 12, 41, 42, 43, -1, + 45, -1, 47, 42, 43, -1, 45, -1, 47, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 41, 41, 43, 43, 45, 45, 47, 41, -1, + 43, -1, 45, -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, -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, -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, -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, -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, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 257, 258, +}; +#if YYBTYACC +static const YYINT expr.oxout_ctable[] = { -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, -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, -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, -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, -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, -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, -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, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, +}; +#endif +#define YYFINAL 1 +#ifndef YYDEBUG +#define YYDEBUG 0 +#endif +#define YYMAXTOKEN 258 +#define YYUNDFTOKEN 264 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) +#if YYDEBUG +static const char *const expr.oxout_name[] = { + +"$end",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,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,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,"error","ID", +"CONST","$accept","yyyAugNonterm","s","$$1","expr","illegal-symbol", +}; +static const char *const expr.oxout_rule[] = { +"$accept : yyyAugNonterm", +"$$1 :", +"yyyAugNonterm : $$1 s", +"s : expr", +"expr : expr '*' expr", +"expr : expr '+' expr", +"expr : expr '/' expr", +"expr : expr '-' expr", +"expr : '(' expr ')'", +"expr : ID", +"expr : CONST", + +}; +#endif + +int yydebug; +int yynerrs; + +int yyerrflag; +int yychar; +YYSTYPE yyval; +YYSTYPE yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) +YYLTYPE yyloc; /* position returned by actions */ +YYLTYPE yylloc; /* position from the lexer */ +#endif + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) +#ifndef YYLLOC_DEFAULT +#define YYLLOC_DEFAULT(loc, rhs, n) \ +do \ +{ \ + if (n == 0) \ + { \ + (loc).first_line = ((rhs)[-1]).last_line; \ + (loc).first_column = ((rhs)[-1]).last_column; \ + (loc).last_line = ((rhs)[-1]).last_line; \ + (loc).last_column = ((rhs)[-1]).last_column; \ + } \ + else \ + { \ + (loc).first_line = ((rhs)[ 0 ]).first_line; \ + (loc).first_column = ((rhs)[ 0 ]).first_column; \ + (loc).last_line = ((rhs)[n-1]).last_line; \ + (loc).last_column = ((rhs)[n-1]).last_column; \ + } \ +} while (0) +#endif /* YYLLOC_DEFAULT */ +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ +#if YYBTYACC + +#ifndef YYLVQUEUEGROWTH +#define YYLVQUEUEGROWTH 32 +#endif +#endif /* YYBTYACC */ + +/* define the initial stack-sizes */ +#ifdef YYSTACKSIZE +#undef YYMAXDEPTH +#define YYMAXDEPTH YYSTACKSIZE +#else +#ifdef YYMAXDEPTH +#define YYSTACKSIZE YYMAXDEPTH +#else +#define YYSTACKSIZE 10000 +#define YYMAXDEPTH 10000 +#endif +#endif + +#ifndef YYINITSTACKSIZE +#define YYINITSTACKSIZE 200 +#endif + +typedef struct { + unsigned stacksize; + YYINT *s_base; + YYINT *s_mark; + YYINT *s_last; + YYSTYPE *l_base; + YYSTYPE *l_mark; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE *p_base; + YYLTYPE *p_mark; +#endif +} YYSTACKDATA; +#if YYBTYACC + +struct YYParseState_s +{ + struct YYParseState_s *save; /* Previously saved parser state */ + YYSTACKDATA yystack; /* saved parser stack */ + int state; /* saved parser state */ + int errflag; /* saved error recovery status */ + int lexeme; /* saved index of the conflict lexeme in the lexical queue */ + YYINT ctry; /* saved index in yyctable[] for this conflict */ +}; +typedef struct YYParseState_s YYParseState; +#endif /* YYBTYACC */ +/* variables for the parser stack */ +static YYSTACKDATA yystack; +#if YYBTYACC + +/* Current parser state */ +static YYParseState *yyps = 0; + +/* yypath != NULL: do the full parse, starting at *yypath parser state. */ +static YYParseState *yypath = 0; + +/* Base of the lexical value queue */ +static YYSTYPE *yylvals = 0; + +/* Current position at lexical value queue */ +static YYSTYPE *yylvp = 0; + +/* End position of lexical value queue */ +static YYSTYPE *yylve = 0; + +/* The last allocated position at the lexical value queue */ +static YYSTYPE *yylvlim = 0; + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) +/* Base of the lexical position queue */ +static YYLTYPE *yylpsns = 0; + +/* Current position at lexical position queue */ +static YYLTYPE *yylpp = 0; + +/* End position of lexical position queue */ +static YYLTYPE *yylpe = 0; + +/* The last allocated position at the lexical position queue */ +static YYLTYPE *yylplim = 0; +#endif + +/* Current position at lexical token queue */ +static YYINT *yylexp = 0; + +static YYINT *yylexemes = 0; +#endif /* YYBTYACC */ +#line 53 "expr.Y" + + +int yyparse(void); + +int main() + {yyparse(); + } + + + +#line 138 "expr.oxout.y" +long yyySSALspaceSize = 20000; +long yyyRSmaxSize = 1000; +long yyyTravStackMaxSize = 2000; + +struct yyySolvedSAlistCell {yyyWAT attrbNum; + long next; + }; + +#define yyyLambdaSSAL 0 +long yyySSALCfreeList = yyyLambdaSSAL; +long yyyNewSSALC = 1; + +struct yyySolvedSAlistCell *yyySSALspace; + +long yyyNbytesStackStg; + + + +yyyFT yyyRCIL[1]; + +short yyyIIIEL[] = {0, +0,2,6,10,14,18,22,24, +}; + +long yyyIIEL[] = { +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +1,1, +}; + +long yyyIEL[] = { +0,0,0, +}; + +yyyFT yyyEntL[1]; + +void yyyfatal(char *msg) +{fputs(msg,stderr);exit(-1);} + + + +#define yyySSALof 'S' +#define yyyRSof 'q' +#define yyyTSof 't' + + + +void yyyHandleOverflow(char which) + {char *msg1,*msg2; + long oldSize,newSize; + switch(which) + { + case yyySSALof : + msg1 = "SSAL overflow: "; + oldSize = yyySSALspaceSize; + break; + case yyyRSof : + msg1 = "ready set overflow: "; + oldSize = yyyRSmaxSize; + break; + case yyyTSof : + msg1 = "traversal stack overflow: "; + oldSize = yyyTravStackMaxSize; + break; + default :; + } + newSize = (3*oldSize)/2; + if (newSize < 100) newSize = 100; + fputs(msg1,stderr); + fprintf(stderr,"size was %ld.\n",oldSize); + msg2 = " Have to modify evaluator: -Y%c%ld.\n"; + fprintf(stderr,msg2,which,newSize); + exit(-1); + } + + + +void yyySignalEnts(yyyGNT *node,long startP,long stopP) + {yyyGNT *dumNode; + + while (startP < stopP) + { + if (!yyyEntL[startP]) dumNode = node; + else dumNode = (node->cL)[yyyEntL[startP]-1]; + if (!(--((dumNode->refCountList)[yyyEntL[startP+1]] + ) + ) + ) + { + if (++yyyRSTop == yyyAfterRS) + {yyyHandleOverflow(yyyRSof); + break; + } + yyyRSTop->node = dumNode; + yyyRSTop->whichSym = yyyEntL[startP]; + yyyRSTop->wa = yyyEntL[startP+1]; + } + startP += 2; + } + } + + + + + + +void yyySolveAndSignal() { +long yyyiDum,*yyypL; +int yyyws,yyywa; +yyyGNT *yyyRSTopN,*yyyRefN; +yyyParent yyyRSTopNp; + + +yyyRSTopNp = (yyyRSTopN = yyyRSTop->node)->parent; +yyyRefN= (yyyws = (yyyRSTop->whichSym))?yyyRSTopNp.noderef:yyyRSTopN; +yyywa = yyyRSTop->wa; +yyyRSTop--; +switch(yyyRefN->prodNum) { +case 1: /***yacc rule 1***/ + switch (yyyws) { + } +break; +case 2: /***yacc rule 2***/ + switch (yyyws) { + } +break; +case 3: /***yacc rule 3***/ + switch (yyyws) { + } +break; +case 4: /***yacc rule 4***/ + switch (yyyws) { + } +break; +case 5: /***yacc rule 5***/ + switch (yyyws) { + } +break; +case 6: /***yacc rule 6***/ + switch (yyyws) { + } +break; +case 7: /***yacc rule 7***/ + switch (yyyws) { + case 1: /**/ + switch (yyywa) { + } + break; + } +break; +case 8: /***yacc rule 8***/ + switch (yyyws) { + case 1: /**/ + switch (yyywa) { + } + break; + } +break; +} /* switch */ + +if (yyyws) /* the just-solved instance was inherited. */ + {if (yyyRSTopN->prodNum) + {yyyiDum = yyyIIEL[yyyIIIEL[yyyRSTopN->prodNum]] + yyywa; + yyySignalEnts(yyyRSTopN,yyyIEL[yyyiDum], + yyyIEL[yyyiDum+1] + ); + } + } + else /* the just-solved instance was synthesized. */ + {if (!(yyyRSTopN->parentIsStack)) /* node has a parent. */ + {yyyiDum = yyyIIEL[yyyIIIEL[yyyRSTopNp.noderef->prodNum] + + yyyRSTopN->whichSym + ] + + yyywa; + yyySignalEnts(yyyRSTopNp.noderef, + yyyIEL[yyyiDum], + yyyIEL[yyyiDum+1] + ); + } + else /* node is still on the stack--it has no parent yet. */ + {yyypL = &(yyyRSTopNp.stackref->solvedSAlist); + if (yyySSALCfreeList == yyyLambdaSSAL) + {yyySSALspace[yyyNewSSALC].next = *yyypL; + if ((*yyypL = yyyNewSSALC++) == yyySSALspaceSize) + yyyHandleOverflow(yyySSALof); + } + else + {yyyiDum = yyySSALCfreeList; + yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next; + yyySSALspace[yyyiDum].next = *yyypL; + *yyypL = yyyiDum; + } + yyySSALspace[*yyypL].attrbNum = yyywa; + } + } + +} /* yyySolveAndSignal */ + + + + + + +#define condStg unsigned int conds; +#define yyyClearConds {yyyTST->conds = 0;} +#define yyySetCond(n) {yyyTST->conds += (1<<(n));} +#define yyyCond(n) ((yyyTST->conds & (1<<(n)))?1:0) + + + +struct yyyTravStackItem {yyyGNT *node; + char isReady; + condStg + }; + + + +void yyyDoTraversals(yyyGNT *rootNode) +{struct yyyTravStackItem *yyyTravStack,*yyyTST,*yyyAfterTravStack; + yyyGNT *yyyTSTn,**yyyCLptr2; + int yyyi,yyyRL,yyyPass; + int i; + + if (!yyyYok) return; + if ((yyyTravStack = + ((struct yyyTravStackItem *) + calloc((size_t)yyyTravStackMaxSize, + (size_t)sizeof(struct yyyTravStackItem) + ) + ) + ) + == + (struct yyyTravStackItem *)NULL + ) + {fputs("malloc error in traversal stack allocation\n",stderr); + exit(-1); + } + +yyyAfterTravStack = yyyTravStack + yyyTravStackMaxSize; +yyyTravStack++; + + +for (yyyi=0; yyyi<2; yyyi++) { +yyyTST = yyyTravStack; +yyyTST->node = rootNode; +yyyTST->isReady = 0; +yyyClearConds + +while(yyyTST >= yyyTravStack) + {yyyTSTn = yyyTST->node; + if (yyyTST->isReady) + {yyyPass = 1; + goto yyyTravSwitch; +yyyTpop: + yyyTST--; + } + else + {yyyPass = 0; + goto yyyTravSwitch; +yyyTpush: + yyyTST->isReady = 1; + if (yyyTSTn->prodNum) + {if (yyyRL) + {yyyCLptr2 = yyyTSTn->cL; + i = yyyTSTn->cLlen; + while (i--) + {if (++yyyTST == yyyAfterTravStack) + yyyHandleOverflow(yyyTSof); + else + {yyyTST->node = *yyyCLptr2; + yyyTST->isReady = 0; + yyyClearConds + } + yyyCLptr2++; + } + } /* right to left */ + else /* left to right */ + {i = yyyTSTn->cLlen; + yyyCLptr2 = yyyTSTn->cL + i; + while (i--) + {yyyCLptr2--; + if (++yyyTST == yyyAfterTravStack) + yyyHandleOverflow(yyyTSof); + else + {yyyTST->node = *yyyCLptr2; + yyyTST->isReady = 0; + yyyClearConds + } + } + } /* left to right */ + } + } /* else */ + continue; +yyyTravSwitch: + switch(yyyTSTn->prodNum) { +case 1: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + +if (! +#line 24 "expr.Y" + (1) +#line 444 "expr.oxout.y" +) yyySetCond(1) +yyySetCond(2) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 24 "expr.Y" + +#line 453 "expr.oxout.y" +} +if (yyyCond(1) != yyyPass) { +#line 24 "expr.Y" + printf("\n"); + +#line 459 "expr.oxout.y" +} +if (yyyCond(2) != yyyPass) { +#line 25 "expr.Y" + printf("prefix: "); + +#line 465 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; +if ( +#line 23 "expr.Y" + (1) +#line 477 "expr.oxout.y" +) yyySetCond(2) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 22 "expr.Y" + printf("\n"); + +#line 486 "expr.oxout.y" +} +if (yyyCond(1) != yyyPass) { +#line 23 "expr.Y" + +#line 491 "expr.oxout.y" +} +if (yyyCond(2) != yyyPass) { +#line 23 "expr.Y" + printf("postfix: ")/* missing ; */ + +#line 497 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 2: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 29 "expr.Y" + printf(" * "); + +#line 518 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 28 "expr.Y" + printf(" * "); + +#line 533 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 3: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 32 "expr.Y" + printf(" + "); + +#line 554 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 33 "expr.Y" + printf(" + "); + +#line 569 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 4: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 37 "expr.Y" + printf(" / "); + +#line 590 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 36 "expr.Y" + printf(" / "); + +#line 605 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 5: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 41 "expr.Y" + printf(" - "); + +#line 626 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 40 "expr.Y" + printf(" - "); + +#line 641 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 6: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + + break; + } + break; + } + +break; +case 7: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 46 "expr.Y" + printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); + +#line 685 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 45 "expr.Y" + printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); + +#line 700 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 8: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 50 "expr.Y" + printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); + +#line 721 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 49 "expr.Y" + printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); + +#line 736 "expr.oxout.y" +} + break; + } + break; + } + +break; + } /* switch */ + if (yyyPass) goto yyyTpop; else goto yyyTpush; + } /* while */ + } /* for */ +} /* yyyDoTraversals */ + +void yyyExecuteRRsection(yyyGNT *rootNode) { + int yyyi; + long cycleSum = 0; + long nNZrc = 0; + + if (!yyyYok) return; + yyyCheckUnsolvedInstTrav(rootNode,&nNZrc,&cycleSum); + if (nNZrc) + { + fputs("\n\n\n**********\n",stderr); + fputs("cycle detected in completed parse tree",stderr); + fputs(" after decoration.\n",stderr); +#if CYCLE_VERBOSE + fprintf(stderr, + "number of unsolved attribute instances == %ld.\n", + nNZrc + ); + fprintf(stderr, + "total number of remaining dependencies == %ld.\n", + cycleSum + ); + fputs("average number of remaining dependencies\n",stderr); + fprintf(stderr," per unsolved instance == %f.\n", + ((float)(cycleSum)/(float)(nNZrc)) + ); +#endif + fprintf(stderr, + "searching parse tree for %ld unsolved instances:\n", + nNZrc + ); + yyyUnsolvedInstSearchTravAux(rootNode); + } + yyyDoTraversals(rootNode); +} /* yyyExecuteRRsection */ + + + +yyyWAT yyyLRCIL[2] = {0,0, +}; + + + +void yyyYoxInit(void) + { + static int yyyInitDone = 0; + if (yyyInitDone) return; + + if ((yyyRS = (struct yyyRSitem *) + calloc((size_t)(yyyRSmaxSize+1), (size_t)sizeof(struct yyyRSitem)) + ) + == + ((struct yyyRSitem *) NULL) + ) + yyyfatal("malloc error in ox ready set space allocation\n"); + yyyRS++; + yyyAfterRS = yyyRS + yyyRSmaxSize; + + + if ((yyySSALspace = (struct yyySolvedSAlistCell *) + calloc((size_t)(yyySSALspaceSize+1), (size_t)sizeof(struct yyySolvedSAlistCell)) + ) + == + ((struct yyySolvedSAlistCell *) NULL) + ) + yyyfatal("malloc error in stack solved list space allocation\n"); + yyyInitDone = 1; + + yyyRSTop = yyyRS - 1; + } /* yyyYoxInit */ + + + +void yyyDecorate(void) + { + while (yyyRSTop >= yyyRS) + yyySolveAndSignal(); + } + + + +void yyyGenIntNode(long yyyProdNum, int yyyRHSlength, int yyyNattrbs, struct yyyOxAttrbs *yyval_OxAttrbs, ...) + {yyyWST i; + yyySIT **yyyOxStackItem = &yyval_OxAttrbs->yyyOxStackItem; + yyyGNT *gnpDum; + va_list ap; + + *yyyOxStackItem = (yyySIT *) malloc((size_t)sizeof(yyySIT)); + if (*yyyOxStackItem == (yyySIT *) NULL) + yyyfatal("malloc error in ox yacc semantic stack space allocation\n"); + (*yyyOxStackItem)->node = + (yyyGNT *) malloc((size_t)sizeof(yyyGNT)); + if ((*yyyOxStackItem)->node == (yyyGNT *) NULL) + yyyfatal("malloc error in ox node space allocation\n"); + (*yyyOxStackItem)->solvedSAlist = yyyLambdaSSAL; + (*yyyOxStackItem)->node->parent.stackref = *yyyOxStackItem; + (*yyyOxStackItem)->node->parentIsStack = 1; + (*yyyOxStackItem)->node->cLlen = yyyRHSlength; + (*yyyOxStackItem)->node->cL = + (yyyGNT **) calloc((size_t)yyyRHSlength, (size_t)sizeof(yyyGNT *)); + if ((*yyyOxStackItem)->node->cL == (yyyGNT **) NULL) + yyyfatal("malloc error in ox child list space allocation\n"); + (*yyyOxStackItem)->node->refCountListLen = yyyNattrbs; + (*yyyOxStackItem)->node->refCountList = + (yyyRCT *) calloc((size_t)yyyNattrbs, (size_t)sizeof(yyyRCT)); + if ((*yyyOxStackItem)->node->refCountList == (yyyRCT *) NULL) + yyyfatal("malloc error in ox reference count list space allocation\n"); + (*yyyOxStackItem)->node->prodNum = yyyProdNum; + va_start(ap, yyval_OxAttrbs); + for (i=1;i<=yyyRHSlength;i++) + {yyySIT *yaccStDum = va_arg(ap,struct yyyOxAttrbs *)->yyyOxStackItem; + gnpDum = (*yyyOxStackItem)->node->cL[i-1] = yaccStDum->node; + gnpDum->whichSym = i; + gnpDum->parent.noderef = (*yyyOxStackItem)->node; + gnpDum->parentIsStack = 0; + } + va_end(ap); + } + + + +#define yyyDECORfREQ 50 + + + +void yyyAdjustINRC(long yyyProdNum, int yyyRHSlength, long startP, long stopP, struct yyyOxAttrbs *yyval_OxAttrbs, ...) + {yyyWST i; + yyySIT *yyyOxStackItem = yyval_OxAttrbs->yyyOxStackItem; + long SSALptr,SSALptrHead,*cPtrPtr; + long *pL; + yyyGNT *gnpDum; + long iTemp; + long nextP; + static unsigned short intNodeCount = yyyDECORfREQ; + va_list ap; + + nextP = startP; + while (nextP < stopP) + {if (yyyRCIL[nextP] == yyyR) + {(yyyOxStackItem->node->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2]; + } + else + {(((yyyOxStackItem->node->cL)[yyyRCIL[nextP]])->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2]; + } + nextP += 3; + } + pL = yyyIIEL + yyyIIIEL[yyyProdNum]; + va_start(ap, yyval_OxAttrbs); + for (i=1;i<=yyyRHSlength;i++) + {yyySIT *yaccStDum = va_arg(ap,struct yyyOxAttrbs *)->yyyOxStackItem; + pL++; + SSALptrHead = SSALptr = *(cPtrPtr = &(yaccStDum->solvedSAlist)); + if (SSALptr != yyyLambdaSSAL) + {*cPtrPtr = yyyLambdaSSAL; + do + { + iTemp = (*pL+yyySSALspace[SSALptr].attrbNum); + yyySignalEnts(yyyOxStackItem->node, + yyyIEL[iTemp], + yyyIEL[iTemp+1] + ); + SSALptr = *(cPtrPtr = &(yyySSALspace[SSALptr].next)); + } + while (SSALptr != yyyLambdaSSAL); + *cPtrPtr = yyySSALCfreeList; + yyySSALCfreeList = SSALptrHead; + } + } + va_end(ap); + nextP = startP + 2; + while (nextP < stopP) + {if (!yyyRCIL[nextP]) + {if (yyyRCIL[nextP-2] == yyyR) + {pL = &(yyyOxStackItem->solvedSAlist); + if (yyySSALCfreeList == yyyLambdaSSAL) + {yyySSALspace[yyyNewSSALC].next = *pL; + if ((*pL = yyyNewSSALC++) == yyySSALspaceSize) + yyyHandleOverflow(yyySSALof); + } + else + {iTemp = yyySSALCfreeList; + yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next; + yyySSALspace[iTemp].next = *pL; + *pL = iTemp; + } + yyySSALspace[*pL].attrbNum = yyyRCIL[nextP-1]; + } + else + {if ((gnpDum = (yyyOxStackItem->node->cL)[yyyRCIL[nextP-2]])->prodNum != 0) + { + iTemp = yyyIIEL[yyyIIIEL[gnpDum->prodNum]] + yyyRCIL[nextP-1]; + yyySignalEnts(gnpDum, + yyyIEL[iTemp], + yyyIEL[iTemp+1] + ); + } + } + } + nextP += 3; + } + if (!--intNodeCount) + {intNodeCount = yyyDECORfREQ; + yyyDecorate(); + } + } + + + +void yyyGenLeaf(int nAttrbs,int typeNum,long startP,long stopP,YYSTYPE *yylval) + {yyyRCT *rcPdum; + yyySIT **yyyOxStackItem = &yylval->yyyOxAttrbs.yyyOxStackItem; + (*yyyOxStackItem) = (yyySIT *) malloc((size_t)sizeof(yyySIT)); + if ((*yyyOxStackItem) == (yyySIT *) NULL) + yyyfatal("malloc error in ox yacc semantic stack space allocation\n"); + (*yyyOxStackItem)->node = + (yyyGNT *) malloc((size_t)sizeof(yyyGNT)) + ; + if ((*yyyOxStackItem)->node == (yyyGNT *) NULL) + yyyfatal("malloc error in ox node space allocation\n"); + (*yyyOxStackItem)->solvedSAlist = yyyLambdaSSAL; + (*yyyOxStackItem)->node->parent.stackref = *yyyOxStackItem; + (*yyyOxStackItem)->node->parentIsStack = 1; + (*yyyOxStackItem)->node->cLlen = 0; + (*yyyOxStackItem)->node->cL = (yyyGNT **)NULL; + (*yyyOxStackItem)->node->refCountListLen = nAttrbs; + rcPdum = (*yyyOxStackItem)->node->refCountList = + (yyyRCT *) calloc((size_t)nAttrbs, (size_t)sizeof(yyyRCT)); + if (rcPdum == (yyyRCT *) NULL) + yyyfatal("malloc error in ox reference count list space allocation\n"); + while (startP < stopP) rcPdum[yyyLRCIL[startP++]] = 0; + (*yyyOxStackItem)->node->prodNum = 0; + (*yyyOxStackItem)->node->whichSym = 0; + } + + + +void yyyabort(void) + {yyyYok = 0; + } + + + + + +#define yyyLastProdNum 8 + + +#define yyyNsorts 1 + + +int yyyProdsInd[] = { + 0, + 0, 2, 6, 10, 14, 18, 22, 24, + 26, +}; + + +int yyyProds[][2] = { +{ 116, 0},{ 462, 0},{ 462, 0},{ 462, 0},{ 412, 0}, +{ 462, 0},{ 462, 0},{ 462, 0},{ 420, 0},{ 462, 0}, +{ 462, 0},{ 462, 0},{ 452, 0},{ 462, 0},{ 462, 0}, +{ 462, 0},{ 436, 0},{ 462, 0},{ 462, 0},{ 396, 0}, +{ 462, 0},{ 404, 0},{ 462, 0},{ 619, 1},{ 462, 0}, +{ 567, 1}, +}; + + +int yyySortsInd[] = { + 0, + 0, + 1, +}; + + +int yyySorts[] = { + 413, +}; + + + +char *yyyStringTab[] = { +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,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,"s",0,0,0, +0,0,"y",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, +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,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,"LRpre",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,"'*'","lexeme",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,"expr",0,0, +0,0,0,0,0, +0,0,0,0,0, +0,"printf",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,0, +0,0,"CONST","LRpost",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,"ID", +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,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,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,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,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, +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,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,0, +0, +}; + + + +#define yyySizeofProd(num) (yyyProdsInd[(num)+1] - yyyProdsInd[(num)]) + +#define yyyGSoccurStr(prodNum,symPos) \ + (yyyStringTab[yyyProds[yyyProdsInd[(prodNum)] + (symPos)][0]]) + +#define yyySizeofSort(num) (yyySortsInd[(num)+1] - yyySortsInd[(num)]) + +#define yyySortOf(prodNum,symPos) \ + (yyyProds[yyyProdsInd[(prodNum)] + (symPos)][1]) + +#define yyyAttrbStr(prodNum,symPos,attrbNum) \ + (yyyStringTab[yyySorts[yyySortsInd[yyySortOf(prodNum,symPos)] + \ + (attrbNum) \ + ] \ + ] \ + ) + + + +void yyyShowProd(int i) + {int j,nSyms; + + nSyms = yyySizeofProd(i); + for (j=0; j\n",stderr); + else + putc('\n',stderr); + } + } + } + + + +void yyyCheckNodeInstancesSolved(yyyGNT *np) + {int mysort,sortSize,i,prodNum,symPos,inTerminalNode; + int nUnsolvedInsts = 0; + + if (np->prodNum != 0) + {inTerminalNode = 0; + prodNum = np->prodNum; + symPos = 0; + } + else + {inTerminalNode = 1; + prodNum = np->parent.noderef->prodNum; + symPos = np->whichSym; + } + mysort = yyySortOf(prodNum,symPos); + sortSize = yyySizeofSort(mysort); + for (i=0; irefCountList)[i] != 0) nUnsolvedInsts += 1; + if (nUnsolvedInsts) + {fprintf(stderr, + "\nFound node that has %d unsolved attribute instance(s).\n", + nUnsolvedInsts + ); + fprintf(stderr,"Node is labeled \"%s\".\n", + yyyGSoccurStr(prodNum,symPos)); + if (inTerminalNode) + {fputs("Node is terminal. Its parent production is:\n ",stderr); + yyyShowProd(prodNum); + } + else + {fputs("Node is nonterminal. ",stderr); + if (!(np->parentIsStack)) + {fprintf(stderr, + "Node is %dth child in its parent production:\n ", + np->whichSym + ); + yyyShowProd(np->parent.noderef->prodNum); + } + fputs("Node is on left hand side of this production:\n ",stderr); + yyyShowProd(np->prodNum); + } + fputs("The following instances are unsolved:\n",stderr); + for (i=0; irefCountList)[i] != 0) + fprintf(stderr," %-16s still has %1d dependencies.\n", + yyyAttrbStr(prodNum,symPos,i),(np->refCountList)[i]); + } + } + + + +void yyyCheckUnsolvedInstTrav(yyyGNT *pNode,long *nNZrc,long *cycleSum) + {yyyGNT **yyyCLpdum; + yyyRCT *rcp; + int i; + + /* visit the refCountList of each node in the tree, and sum the non-zero refCounts */ + rcp = pNode->refCountList; + i = pNode->refCountListLen; + while (i--) + if (*rcp++) {*cycleSum += *(rcp - 1); (*nNZrc)++;} + yyyCLpdum = pNode->cL; + i = pNode->cLlen; + while (i--) + { + yyyCheckUnsolvedInstTrav(*yyyCLpdum,nNZrc,cycleSum); + yyyCLpdum++; + } + } + + + +void yyyUnsolvedInstSearchTravAux(yyyGNT *pNode) + {yyyGNT **yyyCLpdum; + int i; + + yyyCheckNodeInstancesSolved(pNode); + yyyCLpdum = pNode->cL; + i = pNode->cLlen; + while (i--) + { + yyyUnsolvedInstSearchTravAux(*yyyCLpdum); + yyyCLpdum++; + } + } + + + +void yyyUnsolvedInstSearchTrav(yyyGNT *pNode) + {yyyGNT **yyyCLpdum; + int i; + + yyyCLpdum = pNode->cL; + i = pNode->cLlen; + while (i--) + { + yyyUnsolvedInstSearchTravAux(*yyyCLpdum); + yyyCLpdum++; + } + } + + + +#line 1794 "expr.oxout.tab.c" + +/* For use in generated program */ +#define yydepth (int)(yystack.s_mark - yystack.s_base) +#if YYBTYACC +#define yytrial (yyps->save) +#endif /* YYBTYACC */ + +#if YYDEBUG +#include /* needed for printf */ +#endif + +#include /* needed for malloc, etc */ +#include /* needed for memset */ + +/* allocate initial stack or double stack size, up to YYMAXDEPTH */ +static int yygrowstack(YYSTACKDATA *data) +{ + int i; + unsigned newsize; + YYINT *newss; + YYSTYPE *newvs; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE *newps; +#endif + + if ((newsize = data->stacksize) == 0) + newsize = YYINITSTACKSIZE; + else if (newsize >= YYMAXDEPTH) + return YYENOMEM; + else if ((newsize *= 2) > YYMAXDEPTH) + newsize = YYMAXDEPTH; + + i = (int) (data->s_mark - data->s_base); + newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss)); + if (newss == 0) + return YYENOMEM; + + data->s_base = newss; + data->s_mark = newss + i; + + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); + if (newvs == 0) + return YYENOMEM; + + data->l_base = newvs; + data->l_mark = newvs + i; + +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps)); + if (newps == 0) + return YYENOMEM; + + data->p_base = newps; + data->p_mark = newps + i; +#endif + + data->stacksize = newsize; + data->s_last = data->s_base + newsize - 1; + +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize); +#endif + return 0; +} + +#if YYPURE || defined(YY_NO_LEAKS) +static void yyfreestack(YYSTACKDATA *data) +{ + free(data->s_base); + free(data->l_base); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + free(data->p_base); +#endif + memset(data, 0, sizeof(*data)); +} +#else +#define yyfreestack(data) /* nothing */ +#endif /* YYPURE || defined(YY_NO_LEAKS) */ +#if YYBTYACC + +static YYParseState * +yyNewState(unsigned size) +{ + YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState)); + if (p == NULL) return NULL; + + p->yystack.stacksize = size; + if (size == 0) + { + p->yystack.s_base = NULL; + p->yystack.l_base = NULL; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + p->yystack.p_base = NULL; +#endif + return p; + } + p->yystack.s_base = (YYINT *) malloc(size * sizeof(YYINT)); + if (p->yystack.s_base == NULL) return NULL; + p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE)); + if (p->yystack.l_base == NULL) return NULL; + memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE)); + if (p->yystack.p_base == NULL) return NULL; + memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE)); +#endif + + return p; +} + +static void +yyFreeState(YYParseState *p) +{ + yyfreestack(&p->yystack); + free(p); +} +#endif /* YYBTYACC */ + +#define YYABORT goto yyabort +#define YYREJECT goto yyabort +#define YYACCEPT goto yyaccept +#define YYERROR goto yyerrlab +#if YYBTYACC +#define YYVALID do { if (yyps->save) goto yyvalid; } while(0) +#define YYVALID_NESTED do { if (yyps->save && \ + yyps->save->save == 0) goto yyvalid; } while(0) +#endif /* YYBTYACC */ + +int +YYPARSE_DECL() +{ + int yym, yyn, yystate, yyresult; +#if YYBTYACC + int yynewerrflag; + YYParseState *yyerrctx = NULL; +#endif /* YYBTYACC */ +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE yyerror_loc_range[2]; /* position of error start & end */ +#endif +#if YYDEBUG + const char *yys; + + if ((yys = getenv("YYDEBUG")) != 0) + { + yyn = *yys; + if (yyn >= '0' && yyn <= '9') + yydebug = yyn - '0'; + } + if (yydebug) + fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX); +#endif + +#if YYBTYACC + yyps = yyNewState(0); if (yyps == 0) goto yyenomem; + yyps->save = 0; +#endif /* YYBTYACC */ + yym = 0; + yyn = 0; + yynerrs = 0; + yyerrflag = 0; + yychar = YYEMPTY; + yystate = 0; + +#if YYPURE + memset(&yystack, 0, sizeof(yystack)); +#endif + + if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystack.s_mark = yystack.s_base; + yystack.l_mark = yystack.l_base; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base; +#endif + yystate = 0; + *yystack.s_mark = 0; + +yyloop: + if ((yyn = yydefred[yystate]) != 0) goto yyreduce; + if (yychar < 0) + { +#if YYBTYACC + do { + if (yylvp < yylve) + { + /* we're currently re-reading tokens */ + yylval = *yylvp++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylloc = *yylpp++; +#endif + yychar = *yylexp++; + break; + } + if (yyps->save) + { + /* in trial mode; save scanner results for future parse attempts */ + if (yylvp == yylvlim) + { /* Enlarge lexical value queue */ + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); + + s += YYLVQUEUEGROWTH; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem; +#endif + yylvp = yylve = yylvals + p; + yylvlim = yylvals + s; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpe = yylpsns + p; + yylplim = yylpsns + s; +#endif + yylexp = yylexemes + p; + } + *yylexp = (YYINT) YYLEX; + *yylvp++ = yylval; + yylve++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *yylpp++ = yylloc; + yylpe++; +#endif + yychar = *yylexp++; + break; + } + /* normal operation, no conflict encountered */ +#endif /* YYBTYACC */ + yychar = YYLEX; +#if YYBTYACC + } while (0); +#endif /* YYBTYACC */ + if (yychar < 0) yychar = YYEOF; +#if YYDEBUG + if (yydebug) + { + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; + fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)", + YYDEBUGSTR, yydepth, yystate, yychar, yys); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval)); +#endif + fputc('\n', stderr); + } +#endif + } +#if YYBTYACC + + /* Do we have a conflict? */ + if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { + YYINT ctry; + + if (yypath) + { + YYParseState *save; +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n", + YYDEBUGSTR, yydepth, yystate); +#endif + /* Switch to the next conflict context */ + save = yypath; + yypath = save->save; + save->save = NULL; + ctry = save->ctry; + if (save->state != yystate) YYABORT; + yyFreeState(save); + + } + else + { + + /* Unresolved conflict - start/continue trial parse */ + YYParseState *save; +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate); + if (yyps->save) + fputs("ALREADY in conflict, continuing trial parse.\n", stderr); + else + fputs("Starting trial parse.\n", stderr); + } +#endif + save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); + if (save == NULL) goto yyenomem; + save->save = yyps->save; + save->state = yystate; + save->errflag = yyerrflag; + save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base); + memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); + save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base); + memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base); + memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + ctry = yytable[yyn]; + if (yyctable[ctry] == -1) + { +#if YYDEBUG + if (yydebug && yychar >= YYEOF) + fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth); +#endif + ctry++; + } + save->ctry = ctry; + if (yyps->save == NULL) + { + /* If this is a first conflict in the stack, start saving lexemes */ + if (!yylexemes) + { + yylexemes = malloc((YYLVQUEUEGROWTH) * sizeof(YYINT)); + if (yylexemes == NULL) goto yyenomem; + yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE)); + if (yylvals == NULL) goto yyenomem; + yylvlim = yylvals + YYLVQUEUEGROWTH; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE)); + if (yylpsns == NULL) goto yyenomem; + yylplim = yylpsns + YYLVQUEUEGROWTH; +#endif + } + if (yylvp == yylve) + { + yylvp = yylve = yylvals; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpe = yylpsns; +#endif + yylexp = yylexemes; + if (yychar >= YYEOF) + { + *yylve++ = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *yylpe++ = yylloc; +#endif + *yylexp = (YYINT) yychar; + yychar = YYEMPTY; + } + } + } + if (yychar >= YYEOF) + { + yylvp--; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp--; +#endif + yylexp--; + yychar = YYEMPTY; + } + save->lexeme = (int) (yylvp - yylvals); + yyps->save = save; + } + if (yytable[yyn] == ctry) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", + YYDEBUGSTR, yydepth, yystate, yyctable[ctry]); +#endif + if (yychar < 0) + { + yylvp++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp++; +#endif + yylexp++; + } + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) + goto yyoverflow; + yystate = yyctable[ctry]; + *++yystack.s_mark = (YYINT) yystate; + *++yystack.l_mark = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yylloc; +#endif + yychar = YYEMPTY; + if (yyerrflag > 0) --yyerrflag; + goto yyloop; + } + else + { + yyn = yyctable[ctry]; + goto yyreduce; + } + } /* End of code dealing with conflicts */ +#endif /* YYBTYACC */ + if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n", + YYDEBUGSTR, yydepth, yystate, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yylloc; +#endif + yychar = YYEMPTY; + if (yyerrflag > 0) --yyerrflag; + goto yyloop; + } + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { + yyn = yytable[yyn]; + goto yyreduce; + } + if (yyerrflag != 0) goto yyinrecovery; +#if YYBTYACC + + yynewerrflag = 1; + goto yyerrhandler; + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ + +yyerrlab: + /* explicit YYERROR from an action -- pop the rhs of the rule reduced + * before looking for error recovery */ + yystack.s_mark -= yym; + yystate = *yystack.s_mark; + yystack.l_mark -= yym; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark -= yym; +#endif + + yynewerrflag = 0; +yyerrhandler: + while (yyps->save) + { + int ctry; + YYParseState *save = yyps->save; +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n", + YYDEBUGSTR, yydepth, yystate, yyps->save->state, + (int)(yylvp - yylvals - yyps->save->lexeme)); +#endif + /* Memorize most forward-looking error state in case it's really an error. */ + if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals) + { + /* Free old saved error context state */ + if (yyerrctx) yyFreeState(yyerrctx); + /* Create and fill out new saved error context state */ + yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1)); + if (yyerrctx == NULL) goto yyenomem; + yyerrctx->save = yyps->save; + yyerrctx->state = yystate; + yyerrctx->errflag = yyerrflag; + yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base); + memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); + yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base); + memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base); + memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + yyerrctx->lexeme = (int) (yylvp - yylvals); + } + yylvp = yylvals + save->lexeme; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpsns + save->lexeme; +#endif + yylexp = yylexemes + save->lexeme; + yychar = YYEMPTY; + yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base); + memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); + yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base); + memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base); + memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + ctry = ++save->ctry; + yystate = save->state; + /* We tried shift, try reduce now */ + if ((yyn = yyctable[ctry]) >= 0) goto yyreduce; + yyps->save = save->save; + save->save = NULL; + yyFreeState(save); + + /* Nothing left on the stack -- error */ + if (!yyps->save) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n", + YYPREFIX, yydepth); +#endif + /* Restore state as it was in the most forward-advanced error */ + yylvp = yylvals + yyerrctx->lexeme; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpsns + yyerrctx->lexeme; +#endif + yylexp = yylexemes + yyerrctx->lexeme; + yychar = yylexp[-1]; + yylval = yylvp[-1]; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylloc = yylpp[-1]; +#endif + yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base); + memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); + yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base); + memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base); + memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + yystate = yyerrctx->state; + yyFreeState(yyerrctx); + yyerrctx = NULL; + } + yynewerrflag = 1; + } + if (yynewerrflag == 0) goto yyinrecovery; +#endif /* YYBTYACC */ + + YYERROR_CALL("syntax error"); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */ +#endif + +#if !YYBTYACC + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ +yyerrlab: +#endif + ++yynerrs; + +yyinrecovery: + if (yyerrflag < 3) + { + yyerrflag = 3; + for (;;) + { + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n", + YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + /* lookahead position is error end position */ + yyerror_loc_range[1] = yylloc; + YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */ + *++yystack.p_mark = yyloc; +#endif + goto yyloop; + } + else + { +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: error recovery discarding state %d\n", + YYDEBUGSTR, yydepth, *yystack.s_mark); +#endif + if (yystack.s_mark <= yystack.s_base) goto yyabort; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + /* the current TOS position is the error start position */ + yyerror_loc_range[0] = *yystack.p_mark; +#endif +#if defined(YYDESTRUCT_CALL) +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYDESTRUCT_CALL("error: discarding state", + yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark); +#else + YYDESTRUCT_CALL("error: discarding state", + yystos[*yystack.s_mark], yystack.l_mark); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ +#endif /* defined(YYDESTRUCT_CALL) */ + --yystack.s_mark; + --yystack.l_mark; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + --yystack.p_mark; +#endif + } + } + } + else + { + if (yychar == YYEOF) goto yyabort; +#if YYDEBUG + if (yydebug) + { + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; + fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n", + YYDEBUGSTR, yydepth, yystate, yychar, yys); + } +#endif +#if defined(YYDESTRUCT_CALL) +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc); +#else + YYDESTRUCT_CALL("error: discarding token", yychar, &yylval); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ +#endif /* defined(YYDESTRUCT_CALL) */ + yychar = YYEMPTY; + goto yyloop; + } + +yyreduce: + yym = yylen[yyn]; +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)", + YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + if (yym > 0) + { + int i; + fputc('<', stderr); + for (i = yym; i > 0; i--) + { + if (i != yym) fputs(", ", stderr); + fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]], + yystack.l_mark[1-i]), stderr); + } + fputc('>', stderr); + } +#endif + fputc('\n', stderr); + } +#endif + if (yym > 0) + yyval = yystack.l_mark[1-yym]; + else + memset(&yyval, 0, sizeof yyval); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + + /* Perform position reduction */ + memset(&yyloc, 0, sizeof(yyloc)); +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + { + YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym); + /* just in case YYERROR is invoked within the action, save + the start of the rhs as the error start position */ + yyerror_loc_range[0] = yystack.p_mark[1-yym]; + } +#endif + + switch (yyn) + { +case 1: +#line 64 "expr.oxout.y" + {yyyYoxInit();} +break; +case 2: +#line 66 "expr.oxout.y" + { + yyyDecorate(); yyyExecuteRRsection(yystack.l_mark[0].yyyOxAttrbs.yyyOxStackItem->node); + } +break; +case 3: +#line 73 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(1,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(1,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +case 4: +#line 80 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(2,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(2,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +case 5: +#line 87 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(3,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(3,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +case 6: +#line 94 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(4,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(4,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +case 7: +#line 101 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(5,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(5,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +case 8: +#line 108 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(6,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(6,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +case 9: +#line 114 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(7,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(7,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +case 10: +#line 121 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(8,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(8,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +#line 2519 "expr.oxout.tab.c" + default: + break; + } + yystack.s_mark -= yym; + yystate = *yystack.s_mark; + yystack.l_mark -= yym; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark -= yym; +#endif + yym = yylhs[yyn]; + if (yystate == 0 && yym == 0) + { +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval)); +#endif + fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL); + } +#endif + yystate = YYFINAL; + *++yystack.s_mark = YYFINAL; + *++yystack.l_mark = yyval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yyloc; +#endif + if (yychar < 0) + { +#if YYBTYACC + do { + if (yylvp < yylve) + { + /* we're currently re-reading tokens */ + yylval = *yylvp++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylloc = *yylpp++; +#endif + yychar = *yylexp++; + break; + } + if (yyps->save) + { + /* in trial mode; save scanner results for future parse attempts */ + if (yylvp == yylvlim) + { /* Enlarge lexical value queue */ + size_t p = (size_t) (yylvp - yylvals); + size_t s = (size_t) (yylvlim - yylvals); + + s += YYLVQUEUEGROWTH; + if ((yylexemes = realloc(yylexemes, s * sizeof(YYINT))) == NULL) + goto yyenomem; + if ((yylvals = realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) + goto yyenomem; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + if ((yylpsns = realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) + goto yyenomem; +#endif + yylvp = yylve = yylvals + p; + yylvlim = yylvals + s; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpe = yylpsns + p; + yylplim = yylpsns + s; +#endif + yylexp = yylexemes + p; + } + *yylexp = (YYINT) YYLEX; + *yylvp++ = yylval; + yylve++; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *yylpp++ = yylloc; + yylpe++; +#endif + yychar = *yylexp++; + break; + } + /* normal operation, no conflict encountered */ +#endif /* YYBTYACC */ + yychar = YYLEX; +#if YYBTYACC + } while (0); +#endif /* YYBTYACC */ + if (yychar < 0) yychar = YYEOF; +#if YYDEBUG + if (yydebug) + { + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; + fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)\n", + YYDEBUGSTR, yydepth, YYFINAL, yychar, yys); + } +#endif + } + if (yychar == YYEOF) goto yyaccept; + goto yyloop; + } + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) + yystate = yytable[yyn]; + else + yystate = yydgoto[yym]; +#if YYDEBUG + if (yydebug) + { + fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth); +#ifdef YYSTYPE_TOSTRING +#if YYBTYACC + if (!yytrial) +#endif /* YYBTYACC */ + fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval)); +#endif + fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate); + } +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + *++yystack.s_mark = (YYINT) yystate; + *++yystack.l_mark = yyval; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + *++yystack.p_mark = yyloc; +#endif + goto yyloop; +#if YYBTYACC + + /* Reduction declares that this path is valid. Set yypath and do a full parse */ +yyvalid: + if (yypath) YYABORT; + while (yyps->save) + { + YYParseState *save = yyps->save; + yyps->save = save->save; + save->save = yypath; + yypath = save; + } +#if YYDEBUG + if (yydebug) + fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n", + YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme)); +#endif + if (yyerrctx) + { + yyFreeState(yyerrctx); + yyerrctx = NULL; + } + yylvp = yylvals + yypath->lexeme; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yylpp = yylpsns + yypath->lexeme; +#endif + yylexp = yylexemes + yypath->lexeme; + yychar = YYEMPTY; + yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base); + memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(YYINT)); + yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base); + memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE)); +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base); + memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE)); +#endif + yystate = yypath->state; + goto yyloop; +#endif /* YYBTYACC */ + +yyoverflow: + YYERROR_CALL("yacc stack overflow"); +#if YYBTYACC + goto yyabort_nomem; +yyenomem: + YYERROR_CALL("memory exhausted"); +yyabort_nomem: +#endif /* YYBTYACC */ + yyresult = 2; + goto yyreturn; + +yyabort: + yyresult = 1; + goto yyreturn; + +yyaccept: +#if YYBTYACC + if (yyps->save) goto yyvalid; +#endif /* YYBTYACC */ + yyresult = 0; + +yyreturn: +#if defined(YYDESTRUCT_CALL) + if (yychar != YYEOF && yychar != YYEMPTY) +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc); +#else + YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ + + { + YYSTYPE *pv; +#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) + YYLTYPE *pp; + + for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp) + YYDESTRUCT_CALL("cleanup: discarding state", + yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp); +#else + for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv) + YYDESTRUCT_CALL("cleanup: discarding state", + yystos[*(yystack.s_base + (pv - yystack.l_base))], pv); +#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */ + } +#endif /* defined(YYDESTRUCT_CALL) */ + +#if YYBTYACC + if (yyerrctx) + { + yyFreeState(yyerrctx); + yyerrctx = NULL; + } + while (yyps) + { + YYParseState *save = yyps; + yyps = save->save; + save->save = NULL; + yyFreeState(save); + } + while (yypath) + { + YYParseState *save = yypath; + yypath = save->save; + save->save = NULL; + yyFreeState(save); + } +#endif /* YYBTYACC */ + yyfreestack(&yystack); + return (yyresult); +} diff --git a/test/btyacc/expr.oxout.tab.h b/test/btyacc/expr.oxout.tab.h new file mode 100644 index 0000000..e570dd7 --- /dev/null +++ b/test/btyacc/expr.oxout.tab.h @@ -0,0 +1,20 @@ +#ifndef _expr.oxout__defines_h_ +#define _expr.oxout__defines_h_ + +#define ID 257 +#define CONST 258 +#ifdef YYSTYPE +#undef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +#endif +#ifndef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +typedef union { +struct yyyOxAttrbs { +struct yyyStackItem *yyyOxStackItem; +} yyyOxAttrbs; +} YYSTYPE; +#endif /* !YYSTYPE_IS_DECLARED */ +extern YYSTYPE expr.oxout_lval; + +#endif /* _expr.oxout__defines_h_ */ diff --git a/test/expr.oxout.y b/test/expr.oxout.y new file mode 100644 index 0000000..c1769fb --- /dev/null +++ b/test/expr.oxout.y @@ -0,0 +1,1446 @@ +/* output from Ox version G1.04 */ +#line 1 "expr.Y" +#line 4 "expr.oxout.y" +%{ +#include +#include +%} +#line 1 "expr.Y" +/* Y-file for translation of infix expressions to prefix and postfix */ +%token ID CONST +%start yyyAugNonterm +%left '+' '-' +%left '*' '/' +%nonassoc '*' + +%{ +#include "expr.oxout.h" +#include + +extern int yylex(void); +extern void yyerror(const char *); +%} + +#line 25 "expr.oxout.y" + +%{ +#include +#define yyyR USHRT_MAX +%} +%type yyyAugNonterm +%union { +struct yyyOxAttrbs { +struct yyyStackItem *yyyOxStackItem; +} yyyOxAttrbs; +} + +%{ +#include +#include + +static int yyyYok = 1; + +extern yyyFT yyyRCIL[]; + +void yyyExecuteRRsection(yyyGNT *rootNode); +void yyyYoxInit(void); +void yyyDecorate(void); +struct yyyOxAttrbs; /* hack required to compensate for 'msta' behavior */ +void yyyGenIntNode(long yyyProdNum, int yyyRHSlength, int yyyNattrbs, struct yyyOxAttrbs *yyval_OxAttrbs, ...); +void yyyAdjustINRC(long yyyProdNum, int yyyRHSlength, long startP, long stopP, struct yyyOxAttrbs *yyval_OxAttrbs, ...); +void yyyCheckUnsolvedInstTrav(yyyGNT *rootNode,long *nNZrc,long *cycleSum); +void yyyUnsolvedInstSearchTrav(yyyGNT *pNode); +void yyyUnsolvedInstSearchTravAux(yyyGNT *pNode); +void yyyabort(void); + +%} + + +#line 20 "expr.Y" +%% + +#line 63 "expr.oxout.y" +yyyAugNonterm + : {yyyYoxInit();} + s + { + yyyDecorate(); yyyExecuteRRsection($2.yyyOxStackItem->node); + } + ; +#line 21 "expr.Y" +s : expr +#line 73 "expr.oxout.y" +{if(yyyYok){ +yyyGenIntNode(1,1,0,&$$,&$1); +yyyAdjustINRC(1,1,0,0,&$$,&$1);}} + +#line 27 "expr.Y" +expr : expr '*' expr +#line 80 "expr.oxout.y" +{if(yyyYok){ +yyyGenIntNode(2,3,0,&$$,&$1,&$2,&$3); +yyyAdjustINRC(2,3,0,0,&$$,&$1,&$2,&$3);}} + +#line 31 "expr.Y" + | expr '+' expr +#line 87 "expr.oxout.y" +{if(yyyYok){ +yyyGenIntNode(3,3,0,&$$,&$1,&$2,&$3); +yyyAdjustINRC(3,3,0,0,&$$,&$1,&$2,&$3);}} + +#line 35 "expr.Y" + | expr '/' expr +#line 94 "expr.oxout.y" +{if(yyyYok){ +yyyGenIntNode(4,3,0,&$$,&$1,&$2,&$3); +yyyAdjustINRC(4,3,0,0,&$$,&$1,&$2,&$3);}} + +#line 39 "expr.Y" + | expr '-' expr +#line 101 "expr.oxout.y" +{if(yyyYok){ +yyyGenIntNode(5,3,0,&$$,&$1,&$2,&$3); +yyyAdjustINRC(5,3,0,0,&$$,&$1,&$2,&$3);}} + +#line 43 "expr.Y" + | '(' expr ')' +#line 108 "expr.oxout.y" +{if(yyyYok){ +yyyGenIntNode(6,3,0,&$$,&$1,&$2,&$3); +yyyAdjustINRC(6,3,0,0,&$$,&$1,&$2,&$3);}} +#line 44 "expr.Y" + | ID +#line 114 "expr.oxout.y" +{if(yyyYok){ +yyyGenIntNode(7,1,0,&$$,&$1); +yyyAdjustINRC(7,1,0,0,&$$,&$1);}} + +#line 48 "expr.Y" + | CONST +#line 121 "expr.oxout.y" +{if(yyyYok){ +yyyGenIntNode(8,1,0,&$$,&$1); +yyyAdjustINRC(8,1,0,0,&$$,&$1);}} + +#line 52 "expr.Y" + ; +%% + +int yyparse(void); + +int main() + {yyparse(); + } + + + +#line 138 "expr.oxout.y" +long yyySSALspaceSize = 20000; +long yyyRSmaxSize = 1000; +long yyyTravStackMaxSize = 2000; + +struct yyySolvedSAlistCell {yyyWAT attrbNum; + long next; + }; + +#define yyyLambdaSSAL 0 +long yyySSALCfreeList = yyyLambdaSSAL; +long yyyNewSSALC = 1; + +struct yyySolvedSAlistCell *yyySSALspace; + +long yyyNbytesStackStg; + + + +yyyFT yyyRCIL[1]; + +short yyyIIIEL[] = {0, +0,2,6,10,14,18,22,24, +}; + +long yyyIIEL[] = { +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +1,1, +}; + +long yyyIEL[] = { +0,0,0, +}; + +yyyFT yyyEntL[1]; + +void yyyfatal(char *msg) +{fputs(msg,stderr);exit(-1);} + + + +#define yyySSALof 'S' +#define yyyRSof 'q' +#define yyyTSof 't' + + + +void yyyHandleOverflow(char which) + {char *msg1,*msg2; + long oldSize,newSize; + switch(which) + { + case yyySSALof : + msg1 = "SSAL overflow: "; + oldSize = yyySSALspaceSize; + break; + case yyyRSof : + msg1 = "ready set overflow: "; + oldSize = yyyRSmaxSize; + break; + case yyyTSof : + msg1 = "traversal stack overflow: "; + oldSize = yyyTravStackMaxSize; + break; + default :; + } + newSize = (3*oldSize)/2; + if (newSize < 100) newSize = 100; + fputs(msg1,stderr); + fprintf(stderr,"size was %ld.\n",oldSize); + msg2 = " Have to modify evaluator: -Y%c%ld.\n"; + fprintf(stderr,msg2,which,newSize); + exit(-1); + } + + + +void yyySignalEnts(yyyGNT *node,long startP,long stopP) + {yyyGNT *dumNode; + + while (startP < stopP) + { + if (!yyyEntL[startP]) dumNode = node; + else dumNode = (node->cL)[yyyEntL[startP]-1]; + if (!(--((dumNode->refCountList)[yyyEntL[startP+1]] + ) + ) + ) + { + if (++yyyRSTop == yyyAfterRS) + {yyyHandleOverflow(yyyRSof); + break; + } + yyyRSTop->node = dumNode; + yyyRSTop->whichSym = yyyEntL[startP]; + yyyRSTop->wa = yyyEntL[startP+1]; + } + startP += 2; + } + } + + + + + + +void yyySolveAndSignal() { +long yyyiDum,*yyypL; +int yyyws,yyywa; +yyyGNT *yyyRSTopN,*yyyRefN; +yyyParent yyyRSTopNp; + + +yyyRSTopNp = (yyyRSTopN = yyyRSTop->node)->parent; +yyyRefN= (yyyws = (yyyRSTop->whichSym))?yyyRSTopNp.noderef:yyyRSTopN; +yyywa = yyyRSTop->wa; +yyyRSTop--; +switch(yyyRefN->prodNum) { +case 1: /***yacc rule 1***/ + switch (yyyws) { + } +break; +case 2: /***yacc rule 2***/ + switch (yyyws) { + } +break; +case 3: /***yacc rule 3***/ + switch (yyyws) { + } +break; +case 4: /***yacc rule 4***/ + switch (yyyws) { + } +break; +case 5: /***yacc rule 5***/ + switch (yyyws) { + } +break; +case 6: /***yacc rule 6***/ + switch (yyyws) { + } +break; +case 7: /***yacc rule 7***/ + switch (yyyws) { + case 1: /**/ + switch (yyywa) { + } + break; + } +break; +case 8: /***yacc rule 8***/ + switch (yyyws) { + case 1: /**/ + switch (yyywa) { + } + break; + } +break; +} /* switch */ + +if (yyyws) /* the just-solved instance was inherited. */ + {if (yyyRSTopN->prodNum) + {yyyiDum = yyyIIEL[yyyIIIEL[yyyRSTopN->prodNum]] + yyywa; + yyySignalEnts(yyyRSTopN,yyyIEL[yyyiDum], + yyyIEL[yyyiDum+1] + ); + } + } + else /* the just-solved instance was synthesized. */ + {if (!(yyyRSTopN->parentIsStack)) /* node has a parent. */ + {yyyiDum = yyyIIEL[yyyIIIEL[yyyRSTopNp.noderef->prodNum] + + yyyRSTopN->whichSym + ] + + yyywa; + yyySignalEnts(yyyRSTopNp.noderef, + yyyIEL[yyyiDum], + yyyIEL[yyyiDum+1] + ); + } + else /* node is still on the stack--it has no parent yet. */ + {yyypL = &(yyyRSTopNp.stackref->solvedSAlist); + if (yyySSALCfreeList == yyyLambdaSSAL) + {yyySSALspace[yyyNewSSALC].next = *yyypL; + if ((*yyypL = yyyNewSSALC++) == yyySSALspaceSize) + yyyHandleOverflow(yyySSALof); + } + else + {yyyiDum = yyySSALCfreeList; + yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next; + yyySSALspace[yyyiDum].next = *yyypL; + *yyypL = yyyiDum; + } + yyySSALspace[*yyypL].attrbNum = yyywa; + } + } + +} /* yyySolveAndSignal */ + + + + + + +#define condStg unsigned int conds; +#define yyyClearConds {yyyTST->conds = 0;} +#define yyySetCond(n) {yyyTST->conds += (1<<(n));} +#define yyyCond(n) ((yyyTST->conds & (1<<(n)))?1:0) + + + +struct yyyTravStackItem {yyyGNT *node; + char isReady; + condStg + }; + + + +void yyyDoTraversals(yyyGNT *rootNode) +{struct yyyTravStackItem *yyyTravStack,*yyyTST,*yyyAfterTravStack; + yyyGNT *yyyTSTn,**yyyCLptr2; + int yyyi,yyyRL,yyyPass; + int i; + + if (!yyyYok) return; + if ((yyyTravStack = + ((struct yyyTravStackItem *) + calloc((size_t)yyyTravStackMaxSize, + (size_t)sizeof(struct yyyTravStackItem) + ) + ) + ) + == + (struct yyyTravStackItem *)NULL + ) + {fputs("malloc error in traversal stack allocation\n",stderr); + exit(-1); + } + +yyyAfterTravStack = yyyTravStack + yyyTravStackMaxSize; +yyyTravStack++; + + +for (yyyi=0; yyyi<2; yyyi++) { +yyyTST = yyyTravStack; +yyyTST->node = rootNode; +yyyTST->isReady = 0; +yyyClearConds + +while(yyyTST >= yyyTravStack) + {yyyTSTn = yyyTST->node; + if (yyyTST->isReady) + {yyyPass = 1; + goto yyyTravSwitch; +yyyTpop: + yyyTST--; + } + else + {yyyPass = 0; + goto yyyTravSwitch; +yyyTpush: + yyyTST->isReady = 1; + if (yyyTSTn->prodNum) + {if (yyyRL) + {yyyCLptr2 = yyyTSTn->cL; + i = yyyTSTn->cLlen; + while (i--) + {if (++yyyTST == yyyAfterTravStack) + yyyHandleOverflow(yyyTSof); + else + {yyyTST->node = *yyyCLptr2; + yyyTST->isReady = 0; + yyyClearConds + } + yyyCLptr2++; + } + } /* right to left */ + else /* left to right */ + {i = yyyTSTn->cLlen; + yyyCLptr2 = yyyTSTn->cL + i; + while (i--) + {yyyCLptr2--; + if (++yyyTST == yyyAfterTravStack) + yyyHandleOverflow(yyyTSof); + else + {yyyTST->node = *yyyCLptr2; + yyyTST->isReady = 0; + yyyClearConds + } + } + } /* left to right */ + } + } /* else */ + continue; +yyyTravSwitch: + switch(yyyTSTn->prodNum) { +case 1: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + +if (! +#line 24 "expr.Y" + (1) +#line 444 "expr.oxout.y" +) yyySetCond(1) +yyySetCond(2) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 24 "expr.Y" + +#line 453 "expr.oxout.y" +} +if (yyyCond(1) != yyyPass) { +#line 24 "expr.Y" + printf("\n"); + +#line 459 "expr.oxout.y" +} +if (yyyCond(2) != yyyPass) { +#line 25 "expr.Y" + printf("prefix: "); + +#line 465 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; +if ( +#line 23 "expr.Y" + (1) +#line 477 "expr.oxout.y" +) yyySetCond(2) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 22 "expr.Y" + printf("\n"); + +#line 486 "expr.oxout.y" +} +if (yyyCond(1) != yyyPass) { +#line 23 "expr.Y" + +#line 491 "expr.oxout.y" +} +if (yyyCond(2) != yyyPass) { +#line 23 "expr.Y" + printf("postfix: ")/* missing ; */ + +#line 497 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 2: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 29 "expr.Y" + printf(" * "); + +#line 518 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 28 "expr.Y" + printf(" * "); + +#line 533 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 3: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 32 "expr.Y" + printf(" + "); + +#line 554 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 33 "expr.Y" + printf(" + "); + +#line 569 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 4: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 37 "expr.Y" + printf(" / "); + +#line 590 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 36 "expr.Y" + printf(" / "); + +#line 605 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 5: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 41 "expr.Y" + printf(" - "); + +#line 626 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 40 "expr.Y" + printf(" - "); + +#line 641 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 6: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + + break; + } + break; + } + +break; +case 7: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 46 "expr.Y" + printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); + +#line 685 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 45 "expr.Y" + printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); + +#line 700 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 8: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 50 "expr.Y" + printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); + +#line 721 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 49 "expr.Y" + printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); + +#line 736 "expr.oxout.y" +} + break; + } + break; + } + +break; + } /* switch */ + if (yyyPass) goto yyyTpop; else goto yyyTpush; + } /* while */ + } /* for */ +} /* yyyDoTraversals */ + +void yyyExecuteRRsection(yyyGNT *rootNode) { + int yyyi; + long cycleSum = 0; + long nNZrc = 0; + + if (!yyyYok) return; + yyyCheckUnsolvedInstTrav(rootNode,&nNZrc,&cycleSum); + if (nNZrc) + { + fputs("\n\n\n**********\n",stderr); + fputs("cycle detected in completed parse tree",stderr); + fputs(" after decoration.\n",stderr); +#if CYCLE_VERBOSE + fprintf(stderr, + "number of unsolved attribute instances == %ld.\n", + nNZrc + ); + fprintf(stderr, + "total number of remaining dependencies == %ld.\n", + cycleSum + ); + fputs("average number of remaining dependencies\n",stderr); + fprintf(stderr," per unsolved instance == %f.\n", + ((float)(cycleSum)/(float)(nNZrc)) + ); +#endif + fprintf(stderr, + "searching parse tree for %ld unsolved instances:\n", + nNZrc + ); + yyyUnsolvedInstSearchTravAux(rootNode); + } + yyyDoTraversals(rootNode); +} /* yyyExecuteRRsection */ + + + +yyyWAT yyyLRCIL[2] = {0,0, +}; + + + +void yyyYoxInit(void) + { + static int yyyInitDone = 0; + if (yyyInitDone) return; + + if ((yyyRS = (struct yyyRSitem *) + calloc((size_t)(yyyRSmaxSize+1), (size_t)sizeof(struct yyyRSitem)) + ) + == + ((struct yyyRSitem *) NULL) + ) + yyyfatal("malloc error in ox ready set space allocation\n"); + yyyRS++; + yyyAfterRS = yyyRS + yyyRSmaxSize; + + + if ((yyySSALspace = (struct yyySolvedSAlistCell *) + calloc((size_t)(yyySSALspaceSize+1), (size_t)sizeof(struct yyySolvedSAlistCell)) + ) + == + ((struct yyySolvedSAlistCell *) NULL) + ) + yyyfatal("malloc error in stack solved list space allocation\n"); + yyyInitDone = 1; + + yyyRSTop = yyyRS - 1; + } /* yyyYoxInit */ + + + +void yyyDecorate(void) + { + while (yyyRSTop >= yyyRS) + yyySolveAndSignal(); + } + + + +void yyyGenIntNode(long yyyProdNum, int yyyRHSlength, int yyyNattrbs, struct yyyOxAttrbs *yyval_OxAttrbs, ...) + {yyyWST i; + yyySIT **yyyOxStackItem = &yyval_OxAttrbs->yyyOxStackItem; + yyyGNT *gnpDum; + va_list ap; + + *yyyOxStackItem = (yyySIT *) malloc((size_t)sizeof(yyySIT)); + if (*yyyOxStackItem == (yyySIT *) NULL) + yyyfatal("malloc error in ox yacc semantic stack space allocation\n"); + (*yyyOxStackItem)->node = + (yyyGNT *) malloc((size_t)sizeof(yyyGNT)); + if ((*yyyOxStackItem)->node == (yyyGNT *) NULL) + yyyfatal("malloc error in ox node space allocation\n"); + (*yyyOxStackItem)->solvedSAlist = yyyLambdaSSAL; + (*yyyOxStackItem)->node->parent.stackref = *yyyOxStackItem; + (*yyyOxStackItem)->node->parentIsStack = 1; + (*yyyOxStackItem)->node->cLlen = yyyRHSlength; + (*yyyOxStackItem)->node->cL = + (yyyGNT **) calloc((size_t)yyyRHSlength, (size_t)sizeof(yyyGNT *)); + if ((*yyyOxStackItem)->node->cL == (yyyGNT **) NULL) + yyyfatal("malloc error in ox child list space allocation\n"); + (*yyyOxStackItem)->node->refCountListLen = yyyNattrbs; + (*yyyOxStackItem)->node->refCountList = + (yyyRCT *) calloc((size_t)yyyNattrbs, (size_t)sizeof(yyyRCT)); + if ((*yyyOxStackItem)->node->refCountList == (yyyRCT *) NULL) + yyyfatal("malloc error in ox reference count list space allocation\n"); + (*yyyOxStackItem)->node->prodNum = yyyProdNum; + va_start(ap, yyval_OxAttrbs); + for (i=1;i<=yyyRHSlength;i++) + {yyySIT *yaccStDum = va_arg(ap,struct yyyOxAttrbs *)->yyyOxStackItem; + gnpDum = (*yyyOxStackItem)->node->cL[i-1] = yaccStDum->node; + gnpDum->whichSym = i; + gnpDum->parent.noderef = (*yyyOxStackItem)->node; + gnpDum->parentIsStack = 0; + } + va_end(ap); + } + + + +#define yyyDECORfREQ 50 + + + +void yyyAdjustINRC(long yyyProdNum, int yyyRHSlength, long startP, long stopP, struct yyyOxAttrbs *yyval_OxAttrbs, ...) + {yyyWST i; + yyySIT *yyyOxStackItem = yyval_OxAttrbs->yyyOxStackItem; + long SSALptr,SSALptrHead,*cPtrPtr; + long *pL; + yyyGNT *gnpDum; + long iTemp; + long nextP; + static unsigned short intNodeCount = yyyDECORfREQ; + va_list ap; + + nextP = startP; + while (nextP < stopP) + {if (yyyRCIL[nextP] == yyyR) + {(yyyOxStackItem->node->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2]; + } + else + {(((yyyOxStackItem->node->cL)[yyyRCIL[nextP]])->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2]; + } + nextP += 3; + } + pL = yyyIIEL + yyyIIIEL[yyyProdNum]; + va_start(ap, yyval_OxAttrbs); + for (i=1;i<=yyyRHSlength;i++) + {yyySIT *yaccStDum = va_arg(ap,struct yyyOxAttrbs *)->yyyOxStackItem; + pL++; + SSALptrHead = SSALptr = *(cPtrPtr = &(yaccStDum->solvedSAlist)); + if (SSALptr != yyyLambdaSSAL) + {*cPtrPtr = yyyLambdaSSAL; + do + { + iTemp = (*pL+yyySSALspace[SSALptr].attrbNum); + yyySignalEnts(yyyOxStackItem->node, + yyyIEL[iTemp], + yyyIEL[iTemp+1] + ); + SSALptr = *(cPtrPtr = &(yyySSALspace[SSALptr].next)); + } + while (SSALptr != yyyLambdaSSAL); + *cPtrPtr = yyySSALCfreeList; + yyySSALCfreeList = SSALptrHead; + } + } + va_end(ap); + nextP = startP + 2; + while (nextP < stopP) + {if (!yyyRCIL[nextP]) + {if (yyyRCIL[nextP-2] == yyyR) + {pL = &(yyyOxStackItem->solvedSAlist); + if (yyySSALCfreeList == yyyLambdaSSAL) + {yyySSALspace[yyyNewSSALC].next = *pL; + if ((*pL = yyyNewSSALC++) == yyySSALspaceSize) + yyyHandleOverflow(yyySSALof); + } + else + {iTemp = yyySSALCfreeList; + yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next; + yyySSALspace[iTemp].next = *pL; + *pL = iTemp; + } + yyySSALspace[*pL].attrbNum = yyyRCIL[nextP-1]; + } + else + {if ((gnpDum = (yyyOxStackItem->node->cL)[yyyRCIL[nextP-2]])->prodNum != 0) + { + iTemp = yyyIIEL[yyyIIIEL[gnpDum->prodNum]] + yyyRCIL[nextP-1]; + yyySignalEnts(gnpDum, + yyyIEL[iTemp], + yyyIEL[iTemp+1] + ); + } + } + } + nextP += 3; + } + if (!--intNodeCount) + {intNodeCount = yyyDECORfREQ; + yyyDecorate(); + } + } + + + +void yyyGenLeaf(int nAttrbs,int typeNum,long startP,long stopP,YYSTYPE *yylval) + {yyyRCT *rcPdum; + yyySIT **yyyOxStackItem = &yylval->yyyOxAttrbs.yyyOxStackItem; + (*yyyOxStackItem) = (yyySIT *) malloc((size_t)sizeof(yyySIT)); + if ((*yyyOxStackItem) == (yyySIT *) NULL) + yyyfatal("malloc error in ox yacc semantic stack space allocation\n"); + (*yyyOxStackItem)->node = + (yyyGNT *) malloc((size_t)sizeof(yyyGNT)) + ; + if ((*yyyOxStackItem)->node == (yyyGNT *) NULL) + yyyfatal("malloc error in ox node space allocation\n"); + (*yyyOxStackItem)->solvedSAlist = yyyLambdaSSAL; + (*yyyOxStackItem)->node->parent.stackref = *yyyOxStackItem; + (*yyyOxStackItem)->node->parentIsStack = 1; + (*yyyOxStackItem)->node->cLlen = 0; + (*yyyOxStackItem)->node->cL = (yyyGNT **)NULL; + (*yyyOxStackItem)->node->refCountListLen = nAttrbs; + rcPdum = (*yyyOxStackItem)->node->refCountList = + (yyyRCT *) calloc((size_t)nAttrbs, (size_t)sizeof(yyyRCT)); + if (rcPdum == (yyyRCT *) NULL) + yyyfatal("malloc error in ox reference count list space allocation\n"); + while (startP < stopP) rcPdum[yyyLRCIL[startP++]] = 0; + (*yyyOxStackItem)->node->prodNum = 0; + (*yyyOxStackItem)->node->whichSym = 0; + } + + + +void yyyabort(void) + {yyyYok = 0; + } + + + + + +#define yyyLastProdNum 8 + + +#define yyyNsorts 1 + + +int yyyProdsInd[] = { + 0, + 0, 2, 6, 10, 14, 18, 22, 24, + 26, +}; + + +int yyyProds[][2] = { +{ 116, 0},{ 462, 0},{ 462, 0},{ 462, 0},{ 412, 0}, +{ 462, 0},{ 462, 0},{ 462, 0},{ 420, 0},{ 462, 0}, +{ 462, 0},{ 462, 0},{ 452, 0},{ 462, 0},{ 462, 0}, +{ 462, 0},{ 436, 0},{ 462, 0},{ 462, 0},{ 396, 0}, +{ 462, 0},{ 404, 0},{ 462, 0},{ 619, 1},{ 462, 0}, +{ 567, 1}, +}; + + +int yyySortsInd[] = { + 0, + 0, + 1, +}; + + +int yyySorts[] = { + 413, +}; + + + +char *yyyStringTab[] = { +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,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,"s",0,0,0, +0,0,"y",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, +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,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,"LRpre",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,"'*'","lexeme",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,"expr",0,0, +0,0,0,0,0, +0,0,0,0,0, +0,"printf",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,0, +0,0,"CONST","LRpost",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,"ID", +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,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,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,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,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, +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,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,0, +0, +}; + + + +#define yyySizeofProd(num) (yyyProdsInd[(num)+1] - yyyProdsInd[(num)]) + +#define yyyGSoccurStr(prodNum,symPos) \ + (yyyStringTab[yyyProds[yyyProdsInd[(prodNum)] + (symPos)][0]]) + +#define yyySizeofSort(num) (yyySortsInd[(num)+1] - yyySortsInd[(num)]) + +#define yyySortOf(prodNum,symPos) \ + (yyyProds[yyyProdsInd[(prodNum)] + (symPos)][1]) + +#define yyyAttrbStr(prodNum,symPos,attrbNum) \ + (yyyStringTab[yyySorts[yyySortsInd[yyySortOf(prodNum,symPos)] + \ + (attrbNum) \ + ] \ + ] \ + ) + + + +void yyyShowProd(int i) + {int j,nSyms; + + nSyms = yyySizeofProd(i); + for (j=0; j\n",stderr); + else + putc('\n',stderr); + } + } + } + + + +void yyyCheckNodeInstancesSolved(yyyGNT *np) + {int mysort,sortSize,i,prodNum,symPos,inTerminalNode; + int nUnsolvedInsts = 0; + + if (np->prodNum != 0) + {inTerminalNode = 0; + prodNum = np->prodNum; + symPos = 0; + } + else + {inTerminalNode = 1; + prodNum = np->parent.noderef->prodNum; + symPos = np->whichSym; + } + mysort = yyySortOf(prodNum,symPos); + sortSize = yyySizeofSort(mysort); + for (i=0; irefCountList)[i] != 0) nUnsolvedInsts += 1; + if (nUnsolvedInsts) + {fprintf(stderr, + "\nFound node that has %d unsolved attribute instance(s).\n", + nUnsolvedInsts + ); + fprintf(stderr,"Node is labeled \"%s\".\n", + yyyGSoccurStr(prodNum,symPos)); + if (inTerminalNode) + {fputs("Node is terminal. Its parent production is:\n ",stderr); + yyyShowProd(prodNum); + } + else + {fputs("Node is nonterminal. ",stderr); + if (!(np->parentIsStack)) + {fprintf(stderr, + "Node is %dth child in its parent production:\n ", + np->whichSym + ); + yyyShowProd(np->parent.noderef->prodNum); + } + fputs("Node is on left hand side of this production:\n ",stderr); + yyyShowProd(np->prodNum); + } + fputs("The following instances are unsolved:\n",stderr); + for (i=0; irefCountList)[i] != 0) + fprintf(stderr," %-16s still has %1d dependencies.\n", + yyyAttrbStr(prodNum,symPos,i),(np->refCountList)[i]); + } + } + + + +void yyyCheckUnsolvedInstTrav(yyyGNT *pNode,long *nNZrc,long *cycleSum) + {yyyGNT **yyyCLpdum; + yyyRCT *rcp; + int i; + + /* visit the refCountList of each node in the tree, and sum the non-zero refCounts */ + rcp = pNode->refCountList; + i = pNode->refCountListLen; + while (i--) + if (*rcp++) {*cycleSum += *(rcp - 1); (*nNZrc)++;} + yyyCLpdum = pNode->cL; + i = pNode->cLlen; + while (i--) + { + yyyCheckUnsolvedInstTrav(*yyyCLpdum,nNZrc,cycleSum); + yyyCLpdum++; + } + } + + + +void yyyUnsolvedInstSearchTravAux(yyyGNT *pNode) + {yyyGNT **yyyCLpdum; + int i; + + yyyCheckNodeInstancesSolved(pNode); + yyyCLpdum = pNode->cL; + i = pNode->cLlen; + while (i--) + { + yyyUnsolvedInstSearchTravAux(*yyyCLpdum); + yyyCLpdum++; + } + } + + + +void yyyUnsolvedInstSearchTrav(yyyGNT *pNode) + {yyyGNT **yyyCLpdum; + int i; + + yyyCLpdum = pNode->cL; + i = pNode->cLlen; + while (i--) + { + yyyUnsolvedInstSearchTravAux(*yyyCLpdum); + yyyCLpdum++; + } + } + + + diff --git a/test/yacc/expr.oxout.error b/test/yacc/expr.oxout.error new file mode 100644 index 0000000..58fdb1c --- /dev/null +++ b/test/yacc/expr.oxout.error @@ -0,0 +1 @@ +YACC: w - line 6 of "expr.Y", the precedence of '*' has been redeclared diff --git a/test/yacc/expr.oxout.output b/test/yacc/expr.oxout.output new file mode 100644 index 0000000..bfd433c --- /dev/null +++ b/test/yacc/expr.oxout.output @@ -0,0 +1,209 @@ + 0 $accept : yyyAugNonterm $end + + 1 $$1 : + + 2 yyyAugNonterm : $$1 s + + 3 s : expr + + 4 expr : expr '*' expr + 5 | expr '+' expr + 6 | expr '/' expr + 7 | expr '-' expr + 8 | '(' expr ')' + 9 | ID + 10 | CONST + +state 0 + $accept : . yyyAugNonterm $end (0) + $$1 : . (1) + + . reduce 1 + + yyyAugNonterm goto 1 + $$1 goto 2 + + +state 1 + $accept : yyyAugNonterm . $end (0) + + $end accept + + +state 2 + yyyAugNonterm : $$1 . s (2) + + ID shift 3 + CONST shift 4 + '(' shift 5 + . error + + s goto 6 + expr goto 7 + + +state 3 + expr : ID . (9) + + . reduce 9 + + +state 4 + expr : CONST . (10) + + . reduce 10 + + +state 5 + expr : '(' . expr ')' (8) + + ID shift 3 + CONST shift 4 + '(' shift 5 + . error + + expr goto 8 + + +state 6 + yyyAugNonterm : $$1 s . (2) + + . reduce 2 + + +state 7 + s : expr . (3) + expr : expr . '*' expr (4) + expr : expr . '+' expr (5) + expr : expr . '/' expr (6) + expr : expr . '-' expr (7) + + '+' shift 9 + '-' shift 10 + '*' shift 11 + '/' shift 12 + $end reduce 3 + + +state 8 + expr : expr . '*' expr (4) + expr : expr . '+' expr (5) + expr : expr . '/' expr (6) + expr : expr . '-' expr (7) + expr : '(' expr . ')' (8) + + '+' shift 9 + '-' shift 10 + '*' shift 11 + '/' shift 12 + ')' shift 13 + . error + + +state 9 + expr : expr '+' . expr (5) + + ID shift 3 + CONST shift 4 + '(' shift 5 + . error + + expr goto 14 + + +state 10 + expr : expr '-' . expr (7) + + ID shift 3 + CONST shift 4 + '(' shift 5 + . error + + expr goto 15 + + +state 11 + expr : expr '*' . expr (4) + + ID shift 3 + CONST shift 4 + '(' shift 5 + . error + + expr goto 16 + + +state 12 + expr : expr '/' . expr (6) + + ID shift 3 + CONST shift 4 + '(' shift 5 + . error + + expr goto 17 + + +state 13 + expr : '(' expr ')' . (8) + + . reduce 8 + + +state 14 + expr : expr . '*' expr (4) + expr : expr . '+' expr (5) + expr : expr '+' expr . (5) + expr : expr . '/' expr (6) + expr : expr . '-' expr (7) + + '*' shift 11 + '/' shift 12 + $end reduce 5 + '+' reduce 5 + '-' reduce 5 + ')' reduce 5 + + +state 15 + expr : expr . '*' expr (4) + expr : expr . '+' expr (5) + expr : expr . '/' expr (6) + expr : expr . '-' expr (7) + expr : expr '-' expr . (7) + + '*' shift 11 + '/' shift 12 + $end reduce 7 + '+' reduce 7 + '-' reduce 7 + ')' reduce 7 + + +state 16 + expr : expr . '*' expr (4) + expr : expr '*' expr . (4) + expr : expr . '+' expr (5) + expr : expr . '/' expr (6) + expr : expr . '-' expr (7) + + . reduce 4 + + +state 17 + expr : expr . '*' expr (4) + expr : expr . '+' expr (5) + expr : expr . '/' expr (6) + expr : expr '/' expr . (6) + expr : expr . '-' expr (7) + + '*' shift 11 + $end reduce 6 + '+' reduce 6 + '-' reduce 6 + '/' reduce 6 + ')' reduce 6 + + +10 terminals, 5 nonterminals +11 grammar rules, 18 states diff --git a/test/yacc/expr.oxout.tab.c b/test/yacc/expr.oxout.tab.c new file mode 100644 index 0000000..b4b7ec4 --- /dev/null +++ b/test/yacc/expr.oxout.tab.c @@ -0,0 +1,1958 @@ +/* original parser id follows */ +/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */ +/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */ + +#define YYBYACC 1 +#define YYMAJOR 1 +#define YYMINOR 9 +#define YYCHECK "yyyymmdd" + +#define YYEMPTY (-1) +#define yyclearin (yychar = YYEMPTY) +#define yyerrok (yyerrflag = 0) +#define YYRECOVERING() (yyerrflag != 0) +#define YYENOMEM (-2) +#define YYEOF 0 + +#ifndef yyparse +#define yyparse expr.oxout_parse +#endif /* yyparse */ + +#ifndef yylex +#define yylex expr.oxout_lex +#endif /* yylex */ + +#ifndef yyerror +#define yyerror expr.oxout_error +#endif /* yyerror */ + +#ifndef yychar +#define yychar expr.oxout_char +#endif /* yychar */ + +#ifndef yyval +#define yyval expr.oxout_val +#endif /* yyval */ + +#ifndef yylval +#define yylval expr.oxout_lval +#endif /* yylval */ + +#ifndef yydebug +#define yydebug expr.oxout_debug +#endif /* yydebug */ + +#ifndef yynerrs +#define yynerrs expr.oxout_nerrs +#endif /* yynerrs */ + +#ifndef yyerrflag +#define yyerrflag expr.oxout_errflag +#endif /* yyerrflag */ + +#ifndef yylhs +#define yylhs expr.oxout_lhs +#endif /* yylhs */ + +#ifndef yylen +#define yylen expr.oxout_len +#endif /* yylen */ + +#ifndef yydefred +#define yydefred expr.oxout_defred +#endif /* yydefred */ + +#ifndef yydgoto +#define yydgoto expr.oxout_dgoto +#endif /* yydgoto */ + +#ifndef yysindex +#define yysindex expr.oxout_sindex +#endif /* yysindex */ + +#ifndef yyrindex +#define yyrindex expr.oxout_rindex +#endif /* yyrindex */ + +#ifndef yygindex +#define yygindex expr.oxout_gindex +#endif /* yygindex */ + +#ifndef yytable +#define yytable expr.oxout_table +#endif /* yytable */ + +#ifndef yycheck +#define yycheck expr.oxout_check +#endif /* yycheck */ + +#ifndef yyname +#define yyname expr.oxout_name +#endif /* yyname */ + +#ifndef yyrule +#define yyrule expr.oxout_rule +#endif /* yyrule */ +#define YYPREFIX "expr.oxout_" + +#define YYPURE 0 + +#line 5 "expr.oxout.y" +#include +#include +#line 8 "expr.Y" + +#include "expr.oxout.h" +#include + +extern int yylex(void); +extern void yyerror(const char *); +#line 27 "expr.oxout.y" +#include +#define yyyR USHRT_MAX +#ifdef YYSTYPE +#undef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +#endif +#ifndef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +#line 31 "expr.oxout.y" +typedef union { +struct yyyOxAttrbs { +struct yyyStackItem *yyyOxStackItem; +} yyyOxAttrbs; +} YYSTYPE; +#endif /* !YYSTYPE_IS_DECLARED */ +#line 38 "expr.oxout.y" +#include +#include + +static int yyyYok = 1; + +extern yyyFT yyyRCIL[]; + +void yyyExecuteRRsection(yyyGNT *rootNode); +void yyyYoxInit(void); +void yyyDecorate(void); +struct yyyOxAttrbs; /* hack required to compensate for 'msta' behavior */ +void yyyGenIntNode(long yyyProdNum, int yyyRHSlength, int yyyNattrbs, struct yyyOxAttrbs *yyval_OxAttrbs, ...); +void yyyAdjustINRC(long yyyProdNum, int yyyRHSlength, long startP, long stopP, struct yyyOxAttrbs *yyval_OxAttrbs, ...); +void yyyCheckUnsolvedInstTrav(yyyGNT *rootNode,long *nNZrc,long *cycleSum); +void yyyUnsolvedInstSearchTrav(yyyGNT *pNode); +void yyyUnsolvedInstSearchTravAux(yyyGNT *pNode); +void yyyabort(void); + +#line 146 "expr.oxout.tab.c" + +/* compatibility with bison */ +#ifdef YYPARSE_PARAM +/* compatibility with FreeBSD */ +# ifdef YYPARSE_PARAM_TYPE +# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) +# else +# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) +# endif +#else +# define YYPARSE_DECL() yyparse(void) +#endif + +/* Parameters sent to lex. */ +#ifdef YYLEX_PARAM +# define YYLEX_DECL() yylex(void *YYLEX_PARAM) +# define YYLEX yylex(YYLEX_PARAM) +#else +# define YYLEX_DECL() yylex(void) +# define YYLEX yylex() +#endif + +/* Parameters sent to yyerror. */ +#ifndef YYERROR_DECL +#define YYERROR_DECL() yyerror(const char *s) +#endif +#ifndef YYERROR_CALL +#define YYERROR_CALL(msg) yyerror(msg) +#endif + +extern int YYPARSE_DECL(); + +#define ID 257 +#define CONST 258 +#define YYERRCODE 256 +typedef short YYINT; +static const YYINT expr.oxout_lhs[] = { -1, + 2, 0, 1, 3, 3, 3, 3, 3, 3, 3, +}; +static const YYINT expr.oxout_len[] = { 2, + 0, 2, 1, 3, 3, 3, 3, 3, 1, 1, +}; +static const YYINT expr.oxout_defred[] = { 1, + 0, 0, 9, 10, 0, 2, 0, 0, 0, 0, + 0, 0, 8, 0, 0, 4, 0, +}; +static const YYINT expr.oxout_dgoto[] = { 1, + 6, 2, 7, +}; +static const YYINT expr.oxout_sindex[] = { 0, + 0, -40, 0, 0, -40, 0, -18, -24, -40, -40, + -40, -40, 0, -37, -37, 0, -39, +}; +static const YYINT expr.oxout_rindex[] = { 0, + 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, + 0, 0, 0, 2, 8, 0, 1, +}; +static const YYINT expr.oxout_gindex[] = { 0, + 0, 0, 4, +}; +#define YYTABLESIZE 218 +static const YYINT expr.oxout_table[] = { 5, + 6, 5, 11, 0, 11, 3, 0, 7, 8, 12, + 0, 0, 14, 15, 16, 17, 13, 11, 9, 0, + 10, 0, 12, 11, 9, 0, 10, 0, 12, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 6, 5, 6, 5, 6, 5, 6, 7, 0, + 7, 0, 7, 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, + 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, 3, 4, +}; +static const YYINT expr.oxout_check[] = { 40, + 0, 0, 42, -1, 42, 0, -1, 0, 5, 47, + -1, -1, 9, 10, 11, 12, 41, 42, 43, -1, + 45, -1, 47, 42, 43, -1, 45, -1, 47, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 41, 41, 43, 43, 45, 45, 47, 41, -1, + 43, -1, 45, -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, -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, -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, -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, -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, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 257, 258, +}; +#define YYFINAL 1 +#ifndef YYDEBUG +#define YYDEBUG 0 +#endif +#define YYMAXTOKEN 258 +#define YYUNDFTOKEN 264 +#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a)) +#if YYDEBUG +static const char *const expr.oxout_name[] = { + +"end-of-file",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,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,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,"ID", +"CONST",0,0,0,0,0,"illegal-symbol", +}; +static const char *const expr.oxout_rule[] = { +"$accept : yyyAugNonterm", +"$$1 :", +"yyyAugNonterm : $$1 s", +"s : expr", +"expr : expr '*' expr", +"expr : expr '+' expr", +"expr : expr '/' expr", +"expr : expr '-' expr", +"expr : '(' expr ')'", +"expr : ID", +"expr : CONST", + +}; +#endif + +int yydebug; +int yynerrs; + +int yyerrflag; +int yychar; +YYSTYPE yyval; +YYSTYPE yylval; + +/* define the initial stack-sizes */ +#ifdef YYSTACKSIZE +#undef YYMAXDEPTH +#define YYMAXDEPTH YYSTACKSIZE +#else +#ifdef YYMAXDEPTH +#define YYSTACKSIZE YYMAXDEPTH +#else +#define YYSTACKSIZE 10000 +#define YYMAXDEPTH 10000 +#endif +#endif + +#define YYINITSTACKSIZE 200 + +typedef struct { + unsigned stacksize; + YYINT *s_base; + YYINT *s_mark; + YYINT *s_last; + YYSTYPE *l_base; + YYSTYPE *l_mark; +} YYSTACKDATA; +/* variables for the parser stack */ +static YYSTACKDATA yystack; +#line 53 "expr.Y" + + +int yyparse(void); + +int main() + {yyparse(); + } + + + +#line 138 "expr.oxout.y" +long yyySSALspaceSize = 20000; +long yyyRSmaxSize = 1000; +long yyyTravStackMaxSize = 2000; + +struct yyySolvedSAlistCell {yyyWAT attrbNum; + long next; + }; + +#define yyyLambdaSSAL 0 +long yyySSALCfreeList = yyyLambdaSSAL; +long yyyNewSSALC = 1; + +struct yyySolvedSAlistCell *yyySSALspace; + +long yyyNbytesStackStg; + + + +yyyFT yyyRCIL[1]; + +short yyyIIIEL[] = {0, +0,2,6,10,14,18,22,24, +}; + +long yyyIIEL[] = { +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +1,1, +}; + +long yyyIEL[] = { +0,0,0, +}; + +yyyFT yyyEntL[1]; + +void yyyfatal(char *msg) +{fputs(msg,stderr);exit(-1);} + + + +#define yyySSALof 'S' +#define yyyRSof 'q' +#define yyyTSof 't' + + + +void yyyHandleOverflow(char which) + {char *msg1,*msg2; + long oldSize,newSize; + switch(which) + { + case yyySSALof : + msg1 = "SSAL overflow: "; + oldSize = yyySSALspaceSize; + break; + case yyyRSof : + msg1 = "ready set overflow: "; + oldSize = yyyRSmaxSize; + break; + case yyyTSof : + msg1 = "traversal stack overflow: "; + oldSize = yyyTravStackMaxSize; + break; + default :; + } + newSize = (3*oldSize)/2; + if (newSize < 100) newSize = 100; + fputs(msg1,stderr); + fprintf(stderr,"size was %ld.\n",oldSize); + msg2 = " Have to modify evaluator: -Y%c%ld.\n"; + fprintf(stderr,msg2,which,newSize); + exit(-1); + } + + + +void yyySignalEnts(yyyGNT *node,long startP,long stopP) + {yyyGNT *dumNode; + + while (startP < stopP) + { + if (!yyyEntL[startP]) dumNode = node; + else dumNode = (node->cL)[yyyEntL[startP]-1]; + if (!(--((dumNode->refCountList)[yyyEntL[startP+1]] + ) + ) + ) + { + if (++yyyRSTop == yyyAfterRS) + {yyyHandleOverflow(yyyRSof); + break; + } + yyyRSTop->node = dumNode; + yyyRSTop->whichSym = yyyEntL[startP]; + yyyRSTop->wa = yyyEntL[startP+1]; + } + startP += 2; + } + } + + + + + + +void yyySolveAndSignal() { +long yyyiDum,*yyypL; +int yyyws,yyywa; +yyyGNT *yyyRSTopN,*yyyRefN; +yyyParent yyyRSTopNp; + + +yyyRSTopNp = (yyyRSTopN = yyyRSTop->node)->parent; +yyyRefN= (yyyws = (yyyRSTop->whichSym))?yyyRSTopNp.noderef:yyyRSTopN; +yyywa = yyyRSTop->wa; +yyyRSTop--; +switch(yyyRefN->prodNum) { +case 1: /***yacc rule 1***/ + switch (yyyws) { + } +break; +case 2: /***yacc rule 2***/ + switch (yyyws) { + } +break; +case 3: /***yacc rule 3***/ + switch (yyyws) { + } +break; +case 4: /***yacc rule 4***/ + switch (yyyws) { + } +break; +case 5: /***yacc rule 5***/ + switch (yyyws) { + } +break; +case 6: /***yacc rule 6***/ + switch (yyyws) { + } +break; +case 7: /***yacc rule 7***/ + switch (yyyws) { + case 1: /**/ + switch (yyywa) { + } + break; + } +break; +case 8: /***yacc rule 8***/ + switch (yyyws) { + case 1: /**/ + switch (yyywa) { + } + break; + } +break; +} /* switch */ + +if (yyyws) /* the just-solved instance was inherited. */ + {if (yyyRSTopN->prodNum) + {yyyiDum = yyyIIEL[yyyIIIEL[yyyRSTopN->prodNum]] + yyywa; + yyySignalEnts(yyyRSTopN,yyyIEL[yyyiDum], + yyyIEL[yyyiDum+1] + ); + } + } + else /* the just-solved instance was synthesized. */ + {if (!(yyyRSTopN->parentIsStack)) /* node has a parent. */ + {yyyiDum = yyyIIEL[yyyIIIEL[yyyRSTopNp.noderef->prodNum] + + yyyRSTopN->whichSym + ] + + yyywa; + yyySignalEnts(yyyRSTopNp.noderef, + yyyIEL[yyyiDum], + yyyIEL[yyyiDum+1] + ); + } + else /* node is still on the stack--it has no parent yet. */ + {yyypL = &(yyyRSTopNp.stackref->solvedSAlist); + if (yyySSALCfreeList == yyyLambdaSSAL) + {yyySSALspace[yyyNewSSALC].next = *yyypL; + if ((*yyypL = yyyNewSSALC++) == yyySSALspaceSize) + yyyHandleOverflow(yyySSALof); + } + else + {yyyiDum = yyySSALCfreeList; + yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next; + yyySSALspace[yyyiDum].next = *yyypL; + *yyypL = yyyiDum; + } + yyySSALspace[*yyypL].attrbNum = yyywa; + } + } + +} /* yyySolveAndSignal */ + + + + + + +#define condStg unsigned int conds; +#define yyyClearConds {yyyTST->conds = 0;} +#define yyySetCond(n) {yyyTST->conds += (1<<(n));} +#define yyyCond(n) ((yyyTST->conds & (1<<(n)))?1:0) + + + +struct yyyTravStackItem {yyyGNT *node; + char isReady; + condStg + }; + + + +void yyyDoTraversals(yyyGNT *rootNode) +{struct yyyTravStackItem *yyyTravStack,*yyyTST,*yyyAfterTravStack; + yyyGNT *yyyTSTn,**yyyCLptr2; + int yyyi,yyyRL,yyyPass; + int i; + + if (!yyyYok) return; + if ((yyyTravStack = + ((struct yyyTravStackItem *) + calloc((size_t)yyyTravStackMaxSize, + (size_t)sizeof(struct yyyTravStackItem) + ) + ) + ) + == + (struct yyyTravStackItem *)NULL + ) + {fputs("malloc error in traversal stack allocation\n",stderr); + exit(-1); + } + +yyyAfterTravStack = yyyTravStack + yyyTravStackMaxSize; +yyyTravStack++; + + +for (yyyi=0; yyyi<2; yyyi++) { +yyyTST = yyyTravStack; +yyyTST->node = rootNode; +yyyTST->isReady = 0; +yyyClearConds + +while(yyyTST >= yyyTravStack) + {yyyTSTn = yyyTST->node; + if (yyyTST->isReady) + {yyyPass = 1; + goto yyyTravSwitch; +yyyTpop: + yyyTST--; + } + else + {yyyPass = 0; + goto yyyTravSwitch; +yyyTpush: + yyyTST->isReady = 1; + if (yyyTSTn->prodNum) + {if (yyyRL) + {yyyCLptr2 = yyyTSTn->cL; + i = yyyTSTn->cLlen; + while (i--) + {if (++yyyTST == yyyAfterTravStack) + yyyHandleOverflow(yyyTSof); + else + {yyyTST->node = *yyyCLptr2; + yyyTST->isReady = 0; + yyyClearConds + } + yyyCLptr2++; + } + } /* right to left */ + else /* left to right */ + {i = yyyTSTn->cLlen; + yyyCLptr2 = yyyTSTn->cL + i; + while (i--) + {yyyCLptr2--; + if (++yyyTST == yyyAfterTravStack) + yyyHandleOverflow(yyyTSof); + else + {yyyTST->node = *yyyCLptr2; + yyyTST->isReady = 0; + yyyClearConds + } + } + } /* left to right */ + } + } /* else */ + continue; +yyyTravSwitch: + switch(yyyTSTn->prodNum) { +case 1: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + +if (! +#line 24 "expr.Y" + (1) +#line 444 "expr.oxout.y" +) yyySetCond(1) +yyySetCond(2) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 24 "expr.Y" + +#line 453 "expr.oxout.y" +} +if (yyyCond(1) != yyyPass) { +#line 24 "expr.Y" + printf("\n"); + +#line 459 "expr.oxout.y" +} +if (yyyCond(2) != yyyPass) { +#line 25 "expr.Y" + printf("prefix: "); + +#line 465 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; +if ( +#line 23 "expr.Y" + (1) +#line 477 "expr.oxout.y" +) yyySetCond(2) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 22 "expr.Y" + printf("\n"); + +#line 486 "expr.oxout.y" +} +if (yyyCond(1) != yyyPass) { +#line 23 "expr.Y" + +#line 491 "expr.oxout.y" +} +if (yyyCond(2) != yyyPass) { +#line 23 "expr.Y" + printf("postfix: ")/* missing ; */ + +#line 497 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 2: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 29 "expr.Y" + printf(" * "); + +#line 518 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 28 "expr.Y" + printf(" * "); + +#line 533 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 3: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 32 "expr.Y" + printf(" + "); + +#line 554 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 33 "expr.Y" + printf(" + "); + +#line 569 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 4: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 37 "expr.Y" + printf(" / "); + +#line 590 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 36 "expr.Y" + printf(" / "); + +#line 605 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 5: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 41 "expr.Y" + printf(" - "); + +#line 626 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 40 "expr.Y" + printf(" - "); + +#line 641 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 6: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + + break; + } + break; + } + +break; +case 7: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 46 "expr.Y" + printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); + +#line 685 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 45 "expr.Y" + printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); + +#line 700 "expr.oxout.y" +} + break; + } + break; + } + +break; +case 8: + switch(yyyi) { + case 0: + switch(yyyPass) { + case 0: +yyyRL = 0;yyySetCond(0) + + case 1: + +if (yyyCond(0) != yyyPass) { +#line 50 "expr.Y" + printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); + +#line 721 "expr.oxout.y" +} + break; + } + break; + case 1: + switch(yyyPass) { + case 0: +yyyRL = 0; + case 1: + +if (yyyCond(0) != yyyPass) { +#line 49 "expr.Y" + printf(" %s ",yyyTSTn->cL[0]->yyyAttrbs.yyyAttrb1.lexeme); + +#line 736 "expr.oxout.y" +} + break; + } + break; + } + +break; + } /* switch */ + if (yyyPass) goto yyyTpop; else goto yyyTpush; + } /* while */ + } /* for */ +} /* yyyDoTraversals */ + +void yyyExecuteRRsection(yyyGNT *rootNode) { + int yyyi; + long cycleSum = 0; + long nNZrc = 0; + + if (!yyyYok) return; + yyyCheckUnsolvedInstTrav(rootNode,&nNZrc,&cycleSum); + if (nNZrc) + { + fputs("\n\n\n**********\n",stderr); + fputs("cycle detected in completed parse tree",stderr); + fputs(" after decoration.\n",stderr); +#if CYCLE_VERBOSE + fprintf(stderr, + "number of unsolved attribute instances == %ld.\n", + nNZrc + ); + fprintf(stderr, + "total number of remaining dependencies == %ld.\n", + cycleSum + ); + fputs("average number of remaining dependencies\n",stderr); + fprintf(stderr," per unsolved instance == %f.\n", + ((float)(cycleSum)/(float)(nNZrc)) + ); +#endif + fprintf(stderr, + "searching parse tree for %ld unsolved instances:\n", + nNZrc + ); + yyyUnsolvedInstSearchTravAux(rootNode); + } + yyyDoTraversals(rootNode); +} /* yyyExecuteRRsection */ + + + +yyyWAT yyyLRCIL[2] = {0,0, +}; + + + +void yyyYoxInit(void) + { + static int yyyInitDone = 0; + if (yyyInitDone) return; + + if ((yyyRS = (struct yyyRSitem *) + calloc((size_t)(yyyRSmaxSize+1), (size_t)sizeof(struct yyyRSitem)) + ) + == + ((struct yyyRSitem *) NULL) + ) + yyyfatal("malloc error in ox ready set space allocation\n"); + yyyRS++; + yyyAfterRS = yyyRS + yyyRSmaxSize; + + + if ((yyySSALspace = (struct yyySolvedSAlistCell *) + calloc((size_t)(yyySSALspaceSize+1), (size_t)sizeof(struct yyySolvedSAlistCell)) + ) + == + ((struct yyySolvedSAlistCell *) NULL) + ) + yyyfatal("malloc error in stack solved list space allocation\n"); + yyyInitDone = 1; + + yyyRSTop = yyyRS - 1; + } /* yyyYoxInit */ + + + +void yyyDecorate(void) + { + while (yyyRSTop >= yyyRS) + yyySolveAndSignal(); + } + + + +void yyyGenIntNode(long yyyProdNum, int yyyRHSlength, int yyyNattrbs, struct yyyOxAttrbs *yyval_OxAttrbs, ...) + {yyyWST i; + yyySIT **yyyOxStackItem = &yyval_OxAttrbs->yyyOxStackItem; + yyyGNT *gnpDum; + va_list ap; + + *yyyOxStackItem = (yyySIT *) malloc((size_t)sizeof(yyySIT)); + if (*yyyOxStackItem == (yyySIT *) NULL) + yyyfatal("malloc error in ox yacc semantic stack space allocation\n"); + (*yyyOxStackItem)->node = + (yyyGNT *) malloc((size_t)sizeof(yyyGNT)); + if ((*yyyOxStackItem)->node == (yyyGNT *) NULL) + yyyfatal("malloc error in ox node space allocation\n"); + (*yyyOxStackItem)->solvedSAlist = yyyLambdaSSAL; + (*yyyOxStackItem)->node->parent.stackref = *yyyOxStackItem; + (*yyyOxStackItem)->node->parentIsStack = 1; + (*yyyOxStackItem)->node->cLlen = yyyRHSlength; + (*yyyOxStackItem)->node->cL = + (yyyGNT **) calloc((size_t)yyyRHSlength, (size_t)sizeof(yyyGNT *)); + if ((*yyyOxStackItem)->node->cL == (yyyGNT **) NULL) + yyyfatal("malloc error in ox child list space allocation\n"); + (*yyyOxStackItem)->node->refCountListLen = yyyNattrbs; + (*yyyOxStackItem)->node->refCountList = + (yyyRCT *) calloc((size_t)yyyNattrbs, (size_t)sizeof(yyyRCT)); + if ((*yyyOxStackItem)->node->refCountList == (yyyRCT *) NULL) + yyyfatal("malloc error in ox reference count list space allocation\n"); + (*yyyOxStackItem)->node->prodNum = yyyProdNum; + va_start(ap, yyval_OxAttrbs); + for (i=1;i<=yyyRHSlength;i++) + {yyySIT *yaccStDum = va_arg(ap,struct yyyOxAttrbs *)->yyyOxStackItem; + gnpDum = (*yyyOxStackItem)->node->cL[i-1] = yaccStDum->node; + gnpDum->whichSym = i; + gnpDum->parent.noderef = (*yyyOxStackItem)->node; + gnpDum->parentIsStack = 0; + } + va_end(ap); + } + + + +#define yyyDECORfREQ 50 + + + +void yyyAdjustINRC(long yyyProdNum, int yyyRHSlength, long startP, long stopP, struct yyyOxAttrbs *yyval_OxAttrbs, ...) + {yyyWST i; + yyySIT *yyyOxStackItem = yyval_OxAttrbs->yyyOxStackItem; + long SSALptr,SSALptrHead,*cPtrPtr; + long *pL; + yyyGNT *gnpDum; + long iTemp; + long nextP; + static unsigned short intNodeCount = yyyDECORfREQ; + va_list ap; + + nextP = startP; + while (nextP < stopP) + {if (yyyRCIL[nextP] == yyyR) + {(yyyOxStackItem->node->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2]; + } + else + {(((yyyOxStackItem->node->cL)[yyyRCIL[nextP]])->refCountList)[yyyRCIL[nextP+1]] = yyyRCIL[nextP+2]; + } + nextP += 3; + } + pL = yyyIIEL + yyyIIIEL[yyyProdNum]; + va_start(ap, yyval_OxAttrbs); + for (i=1;i<=yyyRHSlength;i++) + {yyySIT *yaccStDum = va_arg(ap,struct yyyOxAttrbs *)->yyyOxStackItem; + pL++; + SSALptrHead = SSALptr = *(cPtrPtr = &(yaccStDum->solvedSAlist)); + if (SSALptr != yyyLambdaSSAL) + {*cPtrPtr = yyyLambdaSSAL; + do + { + iTemp = (*pL+yyySSALspace[SSALptr].attrbNum); + yyySignalEnts(yyyOxStackItem->node, + yyyIEL[iTemp], + yyyIEL[iTemp+1] + ); + SSALptr = *(cPtrPtr = &(yyySSALspace[SSALptr].next)); + } + while (SSALptr != yyyLambdaSSAL); + *cPtrPtr = yyySSALCfreeList; + yyySSALCfreeList = SSALptrHead; + } + } + va_end(ap); + nextP = startP + 2; + while (nextP < stopP) + {if (!yyyRCIL[nextP]) + {if (yyyRCIL[nextP-2] == yyyR) + {pL = &(yyyOxStackItem->solvedSAlist); + if (yyySSALCfreeList == yyyLambdaSSAL) + {yyySSALspace[yyyNewSSALC].next = *pL; + if ((*pL = yyyNewSSALC++) == yyySSALspaceSize) + yyyHandleOverflow(yyySSALof); + } + else + {iTemp = yyySSALCfreeList; + yyySSALCfreeList = yyySSALspace[yyySSALCfreeList].next; + yyySSALspace[iTemp].next = *pL; + *pL = iTemp; + } + yyySSALspace[*pL].attrbNum = yyyRCIL[nextP-1]; + } + else + {if ((gnpDum = (yyyOxStackItem->node->cL)[yyyRCIL[nextP-2]])->prodNum != 0) + { + iTemp = yyyIIEL[yyyIIIEL[gnpDum->prodNum]] + yyyRCIL[nextP-1]; + yyySignalEnts(gnpDum, + yyyIEL[iTemp], + yyyIEL[iTemp+1] + ); + } + } + } + nextP += 3; + } + if (!--intNodeCount) + {intNodeCount = yyyDECORfREQ; + yyyDecorate(); + } + } + + + +void yyyGenLeaf(int nAttrbs,int typeNum,long startP,long stopP,YYSTYPE *yylval) + {yyyRCT *rcPdum; + yyySIT **yyyOxStackItem = &yylval->yyyOxAttrbs.yyyOxStackItem; + (*yyyOxStackItem) = (yyySIT *) malloc((size_t)sizeof(yyySIT)); + if ((*yyyOxStackItem) == (yyySIT *) NULL) + yyyfatal("malloc error in ox yacc semantic stack space allocation\n"); + (*yyyOxStackItem)->node = + (yyyGNT *) malloc((size_t)sizeof(yyyGNT)) + ; + if ((*yyyOxStackItem)->node == (yyyGNT *) NULL) + yyyfatal("malloc error in ox node space allocation\n"); + (*yyyOxStackItem)->solvedSAlist = yyyLambdaSSAL; + (*yyyOxStackItem)->node->parent.stackref = *yyyOxStackItem; + (*yyyOxStackItem)->node->parentIsStack = 1; + (*yyyOxStackItem)->node->cLlen = 0; + (*yyyOxStackItem)->node->cL = (yyyGNT **)NULL; + (*yyyOxStackItem)->node->refCountListLen = nAttrbs; + rcPdum = (*yyyOxStackItem)->node->refCountList = + (yyyRCT *) calloc((size_t)nAttrbs, (size_t)sizeof(yyyRCT)); + if (rcPdum == (yyyRCT *) NULL) + yyyfatal("malloc error in ox reference count list space allocation\n"); + while (startP < stopP) rcPdum[yyyLRCIL[startP++]] = 0; + (*yyyOxStackItem)->node->prodNum = 0; + (*yyyOxStackItem)->node->whichSym = 0; + } + + + +void yyyabort(void) + {yyyYok = 0; + } + + + + + +#define yyyLastProdNum 8 + + +#define yyyNsorts 1 + + +int yyyProdsInd[] = { + 0, + 0, 2, 6, 10, 14, 18, 22, 24, + 26, +}; + + +int yyyProds[][2] = { +{ 116, 0},{ 462, 0},{ 462, 0},{ 462, 0},{ 412, 0}, +{ 462, 0},{ 462, 0},{ 462, 0},{ 420, 0},{ 462, 0}, +{ 462, 0},{ 462, 0},{ 452, 0},{ 462, 0},{ 462, 0}, +{ 462, 0},{ 436, 0},{ 462, 0},{ 462, 0},{ 396, 0}, +{ 462, 0},{ 404, 0},{ 462, 0},{ 619, 1},{ 462, 0}, +{ 567, 1}, +}; + + +int yyySortsInd[] = { + 0, + 0, + 1, +}; + + +int yyySorts[] = { + 413, +}; + + + +char *yyyStringTab[] = { +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,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,"s",0,0,0, +0,0,"y",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, +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,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,"LRpre",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,"'*'","lexeme",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,"expr",0,0, +0,0,0,0,0, +0,0,0,0,0, +0,"printf",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,0, +0,0,"CONST","LRpost",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,"ID", +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,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,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,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,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, +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,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,0, +0, +}; + + + +#define yyySizeofProd(num) (yyyProdsInd[(num)+1] - yyyProdsInd[(num)]) + +#define yyyGSoccurStr(prodNum,symPos) \ + (yyyStringTab[yyyProds[yyyProdsInd[(prodNum)] + (symPos)][0]]) + +#define yyySizeofSort(num) (yyySortsInd[(num)+1] - yyySortsInd[(num)]) + +#define yyySortOf(prodNum,symPos) \ + (yyyProds[yyyProdsInd[(prodNum)] + (symPos)][1]) + +#define yyyAttrbStr(prodNum,symPos,attrbNum) \ + (yyyStringTab[yyySorts[yyySortsInd[yyySortOf(prodNum,symPos)] + \ + (attrbNum) \ + ] \ + ] \ + ) + + + +void yyyShowProd(int i) + {int j,nSyms; + + nSyms = yyySizeofProd(i); + for (j=0; j\n",stderr); + else + putc('\n',stderr); + } + } + } + + + +void yyyCheckNodeInstancesSolved(yyyGNT *np) + {int mysort,sortSize,i,prodNum,symPos,inTerminalNode; + int nUnsolvedInsts = 0; + + if (np->prodNum != 0) + {inTerminalNode = 0; + prodNum = np->prodNum; + symPos = 0; + } + else + {inTerminalNode = 1; + prodNum = np->parent.noderef->prodNum; + symPos = np->whichSym; + } + mysort = yyySortOf(prodNum,symPos); + sortSize = yyySizeofSort(mysort); + for (i=0; irefCountList)[i] != 0) nUnsolvedInsts += 1; + if (nUnsolvedInsts) + {fprintf(stderr, + "\nFound node that has %d unsolved attribute instance(s).\n", + nUnsolvedInsts + ); + fprintf(stderr,"Node is labeled \"%s\".\n", + yyyGSoccurStr(prodNum,symPos)); + if (inTerminalNode) + {fputs("Node is terminal. Its parent production is:\n ",stderr); + yyyShowProd(prodNum); + } + else + {fputs("Node is nonterminal. ",stderr); + if (!(np->parentIsStack)) + {fprintf(stderr, + "Node is %dth child in its parent production:\n ", + np->whichSym + ); + yyyShowProd(np->parent.noderef->prodNum); + } + fputs("Node is on left hand side of this production:\n ",stderr); + yyyShowProd(np->prodNum); + } + fputs("The following instances are unsolved:\n",stderr); + for (i=0; irefCountList)[i] != 0) + fprintf(stderr," %-16s still has %1d dependencies.\n", + yyyAttrbStr(prodNum,symPos,i),(np->refCountList)[i]); + } + } + + + +void yyyCheckUnsolvedInstTrav(yyyGNT *pNode,long *nNZrc,long *cycleSum) + {yyyGNT **yyyCLpdum; + yyyRCT *rcp; + int i; + + /* visit the refCountList of each node in the tree, and sum the non-zero refCounts */ + rcp = pNode->refCountList; + i = pNode->refCountListLen; + while (i--) + if (*rcp++) {*cycleSum += *(rcp - 1); (*nNZrc)++;} + yyyCLpdum = pNode->cL; + i = pNode->cLlen; + while (i--) + { + yyyCheckUnsolvedInstTrav(*yyyCLpdum,nNZrc,cycleSum); + yyyCLpdum++; + } + } + + + +void yyyUnsolvedInstSearchTravAux(yyyGNT *pNode) + {yyyGNT **yyyCLpdum; + int i; + + yyyCheckNodeInstancesSolved(pNode); + yyyCLpdum = pNode->cL; + i = pNode->cLlen; + while (i--) + { + yyyUnsolvedInstSearchTravAux(*yyyCLpdum); + yyyCLpdum++; + } + } + + + +void yyyUnsolvedInstSearchTrav(yyyGNT *pNode) + {yyyGNT **yyyCLpdum; + int i; + + yyyCLpdum = pNode->cL; + i = pNode->cLlen; + while (i--) + { + yyyUnsolvedInstSearchTravAux(*yyyCLpdum); + yyyCLpdum++; + } + } + + + +#line 1645 "expr.oxout.tab.c" + +#if YYDEBUG +#include /* needed for printf */ +#endif + +#include /* needed for malloc, etc */ +#include /* needed for memset */ + +/* allocate initial stack or double stack size, up to YYMAXDEPTH */ +static int yygrowstack(YYSTACKDATA *data) +{ + int i; + unsigned newsize; + YYINT *newss; + YYSTYPE *newvs; + + if ((newsize = data->stacksize) == 0) + newsize = YYINITSTACKSIZE; + else if (newsize >= YYMAXDEPTH) + return YYENOMEM; + else if ((newsize *= 2) > YYMAXDEPTH) + newsize = YYMAXDEPTH; + + i = (int) (data->s_mark - data->s_base); + newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss)); + if (newss == 0) + return YYENOMEM; + + data->s_base = newss; + data->s_mark = newss + i; + + newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)); + if (newvs == 0) + return YYENOMEM; + + data->l_base = newvs; + data->l_mark = newvs + i; + + data->stacksize = newsize; + data->s_last = data->s_base + newsize - 1; + return 0; +} + +#if YYPURE || defined(YY_NO_LEAKS) +static void yyfreestack(YYSTACKDATA *data) +{ + free(data->s_base); + free(data->l_base); + memset(data, 0, sizeof(*data)); +} +#else +#define yyfreestack(data) /* nothing */ +#endif + +#define YYABORT goto yyabort +#define YYREJECT goto yyabort +#define YYACCEPT goto yyaccept +#define YYERROR goto yyerrlab + +int +YYPARSE_DECL() +{ + int yym, yyn, yystate; +#if YYDEBUG + const char *yys; + + if ((yys = getenv("YYDEBUG")) != 0) + { + yyn = *yys; + if (yyn >= '0' && yyn <= '9') + yydebug = yyn - '0'; + } +#endif + + yym = 0; + yyn = 0; + yynerrs = 0; + yyerrflag = 0; + yychar = YYEMPTY; + yystate = 0; + +#if YYPURE + memset(&yystack, 0, sizeof(yystack)); +#endif + + if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystack.s_mark = yystack.s_base; + yystack.l_mark = yystack.l_base; + yystate = 0; + *yystack.s_mark = 0; + +yyloop: + if ((yyn = yydefred[yystate]) != 0) goto yyreduce; + if (yychar < 0) + { + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; +#if YYDEBUG + if (yydebug) + { + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; + printf("%sdebug: state %d, reading %d (%s)\n", + YYPREFIX, yystate, yychar, yys); + } +#endif + } + if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: state %d, shifting to state %d\n", + YYPREFIX, yystate, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; + yychar = YYEMPTY; + if (yyerrflag > 0) --yyerrflag; + goto yyloop; + } + if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar) + { + yyn = yytable[yyn]; + goto yyreduce; + } + if (yyerrflag != 0) goto yyinrecovery; + + YYERROR_CALL("syntax error"); + + goto yyerrlab; /* redundant goto avoids 'unused label' warning */ +yyerrlab: + ++yynerrs; + +yyinrecovery: + if (yyerrflag < 3) + { + yyerrflag = 3; + for (;;) + { + if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE) + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: state %d, error recovery shifting\ + to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; + goto yyloop; + } + else + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: error recovery discarding state %d\n", + YYPREFIX, *yystack.s_mark); +#endif + if (yystack.s_mark <= yystack.s_base) goto yyabort; + --yystack.s_mark; + --yystack.l_mark; + } + } + } + else + { + if (yychar == YYEOF) goto yyabort; +#if YYDEBUG + if (yydebug) + { + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; + printf("%sdebug: state %d, error recovery discards token %d (%s)\n", + YYPREFIX, yystate, yychar, yys); + } +#endif + yychar = YYEMPTY; + goto yyloop; + } + +yyreduce: +#if YYDEBUG + if (yydebug) + printf("%sdebug: state %d, reducing by rule %d (%s)\n", + YYPREFIX, yystate, yyn, yyrule[yyn]); +#endif + yym = yylen[yyn]; + if (yym > 0) + yyval = yystack.l_mark[1-yym]; + else + memset(&yyval, 0, sizeof yyval); + + switch (yyn) + { +case 1: +#line 64 "expr.oxout.y" + {yyyYoxInit();} +break; +case 2: +#line 66 "expr.oxout.y" + { + yyyDecorate(); yyyExecuteRRsection(yystack.l_mark[0].yyyOxAttrbs.yyyOxStackItem->node); + } +break; +case 3: +#line 73 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(1,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(1,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +case 4: +#line 80 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(2,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(2,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +case 5: +#line 87 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(3,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(3,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +case 6: +#line 94 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(4,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(4,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +case 7: +#line 101 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(5,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(5,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +case 8: +#line 108 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(6,3,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(6,3,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[-2].yyyOxAttrbs,&yystack.l_mark[-1].yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +case 9: +#line 114 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(7,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(7,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +case 10: +#line 121 "expr.oxout.y" + {if(yyyYok){ +yyyGenIntNode(8,1,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs); +yyyAdjustINRC(8,1,0,0,&yyval.yyyOxAttrbs,&yystack.l_mark[0].yyyOxAttrbs);}} +break; +#line 1902 "expr.oxout.tab.c" + } + yystack.s_mark -= yym; + yystate = *yystack.s_mark; + yystack.l_mark -= yym; + yym = yylhs[yyn]; + if (yystate == 0 && yym == 0) + { +#if YYDEBUG + if (yydebug) + printf("%sdebug: after reduction, shifting from state 0 to\ + state %d\n", YYPREFIX, YYFINAL); +#endif + yystate = YYFINAL; + *++yystack.s_mark = YYFINAL; + *++yystack.l_mark = yyval; + if (yychar < 0) + { + yychar = YYLEX; + if (yychar < 0) yychar = YYEOF; +#if YYDEBUG + if (yydebug) + { + if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN]; + printf("%sdebug: state %d, reading %d (%s)\n", + YYPREFIX, YYFINAL, yychar, yys); + } +#endif + } + if (yychar == YYEOF) goto yyaccept; + goto yyloop; + } + if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 && + yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate) + yystate = yytable[yyn]; + else + yystate = yydgoto[yym]; +#if YYDEBUG + if (yydebug) + printf("%sdebug: after reduction, shifting from state %d \ +to state %d\n", YYPREFIX, *yystack.s_mark, yystate); +#endif + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow; + *++yystack.s_mark = (YYINT) yystate; + *++yystack.l_mark = yyval; + goto yyloop; + +yyoverflow: + YYERROR_CALL("yacc stack overflow"); + +yyabort: + yyfreestack(&yystack); + return (1); + +yyaccept: + yyfreestack(&yystack); + return (0); +} diff --git a/test/yacc/expr.oxout.tab.h b/test/yacc/expr.oxout.tab.h new file mode 100644 index 0000000..bdaa83b --- /dev/null +++ b/test/yacc/expr.oxout.tab.h @@ -0,0 +1,15 @@ +#define ID 257 +#define CONST 258 +#ifdef YYSTYPE +#undef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +#endif +#ifndef YYSTYPE_IS_DECLARED +#define YYSTYPE_IS_DECLARED 1 +typedef union { +struct yyyOxAttrbs { +struct yyyStackItem *yyyOxStackItem; +} yyyOxAttrbs; +} YYSTYPE; +#endif /* !YYSTYPE_IS_DECLARED */ +extern YYSTYPE expr.oxout_lval; -- cgit v1.2.3