+2012-01-15 Thomas E. Dickey <tom@invisible-island.net>
+
+ * package/debian/copyright: bump
+
+ * test/run_make.sh: workaround for breakage due to GNU make 3.82
+
+ * test/run_make.sh:
+ tested with Solaris 10 (bison 1.875) and added scripting to exercise
+ the /usr/ccs/bin/yacc executable
+
+ * test/grammar.tab.c: regen
+
+ * test/grammar.y: modify to also build with Solaris yacc
+
+ * VERSION, package/debian/changelog, package/byacc.spec: bump
+
+ * test/calc1.output, test/calc1.tab.c: regen
+
+ * test/calc1.y:
+ undo the change made to appease bison, since it was only a warning.
+
+ * test/pure_calc.tab.c, test/pure_error.tab.c: regen
+
+ * test/run_make.sh: another fix for running from top-level directory
+
+ * makefile.in:
+ ensure that check_make rule depends on having byacc built.
+
+ * test/run_make.sh: fixes for building from parent directory
+
+ * test/pure_error.y, test/pure_calc.y: bison-fixes
+
+ * test/calc2.tab.c, test/calc3.tab.c, test/code_error.code.c, test/ftp.tab.c, test/pure_calc.tab.c, test/pure_error.tab.c:
+ regen
+
+ * test/calc2.y, test/calc3.y, test/code_error.y, test/ftp.y:
+ byacc already declares yyerror
+
+ * test/pure_error.y, test/pure_calc.y:
+ modified to help make the files build with bison
+
+ * test/run_make.sh:
+ supply a "%pure-parser" directive when bison needs it.
+
+ * test/code_calc.code.c: regen
+
+ * test/code_calc.y: modified to help make the files build with bison
+
+ * yacc.1:
+ in testing, found that %expect did not work as documented for bison.
+ do not recommend it for portable code.
+
+ * test/run_make.sh: workaround breakage in bison's %expect directive
+
+ * test/grammar.y: modified to help make the files build with bison
+
+ * test/calc1.output, test/calc1.tab.c, test/grammar.tab.c: regen
+
+ * test/calc1.y: quiet a spurious warning from bison 2.3
+
+ * test/calc1.tab.c: regen
+
+ * test/calc1.y: modified to help make the files build with bison
+
+ * yacc.1: comment on "-y" and "-P" options.
+
+ * yacc.1: comment on portability
+
+ * test/ftp.tab.c, test/quote_calc-s.tab.c, test/quote_calc.tab.c, test/quote_calc2-s.tab.c, test/quote_calc3-s.tab.c:
+ regen
+
+ * test/ftp.y: modified to help make the files build with bison
+ (bison's "-y" option is of no use in providing "yacc" compatibility)
+
+ * test/quote_calc2.tab.c, test/quote_calc3.tab.c, test/quote_calc4-s.tab.c, test/quote_calc4.tab.c:
+ regen
+
+ * test/code_calc.y, test/quote_calc2.y, test/quote_calc.y, test/quote_calc4.y, test/quote_calc3.y:
+ modified to help make the files build with bison
+
+ * test/calc.tab.c: regen
+
+ * test/calc.y: modified to help make the files build with bison
+
+ * test/error.tab.c: regen
+
+ * test/error.y: modified to help make the files build with bison
+
+ * test/calc2.tab.c, test/calc3.tab.c, test/code_error.code.c: regen
+
+ * test/run_make.sh:
+ check for older bisons which (2.3 for instance) do not support pure parsers
+
+ * test/code_error.y, test/calc3.y, test/calc2.y:
+ modified to help make the files build with bison
+
+ * test/run_test.sh: use $opt2 in filenames of the generated files
+
+ * test/quote_calc2-s.tab.c, test/quote_calc3-s.tab.c, test/quote_calc4-s.tab.c, test/quote_calc-s.tab.c, test/quote_calc.tab.c, test/quote_calc2.tab.c, test/quote_calc3.tab.c, test/quote_calc4.tab.c:
+ regen
+
+2012-01-14 Thomas E. Dickey <tom@invisible-island.net>
+
+ * test/calc2.tab.c, test/code_calc.code.c, test/code_error.code.c, test/error.tab.c, test/ftp.tab.c, test/grammar.tab.c, test/calc.tab.c, test/calc1.tab.c:
+ regen
+
+ * output.c: Several changes:
+ a) add YYLEX_PARAM_TYPE, like YYPARSE_PARAM_TYPE, but for yylex.
+ b) modify definitions for YYLEX_DECL to be more like YYPARSE_DECL,
+ using YYLEX_PARAM_TYPE and YYLEX_PARAM.
+ c) add ifdef's around #define's for YYERROR_DECL and YYERROR_CALL,
+ to help with redefinitions.
+
+ * test/pure_calc.tab.c:
+ modified to help make the files build with bison
+
+ * test/run_make.sh:
+ start work on followup, to check if the generated files build with bison.
+
+ * test/pure_calc.y, test/pure_error.tab.c:
+ modified to help make the files build with bison
+
+ * test/calc3.tab.c: regen
+
+ * test/quote_calc-s.output, test/quote_calc-s.tab.c, test/quote_calc-s.tab.h, test/quote_calc2-s.output, test/quote_calc2-s.tab.c, test/quote_calc2-s.tab.h, test/quote_calc3-s.output, test/quote_calc3-s.tab.c, test/quote_calc3-s.tab.h, test/quote_calc4-s.output, test/quote_calc4-s.tab.c, test/quote_calc4-s.tab.h:
+ RCS_BASE
+
+ * test/run_test.sh: generate/test with "-s" option applied.
+
+2012-01-13 Thomas E. Dickey <tom@invisible-island.net>
+
+ * package/debian/changelog, package/byacc.spec, VERSION: bump
+
+ * yacc.1: improve documentation of -s option
+
+ * yacc.1: note that yacc ignores -y
+
+ * main.c: add -s option to usage message.
+
+ * test/quote_calc3.output, test/quote_calc3.tab.c, test/quote_calc4.output, test/quote_calc4.tab.c, test/quote_calc4.tab.h, test/quote_calc3.y, test/quote_calc.tab.h, test/quote_calc.output, test/quote_calc.tab.c, test/quote_calc2.output, test/quote_calc2.tab.c, test/quote_calc2.tab.h, test/quote_calc3.tab.h, test/quote_calc4.y, test/quote_calc.y, test/quote_calc2.y:
+ RCS_BASE
+
+ * configure: regen
+
+ * aclocal.m4: resync with my-autoconf, i.e., fixes for CF_XOPEN_SOURCE
+
2011-12-19 Thomas E. Dickey <tom@invisible-island.net>
* package/debian/changelog, package/byacc.spec, VERSION: bump
-dnl $Id: aclocal.m4,v 1.18 2011/09/05 23:45:06 tom Exp $
+dnl $Id: aclocal.m4,v 1.19 2012/01/13 14:10:56 tom Exp $
dnl Macros for byacc configure script (Thomas E. Dickey)
dnl ---------------------------------------------------------------------------
-dnl Copyright 2004-2009,2010 Thomas E. Dickey
+dnl Copyright 2004-2011,2012 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
-e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
])dnl
dnl ---------------------------------------------------------------------------
+dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50
+dnl -------------------
+dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
+dnl can define it successfully.
+AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
+AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
+ AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+],[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif],
+ [cf_cv_xopen_source=no],
+ [cf_save="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+ AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+],[
+#ifdef _XOPEN_SOURCE
+make an error
+#endif],
+ [cf_cv_xopen_source=no],
+ [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
+ CPPFLAGS="$cf_save"
+ ])
+])
+
+if test "$cf_cv_xopen_source" != no ; then
+ CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
+ CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
+ cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
+ CF_ADD_CFLAGS($cf_temp_xopen_source)
+fi
+])
+dnl ---------------------------------------------------------------------------
dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
dnl --------
dnl Make an uppercase version of a variable
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 37 updated: 2011/08/06 20:32:05
+dnl CF_XOPEN_SOURCE version: 42 updated: 2012/01/07 08:26:49
dnl ---------------
dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
dnl or adapt to the vendor's definitions to get equivalent functionality,
;;
darwin*) #(vi
cf_xopen_source="-D_DARWIN_C_SOURCE"
+ cf_XOPEN_SOURCE=
;;
freebsd*|dragonfly*) #(vi
# 5.x headers associate
;;
irix[[56]].*) #(vi
cf_xopen_source="-D_SGI_SOURCE"
+ cf_XOPEN_SOURCE=
;;
linux*|gnu*|mint*|k*bsd*-gnu) #(vi
CF_GNU_SOURCE
;;
mirbsd*) #(vi
- # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
+ # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
+ cf_XOPEN_SOURCE=
+ CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
;;
netbsd*) #(vi
cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
;;
+openbsd[[4-9]]*) #(vi
+ # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
+ cf_xopen_source="-D_BSD_SOURCE"
+ cf_XOPEN_SOURCE=600
+ ;;
openbsd*) #(vi
# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
;;
sco*) #(vi
# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
;;
-solaris2.1[[0-9]]) #(vi
- cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
- ;;
-solaris2.[[1-9]]) #(vi
+solaris2.*) #(vi
cf_xopen_source="-D__EXTENSIONS__"
;;
*)
- AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
- AC_TRY_COMPILE([#include <sys/types.h>],[
-#ifndef _XOPEN_SOURCE
-make an error
-#endif],
- [cf_cv_xopen_source=no],
- [cf_save="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
- AC_TRY_COMPILE([#include <sys/types.h>],[
-#ifdef _XOPEN_SOURCE
-make an error
-#endif],
- [cf_cv_xopen_source=no],
- [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
- CPPFLAGS="$cf_save"
- ])
-])
- if test "$cf_cv_xopen_source" != no ; then
- CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
- CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
- cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
- CF_ADD_CFLAGS($cf_temp_xopen_source)
- fi
+ CF_TRY_XOPEN_SOURCE
CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
;;
esac
if test -n "$cf_xopen_source" ; then
CF_ADD_CFLAGS($cf_xopen_source)
fi
+
+dnl In anything but the default case, we may have system-specific setting
+dnl which is still not guaranteed to provide all of the entrypoints that
+dnl _XOPEN_SOURCE would yield.
+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
+ AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
+ AC_TRY_COMPILE([#include <stdlib.h>],[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif],
+ [cf_XOPEN_SOURCE_set=yes],
+ [cf_XOPEN_SOURCE_set=no])
+ AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
+ if test $cf_XOPEN_SOURCE_set = yes
+ then
+ AC_TRY_COMPILE([#include <stdlib.h>],[
+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
+make an error
+#endif],
+ [cf_XOPEN_SOURCE_set_ok=yes],
+ [cf_XOPEN_SOURCE_set_ok=no])
+ if test $cf_XOPEN_SOURCE_set_ok = no
+ then
+ AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
+ fi
+ else
+ CF_TRY_XOPEN_SOURCE
+ fi
+fi
])
;;
darwin*) #(vi
cf_xopen_source="-D_DARWIN_C_SOURCE"
+ cf_XOPEN_SOURCE=
;;
freebsd*|dragonfly*) #(vi
# 5.x headers associate
;;
irix[56].*) #(vi
cf_xopen_source="-D_SGI_SOURCE"
+ cf_XOPEN_SOURCE=
;;
linux*|gnu*|mint*|k*bsd*-gnu) #(vi
-echo "$as_me:2699: checking if we must define _GNU_SOURCE" >&5
+echo "$as_me:2701: checking if we must define _GNU_SOURCE" >&5
echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6
if test "${cf_cv_gnu_source+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line 2706 "configure"
+#line 2708 "configure"
#include "confdefs.h"
#include <sys/types.h>
int
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2721: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:2723: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
- echo "$as_me:2724: \$? = $ac_status" >&5
+ echo "$as_me:2726: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:2727: \"$ac_try\"") >&5
+ { (eval echo "$as_me:2729: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- echo "$as_me:2730: \$? = $ac_status" >&5
+ echo "$as_me:2732: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_cv_gnu_source=no
else
cf_save="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
cat >conftest.$ac_ext <<_ACEOF
-#line 2739 "configure"
+#line 2741 "configure"
#include "confdefs.h"
#include <sys/types.h>
int
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2754: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:2756: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
- echo "$as_me:2757: \$? = $ac_status" >&5
+ echo "$as_me:2759: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:2760: \"$ac_try\"") >&5
+ { (eval echo "$as_me:2762: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- echo "$as_me:2763: \$? = $ac_status" >&5
+ echo "$as_me:2765: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_cv_gnu_source=no
else
rm -f conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:2778: result: $cf_cv_gnu_source" >&5
+echo "$as_me:2780: result: $cf_cv_gnu_source" >&5
echo "${ECHO_T}$cf_cv_gnu_source" >&6
test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
;;
mirbsd*) #(vi
- # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
+ # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
+ cf_XOPEN_SOURCE=
+
+cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE
+
+cf_save_CFLAGS="$CFLAGS"
+cf_save_CPPFLAGS="$CPPFLAGS"
+
+cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \
+ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \
+ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'`
+
+cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \
+ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \
+ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'`
+
+echo "$as_me:2802: checking if we should define _POSIX_C_SOURCE" >&5
+echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6
+if test "${cf_cv_posix_c_source+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+echo "${as_me:-configure}:2808: testing if the symbol is already defined go no further ..." 1>&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2811 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int
+main ()
+{
+
+#ifndef _POSIX_C_SOURCE
+make an error
+#endif
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2826: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2829: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2832: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2835: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cf_cv_posix_c_source=no
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_want_posix_source=no
+ case .$cf_POSIX_C_SOURCE in #(vi
+ .[12]??*) #(vi
+ cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
+ ;;
+ .2) #(vi
+ cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
+ cf_want_posix_source=yes
+ ;;
+ .*)
+ cf_want_posix_source=yes
+ ;;
+ esac
+ if test "$cf_want_posix_source" = yes ; then
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2856 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int
+main ()
+{
+
+#ifdef _POSIX_SOURCE
+make an error
+#endif
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2871: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2874: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2877: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2880: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE"
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ fi
+
+echo "${as_me:-configure}:2891: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5
+
+ CFLAGS="$cf_trim_CFLAGS"
+ CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
+
+echo "${as_me:-configure}:2896: testing if the second compile does not leave our definition intact error ..." 1>&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2899 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int
+main ()
+{
+
+#ifndef _POSIX_C_SOURCE
+make an error
+#endif
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2914: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2917: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2920: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2923: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_posix_c_source=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$cf_save_CFLAGS"
+ CPPFLAGS="$cf_save_CPPFLAGS"
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:2939: result: $cf_cv_posix_c_source" >&5
+echo "${ECHO_T}$cf_cv_posix_c_source" >&6
+
+if test "$cf_cv_posix_c_source" != no ; then
+ CFLAGS="$cf_trim_CFLAGS"
+ CPPFLAGS="$cf_trim_CPPFLAGS"
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_cv_posix_c_source
+do
+case $cf_fix_cppflags in
+no)
+ case $cf_add_cflags in #(vi
+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+ case $cf_add_cflags in
+ -D*)
+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+ && test -z "${cf_tst_cflags}" \
+ && cf_fix_cppflags=yes
+
+ if test $cf_fix_cppflags = yes ; then
+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+ continue
+ elif test "${cf_tst_cflags}" = "\"'" ; then
+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+ continue
+ fi
+ ;;
+ esac
+ case "$CPPFLAGS" in
+ *$cf_add_cflags) #(vi
+ ;;
+ *) #(vi
+ case $cf_add_cflags in #(vi
+ -D*)
+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \
+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'`
+
+ ;;
+ esac
+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+ ;;
+ esac
+ ;;
+ *)
+ cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+ ;;
+ esac
+ ;;
+yes)
+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+ && test -z "${cf_tst_cflags}" \
+ && cf_fix_cppflags=no
+ ;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+ CFLAGS="$CFLAGS $cf_new_cflags"
+fi
+
+if test -n "$cf_new_cppflags" ; then
+
+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+fi
+
;;
netbsd*) #(vi
cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
;;
+openbsd[4-9]*) #(vi
+ # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
+ cf_xopen_source="-D_BSD_SOURCE"
+ cf_XOPEN_SOURCE=600
+ ;;
openbsd*) #(vi
# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
;;
sco*) #(vi
# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
;;
-solaris2.1[0-9]) #(vi
- cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
- ;;
-solaris2.[1-9]) #(vi
+solaris2.*) #(vi
cf_xopen_source="-D__EXTENSIONS__"
;;
*)
- echo "$as_me:2808: checking if we should define _XOPEN_SOURCE" >&5
+
+echo "$as_me:3052: checking if we should define _XOPEN_SOURCE" >&5
echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6
if test "${cf_cv_xopen_source+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line 2815 "configure"
+#line 3059 "configure"
#include "confdefs.h"
+
+#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
+
int
main ()
{
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2830: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:3078: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
- echo "$as_me:2833: \$? = $ac_status" >&5
+ echo "$as_me:3081: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:2836: \"$ac_try\"") >&5
+ { (eval echo "$as_me:3084: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- echo "$as_me:2839: \$? = $ac_status" >&5
+ echo "$as_me:3087: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_cv_xopen_source=no
else
cf_save="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
cat >conftest.$ac_ext <<_ACEOF
-#line 2848 "configure"
+#line 3096 "configure"
#include "confdefs.h"
+
+#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
+
int
main ()
{
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2863: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:3115: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
- echo "$as_me:2866: \$? = $ac_status" >&5
+ echo "$as_me:3118: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:2869: \"$ac_try\"") >&5
+ { (eval echo "$as_me:3121: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- echo "$as_me:2872: \$? = $ac_status" >&5
+ echo "$as_me:3124: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_cv_xopen_source=no
else
rm -f conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:2887: result: $cf_cv_xopen_source" >&5
+echo "$as_me:3139: result: $cf_cv_xopen_source" >&5
echo "${ECHO_T}$cf_cv_xopen_source" >&6
- if test "$cf_cv_xopen_source" != no ; then
+
+if test "$cf_cv_xopen_source" != no ; then
CFLAGS=`echo "$CFLAGS" | \
sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \
sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \
-e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'`
- cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
+ cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
cf_fix_cppflags=no
cf_new_cflags=
EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
fi
- fi
+fi
cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE
sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \
-e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'`
-echo "$as_me:2994: checking if we should define _POSIX_C_SOURCE" >&5
+echo "$as_me:3247: checking if we should define _POSIX_C_SOURCE" >&5
echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6
if test "${cf_cv_posix_c_source+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
-echo "${as_me:-configure}:3000: testing if the symbol is already defined go no further ..." 1>&5
+echo "${as_me:-configure}:3253: testing if the symbol is already defined go no further ..." 1>&5
cat >conftest.$ac_ext <<_ACEOF
-#line 3003 "configure"
+#line 3256 "configure"
#include "confdefs.h"
#include <sys/types.h>
int
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3018: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:3271: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
- echo "$as_me:3021: \$? = $ac_status" >&5
+ echo "$as_me:3274: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:3024: \"$ac_try\"") >&5
+ { (eval echo "$as_me:3277: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- echo "$as_me:3027: \$? = $ac_status" >&5
+ echo "$as_me:3280: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_cv_posix_c_source=no
else
esac
if test "$cf_want_posix_source" = yes ; then
cat >conftest.$ac_ext <<_ACEOF
-#line 3048 "configure"
+#line 3301 "configure"
#include "confdefs.h"
#include <sys/types.h>
int
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3063: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:3316: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
- echo "$as_me:3066: \$? = $ac_status" >&5
+ echo "$as_me:3319: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:3069: \"$ac_try\"") >&5
+ { (eval echo "$as_me:3322: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- echo "$as_me:3072: \$? = $ac_status" >&5
+ echo "$as_me:3325: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
rm -f conftest.$ac_objext conftest.$ac_ext
fi
-echo "${as_me:-configure}:3083: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5
+echo "${as_me:-configure}:3336: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5
CFLAGS="$cf_trim_CFLAGS"
CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
-echo "${as_me:-configure}:3088: testing if the second compile does not leave our definition intact error ..." 1>&5
+echo "${as_me:-configure}:3341: testing if the second compile does not leave our definition intact error ..." 1>&5
cat >conftest.$ac_ext <<_ACEOF
-#line 3091 "configure"
+#line 3344 "configure"
#include "confdefs.h"
#include <sys/types.h>
int
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3106: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:3359: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
- echo "$as_me:3109: \$? = $ac_status" >&5
+ echo "$as_me:3362: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:3112: \"$ac_try\"") >&5
+ { (eval echo "$as_me:3365: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- echo "$as_me:3115: \$? = $ac_status" >&5
+ echo "$as_me:3368: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
rm -f conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:3131: result: $cf_cv_posix_c_source" >&5
+echo "$as_me:3384: result: $cf_cv_posix_c_source" >&5
echo "${ECHO_T}$cf_cv_posix_c_source" >&6
if test "$cf_cv_posix_c_source" != no ; then
fi
+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
+ echo "$as_me:3557: checking if _XOPEN_SOURCE really is set" >&5
+echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3560 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+int
+main ()
+{
+
+#ifndef _XOPEN_SOURCE
+make an error
+#endif
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:3575: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:3578: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:3581: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3584: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cf_XOPEN_SOURCE_set=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_XOPEN_SOURCE_set=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ echo "$as_me:3593: result: $cf_XOPEN_SOURCE_set" >&5
+echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6
+ if test $cf_XOPEN_SOURCE_set = yes
+ then
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3598 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+int
+main ()
+{
+
+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
+make an error
+#endif
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:3613: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:3616: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:3619: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3622: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cf_XOPEN_SOURCE_set_ok=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_XOPEN_SOURCE_set_ok=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ if test $cf_XOPEN_SOURCE_set_ok = no
+ then
+ { echo "$as_me:3633: WARNING: _XOPEN_SOURCE is lower than requested" >&5
+echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;}
+ fi
+ else
+
+echo "$as_me:3638: checking if we should define _XOPEN_SOURCE" >&5
+echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6
+if test "${cf_cv_xopen_source+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3645 "configure"
+#include "confdefs.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+int
+main ()
+{
+
+#ifndef _XOPEN_SOURCE
+make an error
+#endif
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:3664: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:3667: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:3670: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3673: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cf_cv_xopen_source=no
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_save="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3682 "configure"
+#include "confdefs.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+int
+main ()
+{
+
+#ifdef _XOPEN_SOURCE
+make an error
+#endif
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:3701: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:3704: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:3707: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3710: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cf_cv_xopen_source=no
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cf_cv_xopen_source=$cf_XOPEN_SOURCE
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ CPPFLAGS="$cf_save"
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:3725: result: $cf_cv_xopen_source" >&5
+echo "${ECHO_T}$cf_cv_xopen_source" >&6
+
+if test "$cf_cv_xopen_source" != no ; then
+
+CFLAGS=`echo "$CFLAGS" | \
+ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \
+ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \
+ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'`
+
+ cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
+
+cf_fix_cppflags=no
+cf_new_cflags=
+cf_new_cppflags=
+cf_new_extra_cppflags=
+
+for cf_add_cflags in $cf_temp_xopen_source
+do
+case $cf_fix_cppflags in
+no)
+ case $cf_add_cflags in #(vi
+ -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
+ case $cf_add_cflags in
+ -D*)
+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'`
+
+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+ && test -z "${cf_tst_cflags}" \
+ && cf_fix_cppflags=yes
+
+ if test $cf_fix_cppflags = yes ; then
+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+ continue
+ elif test "${cf_tst_cflags}" = "\"'" ; then
+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+ continue
+ fi
+ ;;
+ esac
+ case "$CPPFLAGS" in
+ *$cf_add_cflags) #(vi
+ ;;
+ *) #(vi
+ case $cf_add_cflags in #(vi
+ -D*)
+ cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
+
+CPPFLAGS=`echo "$CPPFLAGS" | \
+ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \
+ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'`
+
+ ;;
+ esac
+ cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
+ ;;
+ esac
+ ;;
+ *)
+ cf_new_cflags="$cf_new_cflags $cf_add_cflags"
+ ;;
+ esac
+ ;;
+yes)
+ cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
+
+ cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'`
+
+ test "${cf_add_cflags}" != "${cf_tst_cflags}" \
+ && test -z "${cf_tst_cflags}" \
+ && cf_fix_cppflags=no
+ ;;
+esac
+done
+
+if test -n "$cf_new_cflags" ; then
+
+ CFLAGS="$CFLAGS $cf_new_cflags"
+fi
+
+if test -n "$cf_new_cppflags" ; then
+
+ CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
+fi
+
+if test -n "$cf_new_extra_cppflags" ; then
+
+ EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
+fi
+
+fi
+
+ fi
+fi
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_main_return=return
-echo "$as_me:3309: checking how to run the C preprocessor" >&5
+echo "$as_me:3829: checking how to run the C preprocessor" >&5
echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
-#line 3330 "configure"
+#line 3850 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax error
_ACEOF
-if { (eval echo "$as_me:3335: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:3855: \"$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:3341: \$? = $ac_status" >&5
+ echo "$as_me:3861: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
-#line 3364 "configure"
+#line 3884 "configure"
#include "confdefs.h"
#include <ac_nonexistent.h>
_ACEOF
-if { (eval echo "$as_me:3368: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:3888: \"$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:3374: \$? = $ac_status" >&5
+ echo "$as_me:3894: \$? = $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_cv_prog_CPP=$CPP
fi
-echo "$as_me:3411: result: $CPP" >&5
+echo "$as_me:3931: result: $CPP" >&5
echo "${ECHO_T}$CPP" >&6
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
-#line 3421 "configure"
+#line 3941 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax error
_ACEOF
-if { (eval echo "$as_me:3426: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:3946: \"$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:3432: \$? = $ac_status" >&5
+ echo "$as_me:3952: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
-#line 3455 "configure"
+#line 3975 "configure"
#include "confdefs.h"
#include <ac_nonexistent.h>
_ACEOF
-if { (eval echo "$as_me:3459: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:3979: \"$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:3465: \$? = $ac_status" >&5
+ echo "$as_me:3985: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
if $ac_preproc_ok; then
:
else
- { { echo "$as_me:3493: error: C preprocessor \"$CPP\" fails sanity check" >&5
+ { { echo "$as_me:4013: error: C preprocessor \"$CPP\" fails sanity check" >&5
echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;}
{ (exit 1); exit 1; }; }
fi
for ac_header in fcntl.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:3508: checking for $ac_header" >&5
+echo "$as_me:4028: 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 3514 "configure"
+#line 4034 "configure"
#include "confdefs.h"
#include <$ac_header>
_ACEOF
-if { (eval echo "$as_me:3518: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:4038: \"$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:3524: \$? = $ac_status" >&5
+ echo "$as_me:4044: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
fi
rm -f conftest.err conftest.$ac_ext
fi
-echo "$as_me:3543: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:4063: 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 <<EOF
for ac_func in atexit
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:3556: checking for $ac_func" >&5
+echo "$as_me:4076: 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 3562 "configure"
+#line 4082 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below. */
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:3593: \"$ac_link\"") >&5
+if { (eval echo "$as_me:4113: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
- echo "$as_me:3596: \$? = $ac_status" >&5
+ echo "$as_me:4116: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:3599: \"$ac_try\"") >&5
+ { (eval echo "$as_me:4119: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- echo "$as_me:3602: \$? = $ac_status" >&5
+ echo "$as_me:4122: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_var=yes"
else
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
-echo "$as_me:3612: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "$as_me:4132: 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 <<EOF
fi
done
-echo "$as_me:3622: checking for working mkstemp" >&5
+echo "$as_me:4142: checking for working mkstemp" >&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
rm -rf conftest*
if test "$cross_compiling" = yes; then
- echo "$as_me:3630: checking for mkstemp" >&5
+ echo "$as_me:4150: 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 3636 "configure"
+#line 4156 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char mkstemp (); below. */
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:3667: \"$ac_link\"") >&5
+if { (eval echo "$as_me:4187: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
- echo "$as_me:3670: \$? = $ac_status" >&5
+ echo "$as_me:4190: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:3673: \"$ac_try\"") >&5
+ { (eval echo "$as_me:4193: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- echo "$as_me:3676: \$? = $ac_status" >&5
+ echo "$as_me:4196: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_func_mkstemp=yes
else
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
-echo "$as_me:3686: result: $ac_cv_func_mkstemp" >&5
+echo "$as_me:4206: result: $ac_cv_func_mkstemp" >&5
echo "${ECHO_T}$ac_cv_func_mkstemp" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line 3691 "configure"
+#line 4211 "configure"
#include "confdefs.h"
#include <sys/types.h>
_ACEOF
rm -f conftest$ac_exeext
-if { (eval echo "$as_me:3729: \"$ac_link\"") >&5
+if { (eval echo "$as_me:4249: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
- echo "$as_me:3732: \$? = $ac_status" >&5
+ echo "$as_me:4252: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:3734: \"$ac_try\"") >&5
+ { (eval echo "$as_me:4254: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- echo "$as_me:3737: \$? = $ac_status" >&5
+ echo "$as_me:4257: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cf_cv_func_mkstemp=yes
fi
fi
-echo "$as_me:3752: result: $cf_cv_func_mkstemp" >&5
+echo "$as_me:4272: result: $cf_cv_func_mkstemp" >&5
echo "${ECHO_T}$cf_cv_func_mkstemp" >&6
if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then
cat >>confdefs.h <<\EOF
GCC_VERSION=none
if test "$GCC" = yes ; then
- echo "$as_me:3763: checking version of $CC" >&5
+ echo "$as_me:4283: checking version of $CC" >&5
echo $ECHO_N "checking version of $CC... $ECHO_C" >&6
GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`"
test -z "$GCC_VERSION" && GCC_VERSION=unknown
- echo "$as_me:3767: result: $GCC_VERSION" >&5
+ echo "$as_me:4287: result: $GCC_VERSION" >&5
echo "${ECHO_T}$GCC_VERSION" >&6
fi
if ( test "$GCC" = yes || test "$GXX" = yes )
then
-echo "$as_me:3773: checking if you want to check for gcc warnings" >&5
+echo "$as_me:4293: 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.
else
cf_opt_with_warnings=no
fi;
-echo "$as_me:3783: result: $cf_opt_with_warnings" >&5
+echo "$as_me:4303: result: $cf_opt_with_warnings" >&5
echo "${ECHO_T}$cf_opt_with_warnings" >&6
if test "$cf_opt_with_warnings" != no ; then
EOF
if test "$GCC" = yes
then
- { echo "$as_me:3805: checking for $CC __attribute__ directives..." >&5
+ { echo "$as_me:4325: checking for $CC __attribute__ directives..." >&5
echo "$as_me: checking for $CC __attribute__ directives..." >&6;}
cat > conftest.$ac_ext <<EOF
-#line 3808 "${as_me:-configure}"
+#line 4328 "${as_me:-configure}"
#include "confdefs.h"
#include "conftest.h"
#include "conftest.i"
;;
esac
- if { (eval echo "$as_me:3857: \"$ac_compile\"") >&5
+ if { (eval echo "$as_me:4377: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
- echo "$as_me:3860: \$? = $ac_status" >&5
+ echo "$as_me:4380: \$? = $ac_status" >&5
(exit $ac_status); }; then
- test -n "$verbose" && echo "$as_me:3862: result: ... $cf_attribute" >&5
+ test -n "$verbose" && echo "$as_me:4382: result: ... $cf_attribute" >&5
echo "${ECHO_T}... $cf_attribute" >&6
cat conftest.h >>confdefs.h
case $cf_attribute in #(vi
if test "$GCC" = yes ; then
case $host_os in
linux*|gnu*)
- echo "$as_me:3902: checking if this is really Intel C compiler" >&5
+ echo "$as_me:4422: 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 3907 "configure"
+#line 4427 "configure"
#include "confdefs.h"
int
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3924: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:4444: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
- echo "$as_me:3927: \$? = $ac_status" >&5
+ echo "$as_me:4447: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:3930: \"$ac_try\"") >&5
+ { (eval echo "$as_me:4450: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- echo "$as_me:3933: \$? = $ac_status" >&5
+ echo "$as_me:4453: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
INTEL_COMPILER=yes
cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
fi
rm -f conftest.$ac_objext conftest.$ac_ext
CFLAGS="$cf_save_CFLAGS"
- echo "$as_me:3944: result: $INTEL_COMPILER" >&5
+ echo "$as_me:4464: result: $INTEL_COMPILER" >&5
echo "${ECHO_T}$INTEL_COMPILER" >&6
;;
esac
fi
cat > conftest.$ac_ext <<EOF
-#line 3951 "${as_me:-configure}"
+#line 4471 "${as_me:-configure}"
int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; }
EOF
# remark #981: operands are evaluated in unspecified order
# warning #279: controlling expression is constant
- { echo "$as_me:3968: checking for $CC warning options..." >&5
+ { echo "$as_me:4488: checking for $CC warning options..." >&5
echo "$as_me: checking for $CC warning options..." >&6;}
cf_save_CFLAGS="$CFLAGS"
EXTRA_CFLAGS="-Wall"
wd981
do
CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
- if { (eval echo "$as_me:3984: \"$ac_compile\"") >&5
+ if { (eval echo "$as_me:4504: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
- echo "$as_me:3987: \$? = $ac_status" >&5
+ echo "$as_me:4507: \$? = $ac_status" >&5
(exit $ac_status); }; then
- test -n "$verbose" && echo "$as_me:3989: result: ... -$cf_opt" >&5
+ test -n "$verbose" && echo "$as_me:4509: result: ... -$cf_opt" >&5
echo "${ECHO_T}... -$cf_opt" >&6
EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
fi
elif test "$GCC" = yes
then
- { echo "$as_me:3998: checking for $CC warning options..." >&5
+ { echo "$as_me:4518: checking for $CC warning options..." >&5
echo "$as_me: checking for $CC warning options..." >&6;}
cf_save_CFLAGS="$CFLAGS"
EXTRA_CFLAGS=
Wundef $cf_warn_CONST Wwrite-strings
do
CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
- if { (eval echo "$as_me:4018: \"$ac_compile\"") >&5
+ if { (eval echo "$as_me:4538: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
- echo "$as_me:4021: \$? = $ac_status" >&5
+ echo "$as_me:4541: \$? = $ac_status" >&5
(exit $ac_status); }; then
- test -n "$verbose" && echo "$as_me:4023: result: ... -$cf_opt" >&5
+ test -n "$verbose" && echo "$as_me:4543: result: ... -$cf_opt" >&5
echo "${ECHO_T}... -$cf_opt" >&6
case $cf_opt in #(vi
Wcast-qual) #(vi
[34].*)
test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6
-echo "${as_me:-configure}:4034: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
+echo "${as_me:-configure}:4554: testing feature is broken in gcc $GCC_VERSION ..." 1>&5
continue;;
esac
fi
fi
-echo "$as_me:4050: checking if you want to see long compiling messages" >&5
+echo "$as_me:4570: 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.
ECHO_CC=''
fi;
-echo "$as_me:4084: result: $enableval" >&5
+echo "$as_me:4604: result: $enableval" >&5
echo "${ECHO_T}$enableval" >&6
case $cf_cv_system_name in
#define PROG_EXT "$PROG_EXT"
EOF
-echo "$as_me:4104: checking if you want to use dmalloc for testing" >&5
+echo "$as_me:4624: 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.
else
with_dmalloc=
fi;
-echo "$as_me:4120: result: ${with_dmalloc:-no}" >&5
+echo "$as_me:4640: result: ${with_dmalloc:-no}" >&5
echo "${ECHO_T}${with_dmalloc:-no}" >&6
case .$with_cflags in #(vi
esac
if test "$with_dmalloc" = yes ; then
- echo "$as_me:4214: checking for dmalloc.h" >&5
+ echo "$as_me:4734: 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 4220 "configure"
+#line 4740 "configure"
#include "confdefs.h"
#include <dmalloc.h>
_ACEOF
-if { (eval echo "$as_me:4224: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:4744: \"$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:4230: \$? = $ac_status" >&5
+ echo "$as_me:4750: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
fi
rm -f conftest.err conftest.$ac_ext
fi
-echo "$as_me:4249: result: $ac_cv_header_dmalloc_h" >&5
+echo "$as_me:4769: 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:4253: checking for dmalloc_debug in -ldmalloc" >&5
+echo "$as_me:4773: 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
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldmalloc $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line 4261 "configure"
+#line 4781 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4280: \"$ac_link\"") >&5
+if { (eval echo "$as_me:4800: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
- echo "$as_me:4283: \$? = $ac_status" >&5
+ echo "$as_me:4803: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:4286: \"$ac_try\"") >&5
+ { (eval echo "$as_me:4806: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- echo "$as_me:4289: \$? = $ac_status" >&5
+ echo "$as_me:4809: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_dmalloc_dmalloc_debug=yes
else
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:4300: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5
+echo "$as_me:4820: 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 <<EOF
fi
-echo "$as_me:4315: checking if you want to use dbmalloc for testing" >&5
+echo "$as_me:4835: 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.
else
with_dbmalloc=
fi;
-echo "$as_me:4331: result: ${with_dbmalloc:-no}" >&5
+echo "$as_me:4851: result: ${with_dbmalloc:-no}" >&5
echo "${ECHO_T}${with_dbmalloc:-no}" >&6
case .$with_cflags in #(vi
esac
if test "$with_dbmalloc" = yes ; then
- echo "$as_me:4425: checking for dbmalloc.h" >&5
+ echo "$as_me:4945: 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 4431 "configure"
+#line 4951 "configure"
#include "confdefs.h"
#include <dbmalloc.h>
_ACEOF
-if { (eval echo "$as_me:4435: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:4955: \"$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:4441: \$? = $ac_status" >&5
+ echo "$as_me:4961: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
fi
rm -f conftest.err conftest.$ac_ext
fi
-echo "$as_me:4460: result: $ac_cv_header_dbmalloc_h" >&5
+echo "$as_me:4980: 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:4464: checking for debug_malloc in -ldbmalloc" >&5
+echo "$as_me:4984: 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
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldbmalloc $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line 4472 "configure"
+#line 4992 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4491: \"$ac_link\"") >&5
+if { (eval echo "$as_me:5011: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
- echo "$as_me:4494: \$? = $ac_status" >&5
+ echo "$as_me:5014: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:4497: \"$ac_try\"") >&5
+ { (eval echo "$as_me:5017: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- echo "$as_me:4500: \$? = $ac_status" >&5
+ echo "$as_me:5020: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_dbmalloc_debug_malloc=yes
else
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:4511: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5
+echo "$as_me:5031: 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 <<EOF
fi
-echo "$as_me:4526: checking if you want to use valgrind for testing" >&5
+echo "$as_me:5046: 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.
else
with_valgrind=
fi;
-echo "$as_me:4542: result: ${with_valgrind:-no}" >&5
+echo "$as_me:5062: result: ${with_valgrind:-no}" >&5
echo "${ECHO_T}${with_valgrind:-no}" >&6
case .$with_cflags in #(vi
;;
esac
-echo "$as_me:4635: checking if you want to perform memory-leak testing" >&5
+echo "$as_me:5155: 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.
else
: ${with_no_leaks:=no}
fi;
-echo "$as_me:4645: result: $with_no_leaks" >&5
+echo "$as_me:5165: result: $with_no_leaks" >&5
echo "${ECHO_T}$with_no_leaks" >&6
if test "$with_no_leaks" = yes ; then
: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:4741: creating $CONFIG_STATUS" >&5
+{ echo "$as_me:5261: creating $CONFIG_STATUS" >&5
echo "$as_me: creating $CONFIG_STATUS" >&6;}
cat >$CONFIG_STATUS <<_ACEOF
#! $SHELL
echo "$ac_cs_version"; exit 0 ;;
--he | --h)
# Conflict between --help and --header
- { { echo "$as_me:4917: error: ambiguous option: $1
+ { { echo "$as_me:5437: 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;}
ac_need_defaults=false;;
# This is an error.
- -*) { { echo "$as_me:4936: error: unrecognized option: $1
+ -*) { { echo "$as_me:5456: 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;}
"makefile" ) CONFIG_FILES="$CONFIG_FILES makefile" ;;
"default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
"config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config_h.in" ;;
- *) { { echo "$as_me:4974: error: invalid argument: $ac_config_target" >&5
+ *) { { echo "$as_me:5494: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };;
esac
esac
if test x"$ac_file" != x-; then
- { echo "$as_me:5208: creating $ac_file" >&5
+ { echo "$as_me:5728: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
rm -f "$ac_file"
fi
-) echo $tmp/stdin ;;
[\\/$]*)
# Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:5226: error: cannot find input file: $f" >&5
+ test -f "$f" || { { echo "$as_me:5746: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
echo $f;;
echo $srcdir/$f
else
# /dev/null tree
- { { echo "$as_me:5239: error: cannot find input file: $f" >&5
+ { { echo "$as_me:5759: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
* ) ac_file_in=$ac_file.in ;;
esac
- test x"$ac_file" != x- && { echo "$as_me:5305: creating $ac_file" >&5
+ test x"$ac_file" != x- && { echo "$as_me:5825: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
# First look for the input files in the build tree, otherwise in the
-) echo $tmp/stdin ;;
[\\/$]*)
# Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:5316: error: cannot find input file: $f" >&5
+ test -f "$f" || { { echo "$as_me:5836: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
echo $f;;
echo $srcdir/$f
else
# /dev/null tree
- { { echo "$as_me:5329: error: cannot find input file: $f" >&5
+ { { echo "$as_me:5849: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
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:5387: $ac_file is unchanged" >&5
+ { echo "$as_me:5907: $ac_file is unchanged" >&5
echo "$as_me: $ac_file is unchanged" >&6;}
else
ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-/* $Id: main.c,v 1.37 2011/12/20 01:37:40 tom Exp $ */
+/* $Id: main.c,v 1.38 2012/01/14 01:01:15 tom Exp $ */
#include <signal.h>
#include <unistd.h> /* for _exit() */
," -p symbol_prefix set symbol prefix (default \"yy\")"
," -P create a reentrant parser, e.g., \"%pure-parser\""
," -r produce separate code and table files (y.code.c)"
+ ," -s suppress #define's for quoted names in %token lines"
," -t add debugging support"
," -v write description (y.output)"
," -V show version information and exit"
-# $Id: makefile.in,v 1.16 2010/06/09 09:46:37 tom Exp $
+# $Id: makefile.in,v 1.17 2012/01/15 19:11:21 tom Exp $
#
# UNIX template-makefile for Berkeley Yacc
check: $(THIS)$x
$(SHELL) $(testdir)/run_test.sh $(testdir)
-check_make:
+check_make: $(THIS)$x
$(SHELL) $(testdir)/run_make.sh $(testdir)
check_lint:
-/* $Id: output.c,v 1.42 2011/12/20 01:38:18 tom Exp $ */
+/* $Id: output.c,v 1.43 2012/01/14 17:03:52 tom Exp $ */
#include "defs.h"
putl_code(fp, "#ifdef YYLEX_PARAM\n");
if (pure_parser)
{
- putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval, "
- "void *YYLEX_PARAM)\n");
+ putl_code(fp, "# ifdef YYLEX_PARAM_TYPE\n");
+ putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval,"
+ " YYLEX_PARAM_TYPE YYLEX_PARAM)\n");
+ putl_code(fp, "# else\n");
+ putl_code(fp, "# define YYLEX_DECL() yylex(YYSTYPE *yylval,"
+ " void * YYLEX_PARAM)\n");
+ putl_code(fp, "# endif\n");
putl_code(fp, "# define YYLEX yylex(&yylval, YYLEX_PARAM)\n");
}
else
{
param *p;
+ putl_code(fp, "#ifndef YYERROR_DECL\n");
fprintf(fp, "#define YYERROR_DECL() yyerror(");
for (p = parse_param; p; p = p->next)
fprintf(fp, "%s %s%s, ", p->type, p->name, p->type2);
putl_code(fp, "const char *s)\n");
+ putl_code(fp, "#endif\n");
+ putl_code(fp, "#ifndef YYERROR_CALL\n");
puts_code(fp, "#define YYERROR_CALL(msg) yyerror(");
for (p = parse_param; p; p = p->next)
fprintf(fp, "%s, ", p->name);
putl_code(fp, "msg)\n");
+ putl_code(fp, "#endif\n");
}
else
{
+ putl_code(fp, "#ifndef YYERROR_DECL\n");
putl_code(fp, "#define YYERROR_DECL() yyerror(const char *s)\n");
+ putl_code(fp, "#endif\n");
+ putl_code(fp, "#ifndef YYERROR_CALL\n");
putl_code(fp, "#define YYERROR_CALL(msg) yyerror(msg)\n");
+ putl_code(fp, "#endif\n");
}
}
Summary: byacc - public domain Berkeley LALR Yacc parser generator
%define AppProgram byacc
-%define AppVersion 20111219
+%define AppVersion 20120115
%define UseProgram yacc
-# $XTermId: byacc.spec,v 1.11 2011/12/20 01:53:34 tom Exp $
+# $XTermId: byacc.spec,v 1.13 2012/01/15 19:30:29 tom Exp $
Name: %{AppProgram}
Version: %{AppVersion}
Release: 1
+byacc (20120115) unstable; urgency=low
+
+ * add testcases, improve documentation for "-s" option.
+
+ -- Thomas E. Dickey <dickey@invisible-island.net> Fri, 13 Jan 2012 20:44:34 -0500
+
byacc (20111219) unstable; urgency=low
* add "-s" option.
Files: aclocal.m4
Licence: other-BSD
-Copyright: 2004-2009,2010 by Thomas E. Dickey
+Copyright: 2004-2011,2012 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
shared with many OS's install programs.
Files: debian/*
-Copyright: 2010 Thomas E. Dickey
+Copyright: 2012 Thomas E. Dickey
Licence: other-BSD
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
int regs[26];
int base;
-#line 106 "calc.tab.c"
+extern int yylex(void);
+static void yyerror(const char *s);
+
+#line 109 "calc.tab.c"
#ifndef YYSTYPE
typedef int YYSTYPE;
#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();
} YYSTACKDATA;
/* variables for the parser stack */
static YYSTACKDATA yystack;
-#line 63 "calc.y"
+#line 66 "calc.y"
/* start of programs */
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-static void YYERROR_DECL();
-#endif
-
int
main (void)
{
}
return( c );
}
-#line 345 "calc.tab.c"
+#line 347 "calc.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
switch (yyn)
{
case 3:
-#line 25 "calc.y"
+#line 28 "calc.y"
{ yyerrok ; }
break;
case 4:
-#line 29 "calc.y"
+#line 32 "calc.y"
{ printf("%d\n",yystack.l_mark[0]);}
break;
case 5:
-#line 31 "calc.y"
+#line 34 "calc.y"
{ regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
break;
case 6:
-#line 35 "calc.y"
+#line 38 "calc.y"
{ yyval = yystack.l_mark[-1]; }
break;
case 7:
-#line 37 "calc.y"
+#line 40 "calc.y"
{ yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
break;
case 8:
-#line 39 "calc.y"
+#line 42 "calc.y"
{ yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
break;
case 9:
-#line 41 "calc.y"
+#line 44 "calc.y"
{ yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
break;
case 10:
-#line 43 "calc.y"
+#line 46 "calc.y"
{ yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
break;
case 11:
-#line 45 "calc.y"
+#line 48 "calc.y"
{ yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
break;
case 12:
-#line 47 "calc.y"
+#line 50 "calc.y"
{ yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
break;
case 13:
-#line 49 "calc.y"
+#line 52 "calc.y"
{ yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
break;
case 14:
-#line 51 "calc.y"
+#line 54 "calc.y"
{ yyval = - yystack.l_mark[0]; }
break;
case 15:
-#line 53 "calc.y"
+#line 56 "calc.y"
{ yyval = regs[yystack.l_mark[0]]; }
break;
case 17:
-#line 58 "calc.y"
+#line 61 "calc.y"
{ yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
break;
case 18:
-#line 60 "calc.y"
+#line 63 "calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
-#line 611 "calc.tab.c"
+#line 613 "calc.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
int regs[26];
int base;
+extern int yylex(void);
+static void yyerror(const char *s);
+
%}
%start list
%% /* start of programs */
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-static void YYERROR_DECL();
-#endif
-
int
main (void)
{
INTERVAL vmul(double, double, INTERVAL);
INTERVAL vdiv(double, double, INTERVAL);
+extern int yylex(void);
+static void yyerror(const char *s);
+
int dcheck(INTERVAL);
double dreg[26];
INTERVAL vreg[26];
-#line 28 "calc1.y"
+#line 31 "calc1.y"
#ifdef YYSTYPE
#undef YYSTYPE_IS_DECLARED
#define YYSTYPE_IS_DECLARED 1
INTERVAL vval;
} YYSTYPE;
#endif /* !YYSTYPE_IS_DECLARED */
-#line 136 "calc1.tab.c"
+#line 139 "calc1.tab.c"
/* compatibility with bison */
#ifdef YYPARSE_PARAM
#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();
} YYSTACKDATA;
/* variables for the parser stack */
static YYSTACKDATA yystack;
-#line 173 "calc1.y"
+#line 176 "calc1.y"
/* beginning of subroutines section */
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-static void YYERROR_DECL();
-#endif
-
#define BSZ 50 /* buffer size for floating point numbers */
/* lexical analysis */
{
return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
}
-#line 484 "calc1.tab.c"
+#line 486 "calc1.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
switch (yyn)
{
case 3:
-#line 54 "calc1.y"
+#line 57 "calc1.y"
{
(void) printf("%15.8f\n", yystack.l_mark[-1].dval);
}
break;
case 4:
-#line 58 "calc1.y"
+#line 61 "calc1.y"
{
(void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[-1].vval.lo, yystack.l_mark[-1].vval.hi);
}
break;
case 5:
-#line 62 "calc1.y"
+#line 65 "calc1.y"
{
dreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].dval;
}
break;
case 6:
-#line 66 "calc1.y"
+#line 69 "calc1.y"
{
vreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].vval;
}
break;
case 7:
-#line 70 "calc1.y"
+#line 73 "calc1.y"
{
yyerrok;
}
break;
case 9:
-#line 77 "calc1.y"
+#line 80 "calc1.y"
{
yyval.dval = dreg[yystack.l_mark[0].ival];
}
break;
case 10:
-#line 81 "calc1.y"
+#line 84 "calc1.y"
{
yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
}
break;
case 11:
-#line 85 "calc1.y"
+#line 88 "calc1.y"
{
yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
}
break;
case 12:
-#line 89 "calc1.y"
+#line 92 "calc1.y"
{
yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
}
break;
case 13:
-#line 93 "calc1.y"
+#line 96 "calc1.y"
{
yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
}
break;
case 14:
-#line 97 "calc1.y"
+#line 100 "calc1.y"
{
yyval.dval = -yystack.l_mark[0].dval;
}
break;
case 15:
-#line 101 "calc1.y"
+#line 104 "calc1.y"
{
yyval.dval = yystack.l_mark[-1].dval;
}
break;
case 16:
-#line 107 "calc1.y"
+#line 110 "calc1.y"
{
yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
}
break;
case 17:
-#line 111 "calc1.y"
+#line 114 "calc1.y"
{
yyval.vval.lo = yystack.l_mark[-3].dval;
yyval.vval.hi = yystack.l_mark[-1].dval;
}
break;
case 18:
-#line 121 "calc1.y"
+#line 124 "calc1.y"
{
yyval.vval = vreg[yystack.l_mark[0].ival];
}
break;
case 19:
-#line 125 "calc1.y"
+#line 128 "calc1.y"
{
yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
}
break;
case 20:
-#line 130 "calc1.y"
+#line 133 "calc1.y"
{
yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
}
break;
case 21:
-#line 135 "calc1.y"
+#line 138 "calc1.y"
{
yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
}
break;
case 22:
-#line 140 "calc1.y"
+#line 143 "calc1.y"
{
yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
}
break;
case 23:
-#line 145 "calc1.y"
+#line 148 "calc1.y"
{
yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
}
break;
case 24:
-#line 149 "calc1.y"
+#line 152 "calc1.y"
{
yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
}
break;
case 25:
-#line 153 "calc1.y"
+#line 156 "calc1.y"
{
if (dcheck(yystack.l_mark[0].vval)) YYERROR;
yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
}
break;
case 26:
-#line 158 "calc1.y"
+#line 161 "calc1.y"
{
if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
}
break;
case 27:
-#line 163 "calc1.y"
+#line 166 "calc1.y"
{
yyval.vval.hi = -yystack.l_mark[0].vval.lo;
yyval.vval.lo = -yystack.l_mark[0].vval.hi;
}
break;
case 28:
-#line 168 "calc1.y"
+#line 171 "calc1.y"
{
yyval.vval = yystack.l_mark[-1].vval;
}
break;
-#line 853 "calc1.tab.c"
+#line 855 "calc1.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
INTERVAL vmul(double, double, INTERVAL);
INTERVAL vdiv(double, double, INTERVAL);
+extern int yylex(void);
+static void yyerror(const char *s);
+
int dcheck(INTERVAL);
double dreg[26];
%% /* beginning of subroutines section */
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-static void YYERROR_DECL();
-#endif
-
#define BSZ 50 /* buffer size for floating point numbers */
/* lexical analysis */
# include <stdio.h>
# include <ctype.h>
-#line 103 "calc2.tab.c"
+#ifdef YYBISON
+#define YYLEX_PARAM base
+#define YYLEX_DECL() yylex(int *YYLEX_PARAM)
+#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+#line 111 "calc2.tab.c"
#ifndef YYSTYPE
typedef int YYSTYPE;
#endif
/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s)
+#endif
+#ifndef YYERROR_CALL
#define YYERROR_CALL(msg) yyerror(regs, base, msg)
+#endif
extern int YYPARSE_DECL();
} YYSTACKDATA;
/* variables for the parser stack */
static YYSTACKDATA yystack;
-#line 65 "calc2.y"
+#line 73 "calc2.y"
/* start of programs */
#ifdef YYBYACC
extern int YYLEX_DECL();
-static void YYERROR_DECL();
#endif
int
}
int
-yylex(int *base)
+YYLEX_DECL()
{
/* lexical analysis routine */
/* returns LETTER for a lower case letter, yylval = 0 through 25 */
}
return( c );
}
-#line 345 "calc2.tab.c"
+#line 356 "calc2.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
switch (yyn)
{
case 3:
-#line 27 "calc2.y"
+#line 35 "calc2.y"
{ yyerrok ; }
break;
case 4:
-#line 31 "calc2.y"
+#line 39 "calc2.y"
{ printf("%d\n",yystack.l_mark[0]);}
break;
case 5:
-#line 33 "calc2.y"
+#line 41 "calc2.y"
{ regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
break;
case 6:
-#line 37 "calc2.y"
+#line 45 "calc2.y"
{ yyval = yystack.l_mark[-1]; }
break;
case 7:
-#line 39 "calc2.y"
+#line 47 "calc2.y"
{ yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
break;
case 8:
-#line 41 "calc2.y"
+#line 49 "calc2.y"
{ yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
break;
case 9:
-#line 43 "calc2.y"
+#line 51 "calc2.y"
{ yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
break;
case 10:
-#line 45 "calc2.y"
+#line 53 "calc2.y"
{ yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
break;
case 11:
-#line 47 "calc2.y"
+#line 55 "calc2.y"
{ yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
break;
case 12:
-#line 49 "calc2.y"
+#line 57 "calc2.y"
{ yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
break;
case 13:
-#line 51 "calc2.y"
+#line 59 "calc2.y"
{ yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
break;
case 14:
-#line 53 "calc2.y"
+#line 61 "calc2.y"
{ yyval = - yystack.l_mark[0]; }
break;
case 15:
-#line 55 "calc2.y"
+#line 63 "calc2.y"
{ yyval = regs[yystack.l_mark[0]]; }
break;
case 17:
-#line 60 "calc2.y"
+#line 68 "calc2.y"
{ yyval = yystack.l_mark[0]; (*base) = (yystack.l_mark[0]==0) ? 8 : 10; }
break;
case 18:
-#line 62 "calc2.y"
+#line 70 "calc2.y"
{ yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
-#line 611 "calc2.tab.c"
+#line 622 "calc2.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
# include <stdio.h>
# include <ctype.h>
+#ifdef YYBISON
+#define YYLEX_PARAM base
+#define YYLEX_DECL() yylex(int *YYLEX_PARAM)
+#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
%}
%start list
#ifdef YYBYACC
extern int YYLEX_DECL();
-static void YYERROR_DECL();
#endif
int
}
int
-yylex(int *base)
+YYLEX_DECL()
{
/* lexical analysis routine */
/* returns LETTER for a lower case letter, yylval = 0 through 25 */
# include <stdio.h>
# include <ctype.h>
-#line 103 "calc3.tab.c"
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM base
+#define YYLEX_DECL() yylex(YYSTYPE *yylval, int *YYLEX_PARAM)
+#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+#line 112 "calc3.tab.c"
#ifndef YYSTYPE
typedef int YYSTYPE;
/* Parameters sent to lex. */
#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(YYSTYPE *yylval, void *YYLEX_PARAM)
+# ifdef YYLEX_PARAM_TYPE
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLEX_PARAM_TYPE YYLEX_PARAM)
+# else
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, void * YYLEX_PARAM)
+# endif
# define YYLEX yylex(&yylval, YYLEX_PARAM)
#else
# define YYLEX_DECL() yylex(YYSTYPE *yylval, int * base)
#endif
/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s)
+#endif
+#ifndef YYERROR_CALL
#define YYERROR_CALL(msg) yyerror(regs, base, msg)
+#endif
extern int YYPARSE_DECL();
YYSTYPE *l_base;
YYSTYPE *l_mark;
} YYSTACKDATA;
-#line 67 "calc3.y"
+#line 76 "calc3.y"
/* start of programs */
#ifdef YYBYACC
extern int YYLEX_DECL();
-static void YYERROR_DECL();
#endif
int
}
return( c );
}
-#line 338 "calc3.tab.c"
+#line 354 "calc3.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
switch (yyn)
{
case 3:
-#line 29 "calc3.y"
+#line 38 "calc3.y"
{ yyerrok ; }
break;
case 4:
-#line 33 "calc3.y"
+#line 42 "calc3.y"
{ printf("%d\n",yystack.l_mark[0]);}
break;
case 5:
-#line 35 "calc3.y"
+#line 44 "calc3.y"
{ regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
break;
case 6:
-#line 39 "calc3.y"
+#line 48 "calc3.y"
{ yyval = yystack.l_mark[-1]; }
break;
case 7:
-#line 41 "calc3.y"
+#line 50 "calc3.y"
{ yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
break;
case 8:
-#line 43 "calc3.y"
+#line 52 "calc3.y"
{ yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
break;
case 9:
-#line 45 "calc3.y"
+#line 54 "calc3.y"
{ yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
break;
case 10:
-#line 47 "calc3.y"
+#line 56 "calc3.y"
{ yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
break;
case 11:
-#line 49 "calc3.y"
+#line 58 "calc3.y"
{ yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
break;
case 12:
-#line 51 "calc3.y"
+#line 60 "calc3.y"
{ yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
break;
case 13:
-#line 53 "calc3.y"
+#line 62 "calc3.y"
{ yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
break;
case 14:
-#line 55 "calc3.y"
+#line 64 "calc3.y"
{ yyval = - yystack.l_mark[0]; }
break;
case 15:
-#line 57 "calc3.y"
+#line 66 "calc3.y"
{ yyval = regs[yystack.l_mark[0]]; }
break;
case 17:
-#line 62 "calc3.y"
+#line 71 "calc3.y"
{ yyval = yystack.l_mark[0]; (*base) = (yystack.l_mark[0]==0) ? 8 : 10; }
break;
case 18:
-#line 64 "calc3.y"
+#line 73 "calc3.y"
{ yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
-#line 611 "calc3.tab.c"
+#line 627 "calc3.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
# include <stdio.h>
# include <ctype.h>
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM base
+#define YYLEX_DECL() yylex(YYSTYPE *yylval, int *YYLEX_PARAM)
+#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
%}
%start list
#ifdef YYBYACC
extern int YYLEX_DECL();
-static void YYERROR_DECL();
#endif
int
int regs[26];
int base;
-#line 25 "code_calc.code.c"
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *s);
+#endif
+
+#line 30 "code_calc.code.c"
#ifndef YYSTYPE
typedef int YYSTYPE;
#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();
} YYSTACKDATA;
/* variables for the parser stack */
static YYSTACKDATA yystack;
-#line 63 "code_calc.y"
+#line 68 "code_calc.y"
/* start of programs */
#ifdef YYBYACC
extern int YYLEX_DECL();
-static void YYERROR_DECL();
#endif
int
}
int
-yylex(void) {
+yylex(void)
+{
/* lexical analysis routine */
/* returns LETTER for a lower case letter, yylval = 0 through 25 */
/* return DIGIT for a digit, yylval = 0 through 9 */
}
return( c );
}
-#line 245 "code_calc.code.c"
+#line 254 "code_calc.code.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
switch (yyn)
{
case 3:
-#line 25 "code_calc.y"
+#line 30 "code_calc.y"
{ yyerrok ; }
break;
case 4:
-#line 29 "code_calc.y"
+#line 34 "code_calc.y"
{ printf("%d\n",yystack.l_mark[0]);}
break;
case 5:
-#line 31 "code_calc.y"
+#line 36 "code_calc.y"
{ regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
break;
case 6:
-#line 35 "code_calc.y"
+#line 40 "code_calc.y"
{ yyval = yystack.l_mark[-1]; }
break;
case 7:
-#line 37 "code_calc.y"
+#line 42 "code_calc.y"
{ yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
break;
case 8:
-#line 39 "code_calc.y"
+#line 44 "code_calc.y"
{ yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
break;
case 9:
-#line 41 "code_calc.y"
+#line 46 "code_calc.y"
{ yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
break;
case 10:
-#line 43 "code_calc.y"
+#line 48 "code_calc.y"
{ yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
break;
case 11:
-#line 45 "code_calc.y"
+#line 50 "code_calc.y"
{ yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
break;
case 12:
-#line 47 "code_calc.y"
+#line 52 "code_calc.y"
{ yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
break;
case 13:
-#line 49 "code_calc.y"
+#line 54 "code_calc.y"
{ yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
break;
case 14:
-#line 51 "code_calc.y"
+#line 56 "code_calc.y"
{ yyval = - yystack.l_mark[0]; }
break;
case 15:
-#line 53 "code_calc.y"
+#line 58 "code_calc.y"
{ yyval = regs[yystack.l_mark[0]]; }
break;
case 17:
-#line 58 "code_calc.y"
+#line 63 "code_calc.y"
{ yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
break;
case 18:
-#line 60 "code_calc.y"
+#line 65 "code_calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
-#line 511 "code_calc.code.c"
+#line 520 "code_calc.code.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
int regs[26];
int base;
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *s);
+#endif
+
%}
%start list
#ifdef YYBYACC
extern int YYLEX_DECL();
-static void YYERROR_DECL();
#endif
int
}
int
-yylex(void) {
+yylex(void)
+{
/* lexical analysis routine */
/* returns LETTER for a lower case letter, yylval = 0 through 25 */
/* return DIGIT for a digit, yylval = 0 through 9 */
#define YYPURE 0
+#line 2 "code_error.y"
+
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *);
+#endif
+
+#line 25 "code_error.code.c"
#ifndef YYSTYPE
typedef int YYSTYPE;
#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();
} YYSTACKDATA;
/* variables for the parser stack */
static YYSTACKDATA yystack;
-#line 4 "code_error.y"
+#line 12 "code_error.y"
#include <stdio.h>
#ifdef YYBYACC
extern int YYLEX_DECL();
-static void YYERROR_DECL();
#endif
int
{
printf("%s\n", s);
}
-#line 215 "code_error.code.c"
+#line 226 "code_error.code.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
+%{
+
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *);
+#endif
+
+%}
%%
S: error
%%
#ifdef YYBYACC
extern int YYLEX_DECL();
-static void YYERROR_DECL();
#endif
int
#define YYPURE 0
+#line 2 "error.y"
+int yylex(void);
+static void yyerror(const char *);
+#line 102 "error.tab.c"
#ifndef YYSTYPE
typedef int YYSTYPE;
#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();
} YYSTACKDATA;
/* variables for the parser stack */
static YYSTACKDATA yystack;
-#line 4 "error.y"
+#line 8 "error.y"
#include <stdio.h>
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-static void YYERROR_DECL();
-#endif
-
int
main(void)
{
{
printf("%s\n", s);
}
-#line 233 "error.tab.c"
+#line 236 "error.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
+%{
+int yylex(void);
+static void yyerror(const char *);
+%}
%%
S: error
%%
#include <stdio.h>
-#ifdef YYBYACC
-extern int YYLEX_DECL();
-static void YYERROR_DECL();
-#endif
-
int
main(void)
{
#include <time.h>
#include <assert.h>
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *);
+#endif
+
extern struct sockaddr_in data_dest;
extern int logged_in;
extern struct passwd *pw;
char cbuf[512];
char *fromname;
-
+struct tab {
+ const char *name;
+ short token;
+ short state;
+ short implemented; /* 1 if command is implemented */
+ const char *help;
+};
static char * copy(const char *);
+#ifdef YYBISON
+static void sizecmd(char *filename);
+static void help(struct tab *ctab, char *s);
+struct tab cmdtab[];
+struct tab sitetab[];
+#endif
+
static void
yyerror(const char *msg)
{
perror(msg);
}
-#line 180 "ftp.tab.c"
+#line 198 "ftp.tab.c"
#ifndef YYSTYPE
typedef int YYSTYPE;
#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();
} YYSTACKDATA;
/* variables for the parser stack */
static YYSTACKDATA yystack;
-#line 689 "ftp.y"
+#line 707 "ftp.y"
#ifdef YYBYACC
extern int YYLEX_DECL();
-static void YYERROR_DECL();
#endif
extern jmp_buf errcatch;
#define SITECMD 7 /* SITE command */
#define NSTR 8 /* Number followed by a string */
-struct tab {
- const char *name;
- short token;
- short state;
- short implemented; /* 1 if command is implemented */
- const char *help;
-};
-
struct tab cmdtab[] = { /* In order defined in RFC 765 */
{ "USER", USER, STR1, 1, "<sp> username" },
{ "PASS", PASS, ZSTR1, 1, "<sp> password" },
reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
}
}
-#line 1079 "ftp.tab.c"
+#line 1092 "ftp.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
switch (yyn)
{
case 2:
-#line 132 "ftp.y"
+#line 150 "ftp.y"
{
fromname = (char *) 0;
}
break;
case 4:
-#line 139 "ftp.y"
+#line 157 "ftp.y"
{
user((char *) yystack.l_mark[-1]);
free((char *) yystack.l_mark[-1]);
}
break;
case 5:
-#line 144 "ftp.y"
+#line 162 "ftp.y"
{
pass((char *) yystack.l_mark[-1]);
free((char *) yystack.l_mark[-1]);
}
break;
case 6:
-#line 149 "ftp.y"
+#line 167 "ftp.y"
{
usedefault = 0;
if (pdata >= 0) {
}
break;
case 7:
-#line 158 "ftp.y"
+#line 176 "ftp.y"
{
passive();
}
break;
case 8:
-#line 162 "ftp.y"
+#line 180 "ftp.y"
{
switch (cmd_type) {
}
break;
case 9:
-#line 197 "ftp.y"
+#line 215 "ftp.y"
{
switch (yystack.l_mark[-1]) {
}
break;
case 10:
-#line 209 "ftp.y"
+#line 227 "ftp.y"
{
switch (yystack.l_mark[-1]) {
}
break;
case 11:
-#line 221 "ftp.y"
+#line 239 "ftp.y"
{
reply(202, "ALLO command ignored.");
}
break;
case 12:
-#line 225 "ftp.y"
+#line 243 "ftp.y"
{
reply(202, "ALLO command ignored.");
}
break;
case 13:
-#line 229 "ftp.y"
+#line 247 "ftp.y"
{
if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
retrieve((char *) 0, (char *) yystack.l_mark[-1]);
}
break;
case 14:
-#line 236 "ftp.y"
+#line 254 "ftp.y"
{
if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
store((char *) yystack.l_mark[-1], "w", 0);
}
break;
case 15:
-#line 243 "ftp.y"
+#line 261 "ftp.y"
{
if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
store((char *) yystack.l_mark[-1], "a", 0);
}
break;
case 16:
-#line 250 "ftp.y"
+#line 268 "ftp.y"
{
if (yystack.l_mark[-1])
send_file_list(".");
}
break;
case 17:
-#line 255 "ftp.y"
+#line 273 "ftp.y"
{
if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
send_file_list((char *) yystack.l_mark[-1]);
}
break;
case 18:
-#line 262 "ftp.y"
+#line 280 "ftp.y"
{
if (yystack.l_mark[-1])
retrieve("/bin/ls -lgA", "");
}
break;
case 19:
-#line 267 "ftp.y"
+#line 285 "ftp.y"
{
if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
retrieve("/bin/ls -lgA %s", (char *) yystack.l_mark[-1]);
}
break;
case 20:
-#line 274 "ftp.y"
+#line 292 "ftp.y"
{
if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
statfilecmd((char *) yystack.l_mark[-1]);
}
break;
case 21:
-#line 281 "ftp.y"
+#line 299 "ftp.y"
{
statcmd();
}
break;
case 22:
-#line 285 "ftp.y"
+#line 303 "ftp.y"
{
if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
remove((char *) yystack.l_mark[-1]);
}
break;
case 23:
-#line 292 "ftp.y"
+#line 310 "ftp.y"
{
if (fromname) {
renamecmd(fromname, (char *) yystack.l_mark[-1]);
}
break;
case 24:
-#line 303 "ftp.y"
+#line 321 "ftp.y"
{
reply(225, "ABOR command successful.");
}
break;
case 25:
-#line 307 "ftp.y"
+#line 325 "ftp.y"
{
if (yystack.l_mark[-1])
cwd(pw->pw_dir);
}
break;
case 26:
-#line 312 "ftp.y"
+#line 330 "ftp.y"
{
if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
cwd((char *) yystack.l_mark[-1]);
}
break;
case 27:
-#line 319 "ftp.y"
+#line 337 "ftp.y"
{
help(cmdtab, (char *) 0);
}
break;
case 28:
-#line 323 "ftp.y"
+#line 341 "ftp.y"
{
register char *cp = (char *)yystack.l_mark[-1];
}
break;
case 29:
-#line 338 "ftp.y"
+#line 356 "ftp.y"
{
reply(200, "NOOP command successful.");
}
break;
case 30:
-#line 342 "ftp.y"
+#line 360 "ftp.y"
{
if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
makedir((char *) yystack.l_mark[-1]);
}
break;
case 31:
-#line 349 "ftp.y"
+#line 367 "ftp.y"
{
if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
removedir((char *) yystack.l_mark[-1]);
}
break;
case 32:
-#line 356 "ftp.y"
+#line 374 "ftp.y"
{
if (yystack.l_mark[-1])
pwd();
}
break;
case 33:
-#line 361 "ftp.y"
+#line 379 "ftp.y"
{
if (yystack.l_mark[-1])
cwd("..");
}
break;
case 34:
-#line 366 "ftp.y"
+#line 384 "ftp.y"
{
help(sitetab, (char *) 0);
}
break;
case 35:
-#line 370 "ftp.y"
+#line 388 "ftp.y"
{
help(sitetab, (char *) yystack.l_mark[-1]);
}
break;
case 36:
-#line 374 "ftp.y"
+#line 392 "ftp.y"
{
int oldmask;
}
break;
case 37:
-#line 384 "ftp.y"
+#line 402 "ftp.y"
{
int oldmask;
}
break;
case 38:
-#line 399 "ftp.y"
+#line 417 "ftp.y"
{
if (yystack.l_mark[-5] && (yystack.l_mark[-1] != 0)) {
if (yystack.l_mark[-3] > 0777)
}
break;
case 39:
-#line 413 "ftp.y"
+#line 431 "ftp.y"
{
reply(200,
"Current IDLE time limit is %d seconds; max %d",
}
break;
case 40:
-#line 419 "ftp.y"
+#line 437 "ftp.y"
{
if (yystack.l_mark[-1] < 30 || yystack.l_mark[-1] > maxtimeout) {
reply(501,
}
break;
case 41:
-#line 433 "ftp.y"
+#line 451 "ftp.y"
{
if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
store((char *) yystack.l_mark[-1], "w", 1);
}
break;
case 42:
-#line 440 "ftp.y"
+#line 458 "ftp.y"
{
#ifdef unix
#ifdef BSD
}
break;
case 43:
-#line 461 "ftp.y"
+#line 479 "ftp.y"
{
if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0)
sizecmd((char *) yystack.l_mark[-1]);
}
break;
case 44:
-#line 478 "ftp.y"
+#line 496 "ftp.y"
{
if (yystack.l_mark[-3] && yystack.l_mark[-1] != 0) {
struct stat stbuf;
}
break;
case 45:
-#line 500 "ftp.y"
+#line 518 "ftp.y"
{
reply(221, "Goodbye.");
dologout(0);
}
break;
case 46:
-#line 505 "ftp.y"
+#line 523 "ftp.y"
{
yyerrok;
}
break;
case 47:
-#line 510 "ftp.y"
+#line 528 "ftp.y"
{
if (yystack.l_mark[-3] && yystack.l_mark[-1]) {
fromname = renamefrom((char *) yystack.l_mark[-1]);
}
break;
case 49:
-#line 524 "ftp.y"
+#line 542 "ftp.y"
{
*(const char **)(&(yyval)) = "";
}
break;
case 52:
-#line 535 "ftp.y"
+#line 553 "ftp.y"
{
register char *a, *p;
}
break;
case 53:
-#line 547 "ftp.y"
+#line 565 "ftp.y"
{
yyval = FORM_N;
}
break;
case 54:
-#line 551 "ftp.y"
+#line 569 "ftp.y"
{
yyval = FORM_T;
}
break;
case 55:
-#line 555 "ftp.y"
+#line 573 "ftp.y"
{
yyval = FORM_C;
}
break;
case 56:
-#line 561 "ftp.y"
+#line 579 "ftp.y"
{
cmd_type = TYPE_A;
cmd_form = FORM_N;
}
break;
case 57:
-#line 566 "ftp.y"
+#line 584 "ftp.y"
{
cmd_type = TYPE_A;
cmd_form = yystack.l_mark[0];
}
break;
case 58:
-#line 571 "ftp.y"
+#line 589 "ftp.y"
{
cmd_type = TYPE_E;
cmd_form = FORM_N;
}
break;
case 59:
-#line 576 "ftp.y"
+#line 594 "ftp.y"
{
cmd_type = TYPE_E;
cmd_form = yystack.l_mark[0];
}
break;
case 60:
-#line 581 "ftp.y"
+#line 599 "ftp.y"
{
cmd_type = TYPE_I;
}
break;
case 61:
-#line 585 "ftp.y"
+#line 603 "ftp.y"
{
cmd_type = TYPE_L;
cmd_bytesz = NBBY;
}
break;
case 62:
-#line 590 "ftp.y"
+#line 608 "ftp.y"
{
cmd_type = TYPE_L;
cmd_bytesz = yystack.l_mark[0];
}
break;
case 63:
-#line 596 "ftp.y"
+#line 614 "ftp.y"
{
cmd_type = TYPE_L;
cmd_bytesz = yystack.l_mark[0];
}
break;
case 64:
-#line 603 "ftp.y"
+#line 621 "ftp.y"
{
yyval = STRU_F;
}
break;
case 65:
-#line 607 "ftp.y"
+#line 625 "ftp.y"
{
yyval = STRU_R;
}
break;
case 66:
-#line 611 "ftp.y"
+#line 629 "ftp.y"
{
yyval = STRU_P;
}
break;
case 67:
-#line 617 "ftp.y"
+#line 635 "ftp.y"
{
yyval = MODE_S;
}
break;
case 68:
-#line 621 "ftp.y"
+#line 639 "ftp.y"
{
yyval = MODE_B;
}
break;
case 69:
-#line 625 "ftp.y"
+#line 643 "ftp.y"
{
yyval = MODE_C;
}
break;
case 70:
-#line 631 "ftp.y"
+#line 649 "ftp.y"
{
/*
* Problem: this production is used for all pathname
}
break;
case 72:
-#line 653 "ftp.y"
+#line 671 "ftp.y"
{
register int ret, dec, multby, digit;
}
break;
case 73:
-#line 678 "ftp.y"
+#line 696 "ftp.y"
{
if (logged_in)
yyval = 1;
}
}
break;
-#line 1922 "ftp.tab.c"
+#line 1935 "ftp.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
#include <time.h>
#include <assert.h>
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *);
+#endif
+
extern struct sockaddr_in data_dest;
extern int logged_in;
extern struct passwd *pw;
char cbuf[512];
char *fromname;
-
+struct tab {
+ const char *name;
+ short token;
+ short state;
+ short implemented; /* 1 if command is implemented */
+ const char *help;
+};
static char * copy(const char *);
+#ifdef YYBISON
+static void sizecmd(char *filename);
+static void help(struct tab *ctab, char *s);
+struct tab cmdtab[];
+struct tab sitetab[];
+#endif
+
static void
yyerror(const char *msg)
{
cmd_list: /* empty */
| cmd_list cmd
- = {
+ {
fromname = (char *) 0;
}
| cmd_list rcmd
;
cmd: USER SP username CRLF
- = {
+ {
user((char *) $3);
free((char *) $3);
}
| PASS SP password CRLF
- = {
+ {
pass((char *) $3);
free((char *) $3);
}
| PORT SP host_port CRLF
- = {
+ {
usedefault = 0;
if (pdata >= 0) {
(void) close(pdata);
reply(200, "PORT command successful.");
}
| PASV CRLF
- = {
+ {
passive();
}
| TYPE SP type_code CRLF
- = {
+ {
switch (cmd_type) {
case TYPE_A:
}
}
| STRU SP struct_code CRLF
- = {
+ {
switch ($3) {
case STRU_F:
}
}
| MODE SP mode_code CRLF
- = {
+ {
switch ($3) {
case MODE_S:
}
}
| ALLO SP NUMBER CRLF
- = {
+ {
reply(202, "ALLO command ignored.");
}
| ALLO SP NUMBER SP R SP NUMBER CRLF
- = {
+ {
reply(202, "ALLO command ignored.");
}
| RETR check_login SP pathname CRLF
- = {
+ {
if ($2 && $4 != 0)
retrieve((char *) 0, (char *) $4);
if ($4 != 0)
free((char *) $4);
}
| STOR check_login SP pathname CRLF
- = {
+ {
if ($2 && $4 != 0)
store((char *) $4, "w", 0);
if ($4 != 0)
free((char *) $4);
}
| APPE check_login SP pathname CRLF
- = {
+ {
if ($2 && $4 != 0)
store((char *) $4, "a", 0);
if ($4 != 0)
free((char *) $4);
}
| NLST check_login CRLF
- = {
+ {
if ($2)
send_file_list(".");
}
| NLST check_login SP STRING CRLF
- = {
+ {
if ($2 && $4 != 0)
send_file_list((char *) $4);
if ($4 != 0)
free((char *) $4);
}
| LIST check_login CRLF
- = {
+ {
if ($2)
retrieve("/bin/ls -lgA", "");
}
| LIST check_login SP pathname CRLF
- = {
+ {
if ($2 && $4 != 0)
retrieve("/bin/ls -lgA %s", (char *) $4);
if ($4 != 0)
free((char *) $4);
}
| STAT check_login SP pathname CRLF
- = {
+ {
if ($2 && $4 != 0)
statfilecmd((char *) $4);
if ($4 != 0)
free((char *) $4);
}
| STAT CRLF
- = {
+ {
statcmd();
}
| DELE check_login SP pathname CRLF
- = {
+ {
if ($2 && $4 != 0)
remove((char *) $4);
if ($4 != 0)
free((char *) $4);
}
| RNTO SP pathname CRLF
- = {
+ {
if (fromname) {
renamecmd(fromname, (char *) $3);
free(fromname);
free((char *) $3);
}
| ABOR CRLF
- = {
+ {
reply(225, "ABOR command successful.");
}
| CWD check_login CRLF
- = {
+ {
if ($2)
cwd(pw->pw_dir);
}
| CWD check_login SP pathname CRLF
- = {
+ {
if ($2 && $4 != 0)
cwd((char *) $4);
if ($4 != 0)
free((char *) $4);
}
| HELP CRLF
- = {
+ {
help(cmdtab, (char *) 0);
}
| HELP SP STRING CRLF
- = {
+ {
register char *cp = (char *)$3;
if (strncasecmp(cp, "SITE", 4) == 0) {
help(cmdtab, (char *) $3);
}
| NOOP CRLF
- = {
+ {
reply(200, "NOOP command successful.");
}
| MKD check_login SP pathname CRLF
- = {
+ {
if ($2 && $4 != 0)
makedir((char *) $4);
if ($4 != 0)
free((char *) $4);
}
| RMD check_login SP pathname CRLF
- = {
+ {
if ($2 && $4 != 0)
removedir((char *) $4);
if ($4 != 0)
free((char *) $4);
}
| PWD check_login CRLF
- = {
+ {
if ($2)
pwd();
}
| CDUP check_login CRLF
- = {
+ {
if ($2)
cwd("..");
}
| SITE SP HELP CRLF
- = {
+ {
help(sitetab, (char *) 0);
}
| SITE SP HELP SP STRING CRLF
- = {
+ {
help(sitetab, (char *) $5);
}
| SITE SP UMASK check_login CRLF
- = {
+ {
int oldmask;
if ($4) {
}
}
| SITE SP UMASK check_login SP octal_number CRLF
- = {
+ {
int oldmask;
if ($4) {
}
}
| SITE SP CHMOD check_login SP octal_number SP pathname CRLF
- = {
+ {
if ($4 && ($8 != 0)) {
if ($6 > 0777)
reply(501,
free((char *) $8);
}
| SITE SP IDLE CRLF
- = {
+ {
reply(200,
"Current IDLE time limit is %d seconds; max %d",
timeout, maxtimeout);
}
| SITE SP IDLE SP NUMBER CRLF
- = {
+ {
if ($5 < 30 || $5 > maxtimeout) {
reply(501,
"Maximum IDLE time must be between 30 and %d seconds",
}
}
| STOU check_login SP pathname CRLF
- = {
+ {
if ($2 && $4 != 0)
store((char *) $4, "w", 1);
if ($4 != 0)
free((char *) $4);
}
| SYST CRLF
- = {
+ {
#ifdef unix
#ifdef BSD
reply(215, "UNIX Type: L%d Version: BSD-%d",
* using with RESTART (we just count bytes).
*/
| SIZE check_login SP pathname CRLF
- = {
+ {
if ($2 && $4 != 0)
sizecmd((char *) $4);
if ($4 != 0)
* not necessarily 3 digits)
*/
| MDTM check_login SP pathname CRLF
- = {
+ {
if ($2 && $4 != 0) {
struct stat stbuf;
if (stat((char *) $4, &stbuf) < 0)
free((char *) $4);
}
| QUIT CRLF
- = {
+ {
reply(221, "Goodbye.");
dologout(0);
}
| error CRLF
- = {
+ {
yyerrok;
}
;
rcmd: RNFR check_login SP pathname CRLF
- = {
+ {
if ($2 && $4) {
fromname = renamefrom((char *) $4);
if (fromname == (char *) 0 && $4) {
;
password: /* empty */
- = {
+ {
*(const char **)(&($$)) = "";
}
| STRING
host_port: NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
NUMBER COMMA NUMBER
- = {
+ {
register char *a, *p;
a = (char *)&data_dest.sin_addr;
;
form_code: N
- = {
+ {
$$ = FORM_N;
}
| T
- = {
+ {
$$ = FORM_T;
}
| C
- = {
+ {
$$ = FORM_C;
}
;
type_code: A
- = {
+ {
cmd_type = TYPE_A;
cmd_form = FORM_N;
}
| A SP form_code
- = {
+ {
cmd_type = TYPE_A;
cmd_form = $3;
}
| E
- = {
+ {
cmd_type = TYPE_E;
cmd_form = FORM_N;
}
| E SP form_code
- = {
+ {
cmd_type = TYPE_E;
cmd_form = $3;
}
| I
- = {
+ {
cmd_type = TYPE_I;
}
| L
- = {
+ {
cmd_type = TYPE_L;
cmd_bytesz = NBBY;
}
| L SP byte_size
- = {
+ {
cmd_type = TYPE_L;
cmd_bytesz = $3;
}
/* this is for a bug in the BBN ftp */
| L byte_size
- = {
+ {
cmd_type = TYPE_L;
cmd_bytesz = $2;
}
;
struct_code: F
- = {
+ {
$$ = STRU_F;
}
| R
- = {
+ {
$$ = STRU_R;
}
| P
- = {
+ {
$$ = STRU_P;
}
;
mode_code: S
- = {
+ {
$$ = MODE_S;
}
| B
- = {
+ {
$$ = MODE_B;
}
| C
- = {
+ {
$$ = MODE_C;
}
;
pathname: pathstring
- = {
+ {
/*
* Problem: this production is used for all pathname
* processing, but only gives a 550 error reply.
;
octal_number: NUMBER
- = {
+ {
register int ret, dec, multby, digit;
/*
;
check_login: /* empty */
- = {
+ {
if (logged_in)
$$ = 1;
else {
#ifdef YYBYACC
extern int YYLEX_DECL();
-static void YYERROR_DECL();
#endif
extern jmp_buf errcatch;
#define SITECMD 7 /* SITE command */
#define NSTR 8 /* Number followed by a string */
-struct tab {
- const char *name;
- short token;
- short state;
- short implemented; /* 1 if command is implemented */
- const char *help;
-};
-
struct tab cmdtab[] = { /* In order defined in RFC 765 */
{ "USER", USER, STR1, 1, "<sp> username" },
{ "PASS", PASS, ZSTR1, 1, "<sp> password" },
#define YYPURE 0
-#line 69 "grammar.y"
+#line 9 "grammar.y"
+#ifdef YYBISON
+#include <stdlib.h>
+#define YYSTYPE_IS_DECLARED
+#define yyerror yaccError
+#endif
+
+#if defined(YYBISON) || !defined(YYBYACC)
+static void yyerror(const char *s);
+#endif
+#line 81 "grammar.y"
#include <stdio.h>
#include <ctype.h>
#include <string.h>
extern FuncDefStyle func_style;
extern char base_file[];
-#define YYMAXDEPTH 150
-
extern int yylex (void);
/* declaration specifier attributes for the typedef statement currently being
}
return FALSE;
}
-#line 378 "grammar.tab.c"
+#line 386 "grammar.tab.c"
/* compatibility with bison */
#ifdef YYPARSE_PARAM
#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();
} YYSTACKDATA;
/* variables for the parser stack */
static YYSTACKDATA yystack;
-#line 1004 "grammar.y"
+#line 1014 "grammar.y"
/* lex.yy.c */
#define BEGIN yy_start = 1 + 2 *
#endif
}
#endif
-#line 1073 "grammar.tab.c"
+#line 1085 "grammar.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
switch (yyn)
{
case 10:
-#line 367 "grammar.y"
+#line 377 "grammar.y"
{
yyerrok;
}
break;
case 11:
-#line 371 "grammar.y"
+#line 381 "grammar.y"
{
yyerrok;
}
break;
case 13:
-#line 382 "grammar.y"
+#line 392 "grammar.y"
{
/* Provide an empty action here so bison will not complain about
* incompatible types in the default action it normally would
}
break;
case 14:
-#line 389 "grammar.y"
+#line 399 "grammar.y"
{
/* empty */
}
break;
case 15:
-#line 396 "grammar.y"
+#line 406 "grammar.y"
{
#if OPT_LINTLIBRARY
if (types_out && want_typedef()) {
}
break;
case 16:
-#line 407 "grammar.y"
+#line 417 "grammar.y"
{
if (func_params != NULL) {
set_param_types(func_params, &yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list);
}
break;
case 17:
-#line 421 "grammar.y"
+#line 431 "grammar.y"
{
cur_decl_spec_flags = yystack.l_mark[0].decl_spec.flags;
free_decl_spec(&yystack.l_mark[0].decl_spec);
}
break;
case 18:
-#line 426 "grammar.y"
+#line 436 "grammar.y"
{
end_typedef();
}
break;
case 19:
-#line 433 "grammar.y"
+#line 443 "grammar.y"
{
begin_typedef();
}
break;
case 20:
-#line 437 "grammar.y"
+#line 447 "grammar.y"
{
begin_typedef();
}
break;
case 23:
-#line 449 "grammar.y"
+#line 459 "grammar.y"
{
int flags = cur_decl_spec_flags;
}
break;
case 24:
-#line 461 "grammar.y"
+#line 471 "grammar.y"
{
int flags = cur_decl_spec_flags;
}
break;
case 25:
-#line 473 "grammar.y"
+#line 483 "grammar.y"
{
check_untagged(&yystack.l_mark[-1].decl_spec);
if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
}
break;
case 26:
-#line 484 "grammar.y"
+#line 494 "grammar.y"
{
/* If we're converting to K&R and we've got a nominally K&R
* function which has a parameter which is ANSI (i.e., a prototyped
}
break;
case 28:
-#line 509 "grammar.y"
+#line 519 "grammar.y"
{
if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
yyerror("syntax error");
}
break;
case 29:
-#line 519 "grammar.y"
+#line 529 "grammar.y"
{
DeclSpec decl_spec;
}
break;
case 36:
-#line 550 "grammar.y"
+#line 560 "grammar.y"
{
join_decl_specs(&yyval.decl_spec, &yystack.l_mark[-1].decl_spec, &yystack.l_mark[0].decl_spec);
free(yystack.l_mark[-1].decl_spec.text);
}
break;
case 40:
-#line 565 "grammar.y"
+#line 575 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 41:
-#line 569 "grammar.y"
+#line 579 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_EXTERN);
}
break;
case 42:
-#line 573 "grammar.y"
+#line 583 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 43:
-#line 577 "grammar.y"
+#line 587 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_STATIC);
}
break;
case 44:
-#line 581 "grammar.y"
+#line 591 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_INLINE);
}
break;
case 45:
-#line 585 "grammar.y"
+#line 595 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_JUNK);
}
break;
case 46:
-#line 592 "grammar.y"
+#line 602 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
}
break;
case 47:
-#line 596 "grammar.y"
+#line 606 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 48:
-#line 600 "grammar.y"
+#line 610 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_FLOAT);
}
break;
case 49:
-#line 604 "grammar.y"
+#line 614 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 50:
-#line 608 "grammar.y"
+#line 618 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 51:
-#line 612 "grammar.y"
+#line 622 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_SHORT);
}
break;
case 52:
-#line 616 "grammar.y"
+#line 626 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 53:
-#line 620 "grammar.y"
+#line 630 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 54:
-#line 624 "grammar.y"
+#line 634 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 55:
-#line 628 "grammar.y"
+#line 638 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
}
break;
case 56:
-#line 632 "grammar.y"
+#line 642 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 57:
-#line 636 "grammar.y"
+#line 646 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 58:
-#line 640 "grammar.y"
+#line 650 "grammar.y"
{
Symbol *s;
s = find_symbol(typedef_names, yystack.l_mark[0].text.text);
}
break;
case 61:
-#line 652 "grammar.y"
+#line 662 "grammar.y"
{
new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
}
break;
case 62:
-#line 656 "grammar.y"
+#line 666 "grammar.y"
{
/* This rule allows the <pointer> nonterminal to scan #define
* names as if they were type modifiers.
}
break;
case 63:
-#line 669 "grammar.y"
+#line 679 "grammar.y"
{
char *s;
if ((s = implied_typedef()) == 0)
}
break;
case 64:
-#line 676 "grammar.y"
+#line 686 "grammar.y"
{
char *s;
if ((s = implied_typedef()) == 0)
}
break;
case 65:
-#line 683 "grammar.y"
+#line 693 "grammar.y"
{
(void)sprintf(buf, "%s %s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text);
new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
}
break;
case 66:
-#line 691 "grammar.y"
+#line 701 "grammar.y"
{
imply_typedef(yyval.text.text);
}
break;
case 67:
-#line 695 "grammar.y"
+#line 705 "grammar.y"
{
imply_typedef(yyval.text.text);
}
break;
case 68:
-#line 702 "grammar.y"
+#line 712 "grammar.y"
{
new_decl_list(&yyval.decl_list, yystack.l_mark[0].declarator);
}
break;
case 69:
-#line 706 "grammar.y"
+#line 716 "grammar.y"
{
add_decl_list(&yyval.decl_list, &yystack.l_mark[-2].decl_list, yystack.l_mark[0].declarator);
}
break;
case 70:
-#line 713 "grammar.y"
+#line 723 "grammar.y"
{
if (yystack.l_mark[0].declarator->func_def != FUNC_NONE && func_params == NULL &&
func_style == FUNC_TRADITIONAL && cur_file->convert) {
}
break;
case 71:
-#line 722 "grammar.y"
+#line 732 "grammar.y"
{
if (yystack.l_mark[-1].declarator->func_def != FUNC_NONE && func_params == NULL &&
func_style == FUNC_TRADITIONAL && cur_file->convert) {
}
break;
case 73:
-#line 734 "grammar.y"
+#line 744 "grammar.y"
{
char *s;
if ((s = implied_typedef()) == 0)
}
break;
case 74:
-#line 741 "grammar.y"
+#line 751 "grammar.y"
{
char *s;
if ((s = implied_typedef()) == 0)
}
break;
case 75:
-#line 748 "grammar.y"
+#line 758 "grammar.y"
{
(void)sprintf(buf, "enum %s", yystack.l_mark[0].text.text);
new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
}
break;
case 76:
-#line 756 "grammar.y"
+#line 766 "grammar.y"
{
imply_typedef("enum");
yyval.text = yystack.l_mark[0].text;
}
break;
case 79:
-#line 769 "grammar.y"
+#line 779 "grammar.y"
{
yyval.declarator = yystack.l_mark[0].declarator;
(void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text);
}
break;
case 81:
-#line 782 "grammar.y"
+#line 792 "grammar.y"
{
yyval.declarator = new_declarator(yystack.l_mark[0].text.text, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin);
}
break;
case 82:
-#line 786 "grammar.y"
+#line 796 "grammar.y"
{
yyval.declarator = yystack.l_mark[-1].declarator;
(void)sprintf(buf, "(%s)", yyval.declarator->text);
}
break;
case 83:
-#line 794 "grammar.y"
+#line 804 "grammar.y"
{
yyval.declarator = yystack.l_mark[-1].declarator;
(void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text);
}
break;
case 84:
-#line 801 "grammar.y"
+#line 811 "grammar.y"
{
yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
yyval.declarator->params = yystack.l_mark[-1].param_list;
}
break;
case 85:
-#line 809 "grammar.y"
+#line 819 "grammar.y"
{
yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
yyval.declarator->params = yystack.l_mark[-1].param_list;
}
break;
case 86:
-#line 820 "grammar.y"
+#line 830 "grammar.y"
{
(void)sprintf(yyval.text.text, "*%s", yystack.l_mark[0].text.text);
yyval.text.begin = yystack.l_mark[-1].text.begin;
}
break;
case 87:
-#line 825 "grammar.y"
+#line 835 "grammar.y"
{
(void)sprintf(yyval.text.text, "*%s%s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text);
yyval.text.begin = yystack.l_mark[-2].text.begin;
}
break;
case 88:
-#line 833 "grammar.y"
+#line 843 "grammar.y"
{
strcpy(yyval.text.text, "");
yyval.text.begin = 0L;
}
break;
case 90:
-#line 842 "grammar.y"
+#line 852 "grammar.y"
{
(void)sprintf(yyval.text.text, "%s ", yystack.l_mark[0].decl_spec.text);
yyval.text.begin = yystack.l_mark[0].decl_spec.begin;
}
break;
case 91:
-#line 848 "grammar.y"
+#line 858 "grammar.y"
{
(void)sprintf(yyval.text.text, "%s%s ", yystack.l_mark[-1].text.text, yystack.l_mark[0].decl_spec.text);
yyval.text.begin = yystack.l_mark[-1].text.begin;
}
break;
case 93:
-#line 858 "grammar.y"
+#line 868 "grammar.y"
{
add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, "...");
}
break;
case 94:
-#line 865 "grammar.y"
+#line 875 "grammar.y"
{
new_param_list(&yyval.param_list, yystack.l_mark[0].parameter);
}
break;
case 95:
-#line 869 "grammar.y"
+#line 879 "grammar.y"
{
add_param_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].parameter);
}
break;
case 96:
-#line 876 "grammar.y"
+#line 886 "grammar.y"
{
check_untagged(&yystack.l_mark[-1].decl_spec);
yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
}
break;
case 97:
-#line 881 "grammar.y"
+#line 891 "grammar.y"
{
check_untagged(&yystack.l_mark[-1].decl_spec);
yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
}
break;
case 98:
-#line 886 "grammar.y"
+#line 896 "grammar.y"
{
check_untagged(&yystack.l_mark[0].decl_spec);
yyval.parameter = new_parameter(&yystack.l_mark[0].decl_spec, (Declarator *)0);
}
break;
case 99:
-#line 894 "grammar.y"
+#line 904 "grammar.y"
{
new_ident_list(&yyval.param_list);
}
break;
case 101:
-#line 902 "grammar.y"
+#line 912 "grammar.y"
{
new_ident_list(&yyval.param_list);
add_ident_list(&yyval.param_list, &yyval.param_list, yystack.l_mark[0].text.text);
}
break;
case 102:
-#line 907 "grammar.y"
+#line 917 "grammar.y"
{
add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].text.text);
}
break;
case 103:
-#line 914 "grammar.y"
+#line 924 "grammar.y"
{
yyval.text = yystack.l_mark[0].text;
}
break;
case 104:
-#line 918 "grammar.y"
+#line 928 "grammar.y"
{
#if OPT_LINTLIBRARY
if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */
}
break;
case 105:
-#line 931 "grammar.y"
+#line 941 "grammar.y"
{
yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
}
break;
case 106:
-#line 935 "grammar.y"
+#line 945 "grammar.y"
{
yyval.declarator = yystack.l_mark[0].declarator;
(void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text);
}
break;
case 108:
-#line 947 "grammar.y"
+#line 957 "grammar.y"
{
yyval.declarator = yystack.l_mark[-1].declarator;
(void)sprintf(buf, "(%s)", yyval.declarator->text);
}
break;
case 109:
-#line 955 "grammar.y"
+#line 965 "grammar.y"
{
yyval.declarator = yystack.l_mark[-1].declarator;
(void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text);
}
break;
case 110:
-#line 962 "grammar.y"
+#line 972 "grammar.y"
{
yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
}
break;
case 111:
-#line 966 "grammar.y"
+#line 976 "grammar.y"
{
yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-3].declarator->begin);
yyval.declarator->params = yystack.l_mark[-1].param_list;
}
break;
case 112:
-#line 974 "grammar.y"
+#line 984 "grammar.y"
{
yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].declarator->begin);
yyval.declarator->func_stack = yystack.l_mark[-2].declarator;
}
break;
case 113:
-#line 981 "grammar.y"
+#line 991 "grammar.y"
{
Declarator *d;
}
break;
case 114:
-#line 992 "grammar.y"
+#line 1002 "grammar.y"
{
Declarator *d;
yyval.declarator->func_def = FUNC_ANSI;
}
break;
-#line 1953 "grammar.tab.c"
+#line 1965 "grammar.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
-/* $Id: grammar.y,v 1.3 2010/11/23 01:28:47 tom Exp $
+/* $Id: grammar.y,v 1.5 2012/01/15 20:00:59 tom Exp $
*
* yacc grammar for C function prototype generator
* This was derived from the grammar in Appendix A of
* "The C Programming Language" by Kernighan and Ritchie.
*/
%expect 1
+%{
+#ifdef YYBISON
+#include <stdlib.h>
+#define YYSTYPE_IS_DECLARED
+#define yyerror yaccError
+#endif
+
+#if defined(YYBISON) || !defined(YYBYACC)
+static void yyerror(const char *s);
+#endif
+%}
+
%token <text> '(' '*' '&'
/* identifiers that are not reserved words */
T_IDENTIFIER T_TYPEDEF_NAME T_DEFINE_NAME
extern FuncDefStyle func_style;
extern char base_file[];
-#define YYMAXDEPTH 150
-
extern int yylex (void);
/* declaration specifier attributes for the typedef statement currently being
int regs[26];
int base;
-#line 106 "pure_calc.tab.c"
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM &yylval
+#define YYLEX_DECL() yylex(YYSTYPE *yylval)
+#define YYERROR_DECL() yyerror(const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+#line 115 "pure_calc.tab.c"
#ifndef YYSTYPE
typedef int YYSTYPE;
/* Parameters sent to lex. */
#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(YYSTYPE *yylval, void *YYLEX_PARAM)
+# ifdef YYLEX_PARAM_TYPE
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLEX_PARAM_TYPE YYLEX_PARAM)
+# else
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, void * YYLEX_PARAM)
+# endif
# define YYLEX yylex(&yylval, YYLEX_PARAM)
#else
# define YYLEX_DECL() yylex(YYSTYPE *yylval)
#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();
YYSTYPE *l_base;
YYSTYPE *l_mark;
} YYSTACKDATA;
-#line 63 "pure_calc.y"
+#line 72 "pure_calc.y"
/* start of programs */
#ifdef YYBYACC
-extern int YYLEX_DECL();
-static void YYERROR_DECL();
+static int YYLEX_DECL();
#endif
int
}
static void
-yyerror(const char *s)
+YYERROR_DECL()
{
fprintf(stderr, "%s\n", s);
}
int
-yylex(YYSTYPE *value)
+YYLEX_DECL()
{
/* lexical analysis routine */
/* returns LETTER for a lower case letter, yylval = 0 through 25 */
/* c is now nonblank */
if( islower( c )) {
- *value = c - 'a';
+ *yylval = c - 'a';
return ( LETTER );
}
if( isdigit( c )) {
- *value = c - '0';
+ *yylval = c - '0';
return ( DIGIT );
}
return( c );
}
-#line 338 "pure_calc.tab.c"
+#line 354 "pure_calc.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
switch (yyn)
{
case 3:
-#line 25 "pure_calc.y"
+#line 34 "pure_calc.y"
{ yyerrok ; }
break;
case 4:
-#line 29 "pure_calc.y"
+#line 38 "pure_calc.y"
{ printf("%d\n",yystack.l_mark[0]);}
break;
case 5:
-#line 31 "pure_calc.y"
+#line 40 "pure_calc.y"
{ regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
break;
case 6:
-#line 35 "pure_calc.y"
+#line 44 "pure_calc.y"
{ yyval = yystack.l_mark[-1]; }
break;
case 7:
-#line 37 "pure_calc.y"
+#line 46 "pure_calc.y"
{ yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
break;
case 8:
-#line 39 "pure_calc.y"
+#line 48 "pure_calc.y"
{ yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
break;
case 9:
-#line 41 "pure_calc.y"
+#line 50 "pure_calc.y"
{ yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
break;
case 10:
-#line 43 "pure_calc.y"
+#line 52 "pure_calc.y"
{ yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
break;
case 11:
-#line 45 "pure_calc.y"
+#line 54 "pure_calc.y"
{ yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
break;
case 12:
-#line 47 "pure_calc.y"
+#line 56 "pure_calc.y"
{ yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
break;
case 13:
-#line 49 "pure_calc.y"
+#line 58 "pure_calc.y"
{ yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
break;
case 14:
-#line 51 "pure_calc.y"
+#line 60 "pure_calc.y"
{ yyval = - yystack.l_mark[0]; }
break;
case 15:
-#line 53 "pure_calc.y"
+#line 62 "pure_calc.y"
{ yyval = regs[yystack.l_mark[0]]; }
break;
case 17:
-#line 58 "pure_calc.y"
+#line 67 "pure_calc.y"
{ yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
break;
case 18:
-#line 60 "pure_calc.y"
+#line 69 "pure_calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
-#line 611 "pure_calc.tab.c"
+#line 627 "pure_calc.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
int regs[26];
int base;
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM &yylval
+#define YYLEX_DECL() yylex(YYSTYPE *yylval)
+#define YYERROR_DECL() yyerror(const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
%}
%start list
%% /* start of programs */
#ifdef YYBYACC
-extern int YYLEX_DECL();
-static void YYERROR_DECL();
+static int YYLEX_DECL();
#endif
int
}
static void
-yyerror(const char *s)
+YYERROR_DECL()
{
fprintf(stderr, "%s\n", s);
}
int
-yylex(YYSTYPE *value)
+YYLEX_DECL()
{
/* lexical analysis routine */
/* returns LETTER for a lower case letter, yylval = 0 through 25 */
/* c is now nonblank */
if( islower( c )) {
- *value = c - 'a';
+ *yylval = c - 'a';
return ( LETTER );
}
if( isdigit( c )) {
- *value = c - '0';
+ *yylval = c - '0';
return ( DIGIT );
}
return( c );
#define YYPURE 1
+#line 2 "pure_error.y"
+
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM &yylval
+#define YYLEX_DECL() yylex(YYSTYPE *yylval)
+#define YYERROR_DECL() yyerror(const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+#line 110 "pure_error.tab.c"
#ifndef YYSTYPE
typedef int YYSTYPE;
/* Parameters sent to lex. */
#ifdef YYLEX_PARAM
-# define YYLEX_DECL() yylex(YYSTYPE *yylval, void *YYLEX_PARAM)
+# ifdef YYLEX_PARAM_TYPE
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLEX_PARAM_TYPE YYLEX_PARAM)
+# else
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, void * YYLEX_PARAM)
+# endif
# define YYLEX yylex(&yylval, YYLEX_PARAM)
#else
# define YYLEX_DECL() yylex(YYSTYPE *yylval)
#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();
YYSTYPE *l_base;
YYSTYPE *l_mark;
} YYSTACKDATA;
-#line 4 "pure_error.y"
+#line 17 "pure_error.y"
#include <stdio.h>
#ifdef YYBYACC
extern int YYLEX_DECL();
-static void YYERROR_DECL();
#endif
int
{
printf("%s\n", s);
}
-#line 226 "pure_error.tab.c"
+#line 245 "pure_error.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
+%{
+
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM &yylval
+#define YYLEX_DECL() yylex(YYSTYPE *yylval)
+#define YYERROR_DECL() yyerror(const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+%}
+
%%
S: error
%%
#ifdef YYBYACC
extern int YYLEX_DECL();
-static void YYERROR_DECL();
#endif
int
--- /dev/null
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr OP_ADD expr
+ 8 | expr OP_SUB expr
+ 9 | expr OP_MUL expr
+ 10 | expr OP_DIV expr
+ 11 | expr OP_MOD expr
+ 12 | expr OP_AND expr
+ 13 | expr '|' expr
+ 14 | OP_SUB expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+\f
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : OP_SUB . expr (14)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ OP_ADD reduce 15
+ OP_SUB reduce 15
+ OP_MUL reduce 15
+ OP_DIV reduce 15
+ OP_MOD reduce 15
+ OP_AND reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ OP_ADD reduce 16
+ OP_SUB reduce 16
+ OP_MUL reduce 16
+ OP_DIV reduce 16
+ OP_MOD reduce 16
+ OP_AND reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on OP_ADD
+12: shift/reduce conflict (shift 17, reduce 14) on OP_SUB
+12: shift/reduce conflict (shift 18, reduce 14) on OP_MUL
+12: shift/reduce conflict (shift 19, reduce 14) on OP_DIV
+12: shift/reduce conflict (shift 20, reduce 14) on OP_MOD
+12: shift/reduce conflict (shift 21, reduce 14) on OP_AND
+state 12
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : OP_SUB expr . (14)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr OP_ADD . expr (7)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr OP_SUB . expr (8)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr OP_MUL . expr (9)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr OP_DIV . expr (10)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr OP_MOD . expr (11)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr OP_AND . expr (12)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on OP_ADD
+26: shift/reduce conflict (shift 17, reduce 7) on OP_SUB
+26: shift/reduce conflict (shift 18, reduce 7) on OP_MUL
+26: shift/reduce conflict (shift 19, reduce 7) on OP_DIV
+26: shift/reduce conflict (shift 20, reduce 7) on OP_MOD
+26: shift/reduce conflict (shift 21, reduce 7) on OP_AND
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . OP_ADD expr (7)
+ expr : expr OP_ADD expr . (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on OP_ADD
+27: shift/reduce conflict (shift 17, reduce 8) on OP_SUB
+27: shift/reduce conflict (shift 18, reduce 8) on OP_MUL
+27: shift/reduce conflict (shift 19, reduce 8) on OP_DIV
+27: shift/reduce conflict (shift 20, reduce 8) on OP_MOD
+27: shift/reduce conflict (shift 21, reduce 8) on OP_AND
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr OP_SUB expr . (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on OP_ADD
+28: shift/reduce conflict (shift 17, reduce 9) on OP_SUB
+28: shift/reduce conflict (shift 18, reduce 9) on OP_MUL
+28: shift/reduce conflict (shift 19, reduce 9) on OP_DIV
+28: shift/reduce conflict (shift 20, reduce 9) on OP_MOD
+28: shift/reduce conflict (shift 21, reduce 9) on OP_AND
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr OP_MUL expr . (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on OP_ADD
+29: shift/reduce conflict (shift 17, reduce 10) on OP_SUB
+29: shift/reduce conflict (shift 18, reduce 10) on OP_MUL
+29: shift/reduce conflict (shift 19, reduce 10) on OP_DIV
+29: shift/reduce conflict (shift 20, reduce 10) on OP_MOD
+29: shift/reduce conflict (shift 21, reduce 10) on OP_AND
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr OP_DIV expr . (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on OP_ADD
+30: shift/reduce conflict (shift 17, reduce 11) on OP_SUB
+30: shift/reduce conflict (shift 18, reduce 11) on OP_MUL
+30: shift/reduce conflict (shift 19, reduce 11) on OP_DIV
+30: shift/reduce conflict (shift 20, reduce 11) on OP_MOD
+30: shift/reduce conflict (shift 21, reduce 11) on OP_AND
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr OP_MOD expr . (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on OP_ADD
+31: shift/reduce conflict (shift 17, reduce 12) on OP_SUB
+31: shift/reduce conflict (shift 18, reduce 12) on OP_MUL
+31: shift/reduce conflict (shift 19, reduce 12) on OP_DIV
+31: shift/reduce conflict (shift 20, reduce 12) on OP_MOD
+31: shift/reduce conflict (shift 21, reduce 12) on OP_AND
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr OP_AND expr . (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on OP_ADD
+32: shift/reduce conflict (shift 17, reduce 13) on OP_SUB
+32: shift/reduce conflict (shift 18, reduce 13) on OP_MUL
+32: shift/reduce conflict (shift 19, reduce 13) on OP_DIV
+32: shift/reduce conflict (shift 20, reduce 13) on OP_MOD
+32: shift/reduce conflict (shift 21, reduce 13) on OP_AND
+state 32
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
--- /dev/null
+#ifndef lint
+static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+
+
+#ifndef yyparse
+#define yyparse quote_calc_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc_defred
+#endif /* yydefred */
+
+#ifndef yydgoto
+#define yydgoto quote_calc_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc_rule
+#endif /* yyrule */
+#define YYPREFIX "quote_calc_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 109 "quote_calc-s.tab.c"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* 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 OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+static const short quote_calc_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short quote_calc_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short quote_calc_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const short quote_calc_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const short quote_calc_sindex[] = { 0,
+ -38, 5, -36, 0, -51, -36, 7, -121, -248, 0,
+ 0, -243, -36, -22, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const short quote_calc_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 13, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+static const short quote_calc_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 258
+static const short quote_calc_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 16, 10, 17, 15, 18, 25, 19,
+ 23, 20, 4, 21, 5, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 17, 0, 18,
+ 0, 19, 0, 20, 0, 21, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 3, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 16, 15, 16, 15,
+ 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const short quote_calc_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 257, 10, 259, 10, 261, 41, 263,
+ 269, 265, 10, 267, 10, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 124, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 257, -1, 259, -1, 261,
+ -1, 263, -1, 265, -1, 267, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ 259, -1, 259, -1, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 257, -1, 259, -1, 261, -1,
+ 263, -1, 265, -1, 267, -1, 257, 257, 259, 259,
+ 261, 261, 263, 263, 265, 265, 267, 267,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#if YYDEBUG
+static const char *yyname[] = {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
+"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr OP_ADD expr",
+"expr : expr OP_SUB expr",
+"expr : expr OP_MUL expr",
+"expr : expr OP_DIV expr",
+"expr : expr OP_MOD expr",
+"expr : expr OP_AND expr",
+"expr : expr '|' expr",
+"expr : OP_SUB expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#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 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 73 "quote_calc.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 361 "quote_calc-s.tab.c"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return -1;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = data->s_mark - data->s_base;
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return -1;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return -1;
+
+ 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
+
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack)) 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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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 == 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ 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)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 627 "quote_calc-s.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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
--- /dev/null
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
--- /dev/null
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr OP_ADD expr
+ 8 | expr OP_SUB expr
+ 9 | expr OP_MUL expr
+ 10 | expr OP_DIV expr
+ 11 | expr OP_MOD expr
+ 12 | expr OP_AND expr
+ 13 | expr '|' expr
+ 14 | OP_SUB expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+\f
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : OP_SUB . expr (14)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ OP_ADD reduce 15
+ OP_SUB reduce 15
+ OP_MUL reduce 15
+ OP_DIV reduce 15
+ OP_MOD reduce 15
+ OP_AND reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ OP_ADD reduce 16
+ OP_SUB reduce 16
+ OP_MUL reduce 16
+ OP_DIV reduce 16
+ OP_MOD reduce 16
+ OP_AND reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on OP_ADD
+12: shift/reduce conflict (shift 17, reduce 14) on OP_SUB
+12: shift/reduce conflict (shift 18, reduce 14) on OP_MUL
+12: shift/reduce conflict (shift 19, reduce 14) on OP_DIV
+12: shift/reduce conflict (shift 20, reduce 14) on OP_MOD
+12: shift/reduce conflict (shift 21, reduce 14) on OP_AND
+state 12
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : OP_SUB expr . (14)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr OP_ADD . expr (7)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr OP_SUB . expr (8)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr OP_MUL . expr (9)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr OP_DIV . expr (10)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr OP_MOD . expr (11)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr OP_AND . expr (12)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on OP_ADD
+26: shift/reduce conflict (shift 17, reduce 7) on OP_SUB
+26: shift/reduce conflict (shift 18, reduce 7) on OP_MUL
+26: shift/reduce conflict (shift 19, reduce 7) on OP_DIV
+26: shift/reduce conflict (shift 20, reduce 7) on OP_MOD
+26: shift/reduce conflict (shift 21, reduce 7) on OP_AND
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . OP_ADD expr (7)
+ expr : expr OP_ADD expr . (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on OP_ADD
+27: shift/reduce conflict (shift 17, reduce 8) on OP_SUB
+27: shift/reduce conflict (shift 18, reduce 8) on OP_MUL
+27: shift/reduce conflict (shift 19, reduce 8) on OP_DIV
+27: shift/reduce conflict (shift 20, reduce 8) on OP_MOD
+27: shift/reduce conflict (shift 21, reduce 8) on OP_AND
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr OP_SUB expr . (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on OP_ADD
+28: shift/reduce conflict (shift 17, reduce 9) on OP_SUB
+28: shift/reduce conflict (shift 18, reduce 9) on OP_MUL
+28: shift/reduce conflict (shift 19, reduce 9) on OP_DIV
+28: shift/reduce conflict (shift 20, reduce 9) on OP_MOD
+28: shift/reduce conflict (shift 21, reduce 9) on OP_AND
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr OP_MUL expr . (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on OP_ADD
+29: shift/reduce conflict (shift 17, reduce 10) on OP_SUB
+29: shift/reduce conflict (shift 18, reduce 10) on OP_MUL
+29: shift/reduce conflict (shift 19, reduce 10) on OP_DIV
+29: shift/reduce conflict (shift 20, reduce 10) on OP_MOD
+29: shift/reduce conflict (shift 21, reduce 10) on OP_AND
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr OP_DIV expr . (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on OP_ADD
+30: shift/reduce conflict (shift 17, reduce 11) on OP_SUB
+30: shift/reduce conflict (shift 18, reduce 11) on OP_MUL
+30: shift/reduce conflict (shift 19, reduce 11) on OP_DIV
+30: shift/reduce conflict (shift 20, reduce 11) on OP_MOD
+30: shift/reduce conflict (shift 21, reduce 11) on OP_AND
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr OP_MOD expr . (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on OP_ADD
+31: shift/reduce conflict (shift 17, reduce 12) on OP_SUB
+31: shift/reduce conflict (shift 18, reduce 12) on OP_MUL
+31: shift/reduce conflict (shift 19, reduce 12) on OP_DIV
+31: shift/reduce conflict (shift 20, reduce 12) on OP_MOD
+31: shift/reduce conflict (shift 21, reduce 12) on OP_AND
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr OP_AND expr . (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on OP_ADD
+32: shift/reduce conflict (shift 17, reduce 13) on OP_SUB
+32: shift/reduce conflict (shift 18, reduce 13) on OP_MUL
+32: shift/reduce conflict (shift 19, reduce 13) on OP_DIV
+32: shift/reduce conflict (shift 20, reduce 13) on OP_MOD
+32: shift/reduce conflict (shift 21, reduce 13) on OP_AND
+state 32
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
--- /dev/null
+#ifndef lint
+static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+
+
+#ifndef yyparse
+#define yyparse quote_calc_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc_defred
+#endif /* yydefred */
+
+#ifndef yydgoto
+#define yydgoto quote_calc_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc_rule
+#endif /* yyrule */
+#define YYPREFIX "quote_calc_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 109 "quote_calc.tab.c"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* 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 OP_ADD 257
+#define ADD 258
+#define OP_SUB 259
+#define SUB 260
+#define OP_MUL 261
+#define MUL 262
+#define OP_DIV 263
+#define DIV 264
+#define OP_MOD 265
+#define MOD 266
+#define OP_AND 267
+#define AND 268
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+static const short quote_calc_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short quote_calc_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short quote_calc_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const short quote_calc_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const short quote_calc_sindex[] = { 0,
+ -38, 5, -36, 0, -51, -36, 7, -121, -248, 0,
+ 0, -243, -36, -22, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const short quote_calc_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 13, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+static const short quote_calc_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 258
+static const short quote_calc_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 16, 10, 17, 15, 18, 25, 19,
+ 23, 20, 4, 21, 5, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 17, 0, 18,
+ 0, 19, 0, 20, 0, 21, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 3, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 16, 15, 16, 15,
+ 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const short quote_calc_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 257, 10, 259, 10, 261, 41, 263,
+ 269, 265, 10, 267, 10, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 124, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 257, -1, 259, -1, 261,
+ -1, 263, -1, 265, -1, 267, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ 259, -1, 259, -1, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 257, -1, 259, -1, 261, -1,
+ 263, -1, 265, -1, 267, -1, 257, 257, 259, 259,
+ 261, 261, 263, 263, 265, 265, 267, 267,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#if YYDEBUG
+static const char *yyname[] = {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
+"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr OP_ADD expr",
+"expr : expr OP_SUB expr",
+"expr : expr OP_MUL expr",
+"expr : expr OP_DIV expr",
+"expr : expr OP_MOD expr",
+"expr : expr OP_AND expr",
+"expr : expr '|' expr",
+"expr : OP_SUB expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#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 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 73 "quote_calc.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 367 "quote_calc.tab.c"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return -1;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = data->s_mark - data->s_base;
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return -1;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return -1;
+
+ 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
+
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack)) 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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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 == 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ 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)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 633 "quote_calc.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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
--- /dev/null
+#define OP_ADD 257
+#define ADD 258
+#define OP_SUB 259
+#define SUB 260
+#define OP_MUL 261
+#define MUL 262
+#define OP_DIV 263
+#define DIV 264
+#define OP_MOD 265
+#define MOD 266
+#define OP_AND 267
+#define AND 268
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
--- /dev/null
+%{
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+%}
+
+%start list
+
+%token OP_ADD "ADD"
+%token OP_SUB "SUB"
+%token OP_MUL "MUL"
+%token OP_DIV "DIV"
+%token OP_MOD "MOD"
+%token OP_AND "AND"
+
+%token DIGIT LETTER
+
+%left '|'
+%left '&'
+%left '+' '-'
+%left '*' '/' '%'
+%left UMINUS /* supplies precedence for unary minus */
+
+%% /* beginning of rules section */
+
+list : /* empty */
+ | list stat '\n'
+ | list error '\n'
+ { yyerrok ; }
+ ;
+
+stat : expr
+ { printf("%d\n",$1);}
+ | LETTER '=' expr
+ { regs[$1] = $3; }
+ ;
+
+expr : '(' expr ')'
+ { $$ = $2; }
+ | expr OP_ADD expr
+ { $$ = $1 + $3; }
+ | expr OP_SUB expr
+ { $$ = $1 - $3; }
+ | expr OP_MUL expr
+ { $$ = $1 * $3; }
+ | expr OP_DIV expr
+ { $$ = $1 / $3; }
+ | expr OP_MOD expr
+ { $$ = $1 % $3; }
+ | expr OP_AND expr
+ { $$ = $1 & $3; }
+ | expr '|' expr
+ { $$ = $1 | $3; }
+ | OP_SUB expr %prec UMINUS
+ { $$ = - $2; }
+ | LETTER
+ { $$ = regs[$1]; }
+ | number
+ ;
+
+number: DIGIT
+ { $$ = $1; base = ($1==0) ? 8 : 10; }
+ | number DIGIT
+ { $$ = base * $1 + $2; }
+ ;
+
+%% /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
--- /dev/null
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr "ADD" expr
+ 8 | expr "SUB" expr
+ 9 | expr "MUL" expr
+ 10 | expr "DIV" expr
+ 11 | expr "MOD" expr
+ 12 | expr "AND" expr
+ 13 | expr '|' expr
+ 14 | "SUB" expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+\f
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : "SUB" . expr (14)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ "ADD" reduce 15
+ "SUB" reduce 15
+ "MUL" reduce 15
+ "DIV" reduce 15
+ "MOD" reduce 15
+ "AND" reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ "ADD" reduce 16
+ "SUB" reduce 16
+ "MUL" reduce 16
+ "DIV" reduce 16
+ "MOD" reduce 16
+ "AND" reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on "ADD"
+12: shift/reduce conflict (shift 17, reduce 14) on "SUB"
+12: shift/reduce conflict (shift 18, reduce 14) on "MUL"
+12: shift/reduce conflict (shift 19, reduce 14) on "DIV"
+12: shift/reduce conflict (shift 20, reduce 14) on "MOD"
+12: shift/reduce conflict (shift 21, reduce 14) on "AND"
+state 12
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+ expr : "SUB" expr . (14)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr "ADD" . expr (7)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr "SUB" . expr (8)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr "MUL" . expr (9)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr "DIV" . expr (10)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr "MOD" . expr (11)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr "AND" . expr (12)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on "ADD"
+26: shift/reduce conflict (shift 17, reduce 7) on "SUB"
+26: shift/reduce conflict (shift 18, reduce 7) on "MUL"
+26: shift/reduce conflict (shift 19, reduce 7) on "DIV"
+26: shift/reduce conflict (shift 20, reduce 7) on "MOD"
+26: shift/reduce conflict (shift 21, reduce 7) on "AND"
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . "ADD" expr (7)
+ expr : expr "ADD" expr . (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on "ADD"
+27: shift/reduce conflict (shift 17, reduce 8) on "SUB"
+27: shift/reduce conflict (shift 18, reduce 8) on "MUL"
+27: shift/reduce conflict (shift 19, reduce 8) on "DIV"
+27: shift/reduce conflict (shift 20, reduce 8) on "MOD"
+27: shift/reduce conflict (shift 21, reduce 8) on "AND"
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr "SUB" expr . (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on "ADD"
+28: shift/reduce conflict (shift 17, reduce 9) on "SUB"
+28: shift/reduce conflict (shift 18, reduce 9) on "MUL"
+28: shift/reduce conflict (shift 19, reduce 9) on "DIV"
+28: shift/reduce conflict (shift 20, reduce 9) on "MOD"
+28: shift/reduce conflict (shift 21, reduce 9) on "AND"
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr "MUL" expr . (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on "ADD"
+29: shift/reduce conflict (shift 17, reduce 10) on "SUB"
+29: shift/reduce conflict (shift 18, reduce 10) on "MUL"
+29: shift/reduce conflict (shift 19, reduce 10) on "DIV"
+29: shift/reduce conflict (shift 20, reduce 10) on "MOD"
+29: shift/reduce conflict (shift 21, reduce 10) on "AND"
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr "DIV" expr . (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on "ADD"
+30: shift/reduce conflict (shift 17, reduce 11) on "SUB"
+30: shift/reduce conflict (shift 18, reduce 11) on "MUL"
+30: shift/reduce conflict (shift 19, reduce 11) on "DIV"
+30: shift/reduce conflict (shift 20, reduce 11) on "MOD"
+30: shift/reduce conflict (shift 21, reduce 11) on "AND"
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr "MOD" expr . (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on "ADD"
+31: shift/reduce conflict (shift 17, reduce 12) on "SUB"
+31: shift/reduce conflict (shift 18, reduce 12) on "MUL"
+31: shift/reduce conflict (shift 19, reduce 12) on "DIV"
+31: shift/reduce conflict (shift 20, reduce 12) on "MOD"
+31: shift/reduce conflict (shift 21, reduce 12) on "AND"
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr "AND" expr . (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on "ADD"
+32: shift/reduce conflict (shift 17, reduce 13) on "SUB"
+32: shift/reduce conflict (shift 18, reduce 13) on "MUL"
+32: shift/reduce conflict (shift 19, reduce 13) on "DIV"
+32: shift/reduce conflict (shift 20, reduce 13) on "MOD"
+32: shift/reduce conflict (shift 21, reduce 13) on "AND"
+state 32
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
--- /dev/null
+#ifndef lint
+static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+
+
+#ifndef yyparse
+#define yyparse quote_calc2_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc2_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc2_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc2_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc2_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc2_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc2_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc2_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc2_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc2_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc2_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc2_defred
+#endif /* yydefred */
+
+#ifndef yydgoto
+#define yydgoto quote_calc2_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc2_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc2_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc2_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc2_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc2_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc2_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc2_rule
+#endif /* yyrule */
+#define YYPREFIX "quote_calc2_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc2.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 109 "quote_calc2-s.tab.c"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* 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 OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+static const short quote_calc2_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short quote_calc2_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short quote_calc2_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const short quote_calc2_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const short quote_calc2_sindex[] = { 0,
+ -38, 4, -36, 0, -51, -36, 6, -121, -249, 0,
+ 0, -243, -36, -23, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const short quote_calc2_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 12, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 14, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+static const short quote_calc2_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 259
+static const short quote_calc2_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 10, 16, 15, 17, 25, 18, 23,
+ 19, 4, 20, 5, 21, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 22, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 16, 0, 17, 0,
+ 18, 0, 19, 0, 20, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 3, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 0, 16, 15, 16,
+ 15, 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const short quote_calc2_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 10, 258, 10, 260, 41, 262, 269,
+ 264, 10, 266, 10, 268, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 124, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 258, -1, 260, -1,
+ 262, -1, 264, -1, 266, -1, 268, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ -1, 260, -1, 260, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 258, -1, 260, -1, 262, -1,
+ 264, -1, 266, -1, 268, -1, -1, 258, 258, 260,
+ 260, 262, 262, 264, 264, 266, 266, 268, 268,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#if YYDEBUG
+static const char *yyname[] = {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
+"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr \"ADD\" expr",
+"expr : expr \"SUB\" expr",
+"expr : expr \"MUL\" expr",
+"expr : expr \"DIV\" expr",
+"expr : expr \"MOD\" expr",
+"expr : expr \"AND\" expr",
+"expr : expr '|' expr",
+"expr : \"SUB\" expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#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 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 73 "quote_calc2.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 361 "quote_calc2-s.tab.c"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return -1;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = data->s_mark - data->s_base;
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return -1;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return -1;
+
+ 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
+
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack)) 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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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 == 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ 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)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc2.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc2.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc2.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc2.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc2.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc2.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc2.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc2.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 627 "quote_calc2-s.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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
--- /dev/null
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
--- /dev/null
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr "ADD" expr
+ 8 | expr "SUB" expr
+ 9 | expr "MUL" expr
+ 10 | expr "DIV" expr
+ 11 | expr "MOD" expr
+ 12 | expr "AND" expr
+ 13 | expr '|' expr
+ 14 | "SUB" expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+\f
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : "SUB" . expr (14)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ "ADD" reduce 15
+ "SUB" reduce 15
+ "MUL" reduce 15
+ "DIV" reduce 15
+ "MOD" reduce 15
+ "AND" reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ "ADD" reduce 16
+ "SUB" reduce 16
+ "MUL" reduce 16
+ "DIV" reduce 16
+ "MOD" reduce 16
+ "AND" reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on "ADD"
+12: shift/reduce conflict (shift 17, reduce 14) on "SUB"
+12: shift/reduce conflict (shift 18, reduce 14) on "MUL"
+12: shift/reduce conflict (shift 19, reduce 14) on "DIV"
+12: shift/reduce conflict (shift 20, reduce 14) on "MOD"
+12: shift/reduce conflict (shift 21, reduce 14) on "AND"
+state 12
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+ expr : "SUB" expr . (14)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr "ADD" . expr (7)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr "SUB" . expr (8)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr "MUL" . expr (9)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr "DIV" . expr (10)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr "MOD" . expr (11)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr "AND" . expr (12)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on "ADD"
+26: shift/reduce conflict (shift 17, reduce 7) on "SUB"
+26: shift/reduce conflict (shift 18, reduce 7) on "MUL"
+26: shift/reduce conflict (shift 19, reduce 7) on "DIV"
+26: shift/reduce conflict (shift 20, reduce 7) on "MOD"
+26: shift/reduce conflict (shift 21, reduce 7) on "AND"
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . "ADD" expr (7)
+ expr : expr "ADD" expr . (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on "ADD"
+27: shift/reduce conflict (shift 17, reduce 8) on "SUB"
+27: shift/reduce conflict (shift 18, reduce 8) on "MUL"
+27: shift/reduce conflict (shift 19, reduce 8) on "DIV"
+27: shift/reduce conflict (shift 20, reduce 8) on "MOD"
+27: shift/reduce conflict (shift 21, reduce 8) on "AND"
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr "SUB" expr . (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on "ADD"
+28: shift/reduce conflict (shift 17, reduce 9) on "SUB"
+28: shift/reduce conflict (shift 18, reduce 9) on "MUL"
+28: shift/reduce conflict (shift 19, reduce 9) on "DIV"
+28: shift/reduce conflict (shift 20, reduce 9) on "MOD"
+28: shift/reduce conflict (shift 21, reduce 9) on "AND"
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr "MUL" expr . (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on "ADD"
+29: shift/reduce conflict (shift 17, reduce 10) on "SUB"
+29: shift/reduce conflict (shift 18, reduce 10) on "MUL"
+29: shift/reduce conflict (shift 19, reduce 10) on "DIV"
+29: shift/reduce conflict (shift 20, reduce 10) on "MOD"
+29: shift/reduce conflict (shift 21, reduce 10) on "AND"
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr "DIV" expr . (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on "ADD"
+30: shift/reduce conflict (shift 17, reduce 11) on "SUB"
+30: shift/reduce conflict (shift 18, reduce 11) on "MUL"
+30: shift/reduce conflict (shift 19, reduce 11) on "DIV"
+30: shift/reduce conflict (shift 20, reduce 11) on "MOD"
+30: shift/reduce conflict (shift 21, reduce 11) on "AND"
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr "MOD" expr . (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on "ADD"
+31: shift/reduce conflict (shift 17, reduce 12) on "SUB"
+31: shift/reduce conflict (shift 18, reduce 12) on "MUL"
+31: shift/reduce conflict (shift 19, reduce 12) on "DIV"
+31: shift/reduce conflict (shift 20, reduce 12) on "MOD"
+31: shift/reduce conflict (shift 21, reduce 12) on "AND"
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr "AND" expr . (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on "ADD"
+32: shift/reduce conflict (shift 17, reduce 13) on "SUB"
+32: shift/reduce conflict (shift 18, reduce 13) on "MUL"
+32: shift/reduce conflict (shift 19, reduce 13) on "DIV"
+32: shift/reduce conflict (shift 20, reduce 13) on "MOD"
+32: shift/reduce conflict (shift 21, reduce 13) on "AND"
+state 32
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
--- /dev/null
+#ifndef lint
+static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+
+
+#ifndef yyparse
+#define yyparse quote_calc2_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc2_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc2_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc2_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc2_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc2_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc2_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc2_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc2_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc2_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc2_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc2_defred
+#endif /* yydefred */
+
+#ifndef yydgoto
+#define yydgoto quote_calc2_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc2_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc2_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc2_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc2_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc2_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc2_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc2_rule
+#endif /* yyrule */
+#define YYPREFIX "quote_calc2_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc2.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 109 "quote_calc2.tab.c"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* 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 OP_ADD 257
+#define ADD 258
+#define OP_SUB 259
+#define SUB 260
+#define OP_MUL 261
+#define MUL 262
+#define OP_DIV 263
+#define DIV 264
+#define OP_MOD 265
+#define MOD 266
+#define OP_AND 267
+#define AND 268
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+static const short quote_calc2_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short quote_calc2_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short quote_calc2_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const short quote_calc2_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const short quote_calc2_sindex[] = { 0,
+ -38, 4, -36, 0, -51, -36, 6, -121, -249, 0,
+ 0, -243, -36, -23, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const short quote_calc2_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 12, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 14, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+static const short quote_calc2_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 259
+static const short quote_calc2_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 10, 16, 15, 17, 25, 18, 23,
+ 19, 4, 20, 5, 21, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 22, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 16, 0, 17, 0,
+ 18, 0, 19, 0, 20, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 3, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 0, 16, 15, 16,
+ 15, 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const short quote_calc2_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 10, 258, 10, 260, 41, 262, 269,
+ 264, 10, 266, 10, 268, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 124, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 258, -1, 260, -1,
+ 262, -1, 264, -1, 266, -1, 268, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ -1, 260, -1, 260, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 258, -1, 260, -1, 262, -1,
+ 264, -1, 266, -1, 268, -1, -1, 258, 258, 260,
+ 260, 262, 262, 264, 264, 266, 266, 268, 268,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#if YYDEBUG
+static const char *yyname[] = {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
+"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr \"ADD\" expr",
+"expr : expr \"SUB\" expr",
+"expr : expr \"MUL\" expr",
+"expr : expr \"DIV\" expr",
+"expr : expr \"MOD\" expr",
+"expr : expr \"AND\" expr",
+"expr : expr '|' expr",
+"expr : \"SUB\" expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#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 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 73 "quote_calc2.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 367 "quote_calc2.tab.c"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return -1;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = data->s_mark - data->s_base;
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return -1;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return -1;
+
+ 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
+
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack)) 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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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 == 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ 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)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc2.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc2.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc2.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc2.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc2.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc2.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc2.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc2.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 633 "quote_calc2.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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
--- /dev/null
+#define OP_ADD 257
+#define ADD 258
+#define OP_SUB 259
+#define SUB 260
+#define OP_MUL 261
+#define MUL 262
+#define OP_DIV 263
+#define DIV 264
+#define OP_MOD 265
+#define MOD 266
+#define OP_AND 267
+#define AND 268
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
--- /dev/null
+%{
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+%}
+
+%start list
+
+%token OP_ADD "ADD"
+%token OP_SUB "SUB"
+%token OP_MUL "MUL"
+%token OP_DIV "DIV"
+%token OP_MOD "MOD"
+%token OP_AND "AND"
+
+%token DIGIT LETTER
+
+%left '|'
+%left '&'
+%left '+' '-'
+%left '*' '/' '%'
+%left UMINUS /* supplies precedence for unary minus */
+
+%% /* beginning of rules section */
+
+list : /* empty */
+ | list stat '\n'
+ | list error '\n'
+ { yyerrok ; }
+ ;
+
+stat : expr
+ { printf("%d\n",$1);}
+ | LETTER '=' expr
+ { regs[$1] = $3; }
+ ;
+
+expr : '(' expr ')'
+ { $$ = $2; }
+ | expr "ADD" expr
+ { $$ = $1 + $3; }
+ | expr "SUB" expr
+ { $$ = $1 - $3; }
+ | expr "MUL" expr
+ { $$ = $1 * $3; }
+ | expr "DIV" expr
+ { $$ = $1 / $3; }
+ | expr "MOD" expr
+ { $$ = $1 % $3; }
+ | expr "AND" expr
+ { $$ = $1 & $3; }
+ | expr '|' expr
+ { $$ = $1 | $3; }
+ | "SUB" expr %prec UMINUS
+ { $$ = - $2; }
+ | LETTER
+ { $$ = regs[$1]; }
+ | number
+ ;
+
+number: DIGIT
+ { $$ = $1; base = ($1==0) ? 8 : 10; }
+ | number DIGIT
+ { $$ = base * $1 + $2; }
+ ;
+
+%% /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
--- /dev/null
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr OP_ADD expr
+ 8 | expr OP_SUB expr
+ 9 | expr OP_MUL expr
+ 10 | expr OP_DIV expr
+ 11 | expr OP_MOD expr
+ 12 | expr OP_AND expr
+ 13 | expr '|' expr
+ 14 | OP_SUB expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+\f
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : OP_SUB . expr (14)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ OP_ADD reduce 15
+ OP_SUB reduce 15
+ OP_MUL reduce 15
+ OP_DIV reduce 15
+ OP_MOD reduce 15
+ OP_AND reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ OP_ADD reduce 16
+ OP_SUB reduce 16
+ OP_MUL reduce 16
+ OP_DIV reduce 16
+ OP_MOD reduce 16
+ OP_AND reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on OP_ADD
+12: shift/reduce conflict (shift 17, reduce 14) on OP_SUB
+12: shift/reduce conflict (shift 18, reduce 14) on OP_MUL
+12: shift/reduce conflict (shift 19, reduce 14) on OP_DIV
+12: shift/reduce conflict (shift 20, reduce 14) on OP_MOD
+12: shift/reduce conflict (shift 21, reduce 14) on OP_AND
+state 12
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : OP_SUB expr . (14)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr OP_ADD . expr (7)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr OP_SUB . expr (8)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr OP_MUL . expr (9)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr OP_DIV . expr (10)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr OP_MOD . expr (11)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr OP_AND . expr (12)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on OP_ADD
+26: shift/reduce conflict (shift 17, reduce 7) on OP_SUB
+26: shift/reduce conflict (shift 18, reduce 7) on OP_MUL
+26: shift/reduce conflict (shift 19, reduce 7) on OP_DIV
+26: shift/reduce conflict (shift 20, reduce 7) on OP_MOD
+26: shift/reduce conflict (shift 21, reduce 7) on OP_AND
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . OP_ADD expr (7)
+ expr : expr OP_ADD expr . (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on OP_ADD
+27: shift/reduce conflict (shift 17, reduce 8) on OP_SUB
+27: shift/reduce conflict (shift 18, reduce 8) on OP_MUL
+27: shift/reduce conflict (shift 19, reduce 8) on OP_DIV
+27: shift/reduce conflict (shift 20, reduce 8) on OP_MOD
+27: shift/reduce conflict (shift 21, reduce 8) on OP_AND
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr OP_SUB expr . (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on OP_ADD
+28: shift/reduce conflict (shift 17, reduce 9) on OP_SUB
+28: shift/reduce conflict (shift 18, reduce 9) on OP_MUL
+28: shift/reduce conflict (shift 19, reduce 9) on OP_DIV
+28: shift/reduce conflict (shift 20, reduce 9) on OP_MOD
+28: shift/reduce conflict (shift 21, reduce 9) on OP_AND
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr OP_MUL expr . (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on OP_ADD
+29: shift/reduce conflict (shift 17, reduce 10) on OP_SUB
+29: shift/reduce conflict (shift 18, reduce 10) on OP_MUL
+29: shift/reduce conflict (shift 19, reduce 10) on OP_DIV
+29: shift/reduce conflict (shift 20, reduce 10) on OP_MOD
+29: shift/reduce conflict (shift 21, reduce 10) on OP_AND
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr OP_DIV expr . (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on OP_ADD
+30: shift/reduce conflict (shift 17, reduce 11) on OP_SUB
+30: shift/reduce conflict (shift 18, reduce 11) on OP_MUL
+30: shift/reduce conflict (shift 19, reduce 11) on OP_DIV
+30: shift/reduce conflict (shift 20, reduce 11) on OP_MOD
+30: shift/reduce conflict (shift 21, reduce 11) on OP_AND
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr OP_MOD expr . (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on OP_ADD
+31: shift/reduce conflict (shift 17, reduce 12) on OP_SUB
+31: shift/reduce conflict (shift 18, reduce 12) on OP_MUL
+31: shift/reduce conflict (shift 19, reduce 12) on OP_DIV
+31: shift/reduce conflict (shift 20, reduce 12) on OP_MOD
+31: shift/reduce conflict (shift 21, reduce 12) on OP_AND
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr OP_AND expr . (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on OP_ADD
+32: shift/reduce conflict (shift 17, reduce 13) on OP_SUB
+32: shift/reduce conflict (shift 18, reduce 13) on OP_MUL
+32: shift/reduce conflict (shift 19, reduce 13) on OP_DIV
+32: shift/reduce conflict (shift 20, reduce 13) on OP_MOD
+32: shift/reduce conflict (shift 21, reduce 13) on OP_AND
+state 32
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
--- /dev/null
+#ifndef lint
+static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+
+
+#ifndef yyparse
+#define yyparse quote_calc3_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc3_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc3_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc3_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc3_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc3_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc3_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc3_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc3_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc3_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc3_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc3_defred
+#endif /* yydefred */
+
+#ifndef yydgoto
+#define yydgoto quote_calc3_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc3_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc3_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc3_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc3_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc3_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc3_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc3_rule
+#endif /* yyrule */
+#define YYPREFIX "quote_calc3_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc3.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 109 "quote_calc3-s.tab.c"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* 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 OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+static const short quote_calc3_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short quote_calc3_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short quote_calc3_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const short quote_calc3_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const short quote_calc3_sindex[] = { 0,
+ -38, 5, -36, 0, -51, -36, 7, -121, -248, 0,
+ 0, -243, -36, -22, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const short quote_calc3_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 13, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+static const short quote_calc3_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 258
+static const short quote_calc3_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 16, 10, 17, 15, 18, 25, 19,
+ 23, 20, 4, 21, 5, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 17, 0, 18,
+ 0, 19, 0, 20, 0, 21, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 3, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 16, 15, 16, 15,
+ 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const short quote_calc3_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 257, 10, 259, 10, 261, 41, 263,
+ 269, 265, 10, 267, 10, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 124, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 257, -1, 259, -1, 261,
+ -1, 263, -1, 265, -1, 267, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ 259, -1, 259, -1, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 257, -1, 259, -1, 261, -1,
+ 263, -1, 265, -1, 267, -1, 257, 257, 259, 259,
+ 261, 261, 263, 263, 265, 265, 267, 267,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#if YYDEBUG
+static const char *yyname[] = {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
+"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
+"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr OP_ADD expr",
+"expr : expr OP_SUB expr",
+"expr : expr OP_MUL expr",
+"expr : expr OP_DIV expr",
+"expr : expr OP_MOD expr",
+"expr : expr OP_AND expr",
+"expr : expr '|' expr",
+"expr : OP_SUB expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#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 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 73 "quote_calc3.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 362 "quote_calc3-s.tab.c"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return -1;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = data->s_mark - data->s_base;
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return -1;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return -1;
+
+ 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
+
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack)) 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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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 == 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ 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)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc3.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc3.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc3.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc3.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc3.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc3.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc3.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc3.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 628 "quote_calc3-s.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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
--- /dev/null
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
--- /dev/null
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr OP_ADD expr
+ 8 | expr OP_SUB expr
+ 9 | expr OP_MUL expr
+ 10 | expr OP_DIV expr
+ 11 | expr OP_MOD expr
+ 12 | expr OP_AND expr
+ 13 | expr '|' expr
+ 14 | OP_SUB expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+\f
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : OP_SUB . expr (14)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ OP_ADD reduce 15
+ OP_SUB reduce 15
+ OP_MUL reduce 15
+ OP_DIV reduce 15
+ OP_MOD reduce 15
+ OP_AND reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ OP_ADD reduce 16
+ OP_SUB reduce 16
+ OP_MUL reduce 16
+ OP_DIV reduce 16
+ OP_MOD reduce 16
+ OP_AND reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on OP_ADD
+12: shift/reduce conflict (shift 17, reduce 14) on OP_SUB
+12: shift/reduce conflict (shift 18, reduce 14) on OP_MUL
+12: shift/reduce conflict (shift 19, reduce 14) on OP_DIV
+12: shift/reduce conflict (shift 20, reduce 14) on OP_MOD
+12: shift/reduce conflict (shift 21, reduce 14) on OP_AND
+state 12
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : OP_SUB expr . (14)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr OP_ADD . expr (7)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr OP_SUB . expr (8)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr OP_MUL . expr (9)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr OP_DIV . expr (10)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr OP_MOD . expr (11)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr OP_AND . expr (12)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on OP_ADD
+26: shift/reduce conflict (shift 17, reduce 7) on OP_SUB
+26: shift/reduce conflict (shift 18, reduce 7) on OP_MUL
+26: shift/reduce conflict (shift 19, reduce 7) on OP_DIV
+26: shift/reduce conflict (shift 20, reduce 7) on OP_MOD
+26: shift/reduce conflict (shift 21, reduce 7) on OP_AND
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . OP_ADD expr (7)
+ expr : expr OP_ADD expr . (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on OP_ADD
+27: shift/reduce conflict (shift 17, reduce 8) on OP_SUB
+27: shift/reduce conflict (shift 18, reduce 8) on OP_MUL
+27: shift/reduce conflict (shift 19, reduce 8) on OP_DIV
+27: shift/reduce conflict (shift 20, reduce 8) on OP_MOD
+27: shift/reduce conflict (shift 21, reduce 8) on OP_AND
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr OP_SUB expr . (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on OP_ADD
+28: shift/reduce conflict (shift 17, reduce 9) on OP_SUB
+28: shift/reduce conflict (shift 18, reduce 9) on OP_MUL
+28: shift/reduce conflict (shift 19, reduce 9) on OP_DIV
+28: shift/reduce conflict (shift 20, reduce 9) on OP_MOD
+28: shift/reduce conflict (shift 21, reduce 9) on OP_AND
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr OP_MUL expr . (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on OP_ADD
+29: shift/reduce conflict (shift 17, reduce 10) on OP_SUB
+29: shift/reduce conflict (shift 18, reduce 10) on OP_MUL
+29: shift/reduce conflict (shift 19, reduce 10) on OP_DIV
+29: shift/reduce conflict (shift 20, reduce 10) on OP_MOD
+29: shift/reduce conflict (shift 21, reduce 10) on OP_AND
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr OP_DIV expr . (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on OP_ADD
+30: shift/reduce conflict (shift 17, reduce 11) on OP_SUB
+30: shift/reduce conflict (shift 18, reduce 11) on OP_MUL
+30: shift/reduce conflict (shift 19, reduce 11) on OP_DIV
+30: shift/reduce conflict (shift 20, reduce 11) on OP_MOD
+30: shift/reduce conflict (shift 21, reduce 11) on OP_AND
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr OP_MOD expr . (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on OP_ADD
+31: shift/reduce conflict (shift 17, reduce 12) on OP_SUB
+31: shift/reduce conflict (shift 18, reduce 12) on OP_MUL
+31: shift/reduce conflict (shift 19, reduce 12) on OP_DIV
+31: shift/reduce conflict (shift 20, reduce 12) on OP_MOD
+31: shift/reduce conflict (shift 21, reduce 12) on OP_AND
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr OP_AND expr . (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on OP_ADD
+32: shift/reduce conflict (shift 17, reduce 13) on OP_SUB
+32: shift/reduce conflict (shift 18, reduce 13) on OP_MUL
+32: shift/reduce conflict (shift 19, reduce 13) on OP_DIV
+32: shift/reduce conflict (shift 20, reduce 13) on OP_MOD
+32: shift/reduce conflict (shift 21, reduce 13) on OP_AND
+state 32
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
--- /dev/null
+#ifndef lint
+static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+
+
+#ifndef yyparse
+#define yyparse quote_calc3_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc3_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc3_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc3_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc3_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc3_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc3_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc3_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc3_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc3_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc3_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc3_defred
+#endif /* yydefred */
+
+#ifndef yydgoto
+#define yydgoto quote_calc3_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc3_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc3_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc3_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc3_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc3_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc3_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc3_rule
+#endif /* yyrule */
+#define YYPREFIX "quote_calc3_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc3.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 109 "quote_calc3.tab.c"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* 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 OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+static const short quote_calc3_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short quote_calc3_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short quote_calc3_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const short quote_calc3_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const short quote_calc3_sindex[] = { 0,
+ -38, 5, -36, 0, -51, -36, 7, -121, -248, 0,
+ 0, -243, -36, -22, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const short quote_calc3_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 13, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+static const short quote_calc3_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 258
+static const short quote_calc3_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 16, 10, 17, 15, 18, 25, 19,
+ 23, 20, 4, 21, 5, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 17, 0, 18,
+ 0, 19, 0, 20, 0, 21, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 3, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 16, 15, 16, 15,
+ 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const short quote_calc3_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 257, 10, 259, 10, 261, 41, 263,
+ 269, 265, 10, 267, 10, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 124, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 257, -1, 259, -1, 261,
+ -1, 263, -1, 265, -1, 267, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ 259, -1, 259, -1, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 257, -1, 259, -1, 261, -1,
+ 263, -1, 265, -1, 267, -1, 257, 257, 259, 259,
+ 261, 261, 263, 263, 265, 265, 267, 267,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#if YYDEBUG
+static const char *yyname[] = {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
+"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
+"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr OP_ADD expr",
+"expr : expr OP_SUB expr",
+"expr : expr OP_MUL expr",
+"expr : expr OP_DIV expr",
+"expr : expr OP_MOD expr",
+"expr : expr OP_AND expr",
+"expr : expr '|' expr",
+"expr : OP_SUB expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#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 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 73 "quote_calc3.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 362 "quote_calc3.tab.c"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return -1;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = data->s_mark - data->s_base;
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return -1;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return -1;
+
+ 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
+
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack)) 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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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 == 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ 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)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc3.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc3.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc3.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc3.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc3.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc3.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc3.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc3.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 628 "quote_calc3.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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
--- /dev/null
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
--- /dev/null
+%{
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+%}
+
+%start list
+
+%token OP_ADD "ADD-operator"
+%token OP_SUB "SUB-operator"
+%token OP_MUL "MUL-operator"
+%token OP_DIV "DIV-operator"
+%token OP_MOD "MOD-operator"
+%token OP_AND "AND-operator"
+
+%token DIGIT LETTER
+
+%left '|'
+%left '&'
+%left '+' '-'
+%left '*' '/' '%'
+%left UMINUS /* supplies precedence for unary minus */
+
+%% /* beginning of rules section */
+
+list : /* empty */
+ | list stat '\n'
+ | list error '\n'
+ { yyerrok ; }
+ ;
+
+stat : expr
+ { printf("%d\n",$1);}
+ | LETTER '=' expr
+ { regs[$1] = $3; }
+ ;
+
+expr : '(' expr ')'
+ { $$ = $2; }
+ | expr OP_ADD expr
+ { $$ = $1 + $3; }
+ | expr OP_SUB expr
+ { $$ = $1 - $3; }
+ | expr OP_MUL expr
+ { $$ = $1 * $3; }
+ | expr OP_DIV expr
+ { $$ = $1 / $3; }
+ | expr OP_MOD expr
+ { $$ = $1 % $3; }
+ | expr OP_AND expr
+ { $$ = $1 & $3; }
+ | expr '|' expr
+ { $$ = $1 | $3; }
+ | OP_SUB expr %prec UMINUS
+ { $$ = - $2; }
+ | LETTER
+ { $$ = regs[$1]; }
+ | number
+ ;
+
+number: DIGIT
+ { $$ = $1; base = ($1==0) ? 8 : 10; }
+ | number DIGIT
+ { $$ = base * $1 + $2; }
+ ;
+
+%% /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
--- /dev/null
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr "ADD-operator" expr
+ 8 | expr "SUB-operator" expr
+ 9 | expr "MUL-operator" expr
+ 10 | expr "DIV-operator" expr
+ 11 | expr "MOD-operator" expr
+ 12 | expr "AND-operator" expr
+ 13 | expr '|' expr
+ 14 | "SUB-operator" expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+\f
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : "SUB-operator" . expr (14)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ "ADD-operator" reduce 15
+ "SUB-operator" reduce 15
+ "MUL-operator" reduce 15
+ "DIV-operator" reduce 15
+ "MOD-operator" reduce 15
+ "AND-operator" reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ "ADD-operator" reduce 16
+ "SUB-operator" reduce 16
+ "MUL-operator" reduce 16
+ "DIV-operator" reduce 16
+ "MOD-operator" reduce 16
+ "AND-operator" reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on "ADD-operator"
+12: shift/reduce conflict (shift 17, reduce 14) on "SUB-operator"
+12: shift/reduce conflict (shift 18, reduce 14) on "MUL-operator"
+12: shift/reduce conflict (shift 19, reduce 14) on "DIV-operator"
+12: shift/reduce conflict (shift 20, reduce 14) on "MOD-operator"
+12: shift/reduce conflict (shift 21, reduce 14) on "AND-operator"
+state 12
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+ expr : "SUB-operator" expr . (14)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr "ADD-operator" . expr (7)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr "SUB-operator" . expr (8)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr "MUL-operator" . expr (9)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr "DIV-operator" . expr (10)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr "MOD-operator" . expr (11)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr "AND-operator" . expr (12)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on "ADD-operator"
+26: shift/reduce conflict (shift 17, reduce 7) on "SUB-operator"
+26: shift/reduce conflict (shift 18, reduce 7) on "MUL-operator"
+26: shift/reduce conflict (shift 19, reduce 7) on "DIV-operator"
+26: shift/reduce conflict (shift 20, reduce 7) on "MOD-operator"
+26: shift/reduce conflict (shift 21, reduce 7) on "AND-operator"
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr "ADD-operator" expr . (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on "ADD-operator"
+27: shift/reduce conflict (shift 17, reduce 8) on "SUB-operator"
+27: shift/reduce conflict (shift 18, reduce 8) on "MUL-operator"
+27: shift/reduce conflict (shift 19, reduce 8) on "DIV-operator"
+27: shift/reduce conflict (shift 20, reduce 8) on "MOD-operator"
+27: shift/reduce conflict (shift 21, reduce 8) on "AND-operator"
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr "SUB-operator" expr . (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on "ADD-operator"
+28: shift/reduce conflict (shift 17, reduce 9) on "SUB-operator"
+28: shift/reduce conflict (shift 18, reduce 9) on "MUL-operator"
+28: shift/reduce conflict (shift 19, reduce 9) on "DIV-operator"
+28: shift/reduce conflict (shift 20, reduce 9) on "MOD-operator"
+28: shift/reduce conflict (shift 21, reduce 9) on "AND-operator"
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr "MUL-operator" expr . (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on "ADD-operator"
+29: shift/reduce conflict (shift 17, reduce 10) on "SUB-operator"
+29: shift/reduce conflict (shift 18, reduce 10) on "MUL-operator"
+29: shift/reduce conflict (shift 19, reduce 10) on "DIV-operator"
+29: shift/reduce conflict (shift 20, reduce 10) on "MOD-operator"
+29: shift/reduce conflict (shift 21, reduce 10) on "AND-operator"
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr "DIV-operator" expr . (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on "ADD-operator"
+30: shift/reduce conflict (shift 17, reduce 11) on "SUB-operator"
+30: shift/reduce conflict (shift 18, reduce 11) on "MUL-operator"
+30: shift/reduce conflict (shift 19, reduce 11) on "DIV-operator"
+30: shift/reduce conflict (shift 20, reduce 11) on "MOD-operator"
+30: shift/reduce conflict (shift 21, reduce 11) on "AND-operator"
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr "MOD-operator" expr . (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on "ADD-operator"
+31: shift/reduce conflict (shift 17, reduce 12) on "SUB-operator"
+31: shift/reduce conflict (shift 18, reduce 12) on "MUL-operator"
+31: shift/reduce conflict (shift 19, reduce 12) on "DIV-operator"
+31: shift/reduce conflict (shift 20, reduce 12) on "MOD-operator"
+31: shift/reduce conflict (shift 21, reduce 12) on "AND-operator"
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr "AND-operator" expr . (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on "ADD-operator"
+32: shift/reduce conflict (shift 17, reduce 13) on "SUB-operator"
+32: shift/reduce conflict (shift 18, reduce 13) on "MUL-operator"
+32: shift/reduce conflict (shift 19, reduce 13) on "DIV-operator"
+32: shift/reduce conflict (shift 20, reduce 13) on "MOD-operator"
+32: shift/reduce conflict (shift 21, reduce 13) on "AND-operator"
+state 32
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
--- /dev/null
+#ifndef lint
+static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+
+
+#ifndef yyparse
+#define yyparse quote_calc4_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc4_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc4_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc4_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc4_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc4_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc4_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc4_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc4_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc4_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc4_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc4_defred
+#endif /* yydefred */
+
+#ifndef yydgoto
+#define yydgoto quote_calc4_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc4_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc4_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc4_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc4_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc4_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc4_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc4_rule
+#endif /* yyrule */
+#define YYPREFIX "quote_calc4_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc4.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 109 "quote_calc4-s.tab.c"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* 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 OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+static const short quote_calc4_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short quote_calc4_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short quote_calc4_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const short quote_calc4_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const short quote_calc4_sindex[] = { 0,
+ -38, 4, -36, 0, -51, -36, 6, -121, -249, 0,
+ 0, -243, -36, -23, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const short quote_calc4_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 12, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 14, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+static const short quote_calc4_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 259
+static const short quote_calc4_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 10, 16, 15, 17, 25, 18, 23,
+ 19, 4, 20, 5, 21, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 22, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 16, 0, 17, 0,
+ 18, 0, 19, 0, 20, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 3, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 0, 16, 15, 16,
+ 15, 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const short quote_calc4_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 10, 258, 10, 260, 41, 262, 269,
+ 264, 10, 266, 10, 268, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 124, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 258, -1, 260, -1,
+ 262, -1, 264, -1, 266, -1, 268, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ -1, 260, -1, 260, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 258, -1, 260, -1, 262, -1,
+ 264, -1, 266, -1, 268, -1, -1, 258, 258, 260,
+ 260, 262, 262, 264, 264, 266, 266, 268, 268,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#if YYDEBUG
+static const char *yyname[] = {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
+"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
+"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr \"ADD-operator\" expr",
+"expr : expr \"SUB-operator\" expr",
+"expr : expr \"MUL-operator\" expr",
+"expr : expr \"DIV-operator\" expr",
+"expr : expr \"MOD-operator\" expr",
+"expr : expr \"AND-operator\" expr",
+"expr : expr '|' expr",
+"expr : \"SUB-operator\" expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#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 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 73 "quote_calc4.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 362 "quote_calc4-s.tab.c"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return -1;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = data->s_mark - data->s_base;
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return -1;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return -1;
+
+ 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
+
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack)) 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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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 == 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ 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)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc4.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc4.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc4.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc4.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc4.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc4.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc4.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc4.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 628 "quote_calc4-s.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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
--- /dev/null
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
--- /dev/null
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr "ADD-operator" expr
+ 8 | expr "SUB-operator" expr
+ 9 | expr "MUL-operator" expr
+ 10 | expr "DIV-operator" expr
+ 11 | expr "MOD-operator" expr
+ 12 | expr "AND-operator" expr
+ 13 | expr '|' expr
+ 14 | "SUB-operator" expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+\f
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : "SUB-operator" . expr (14)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ "ADD-operator" reduce 15
+ "SUB-operator" reduce 15
+ "MUL-operator" reduce 15
+ "DIV-operator" reduce 15
+ "MOD-operator" reduce 15
+ "AND-operator" reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ "ADD-operator" reduce 16
+ "SUB-operator" reduce 16
+ "MUL-operator" reduce 16
+ "DIV-operator" reduce 16
+ "MOD-operator" reduce 16
+ "AND-operator" reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on "ADD-operator"
+12: shift/reduce conflict (shift 17, reduce 14) on "SUB-operator"
+12: shift/reduce conflict (shift 18, reduce 14) on "MUL-operator"
+12: shift/reduce conflict (shift 19, reduce 14) on "DIV-operator"
+12: shift/reduce conflict (shift 20, reduce 14) on "MOD-operator"
+12: shift/reduce conflict (shift 21, reduce 14) on "AND-operator"
+state 12
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+ expr : "SUB-operator" expr . (14)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr "ADD-operator" . expr (7)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr "SUB-operator" . expr (8)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr "MUL-operator" . expr (9)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr "DIV-operator" . expr (10)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr "MOD-operator" . expr (11)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr "AND-operator" . expr (12)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on "ADD-operator"
+26: shift/reduce conflict (shift 17, reduce 7) on "SUB-operator"
+26: shift/reduce conflict (shift 18, reduce 7) on "MUL-operator"
+26: shift/reduce conflict (shift 19, reduce 7) on "DIV-operator"
+26: shift/reduce conflict (shift 20, reduce 7) on "MOD-operator"
+26: shift/reduce conflict (shift 21, reduce 7) on "AND-operator"
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr "ADD-operator" expr . (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on "ADD-operator"
+27: shift/reduce conflict (shift 17, reduce 8) on "SUB-operator"
+27: shift/reduce conflict (shift 18, reduce 8) on "MUL-operator"
+27: shift/reduce conflict (shift 19, reduce 8) on "DIV-operator"
+27: shift/reduce conflict (shift 20, reduce 8) on "MOD-operator"
+27: shift/reduce conflict (shift 21, reduce 8) on "AND-operator"
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr "SUB-operator" expr . (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on "ADD-operator"
+28: shift/reduce conflict (shift 17, reduce 9) on "SUB-operator"
+28: shift/reduce conflict (shift 18, reduce 9) on "MUL-operator"
+28: shift/reduce conflict (shift 19, reduce 9) on "DIV-operator"
+28: shift/reduce conflict (shift 20, reduce 9) on "MOD-operator"
+28: shift/reduce conflict (shift 21, reduce 9) on "AND-operator"
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr "MUL-operator" expr . (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on "ADD-operator"
+29: shift/reduce conflict (shift 17, reduce 10) on "SUB-operator"
+29: shift/reduce conflict (shift 18, reduce 10) on "MUL-operator"
+29: shift/reduce conflict (shift 19, reduce 10) on "DIV-operator"
+29: shift/reduce conflict (shift 20, reduce 10) on "MOD-operator"
+29: shift/reduce conflict (shift 21, reduce 10) on "AND-operator"
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr "DIV-operator" expr . (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on "ADD-operator"
+30: shift/reduce conflict (shift 17, reduce 11) on "SUB-operator"
+30: shift/reduce conflict (shift 18, reduce 11) on "MUL-operator"
+30: shift/reduce conflict (shift 19, reduce 11) on "DIV-operator"
+30: shift/reduce conflict (shift 20, reduce 11) on "MOD-operator"
+30: shift/reduce conflict (shift 21, reduce 11) on "AND-operator"
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr "MOD-operator" expr . (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on "ADD-operator"
+31: shift/reduce conflict (shift 17, reduce 12) on "SUB-operator"
+31: shift/reduce conflict (shift 18, reduce 12) on "MUL-operator"
+31: shift/reduce conflict (shift 19, reduce 12) on "DIV-operator"
+31: shift/reduce conflict (shift 20, reduce 12) on "MOD-operator"
+31: shift/reduce conflict (shift 21, reduce 12) on "AND-operator"
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr "AND-operator" expr . (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on "ADD-operator"
+32: shift/reduce conflict (shift 17, reduce 13) on "SUB-operator"
+32: shift/reduce conflict (shift 18, reduce 13) on "MUL-operator"
+32: shift/reduce conflict (shift 19, reduce 13) on "DIV-operator"
+32: shift/reduce conflict (shift 20, reduce 13) on "MOD-operator"
+32: shift/reduce conflict (shift 21, reduce 13) on "AND-operator"
+state 32
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
--- /dev/null
+#ifndef lint
+static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+
+
+#ifndef yyparse
+#define yyparse quote_calc4_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc4_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc4_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc4_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc4_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc4_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc4_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc4_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc4_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc4_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc4_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc4_defred
+#endif /* yydefred */
+
+#ifndef yydgoto
+#define yydgoto quote_calc4_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc4_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc4_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc4_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc4_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc4_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc4_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc4_rule
+#endif /* yyrule */
+#define YYPREFIX "quote_calc4_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc4.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 109 "quote_calc4.tab.c"
+
+#ifndef YYSTYPE
+typedef int YYSTYPE;
+#endif
+
+/* 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 OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+static const short quote_calc4_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const short quote_calc4_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const short quote_calc4_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const short quote_calc4_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const short quote_calc4_sindex[] = { 0,
+ -38, 4, -36, 0, -51, -36, 6, -121, -249, 0,
+ 0, -243, -36, -23, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const short quote_calc4_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 12, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 14, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+static const short quote_calc4_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 259
+static const short quote_calc4_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 10, 16, 15, 17, 25, 18, 23,
+ 19, 4, 20, 5, 21, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 22, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 16, 0, 17, 0,
+ 18, 0, 19, 0, 20, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 3, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 0, 16, 15, 16,
+ 15, 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const short quote_calc4_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 10, 258, 10, 260, 41, 262, 269,
+ 264, 10, 266, 10, 268, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 124, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 258, -1, 260, -1,
+ 262, -1, 264, -1, 266, -1, 268, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ -1, 260, -1, 260, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 258, -1, 260, -1, 262, -1,
+ 264, -1, 266, -1, 268, -1, -1, 258, 258, 260,
+ 260, 262, 262, 264, 264, 266, 266, 268, 268,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#if YYDEBUG
+static const char *yyname[] = {
+
+"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
+"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
+"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS",
+};
+static const char *yyrule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr \"ADD-operator\" expr",
+"expr : expr \"SUB-operator\" expr",
+"expr : expr \"MUL-operator\" expr",
+"expr : expr \"DIV-operator\" expr",
+"expr : expr \"MOD-operator\" expr",
+"expr : expr \"AND-operator\" expr",
+"expr : expr '|' expr",
+"expr : \"SUB-operator\" expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#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 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+} YYSTACKDATA;
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#line 73 "quote_calc4.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 362 "quote_calc4.tab.c"
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return -1;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = data->s_mark - data->s_base;
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return -1;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return -1;
+
+ 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
+
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack)) 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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+
+ yyerror("syntax error");
+
+ goto yyerrlab;
+
+yyerrlab:
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ 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 == 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ 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)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc4.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc4.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc4.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc4.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc4.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc4.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc4.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc4.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 628 "quote_calc4.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)
+ {
+ if ((yychar = YYLEX) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == 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))
+ {
+ goto yyoverflow;
+ }
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+ goto yyloop;
+
+yyoverflow:
+ yyerror("yacc stack overflow");
+
+yyabort:
+ yyfreestack(&yystack);
+ return (1);
+
+yyaccept:
+ yyfreestack(&yystack);
+ return (0);
+}
--- /dev/null
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
--- /dev/null
+%{
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+%}
+
+%start list
+
+%token OP_ADD "ADD-operator"
+%token OP_SUB "SUB-operator"
+%token OP_MUL "MUL-operator"
+%token OP_DIV "DIV-operator"
+%token OP_MOD "MOD-operator"
+%token OP_AND "AND-operator"
+
+%token DIGIT LETTER
+
+%left '|'
+%left '&'
+%left '+' '-'
+%left '*' '/' '%'
+%left UMINUS /* supplies precedence for unary minus */
+
+%% /* beginning of rules section */
+
+list : /* empty */
+ | list stat '\n'
+ | list error '\n'
+ { yyerrok ; }
+ ;
+
+stat : expr
+ { printf("%d\n",$1);}
+ | LETTER '=' expr
+ { regs[$1] = $3; }
+ ;
+
+expr : '(' expr ')'
+ { $$ = $2; }
+ | expr "ADD-operator" expr
+ { $$ = $1 + $3; }
+ | expr "SUB-operator" expr
+ { $$ = $1 - $3; }
+ | expr "MUL-operator" expr
+ { $$ = $1 * $3; }
+ | expr "DIV-operator" expr
+ { $$ = $1 / $3; }
+ | expr "MOD-operator" expr
+ { $$ = $1 % $3; }
+ | expr "AND-operator" expr
+ { $$ = $1 & $3; }
+ | expr '|' expr
+ { $$ = $1 | $3; }
+ | "SUB-operator" expr %prec UMINUS
+ { $$ = - $2; }
+ | LETTER
+ { $$ = regs[$1]; }
+ | number
+ ;
+
+number: DIGIT
+ { $$ = $1; base = ($1==0) ? 8 : 10; }
+ | number DIGIT
+ { $$ = base * $1 + $2; }
+ ;
+
+%% /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
#!/bin/sh
-# $Id: run_make.sh,v 1.1 2010/06/08 09:00:39 tom Exp $
+# $Id: run_make.sh,v 1.9 2012/01/15 22:35:01 tom Exp $
# vi:ts=4 sw=4:
# do a test-compile on each of the ".c" files in the test-directory
+BISON=`bison --version 2>/dev/null | head -n 1 | sed -e 's/^[^0-9.]*//' -e 's/[^0-9.]*$//'`
+
if test $# = 1
then
PROG_DIR=`pwd`
TEST_DIR=.
fi
+MY_MAKE="make -f $PROG_DIR/makefile srcdir=$PROG_DIR VPATH=$TEST_DIR"
+
echo '** '`date`
-for i in ${TEST_DIR}/*.c
+for input in ${TEST_DIR}/*.c
do
- obj=`echo "$i" |sed -e 's/\.c$/.o/'`
- make -f $PROG_DIR/makefile $obj C_FILES=$i srcdir=$PROG_DIR
+ test -f "$input" || continue
+
+ obj=`basename "$input" .c`.o
+
+ $MY_MAKE $obj C_FILES=$input
test -f $obj && rm $obj
+
+ DEFS=
+ case $input in #(vi
+ ${TEST_DIR}/pure_*)
+ # DEFS="-DYYLEX_PARAM=flag -DYYLEX_PARAM_TYPE=int"
+ ;;
+ esac
+
+ if test "x$DEFS" != "x"
+ then
+ $MY_MAKE $obj C_FILES=$input DEFINES="$DEFS"
+ test -f $obj && rm -f $obj
+ fi
+done
+
+if test -n "$BISON"
+then
+ echo "** compare with bison $BISON"
+ for input in ${TEST_DIR}/*.y
+ do
+ test -f "$input" || continue
+
+ # Bison does not support pure-parser from command-line.
+ # Also, its support for %expect is generally broken.
+ # Work around these issues using a temporary file.
+
+ echo "... testing $input"
+ rm -f run_make.[coy]
+
+ case $input in
+ pure_*)
+ if test -z `fgrep -l '%pure-parser' $input`
+ then
+ echo "%pure-parser" >>run_make.y
+ fi
+ ;;
+ esac
+
+ sed -e '/^%expect/s,%expect.*,,' $input >>run_make.y
+
+ bison -y run_make.y
+ sed -e '/^#line/s,"run_make.y","'$input'",' y.tab.c >run_make.c
+
+ rm -f y.tab.c
+
+ input=run_make.c
+ object=run_make.o
+ if test -f $input
+ then
+ $MY_MAKE $object DEFINES='-DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=1 -DYYSTACK_USE_ALLOCA=0 -DYYMAXDEPTH=0'
+ else
+ echo "?? $input not found"
+ fi
+ rm -f run_make.[coy]
+ done
+fi
+
+YACC=
+for name in /usr/ccs/bin/yacc
+do
+ if test -f $name
+ then
+ YACC=$name
+ fi
done
+
+if test -n "$YACC"
+then
+ echo "** compare with $YACC"
+ for input in ${TEST_DIR}/*.y
+ do
+ test -f "$input" || continue
+
+ echo "... testing $input"
+ rm -f run_make.[coy]
+
+ case $input in
+ pure_*)
+ echo "... skipping $input"
+ continue;
+ ;;
+ *)
+ if fgrep '%pure-parser' $input >/dev/null ||
+ fgrep '%parse-param' $input >/dev/null ||
+ fgrep '%lex-param' $input >/dev/null ||
+ fgrep 'YYLEX_PARAM' $input >/dev/null
+ then
+ echo "... skipping $input"
+ continue;
+ fi
+ ;;
+ esac
+
+ sed -e '/^%expect/s,%expect.*,,' $input >>run_make.y
+
+ $YACC run_make.y
+ sed -e '/^#line/s,"run_make.y","'$input'",' y.tab.c >run_make.c
+
+ rm -f y.tab.c
+
+ input=run_make.c
+ object=run_make.o
+ if test -f $input
+ then
+ $MY_MAKE $object
+ else
+ echo "?? $input not found"
+ fi
+ rm -f run_make.[coy]
+ done
+fi
#!/bin/sh
-# $Id: run_test.sh,v 1.6 2010/06/08 08:53:38 tom Exp $
+# $Id: run_test.sh,v 1.8 2012/01/15 11:50:35 tom Exp $
# vi:ts=4 sw=4:
if test $# = 1
YACC=$PROG_DIR/yacc
tmpfile=temp$$
+rm -f test-*
echo '** '`date`
-for i in ${TEST_DIR}/*.y
+for input in ${TEST_DIR}/*.y
do
- case $i in
+ case $input in
test*)
- echo "?? ignored $i"
+ echo "?? ignored $input"
;;
*)
- root=`basename $i .y`
+ root=`basename $input .y`
ROOT="test-$root"
prefix=${root}_
OPTS=
+ OPT2=
TYPE=".output .tab.c .tab.h"
- case $i in
+ case $input in
${TEST_DIR}/code_*)
OPTS="$OPTS -r"
TYPE="$TYPE .code.c"
OPTS="$OPTS -P"
prefix=`echo "$prefix" | sed -e 's/^pure_//'`
;;
+ ${TEST_DIR}/quote_*)
+ OPT2="-s"
+ ;;
esac
- $YACC $OPTS -v -d -p $prefix -b $ROOT $i
- for type in $TYPE
+ for opt2 in "" $OPT2
do
- REF=${TEST_DIR}/${root}${type}
- CMP=${ROOT}${type}
- if test ! -f $CMP ; then
- echo "...not found $CMP"
- continue
- fi
- sed -e s,$CMP,$REF, \
- -e /YYPATCH/d \
- -e 's,#line \([1-9][0-9]*\) "'$TEST_DIR'/,#line \1 ",' \
- < $CMP >$tmpfile \
- && mv $tmpfile $CMP
- if test ! -f $REF
- then
- mv $CMP $REF
- echo "...saved $REF"
- elif ( cmp -s $REF $CMP )
- then
- echo "...ok $REF"
- rm -f $CMP
- else
- echo "...diff $REF"
- diff -u $REF $CMP
- fi
+ $YACC $OPTS $opt2 -v -d -p $prefix -b $ROOT${opt2} $input
+ for type in $TYPE
+ do
+ REF=${TEST_DIR}/${root}${opt2}${type}
+ CMP=${ROOT}${opt2}${type}
+ if test ! -f $CMP
+ then
+ echo "...not found $CMP"
+ else
+ sed -e s,$CMP,$REF, \
+ -e /YYPATCH/d \
+ -e 's,#line \([1-9][0-9]*\) "'$TEST_DIR'/,#line \1 ",' \
+ < $CMP >$tmpfile \
+ && mv $tmpfile $CMP
+ if test ! -f $REF
+ then
+ mv $CMP $REF
+ echo "...saved $REF"
+ elif ( cmp -s $REF $CMP )
+ then
+ echo "...ok $REF"
+ rm -f $CMP
+ else
+ echo "...diff $REF"
+ diff -u $REF $CMP
+ fi
+ fi
+ done
done
;;
esac
-.\" $Id: yacc.1,v 1.13 2011/12/20 01:46:19 tom Exp $
+.\" $Id: yacc.1,v 1.18 2012/01/15 18:12:28 tom Exp $
.\"
.\" .TH YACC 1 "July\ 15,\ 1990"
.\" .UC 6
+.de ES
+.ne 8
+.nf
+.sp
+.in +4
+..
+.de EE
+.in -4
+.fi
+..
+.\" Bulleted paragraph
+.de bP
+.IP \(bu 4
+..
.TH YACC 1 "September 7, 2011" "Berkeley Yacc" "User Commands"
.SH NAME
Yacc \- an LALR(1) parser generator
.IR y.tab.c.
.PP
The following options are available:
-.TP
+.TP 5
\fB\-b \fP\fIfile_prefix\fR
The
.B \-b
.TP
.B \-s
suppress "\fB#define\fP" statements generated for string literals in
-a "%token" statement, to more closely match original \fByacc\fP behavior.
+a "\fB%token\fP" statement, to more closely match original \fByacc\fP behavior.
+.IP
+Normally when \fByacc\fP sees a line such as
+.ES
+%token OP_ADD "ADD"
+.EE
+.IP
+it notices that the quoted "ADD" is a valid C identifier,
+and generates a #define not only for OP_ADD,
+but for ADD as well,
+e.g.,
+.ES
+#define OP_ADD 257
+.br
+#define ADD 258
+.EE
+.IP
+The original \fByacc\fP does not generate the second "\fB#define\fP".
+The \fB\-s\fP option suppresses this "\fB#define\fP".
+.IP
+POSIX (IEEE 1003.1 2004) documents only names and numbers for "\fB%token\fP",
+though original \fByacc\fP and bison also accept string literals.
.TP
.B \-t
The
.TP
.B \-V
print the version number to the standard output.
+.TP
+.B \-y
+\fByacc\fP ignores this option,
+which bison supports for ostensible POSIX compatibility.
.SH EXTENSIONS
.B yacc
provides some extensions for compatibility with bison and other implementations
Use this directive to add parameter declarations for your customized lexer.
.TP
\fB %parse-param\fP { \fIargument-declaration\fP }
-By default, the parser accepts no parameters, e.g., \fByyparse()\fP.
+By default, the parser accepts no parameters, e.g., \fByyparse()\fP.
Use this directive to add parameter declarations for your customized parser.
.TP
\fB %pure-parser\fP
Most variables (other than \fByydebug\fP and \fByynerrs\fP) are
allocated on the stack within \fByyparse\fP, making the parser reasonably
reentrant.
+.SH PORTABILITY
+According to Robert Corbett,
+.ES
+ Berkeley Yacc is an LALR(1) parser generator. Berkeley Yacc has been made
+as compatible as possible with AT&T Yacc. Berkeley Yacc can accept any input
+specification that conforms to the AT&T Yacc documentation. Specifications
+that take advantage of undocumented features of AT&T Yacc will probably be
+rejected.
+.EE
+.PP
+The rationale in
+.ES
+http://pubs.opengroup.org/onlinepubs/9699919799/utilities/yacc.html
+.EE
+.PP
+documents some features of AT&T yacc which are no longer required for POSIX
+compliance.
+.PP
+That said, you may be interested in reusing grammary files with some
+other implementation which is not strictly compatible with AT&T yacc.
+For instance, there is bison.
+Here are a few differences:
+.bP
+\fBYacc\fP accepts an equals mark preceding the left curly brace
+of an action (as in the original grammar file \fBftp.y\fP):
+.ES
+ | STAT CRLF
+ = {
+ statcmd();
+ }
+.EE
+.bP
+\fBYacc\fP and bison emit code in different order, and in particular bison
+makes forward reference to common functions such as yylex, yyparse and
+yyerror without providing prototypes.
+.bP
+Bison's support for "%expect" is broken in more than one release.
+For best results using bison, delete that directive.
+.bP
+Bison has no equivalent for some of \fByacc\fP's commmand-line options,
+relying on directives embedded in the grammar file.
+.bP
+Bison's "\fB\-y\fP" option does not affect bison's lack of support for
+features of AT&T yacc which were deemed obsolescent.
.
.SH DIAGNOSTICS
If there are rules that are never reduced, the number of such rules is