kelbt-0.15/0000775000175000017500000000000011707046233013103 5ustar thurstonthurstonkelbt-0.15/version.mk0000664000175000017500000000004211707044376015123 0ustar thurstonthurstonVERSION = 0.15 PUBDATE = Jan 2012 kelbt-0.15/config.h.in0000664000175000017500000000200711072514631015122 0ustar thurstonthurston/* * Copyright 2001, 2005 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _CONFIG_H #define _CONFIG_H /* Type type of the location structure used by bison. */ #undef BISON_YYLTYPE /* Using bison 1.875. */ #undef BISON_V1875 /* Compiler */ #undef CXX #endif /* _CONFIG_H */ kelbt-0.15/Makefile.in0000664000175000017500000000250111072514631015143 0ustar thurstonthurston# # Copyright 2001-2003, 2005 Adrian Thurston # # This file is part of Kelbt # # Kelbt is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Kelbt is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Kelbt; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA SUBDIRS = kelbt test #************************************* # Get the version info. include version.mk # Rules. all: @cd kelbt && $(MAKE) install: @cd kelbt && $(MAKE) install distclean: distclean-rec distclean-local distclean-rec: for dir in $(SUBDIRS); do cd $$dir; $(MAKE) distclean; cd ..; done distclean-local: clean-local rm -f Makefile config.h config.cache config.status config.log clean: clean-rec clean-local clean-rec: for dir in $(SUBDIRS); do cd $$dir; $(MAKE) clean; cd ..; done clean-local: rm -Rf tags kelbt-0.15/configure0000775000175000017500000026107010572350155015020 0ustar thurstonthurston#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="kelbt/main.cpp" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT SET_MAKE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } 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_config_headers="$ac_config_headers config.h" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C++ compiler default output file name" >&5 echo $ECHO_N "checking for C++ compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C++ compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C++ compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C++ compiler works" >&5 echo $ECHO_N "checking whether the C++ compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h 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 cat >>confdefs.h <<_ACEOF #define CXX $CXX _ACEOF ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi ac_config_files="$ac_config_files Makefile kelbt/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: 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;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: 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;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "kelbt/Makefile" ) CONFIG_FILES="$CONFIG_FILES kelbt/Makefile" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi echo "configuration of kelbt complete" kelbt-0.15/configure.in0000664000175000017500000000222411072514631015411 0ustar thurstonthurstondnl dnl Copyright 2001, 2005 Adrian Thurston dnl dnl This file is part of Kelbt. dnl dnl Kelbt is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl Kelbt is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with Kelbt; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA AC_INIT(kelbt/main.cpp) AC_CONFIG_HEADER(config.h) dnl Checks for programs. AC_PROG_CXX AC_DEFINE_UNQUOTED(CXX,$CXX) dnl Set test on c++ compiler. AC_LANG_CPLUSPLUS dnl Check for definition of MAKE. AC_PROG_MAKE_SET dnl write output files AC_OUTPUT(Makefile kelbt/Makefile) echo "configuration of kelbt complete" kelbt-0.15/test/0000775000175000017500000000000011707046233014062 5ustar thurstonthurstonkelbt-0.15/test/calc2.kl0000664000175000017500000000600111136220252015362 0ustar thurstonthurston/* * @LANG: c */ #include #include struct Token { }; struct LangEl; %%{ parser Parser; # Token names. token tok_plus, tok_mult, tok_number; }%% struct Parser { %%{ write instance_data; access p.; }%% }; struct Parser p; void init(); int parseLangEl( int type, const struct Token *token ); void finish(); void token( int tokid ); %% write token_defs; %%{ parser Parser; # Expect an expression. start: E try { printf( "start = E;\n" ); }; # Expressions returns a float result; nonterm E { double res; }; # Top level of expressions support addition. E: E tok_plus F try { printf( "E = E tok_plus F;\n" ); }; E: F try { printf( "E = F;\n" ); }; # Factor returns a float result; nonterm F { double res; }; # Second level supports multiplication. F: tok_number tok_mult F try { printf( "F = tok_number tok_mult F;\n" ); }; F: tok_number try { printf( "F = tok_number;\n" ); }; }%% %%{ write types; write data; }%% void init() { %% write init; } void finish() { %% write finish; } int parseLangEl( int type, const struct Token *token ) { %% write exec; return p.errCount > 0 ? -1 : 0; } void token( int tokid ) { struct Token token; int result = parseLangEl( tokid, &token ); if ( result < 0 ) printf("parse error\n"); } void test0() { init(); token( tok_number ); token( tok_plus ); token( tok_number ); token( tok_mult ); token( tok_number ); token( Parser_tk_eof ); finish(); printf( "%d\n", p.errCount ); } void test1() { init(); token( tok_number ); token( Parser_tk_eof ); finish(); printf( "%d\n", p.errCount ); } void test2() { init(); token( tok_number ); token( tok_plus ); token( tok_number ); token( tok_plus ); token( tok_number ); token( tok_plus ); token( tok_number ); token( tok_mult ); token( tok_number ); token( Parser_tk_eof ); finish(); printf( "%d\n", p.errCount ); } void test3() { init(); token( Parser_tk_eof ); finish(); printf( "%d\n", p.errCount ); } void test4() { init(); token( tok_plus ); token( Parser_tk_eof ); finish(); printf( "%d\n", p.errCount ); } void test5() { init(); token( tok_number ); token( tok_plus ); token( Parser_tk_eof ); finish(); printf( "%d\n", p.errCount ); } void test6() { init(); token( tok_number ); token( tok_mult ); token( Parser_tk_eof ); finish(); printf( "%d\n", p.errCount ); } void test7() { init(); token( tok_number ); token( tok_mult ); token( tok_number ); token( tok_number ); token( Parser_tk_eof ); finish(); printf( "%d\n", p.errCount ); } int main() { test0(); test1(); test2(); test3(); test4(); test5(); test6(); test7(); return 0; } #ifdef _____OUTPUT_____ F = tok_number; E = F; F = tok_number; F = tok_number tok_mult F; E = E tok_plus F; start = E; 0 F = tok_number; E = F; start = E; 0 F = tok_number; E = F; F = tok_number; E = E tok_plus F; F = tok_number; E = E tok_plus F; F = tok_number; F = tok_number tok_mult F; E = E tok_plus F; start = E; 0 parse error 1 parse error 1 F = tok_number; E = F; parse error 1 parse error 1 parse error 1 #endif kelbt-0.15/test/exptime.kl0000664000175000017500000000316711136220252016063 0ustar thurstonthurston#include #include using std::cout; using std::endl; struct Token { }; struct LangEl; struct Parser { %%{ parser Parser; # Token names. token a, b; }%% %% write instance_data; void init(); int parseLangEl( int type, const Token &tokenRef ); void finish(); }; %% write token_defs; %%{ parser Parser; start: A1 '!' try { cout << "start-1" << endl; }; start: A2 b try { cout << "start-2" << endl; }; A1: a A1 try { cout << "UNDOING A1-1" << endl; }; A1: A1 a try { cout << "UNDOING A1-2" << endl; }; A1: a try { cout << "UNDOING A1-2" << endl; }; A2: A2 a; A2: a; }%% %%{ write types; write data; }%% void Parser::init() { %% write init; } void Parser::finish() { %% write finish; } int Parser::parseLangEl( int type, const Token &tokenRef ) { const Token *token = &tokenRef; %% write exec; return errCount == 0 ? 0 : -1; } void test0() { Parser parser; Token token; parser.init(); parser.parseLangEl( a, token ); parser.parseLangEl( a, token ); parser.parseLangEl( a, token ); parser.parseLangEl( a, token ); parser.parseLangEl( a, token ); parser.parseLangEl( b, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } int main() { test0(); } #ifdef _____OUTPUT_____ UNDOING A1-2 UNDOING A1-1 UNDOING A1-1 UNDOING A1-1 UNDOING A1-2 UNDOING A1-1 UNDOING A1-1 UNDOING A1-2 UNDOING A1-2 UNDOING A1-1 UNDOING A1-2 UNDOING A1-1 UNDOING A1-1 UNDOING A1-2 UNDOING A1-1 UNDOING A1-2 UNDOING A1-2 UNDOING A1-2 UNDOING A1-1 UNDOING A1-2 UNDOING A1-2 UNDOING A1-1 UNDOING A1-2 UNDOING A1-2 UNDOING A1-2 UNDOING A1-2 start-2 0 #endif kelbt-0.15/test/ambiguous.kl0000664000175000017500000000014510572350155016405 0ustar thurstonthurston // @IGNORE: yes %% Ambiguous # A hugely ambiguous grammar. token a; start: A; A: A A; A: a; %% kelbt-0.15/test/ada1.kl0000664000175000017500000000540011136220252015206 0ustar thurstonthurston#include #include using namespace::std; struct Token { }; struct LangEl; struct Parser { %%{ parser Parser; token # keywords kw_abs, kw_and, kw_array, kw_begin, kw_body, kw_case, kw_constant, kw_declare, kw_else, kw_elsif, kw_end, kw_exception, kw_exit, kw_for, kw_function, kw_if, kw_in, kw_is, kw_loop, kw_mod, kw_not, kw_null, kw_of, kw_or, kw_others, kw_out, kw_package, kw_pragma, kw_private, kw_procedure, kw_raise, kw_range, kw_record, kw_return, kw_reverse, kw_separate, kw_subtype, kw_then, kw_type, kw_use, kw_when, kw_while, # Any other word identifier, # literals lit_integer, lit_float, lit_string, # operators # note that "not", "and", "or", "and then", "or else", "abs", "mod" # are left as keywords. op_mult, # * op_div, # / op_plus, # + op_minus, # - op_cat, # & op_eq, # = op_neq, # /= op_lt, # < op_lteq, # <= op_gt, # > op_gteq, # >= op_exponentiation, # ** op_field_qualification, # . op_left_bracket, # ( op_right_bracket, # ) op_assign, # := # delimiters de_single_quote, # ' de_dot_dot, # .. de_colon, # : de_comma, # , de_pipe, # | de_arrow, # => de_unconstrained # <> ; }%% %% write instance_data; void init(); int parseLangEl( int type, const Token *token ); void finish(); void token( int tokid ); }; %% write token_defs; %%{ parser Parser; start: identifier try { cout << "reduced start = identifier" << endl; }; }%% %%{ write types; write data; }%% void Parser::init() { %% write init; } void Parser::finish() { %% write finish; } int Parser::parseLangEl( int type, const Token *token ) { %% write exec; return errCount == 0 ? 0 : -1; } void Parser::token( int tokid ) { Token token; int result = parseLangEl( tokid, &token ); if ( result < 0 ) cout << "parse error" << endl; } void test0() { Parser parser; parser.init(); parser.token( identifier ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test1() { Parser parser; parser.init(); parser.token( identifier ); parser.token( identifier ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test2() { Parser parser; parser.init(); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } int main() { test0(); test1(); test2(); return 0; } #ifdef _____OUTPUT_____ reduced start = identifier 0 reduced start = identifier parse error 1 parse error 1 #endif kelbt-0.15/test/basic1.kl0000664000175000017500000001030511136220252015542 0ustar thurstonthurston#include #include using std::cout; using std::endl; struct Token { }; struct LangEl; struct Parser { %%{ parser Parser; # Token names. token word, symbol, litString, number; }%% %% write instance_data; void init(); int parseLangEl( int type, const Token &tokenRef ); void finish(); void token( int tokid ); }; %% write token_defs; %%{ parser Parser; nonterm start { int startVal; }; # The first production start: word litString hello try { cout << "start = word litString hello;" << endl; }; hello: A B A try { cout << "hello = A B A;" << endl; }; A: symbol try { cout << "A = symbol;" << endl; }; A: word try { cout << "A = word;" << endl; }; A: number try { cout << "A = number;" << endl; }; B: unknown try { cout << "B = unknown;" << endl; }; unknown: try { cout << "unknown = ;" << endl; }; }%% %%{ write types; write data; }%% void Parser::init() { %% write init; } void Parser::finish() { %% write finish; } int Parser::parseLangEl( int type, const Token &tokenRef ) { const Token *token = &tokenRef; %% write exec; return errCount == 0 ? 0 : -1; } void Parser::token( int tokid ) { Token token; int result = parseLangEl( tokid, token ); if ( result < 0 ) cout << "parse error" << endl; } void test0() { Parser parser; parser.init(); parser.token( word ); parser.token( litString ); parser.token( symbol ); parser.token( word ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test1() { Parser parser; parser.init(); parser.token( word ); parser.token( litString ); parser.token( word ); parser.token( symbol ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test2() { Parser parser; parser.init(); parser.token( word ); parser.token( litString ); parser.token( number ); parser.token( number ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test3() { Parser parser; parser.init(); parser.token( word ); parser.token( litString ); parser.token( number ); parser.token( word ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test4() { Parser parser; parser.init(); parser.token( word ); parser.token( litString ); parser.token( number ); parser.token( word ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test5() { Parser parser; parser.init(); parser.token( word ); parser.token( litString ); parser.token( word ); parser.token( word ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test6() { Parser parser; parser.init(); parser.token( word ); parser.token( litString ); parser.token( word ); parser.token( word ); parser.token( word ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test7() { Parser parser; parser.init(); parser.token( word ); parser.token( litString ); parser.token( word ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test8() { Parser parser; parser.init(); parser.token( litString ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test9() { Parser parser; parser.init(); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } int main() { test0(); test1(); test2(); test3(); test4(); test5(); test6(); test7(); test8(); test9(); } #ifdef _____OUTPUT_____ A = symbol; unknown = ; B = unknown; A = word; hello = A B A; start = word litString hello; 0 A = word; unknown = ; B = unknown; A = symbol; hello = A B A; start = word litString hello; 0 A = number; unknown = ; B = unknown; A = number; hello = A B A; start = word litString hello; 0 A = number; unknown = ; B = unknown; A = word; hello = A B A; start = word litString hello; 0 A = number; unknown = ; B = unknown; A = word; hello = A B A; start = word litString hello; 0 A = word; unknown = ; B = unknown; A = word; hello = A B A; start = word litString hello; 0 A = word; unknown = ; B = unknown; A = word; hello = A B A; start = word litString hello; parse error 1 A = word; parse error 1 parse error 1 parse error 1 #endif kelbt-0.15/test/g42.kl0000664000175000017500000000024410572350155015006 0ustar thurstonthurston// @IGNORE: yes %% non_slr token a; token b; token c; # This grammar is LALR(1) but not SLR. start: a A a; start: b A b; start: a B b; A: a; B: c b; %% kelbt-0.15/test/conflicts1.kl0000664000175000017500000000204210572350155016455 0ustar thurstonthurston// @IGNORE: yes %% conflicts1 # This is an example of a grammar that causes conflicts for SLR but not for # LALR. token word; token tok1; token tok2; token kw1, kw2, kw3, kw4; # You've got a name and a type, both are words. name: word; type: word; # # These productions just establish kw1, and kw2 both in the follow set # of name and type. # make_follow_name: name kw1; make_follow_name: name kw2; make_follow_type: type kw1; make_follow_type: type kw2; start: tok1 make_follow_name; start: tok2 make_follow_type; # # These are the productions where the conflicts orig. # # BAD: Uses the widely used name and type. start: name kw3; start: type kw4; # GOOD: Uses names and types that don't appear everywhere and thus have # no overlapping follow sets. #start: name_specific kw3; #start: type_specific kw4; name_specific: word; type_specific: word; kelbt-0.15/test/reglang.kl0000664000175000017500000001720111136220252016021 0ustar thurstonthurston#include #include using std::cout; using std::endl; /* Grammar for a language describing regular languages. */ struct Token { }; struct LangEl; struct Parser { %%{ parser Parser; token tt_id; token tt_equals; token tt_semi; token tt_pipe; token tt_amp; token tt_minus; token tt_dot; token tt_colon; token tt_percent; token tt_dollar; token tt_plus; token tt_number; token tt_star; token tt_question; token tt_not; token tt_andFSM; token tt_orFSM; token tt_open; token tt_close; }%% %% write instance_data; void init(); int parseLangEl( int type, const Token &tokenRef ); void finish(); }; %% write token_defs; %%{ parser Parser; start: M try { cout << "start = M;" << endl; }; M: M A try { cout << "M = M A;" << endl; }; M: A try { cout << "M = A;" << endl; }; A: tt_id tt_equals E tt_semi try { cout << "A = tt_id tt_equals E tt_semi;" << endl; }; E: E tt_pipe T try { cout << "E = E tt_pipe T;" << endl; }; E: E tt_amp T try { cout << "E = E tt_amp T;" << endl; }; E: E tt_minus T try { cout << "E = E tt_minus T;" << endl; }; E: T try { cout << "E = T;" << endl; }; T: T tt_dot N try { cout << "T = T tt_dot N;" << endl; }; T: T N try { cout << "T = T N;" << endl; }; T: N try { cout << "T = N;" << endl; }; N: N tt_colon tt_id try { cout << "N = N tt_colon tt_id;" << endl; }; N: N tt_percent tt_id try { cout << "N = N tt_percent tt_id;" << endl; }; N: N tt_dollar tt_id try { cout << "N = N tt_dollar tt_id;" << endl; }; N: N tt_colon tt_plus tt_number try { cout << "N = N tt_colon tt_plus tt_number;" << endl; }; N: N tt_colon tt_minus tt_number try { cout << "N = N tt_colon tt_minus tt_number;" << endl; }; N: N tt_percent tt_plus tt_number try { cout << "N = N tt_percent tt_plus tt_number;" << endl; }; N: N tt_percent tt_minus tt_number try { cout << "N = N tt_percent tt_minus tt_number;" << endl; }; N: N tt_dollar tt_plus tt_number try { cout << "N = N tt_dollar tt_plus tt_number;" << endl; }; N: N tt_dollar tt_minus tt_number try { cout << "N = N tt_dollar tt_minus tt_number;" << endl; }; N: K try { cout << "N = K;" << endl; }; K: F tt_star try { cout << "K = F tt_star;" << endl; }; K: F tt_question try { cout << "K = F tt_question;" << endl; }; K: F tt_plus try { cout << "K = F tt_plus;" << endl; }; K: F try { cout << "K = F;" << endl; }; K: tt_not F tt_star try { cout << "K = tt_not F tt_star;" << endl; }; K: tt_not F tt_question try { cout << "K = tt_not F tt_question;" << endl; }; K: tt_not F tt_plus try { cout << "K = tt_not F tt_plus;" << endl; }; K: tt_not F try { cout << "K = tt_not F;" << endl; }; F: tt_andFSM try { cout << "F = tt_andFSM;" << endl; }; F: tt_orFSM try { cout << "F = tt_orFSM;" << endl; }; F: tt_id try { cout << "F = tt_id;" << endl; }; F: tt_open E tt_close try { cout << "F = tt_open E tt_close;" << endl; }; }%% %%{ write types; write data; }%% void Parser::init() { %% write init; } void Parser::finish() { %% write finish; } int Parser::parseLangEl( int type, const Token &tokenRef ) { const Token *token = &tokenRef; %% write exec; return errCount == 0 ? 0 : -1; } void test0() { Parser parser; Token token; parser.init(); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_equals, token ); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_star, token ); parser.parseLangEl( tt_minus, token ); parser.parseLangEl( tt_andFSM, token ); parser.parseLangEl( tt_dot, token ); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_semi, token ); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_equals, token ); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_andFSM, token ); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_semi, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test1() { Parser parser; Token token; parser.init(); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_equals, token ); parser.parseLangEl( tt_open, token ); parser.parseLangEl( tt_orFSM, token ); parser.parseLangEl( tt_minus, token ); parser.parseLangEl( tt_andFSM, token ); parser.parseLangEl( tt_close, token ); parser.parseLangEl( tt_star, token ); parser.parseLangEl( tt_semi, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test2() { Parser parser; Token token; parser.init(); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_equals, token ); parser.parseLangEl( tt_not, token ); parser.parseLangEl( tt_open, token ); parser.parseLangEl( tt_orFSM, token ); parser.parseLangEl( tt_minus, token ); parser.parseLangEl( tt_not, token ); parser.parseLangEl( tt_andFSM, token ); parser.parseLangEl( tt_close, token ); parser.parseLangEl( tt_star, token ); parser.parseLangEl( tt_semi, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test3() { Parser parser; Token token; parser.init(); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_equals, token ); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_colon, token ); parser.parseLangEl( tt_minus, token ); parser.parseLangEl( tt_number, token ); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_colon, token ); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_dollar, token ); parser.parseLangEl( tt_plus, token ); parser.parseLangEl( tt_number, token ); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_percent, token ); parser.parseLangEl( tt_minus, token ); parser.parseLangEl( tt_number, token ); parser.parseLangEl( tt_semi, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test4() { Parser parser; Token token; parser.init(); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_equals, token ); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_pipe, token ); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_amp, token ); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_minus, token ); parser.parseLangEl( tt_id, token ); parser.parseLangEl( tt_semi, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } int main() { test0(); test1(); test2(); test3(); test4(); } #ifdef _____OUTPUT_____ F = tt_id; K = F tt_star; N = K; T = N; E = T; F = tt_andFSM; K = F; N = K; T = N; F = tt_id; K = F; N = K; T = T tt_dot N; E = E tt_minus T; A = tt_id tt_equals E tt_semi; M = A; F = tt_id; K = F; N = K; T = N; F = tt_andFSM; K = F; N = K; T = T N; F = tt_id; K = F; N = K; T = T N; E = T; A = tt_id tt_equals E tt_semi; M = M A; start = M; 0 F = tt_orFSM; K = F; N = K; T = N; E = T; F = tt_andFSM; K = F; N = K; T = N; E = E tt_minus T; F = tt_open E tt_close; K = F tt_star; N = K; T = N; E = T; A = tt_id tt_equals E tt_semi; M = A; start = M; 0 F = tt_orFSM; K = F; N = K; T = N; E = T; F = tt_andFSM; K = tt_not F; N = K; T = N; E = E tt_minus T; F = tt_open E tt_close; K = tt_not F tt_star; N = K; T = N; E = T; A = tt_id tt_equals E tt_semi; M = A; start = M; 0 F = tt_id; K = F; N = K; N = N tt_colon tt_minus tt_number; T = N; F = tt_id; K = F; N = K; N = N tt_colon tt_id; T = T N; F = tt_id; K = F; N = K; N = N tt_dollar tt_plus tt_number; T = T N; F = tt_id; K = F; N = K; N = N tt_percent tt_minus tt_number; T = T N; E = T; A = tt_id tt_equals E tt_semi; M = A; start = M; 0 F = tt_id; K = F; N = K; T = N; E = T; F = tt_id; K = F; N = K; T = N; E = E tt_pipe T; F = tt_id; K = F; N = K; T = N; E = E tt_amp T; F = tt_id; K = F; N = K; T = N; E = E tt_minus T; A = tt_id tt_equals E tt_semi; M = A; start = M; 0 #endif kelbt-0.15/test/item_count.kl0000664000175000017500000000510411136220252016547 0ustar thurstonthurston#include #include using namespace::std; //#define LOG_ACTIONS //#define LOG_BACKTRACK struct Token { }; struct Parser { %%{ parser Parser; token tok1; token tok2; }%% %% write instance_data; void init(); int parseLangEl( int type, const Token &token ); void finish(); }; %% write token_defs; int item_count; #define ITEMS 3 %%{ parser Parser; start: counted_list tok1 tok1; counted_list: cl_init cl_list cl_end; cl_list: cl_list cl_pred item; cl_list: ; item: tok1 tok1; cl_init: try { item_count = 0; }; cl_end: try { cout << "trial: cl_end" << endl; if ( item_count < ITEMS ) { cout << "reject: cl_end" << endl; reject(); } } undo { cout << "undo: cl_end" << endl; }; cl_pred: try { item_count += 1; cout << "trial: cl_pred" << endl; if ( item_count > ITEMS ) { cout << "reject: cl_pred" << endl; reject(); } } undo { item_count -= 1; cout << "undo: cl_pred" << endl; }; }%% %%{ write types; write data; }%% void Parser::init() { %% write init; } void Parser::finish() { %% write finish; } int Parser::parseLangEl( int type, const Token &tokenRef ) { const Token *token = &tokenRef; %% write exec; return errCount == 0 ? 0 : -1; } void test( int *vals ) { Parser parser; Token token; parser.init(); for (;;) { int result = parser.parseLangEl( *vals, token ); if ( result < 0 ) cout << "parse error" << endl; if ( *vals++ == Parser_tk_eof ) break; } parser.finish(); cout << parser.errCount << endl; } /* Exact. */ int test1[] = { tok1, tok1, tok1, tok1, tok1, tok1, tok1, tok1, Parser_tk_eof }; /* Too Short. */ int test2[] = { tok1, tok1, tok1, tok1, tok1, tok1, tok1, Parser_tk_eof }; /* Too Long. */ int test3[] = { tok1, tok1, tok1, tok1, tok1, tok1, tok1, tok1, tok1, Parser_tk_eof }; int main() { test( test1 ); test( test2 ); test( test3 ); } #ifdef _____OUTPUT_____ trial: cl_pred trial: cl_pred trial: cl_pred trial: cl_pred reject: cl_pred undo: cl_pred trial: cl_end 0 trial: cl_pred trial: cl_pred trial: cl_pred trial: cl_pred reject: cl_pred undo: cl_pred trial: cl_end undo: cl_end undo: cl_pred trial: cl_end reject: cl_end undo: cl_end undo: cl_pred trial: cl_end reject: cl_end undo: cl_end undo: cl_pred trial: cl_end reject: cl_end parse error 1 trial: cl_pred trial: cl_pred trial: cl_pred trial: cl_pred reject: cl_pred undo: cl_pred trial: cl_end undo: cl_end undo: cl_pred trial: cl_end reject: cl_end undo: cl_end undo: cl_pred trial: cl_end reject: cl_end undo: cl_end undo: cl_pred trial: cl_end reject: cl_end parse error 1 #endif kelbt-0.15/test/simple1.kl0000664000175000017500000000541111136220252015754 0ustar thurstonthurston#include #include using namespace::std; struct Token { }; struct LangEl; struct Parser { %%{ parser Parser; # Comment token tok1; token tok2; token tok3; token error; }%% %% write instance_data; void init(); int parseLangEl( int type, const Token &tokenRef ); void finish(); void token( int tokid ); }; %% write token_defs; %%{ parser Parser; start: silly_nothing A silly_nothing B silly_nothing C silly_nothing try { cout << "start = silly_nothing A silly_nothing B silly_nothing C silly_nothing;" << endl; }; start: error tok1 try { cout << "start = error tok1;" << endl; }; A: tok1 try { cout << "A = tok1;" << endl; }; B: tok2 try { cout << "B = tok2;" << endl; }; C: tok3 try { cout << "C = tok3;" << endl; }; silly_nothing: try { cout << "silly_nothing = ;" << endl; }; }%% %%{ write types; write data; }%% void Parser::init() { %% write init; } void Parser::finish() { %% write finish; } int Parser::parseLangEl( int type, const Token &tokenRef ) { const Token *token = &tokenRef; %% write exec; return errCount == 0 ? 0 : -1; } void Parser::token( int tokid ) { Token token; int result = parseLangEl( tokid, token ); if ( result < 0 ) cout << "parse error" << endl; } void test0() { Parser parser; parser.init(); parser.token( tok1 ); parser.token( tok2 ); parser.token( tok3 ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test1() { Parser parser; parser.init(); parser.token( tok1 ); parser.token( tok2 ); parser.token( tok3 ); parser.token( tok1 ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test2() { Parser parser; parser.init(); parser.token( tok1 ); parser.token( tok2 ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test3() { Parser parser; parser.init(); parser.token( tok1 ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test4() { Parser parser; parser.init(); parser.token( tok3 ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test5() { Parser parser; parser.init(); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } int main() { test0(); test1(); test2(); test3(); test4(); test5(); } #ifdef _____OUTPUT_____ silly_nothing = ; A = tok1; silly_nothing = ; B = tok2; silly_nothing = ; C = tok3; silly_nothing = ; start = silly_nothing A silly_nothing B silly_nothing C silly_nothing; 0 silly_nothing = ; A = tok1; silly_nothing = ; B = tok2; silly_nothing = ; C = tok3; parse error 1 silly_nothing = ; A = tok1; silly_nothing = ; B = tok2; parse error 1 silly_nothing = ; A = tok1; parse error 1 parse error 1 parse error 1 #endif kelbt-0.15/test/ragelpar.kl0000664000175000017500000043771711136220252016221 0ustar thurstonthurston// @IGNORE: yes #include using namespace std; %% ragelpar token rl_section, rl_uInt, rl_pInt, rl_nInt, rl_hex, rl_word, rl_literal, rl_doubleDot, rl_arrow, rl_reLiteralSlash, rl_reLiteralOpen, rl_reLiteralOpenNeg, rl_reLiteralClose, rl_reLiteralDot, rl_reLiteralStar, rl_reLiteralDash, rl_reLiteralChar, rl_orLiteral, rl_builtin, rl_data, rl_action, rl_init, rl_clear, rl_alphType, rl_range, rl_exp, rl_start, rl_final, rl_star, rl_question, rl_plus, rl_bang, rl_open, rl_close, rl_semi, rl_equals, rl_colon, rl_percent, rl_dollar, rl_minus, rl_bar, rl_amp, rl_dot, rl_gt, rl_comma; start = FsmSpecList { cout << "start = FsmSpecList;" << endl; }; FsmSpecList = FsmSpecList FsmSpec { cout << "FsmSpecList = FsmSpecList FsmSpec;" << endl; }; FsmSpecList = { cout << "FsmSpecList = ;" << endl; }; FsmSpec = rl_section rl_word StatementList rl_section { cout << "FsmSpec = rl_section rl_word StatementList rl_section;" << endl; }; StatementList = StatementList Statement { cout << "StatementList = StatementList Statement;" << endl; }; StatementList = { cout << "StatementList = ;" << endl; }; Statement = RLAssignment { cout << "Statement = RLAssignment;" << endl; }; Statement = DataSpec { cout << "Statement = DataSpec;" << endl; }; Statement = ActionSpec { cout << "Statement = ActionSpec;" << endl; }; Statement = InitSpec { cout << "Statement = InitSpec;" << endl; }; Statement = AlphSpec { cout << "Statement = AlphSpec;" << endl; }; Statement = RangeSpec { cout << "Statement = RangeSpec;" << endl; }; InitSpec = rl_init rl_builtin { cout << "InitSpec = rl_init rl_builtin;" << endl; }; DataSpec = rl_data rl_builtin rl_semi { cout << "DataSpec = rl_data rl_builtin rl_semi;" << endl; }; ActionSpec = rl_action rl_word rl_builtin { cout << "ActionSpec = rl_action rl_word rl_builtin;" << endl; }; AlphSpec = rl_alphType rl_word rl_word rl_semi { cout << "AlphSpec = rl_alphType rl_word rl_word rl_semi;" << endl; }; AlphSpec = rl_alphType rl_word rl_semi { cout << "AlphSpec = rl_alphType rl_word rl_semi;" << endl; }; RangeSpec = rl_range AlphabetNum AlphabetNum rl_semi { cout << "RangeSpec = rl_range AlphabetNum AlphabetNum rl_semi;" << endl; }; RLAssignment = MachineName rl_equals Expression rl_semi { cout << "RLAssignment = MachineName rl_equals Expression rl_semi;" << endl; }; MachineName = rl_word { cout << "MachineName = rl_word;" << endl; }; Expression = Expression rl_bar Term { cout << "Expression = Expression rl_bar Term;" << endl; }; Expression = Expression rl_amp Term { cout << "Expression = Expression rl_amp Term;" << endl; }; Expression = Expression rl_minus Term { cout << "Expression = Expression rl_minus Term;" << endl; }; Expression = Term { cout << "Expression = Term;" << endl; }; Term = Term FactorWithAug { cout << "Term = Term FactorWithAug;" << endl; }; Term = Term rl_dot FactorWithAug { cout << "Term = Term rl_dot FactorWithAug;" << endl; }; Term = FactorWithAug { cout << "Term = FactorWithAug;" << endl; }; FactorWithAug = FactorWithAug AugType ActionEmbed { cout << "FactorWithAug = FactorWithAug AugType ActionEmbed;" << endl; }; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug { cout << "FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug;" << endl; }; FactorWithAug = FactorWithRep { cout << "FactorWithAug = FactorWithRep;" << endl; }; PriorityAug = PriorityAugStr { cout << "PriorityAug = PriorityAugStr;" << endl; }; OptPriorName = rl_word rl_comma { cout << "OptPriorName = rl_word rl_comma;" << endl; }; OptPriorName = { cout << "OptPriorName = ;" << endl; }; PriorityAugStr = rl_nInt { cout << "PriorityAugStr = rl_nInt;" << endl; }; PriorityAugStr = rl_pInt { cout << "PriorityAugStr = rl_pInt;" << endl; }; PriorityAugStr = rl_uInt { cout << "PriorityAugStr = rl_uInt;" << endl; }; AugType = rl_colon { cout << "AugType = rl_colon;" << endl; }; AugType = rl_percent { cout << "AugType = rl_percent;" << endl; }; AugType = rl_dollar { cout << "AugType = rl_dollar;" << endl; }; AugType = rl_gt { cout << "AugType = rl_gt;" << endl; }; ActionEmbed = rl_word { cout << "ActionEmbed = rl_word;" << endl; }; ActionEmbed = rl_builtin { cout << "ActionEmbed = rl_builtin;" << endl; }; FactorWithRep = FactorWithRep rl_star { cout << "FactorWithRep = FactorWithRep rl_star;" << endl; }; FactorWithRep = FactorWithRep rl_question { cout << "FactorWithRep = FactorWithRep rl_question;" << endl; }; FactorWithRep = FactorWithRep rl_plus { cout << "FactorWithRep = FactorWithRep rl_plus;" << endl; }; FactorWithRep = FactorWithNeg { cout << "FactorWithRep = FactorWithNeg;" << endl; }; FactorWithNeg = rl_bang FactorWithNeg { cout << "FactorWithNeg = rl_bang FactorWithNeg;" << endl; }; FactorWithNeg = Factor { cout << "FactorWithNeg = Factor;" << endl; }; Factor = rl_literal { cout << "Factor = rl_literal;" << endl; }; Factor = rl_orLiteral { cout << "Factor = rl_orLiteral;" << endl; }; Factor = rl_reLiteralSlash RegularExpr rl_reLiteralSlash { cout << "Factor = rl_reLiteralSlash RegularExpr rl_reLiteralSlash;" << endl; }; Factor = AlphabetNum { cout << "Factor = AlphabetNum;" << endl; }; Factor = RangeLit rl_doubleDot RangeLit { cout << "Factor = RangeLit rl_doubleDot RangeLit;" << endl; }; Factor = rl_word { cout << "Factor = rl_word;" << endl; }; Factor = ExplicitMachine { cout << "Factor = ExplicitMachine;" << endl; }; Factor = rl_open Expression rl_close { cout << "Factor = rl_open Expression rl_close;" << endl; }; ExplicitMachine = rl_exp rl_open ExpStateList rl_close { cout << "ExplicitMachine = rl_exp rl_open ExpStateList rl_close;" << endl; }; ExpStateList = ExpStateList rl_semi ExpState { cout << "ExpStateList = ExpStateList rl_semi ExpState;" << endl; }; ExpStateList = ExpState { cout << "ExpStateList = ExpState;" << endl; }; ExpState = ExpStateMods rl_word ExpStateAug ExpTransList { cout << "ExpState = ExpStateMods rl_word ExpStateAug ExpTransList;" << endl; }; ExpStateMods = rl_start rl_final { cout << "ExpStateMods = rl_start rl_final;" << endl; }; ExpStateMods = rl_final rl_start { cout << "ExpStateMods = rl_final rl_start;" << endl; }; ExpStateMods = rl_start { cout << "ExpStateMods = rl_start;" << endl; }; ExpStateMods = rl_final { cout << "ExpStateMods = rl_final;" << endl; }; ExpStateMods = { cout << "ExpStateMods = ;" << endl; }; ExpStateAug = ExpStateAug rl_percent ActionEmbed { cout << "ExpStateAug = ExpStateAug rl_percent ActionEmbed;" << endl; }; ExpStateAug = ExpStateAug rl_percent PriorityAug { cout << "ExpStateAug = ExpStateAug rl_percent PriorityAug;" << endl; }; ExpStateAug = { cout << "ExpStateAug = ;" << endl; }; ExpTransList = rl_colon ExpTLOneOrMore { cout << "ExpTransList = rl_colon ExpTLOneOrMore;" << endl; }; ExpTransList = { cout << "ExpTransList = ;" << endl; }; ExpTLOneOrMore = ExpTLOneOrMore rl_comma ExpTrans { cout << "ExpTLOneOrMore = ExpTLOneOrMore rl_comma ExpTrans;" << endl; }; ExpTLOneOrMore = ExpTrans { cout << "ExpTLOneOrMore = ExpTrans;" << endl; }; ExpTrans = Expression rl_arrow rl_word { cout << "ExpTrans = Expression rl_arrow rl_word;" << endl; }; RegularExpr = RegularExpr RegularExprItem { cout << "RegularExpr = RegularExpr RegularExprItem;" << endl; }; RegularExpr = { cout << "RegularExpr = ;" << endl; }; RegularExprItem = RegularExprChar rl_reLiteralStar { cout << "RegularExprItem = RegularExprChar rl_reLiteralStar;" << endl; }; RegularExprItem = RegularExprChar { cout << "RegularExprItem = RegularExprChar;" << endl; }; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose { cout << "RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose;" << endl; }; RegularExprChar = rl_reLiteralOpenNeg RegularExprOrData rl_reLiteralClose { cout << "RegularExprChar = rl_reLiteralOpenNeg RegularExprOrData rl_reLiteralClose;" << endl; }; RegularExprChar = rl_reLiteralDot { cout << "RegularExprChar = rl_reLiteralDot;" << endl; }; RegularExprChar = rl_reLiteralChar { cout << "RegularExprChar = rl_reLiteralChar;" << endl; }; RegularExprOrData = RegularExprOrData RegularExprOrChar { cout << "RegularExprOrData = RegularExprOrData RegularExprOrChar;" << endl; }; RegularExprOrData = { cout << "RegularExprOrData = ;" << endl; }; RegularExprOrChar = rl_reLiteralChar { cout << "RegularExprOrChar = rl_reLiteralChar;" << endl; }; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar { cout << "RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar;" << endl; }; RangeLit = rl_literal { cout << "RangeLit = rl_literal;" << endl; }; RangeLit = AlphabetNum { cout << "RangeLit = AlphabetNum;" << endl; }; AlphabetNum = rl_uInt { cout << "AlphabetNum = rl_uInt;" << endl; }; AlphabetNum = rl_pInt { cout << "AlphabetNum = rl_pInt;" << endl; }; AlphabetNum = rl_nInt { cout << "AlphabetNum = rl_nInt;" << endl; }; AlphabetNum = rl_hex { cout << "AlphabetNum = rl_hex;" << endl; }; %% void awkemu() { Parser parser; Token token; parser.init(); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_data, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_minus, token ); parser.parseLangEl( rl_orLiteral, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_plus, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_orLiteral, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_minus, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_gt, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( Parser_tk_eof, token ); cout << parser.finish() << endl; } void builtin() { Parser parser; Token token; parser.init(); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_data, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_alphType, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( Parser_tk_eof, token ); cout << parser.finish() << endl; } void clang() { Parser parser; Token token; parser.init(); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_data, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_init, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_minus, token ); parser.parseLangEl( rl_orLiteral, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_gt, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_gt, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_minus, token ); parser.parseLangEl( rl_orLiteral, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_minus, token ); parser.parseLangEl( rl_orLiteral, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_minus, token ); parser.parseLangEl( rl_hex, token ); parser.parseLangEl( rl_doubleDot, token ); parser.parseLangEl( rl_hex, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_plus, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_plus, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_plus, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_gt, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_plus, token ); parser.parseLangEl( rl_gt, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( Parser_tk_eof, token ); cout << parser.finish() << endl; } void forder1() { Parser parser; Token token; parser.init(); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_data, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_gt, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_gt, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( Parser_tk_eof, token ); cout << parser.finish() << endl; } void forder2() { Parser parser; Token token; parser.init(); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_data, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_gt, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_gt, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( Parser_tk_eof, token ); cout << parser.finish() << endl; } void forder3() { Parser parser; Token token; parser.init(); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_data, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_gt, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_gt, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( Parser_tk_eof, token ); cout << parser.finish() << endl; } void highc() { Parser parser; Token token; parser.init(); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_data, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_alphType, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_hex, token ); parser.parseLangEl( rl_doubleDot, token ); parser.parseLangEl( rl_hex, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_hex, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_hex, token ); parser.parseLangEl( rl_doubleDot, token ); parser.parseLangEl( rl_hex, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_data, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_doubleDot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_plus, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( Parser_tk_eof, token ); cout << parser.finish() << endl; } void highcc() { Parser parser; Token token; parser.init(); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_data, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_alphType, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_hex, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( Parser_tk_eof, token ); cout << parser.finish() << endl; } void mailbox() { Parser parser; Token token; parser.init(); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_data, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralOpen, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralDash, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_reLiteralOpenNeg, token ); parser.parseLangEl( rl_reLiteralChar, token ); parser.parseLangEl( rl_reLiteralClose, token ); parser.parseLangEl( rl_reLiteralSlash, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_comma, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_minus, token ); parser.parseLangEl( rl_orLiteral, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_plus, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_minus, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_dollar, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_orLiteral, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_percent, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_minus, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_comma, token ); parser.parseLangEl( rl_uInt, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( Parser_tk_eof, token ); cout << parser.finish() << endl; } void minimize1() { Parser parser; Token token; parser.init(); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_data, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_action, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_orLiteral, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_orLiteral, token ); parser.parseLangEl( rl_star, token ); parser.parseLangEl( rl_colon, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_dot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( Parser_tk_eof, token ); cout << parser.finish() << endl; } void range() { Parser parser; Token token; parser.init(); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_data, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_open, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_doubleDot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_doubleDot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_doubleDot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_doubleDot, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_close, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( Parser_tk_eof, token ); cout << parser.finish() << endl; } void strings1() { Parser parser; Token token; parser.init(); parser.parseLangEl( rl_section, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_data, token ); parser.parseLangEl( rl_builtin, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_word, token ); parser.parseLangEl( rl_equals, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_bar, token ); parser.parseLangEl( rl_literal, token ); parser.parseLangEl( rl_semi, token ); parser.parseLangEl( rl_section, token ); parser.parseLangEl( Parser_tk_eof, token ); cout << parser.finish() << endl; } int main() { awkemu(); builtin(); clang(); forder1(); forder2(); forder3(); highc(); highcc(); mailbox(); minimize1(); range(); strings1(); } #ifdef _____OUTPUT_____ FsmSpecList = ; StatementList = ; DataSpec = rl_data rl_builtin rl_semi; Statement = DataSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_orLiteral; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_minus Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_plus; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_orLiteral; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_dollar; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_percent; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_dollar; OptPriorName = ; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; AugType = rl_percent; OptPriorName = ; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; Term = FactorWithAug; Expression = Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_minus Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; AugType = rl_dollar; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_percent; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_gt; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; FsmSpec = rl_section rl_word StatementList rl_section; FsmSpecList = FsmSpecList FsmSpec; start = FsmSpecList; 0 FsmSpecList = ; StatementList = ; DataSpec = rl_data rl_builtin rl_semi; Statement = DataSpec; StatementList = StatementList Statement; AlphSpec = rl_alphType rl_word rl_word rl_semi; Statement = AlphSpec; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; FsmSpec = rl_section rl_word StatementList rl_section; FsmSpecList = FsmSpecList FsmSpec; start = FsmSpecList; 0 FsmSpecList = ; StatementList = ; DataSpec = rl_data rl_builtin rl_semi; Statement = DataSpec; StatementList = StatementList Statement; InitSpec = rl_init rl_builtin; Statement = InitSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_orLiteral; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_minus Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_gt; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_dollar; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_percent; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_gt; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_dollar; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_percent; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_orLiteral; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_minus Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = Term rl_dot FactorWithAug; Expression = Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_orLiteral; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_minus Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = Term rl_dot FactorWithAug; Expression = Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_percent; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_percent; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; AlphabetNum = rl_hex; RangeLit = AlphabetNum; AlphabetNum = rl_hex; RangeLit = AlphabetNum; Factor = RangeLit rl_doubleDot RangeLit; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_minus Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; AugType = rl_dollar; OptPriorName = ; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; Term = Term rl_dot FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; OptPriorName = ; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; Term = Term rl_dot FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; AugType = rl_dollar; OptPriorName = ; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; Term = Term rl_dot FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; OptPriorName = ; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; Term = Term rl_dot FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_plus; FactorWithAug = FactorWithRep; AugType = rl_percent; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_plus; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_plus; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_gt; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_dollar; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_percent; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_plus; FactorWithAug = FactorWithRep; AugType = rl_gt; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_dollar; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_percent; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = Term rl_dot FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_dollar; OptPriorName = ; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; AugType = rl_percent; OptPriorName = ; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; Term = FactorWithAug; Expression = Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; FsmSpec = rl_section rl_word StatementList rl_section; FsmSpecList = FsmSpecList FsmSpec; start = FsmSpecList; 0 FsmSpecList = ; StatementList = ; DataSpec = rl_data rl_builtin rl_semi; Statement = DataSpec; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_gt; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_gt; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_percent; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; FsmSpec = rl_section rl_word StatementList rl_section; FsmSpecList = FsmSpecList FsmSpec; start = FsmSpecList; 0 FsmSpecList = ; StatementList = ; DataSpec = rl_data rl_builtin rl_semi; Statement = DataSpec; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_gt; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_dollar; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_percent; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_gt; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_dollar; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_percent; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; FsmSpec = rl_section rl_word StatementList rl_section; FsmSpecList = FsmSpecList FsmSpec; start = FsmSpecList; 0 FsmSpecList = ; StatementList = ; DataSpec = rl_data rl_builtin rl_semi; Statement = DataSpec; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; AugType = rl_gt; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_percent; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = Term rl_dot FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = Term FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_percent; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_gt; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_percent; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; FsmSpec = rl_section rl_word StatementList rl_section; FsmSpecList = FsmSpecList FsmSpec; start = FsmSpecList; 0 FsmSpecList = ; StatementList = ; DataSpec = rl_data rl_builtin rl_semi; Statement = DataSpec; StatementList = StatementList Statement; AlphSpec = rl_alphType rl_word rl_word rl_semi; Statement = AlphSpec; StatementList = StatementList Statement; MachineName = rl_word; AlphabetNum = rl_hex; RangeLit = AlphabetNum; AlphabetNum = rl_hex; RangeLit = AlphabetNum; Factor = RangeLit rl_doubleDot RangeLit; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; OptPriorName = ; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; AlphabetNum = rl_hex; Factor = AlphabetNum; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; OptPriorName = ; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; AlphabetNum = rl_hex; RangeLit = AlphabetNum; AlphabetNum = rl_hex; RangeLit = AlphabetNum; Factor = RangeLit rl_doubleDot RangeLit; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; OptPriorName = ; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; OptPriorName = ; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; AugType = rl_colon; ActionEmbed = rl_builtin; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; FsmSpec = rl_section rl_word StatementList rl_section; FsmSpecList = FsmSpecList FsmSpec; StatementList = ; DataSpec = rl_data rl_builtin rl_semi; Statement = DataSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RangeLit = rl_literal; RangeLit = rl_literal; Factor = RangeLit rl_doubleDot RangeLit; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_plus; FactorWithAug = FactorWithRep; AugType = rl_dollar; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; AugType = rl_percent; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_dollar; OptPriorName = ; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; AugType = rl_percent; OptPriorName = ; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; Term = FactorWithAug; Expression = Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; AugType = rl_percent; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; FsmSpec = rl_section rl_word StatementList rl_section; FsmSpecList = FsmSpecList FsmSpec; start = FsmSpecList; 0 FsmSpecList = ; StatementList = ; DataSpec = rl_data rl_builtin rl_semi; Statement = DataSpec; StatementList = StatementList Statement; AlphSpec = rl_alphType rl_word rl_word rl_semi; Statement = AlphSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; MachineName = rl_word; AlphabetNum = rl_hex; Factor = AlphabetNum; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; FsmSpec = rl_section rl_word StatementList rl_section; FsmSpecList = FsmSpecList FsmSpec; start = FsmSpecList; 0 FsmSpecList = ; StatementList = ; DataSpec = rl_data rl_builtin rl_semi; Statement = DataSpec; StatementList = StatementList Statement; FsmSpec = rl_section rl_word StatementList rl_section; FsmSpecList = FsmSpecList FsmSpec; StatementList = ; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; MachineName = rl_word; RegularExpr = ; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; Factor = rl_reLiteralSlash RegularExpr rl_reLiteralSlash; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; RegularExpr = ; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; Factor = rl_reLiteralSlash RegularExpr rl_reLiteralSlash; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; RegularExpr = ; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; Factor = rl_reLiteralSlash RegularExpr rl_reLiteralSlash; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; RegularExpr = ; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprChar = rl_reLiteralChar; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; Factor = rl_reLiteralSlash RegularExpr rl_reLiteralSlash; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; RegularExpr = ; RegularExprChar = rl_reLiteralChar; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; Factor = rl_reLiteralSlash RegularExpr rl_reLiteralSlash; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; RegularExpr = ; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; Factor = rl_reLiteralSlash RegularExpr rl_reLiteralSlash; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; RegularExpr = ; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprOrChar = rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; Factor = rl_reLiteralSlash RegularExpr rl_reLiteralSlash; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; RegularExpr = ; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprOrChar = rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar rl_reLiteralDash rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpen RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; Factor = rl_reLiteralSlash RegularExpr rl_reLiteralSlash; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; RegularExpr = ; RegularExprOrData = ; RegularExprOrChar = rl_reLiteralChar; RegularExprOrData = RegularExprOrData RegularExprOrChar; RegularExprChar = rl_reLiteralOpenNeg RegularExprOrData rl_reLiteralClose; RegularExprItem = RegularExprChar; RegularExpr = RegularExpr RegularExprItem; Factor = rl_reLiteralSlash RegularExpr rl_reLiteralSlash; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; OptPriorName = rl_word rl_comma; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; AugType = rl_colon; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = Term rl_dot FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_orLiteral; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_minus Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_plus; FactorWithAug = FactorWithRep; AugType = rl_dollar; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_minus Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_dollar; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = FactorWithAug; Expression = Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_orLiteral; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = Term rl_dot FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_percent; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = Term rl_dot FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_minus Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; OptPriorName = rl_word rl_comma; PriorityAugStr = rl_uInt; PriorityAug = PriorityAugStr; FactorWithAug = FactorWithAug AugType OptPriorName PriorityAug; Term = Term rl_dot FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = Term rl_dot FactorWithAug; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_word; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; FsmSpec = rl_section rl_word StatementList rl_section; FsmSpecList = FsmSpecList FsmSpec; start = FsmSpecList; 0 FsmSpecList = ; StatementList = ; DataSpec = rl_data rl_builtin rl_semi; Statement = DataSpec; StatementList = StatementList Statement; ActionSpec = rl_action rl_word rl_builtin; Statement = ActionSpec; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_orLiteral; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = Term rl_dot FactorWithAug; Expression = Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_orLiteral; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithRep = FactorWithRep rl_star; FactorWithAug = FactorWithRep; AugType = rl_colon; ActionEmbed = rl_word; FactorWithAug = FactorWithAug AugType ActionEmbed; Term = Term rl_dot FactorWithAug; Expression = Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term rl_dot FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; FsmSpec = rl_section rl_word StatementList rl_section; FsmSpecList = FsmSpecList FsmSpec; start = FsmSpecList; 0 FsmSpecList = ; StatementList = ; DataSpec = rl_data rl_builtin rl_semi; Statement = DataSpec; StatementList = StatementList Statement; MachineName = rl_word; RangeLit = rl_literal; RangeLit = rl_literal; Factor = RangeLit rl_doubleDot RangeLit; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; RangeLit = rl_literal; RangeLit = rl_literal; Factor = RangeLit rl_doubleDot RangeLit; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; RangeLit = rl_literal; RangeLit = rl_literal; Factor = RangeLit rl_doubleDot RangeLit; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; RangeLit = rl_literal; RangeLit = rl_literal; Factor = RangeLit rl_doubleDot RangeLit; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_open Expression rl_close; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = Term FactorWithAug; Expression = Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; FsmSpec = rl_section rl_word StatementList rl_section; FsmSpecList = FsmSpecList FsmSpec; start = FsmSpecList; 0 FsmSpecList = ; StatementList = ; DataSpec = rl_data rl_builtin rl_semi; Statement = DataSpec; StatementList = StatementList Statement; MachineName = rl_word; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; Factor = rl_literal; FactorWithNeg = Factor; FactorWithRep = FactorWithNeg; FactorWithAug = FactorWithRep; Term = FactorWithAug; Expression = Expression rl_bar Term; RLAssignment = MachineName rl_equals Expression rl_semi; Statement = RLAssignment; StatementList = StatementList Statement; FsmSpec = rl_section rl_word StatementList rl_section; FsmSpecList = FsmSpecList FsmSpec; start = FsmSpecList; 0 #endif kelbt-0.15/test/backtrack2.kl0000664000175000017500000000352311136220252016413 0ustar thurstonthurston #include #include using namespace std; //#define LOG_ACTIONS //#define LOG_BACKTRACK struct Token { }; struct LangEl; struct Parser { %%{ parser Parser; # Token names. token number, id, dead; }%% %% write instance_data; void init(); int parseLangEl( int type, const Token &tokenRef ); void finish(); }; %% write token_defs; %%{ parser Parser; start: go try { cout << "reducing start: go;" << endl; }; go: divert number id dead try { cout << "reducing go: divert number id dead;" << endl; }; go: id choice1 choice2 id try { cout << "reducing go: id choice1 choice2 id;" << endl; }; divert: id choice1 try { cout << "reducing divert: id choice1;" << endl; } undo { cout << "undoing divert: id choice1;" << endl; }; choice1: number number try { cout << "reducing choice1: number number;" << endl; }; choice1: number try { cout << "reducing choice1: number;" << endl; }; choice2: number id try { cout << "reducing choice2: number id;" << endl; }; choice2: number try { cout << "reducing choice2: number;" << endl; }; }%% %%{ write types; write data; }%% void Parser::init() { %% write init; } void Parser::finish() { %% write finish; } int Parser::parseLangEl( int type, const Token &tokenRef ) { const Token *token = &tokenRef; %% write exec; return errCount == 0 ? 0 : -1; } void test0() { Parser parser; Token token; parser.init(); parser.parseLangEl( id, token ); parser.parseLangEl( number, token ); parser.parseLangEl( number, token ); parser.parseLangEl( id, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } int main() { test0(); } #ifdef _____OUTPUT_____ reducing choice1: number; reducing divert: id choice1; undoing divert: id choice1; reducing choice2: number; reducing go: id choice1 choice2 id; reducing start: go; 0 #endif kelbt-0.15/test/rlprods.kl0000664000175000017500000130241011136220252016067 0ustar thurstonthurston#include #include using namespace std; struct Token { }; struct LangEl; struct Parser { %%{ parser Parser; token t_word, t_float, t_integer, t_literal, t_character; token t_semi, t_back, t_sopen, t_sclose, t_dot, t_dollar; token t_copen, t_cclose, t_question, t_star, t_forward; token t_amp, t_comma, t_equals, t_bar, t_lt, t_gt, t_minus; token t_plus, t_open, t_close, t_bang, t_colon; }%% %% write instance_data; void init(); int parseLangEl( int type, const Token &tokenRef ); void finish(); }; %% write token_defs; %%{ parser Parser; start: Statements try { cout << "start = Statements;" << endl; }; Statements: Statements Statement try { cout << "Statements = Statements Statement;" << endl; }; Statements: Statement try { cout << "Statements = Statement;" << endl; }; Statement: Rule try { cout << "Statement = Rule;" << endl; }; Statement: Production try { cout << "Statement = Production;" << endl; }; Rule: Pattern t_equals Expression t_semi try { cout << "Rule = Pattern t_equals Expression t_semi;" << endl; }; Pattern: Pattern ProdWord try { cout << "Pattern = Pattern ProdWord;" << endl; }; Pattern: ProdWord try { cout << "Pattern = ProdWord;" << endl; }; Expression: Expression ExpItem try { cout << "Expression = Expression ExpItem;" << endl; }; Expression: try { cout << "Expression = ;" << endl; }; ExpItem: ExpVarRef try { cout << "ExpItem = ExpVarRef;" << endl; }; ExpItem: ExpAny try { cout << "ExpItem = ExpAny;" << endl; }; ExpVarRef: t_dollar SimpleVarRef try { cout << "ExpVarRef = t_dollar SimpleVarRef;" << endl; }; ExpVarRef: t_question SimpleVarRef try { cout << "ExpVarRef = t_question SimpleVarRef;" << endl; }; ExpVarRef: t_dollar t_copen VarRef t_cclose try { cout << "ExpVarRef = t_dollar t_copen VarRef t_cclose;" << endl; }; ExpVarRef: t_question t_copen VarRef t_cclose try { cout << "ExpVarRef = t_question t_copen VarRef t_cclose;" << endl; }; ExpAny: t_word try { cout << "ExpAny = t_word;" << endl; }; ExpAny: t_float try { cout << "ExpAny = t_float;" << endl; }; ExpAny: t_integer try { cout << "ExpAny = t_integer;" << endl; }; ExpAny: t_literal try { cout << "ExpAny = t_literal;" << endl; }; ExpAny: t_character try { cout << "ExpAny = t_character;" << endl; }; ExpAny: t_sopen try { cout << "ExpAny = t_sopen;" << endl; }; ExpAny: t_sclose try { cout << "ExpAny = t_sclose;" << endl; }; ExpAny: t_dot try { cout << "ExpAny = t_dot;" << endl; }; ExpAny: t_copen try { cout << "ExpAny = t_copen;" << endl; }; ExpAny: t_cclose try { cout << "ExpAny = t_cclose;" << endl; }; Production: ProductionName t_minus t_gt WordOrExpression t_semi try { cout << "Production = ProductionName t_minus t_gt WordOrExpression t_semi ;" << endl; }; ProductionName: t_word try { cout << "ProductionName = t_word;" << endl; }; CodeStatements: CodeStatements CodeStatement try { cout << "CodeStatements = CodeStatements CodeStatement;" << endl; }; CodeStatements: try { cout << "CodeStatements = ;" << endl; }; CodeStatement: AssignVarName t_equals AssignRhs t_semi try { cout << "CodeStatement = AssignVarName t_equals AssignRhs t_semi;" << endl; }; AssignRhs: CodeExpr1 t_question CodeExpr1 t_colon CodeExpr1 try { cout << "AssignRhs = CodeExpr1 t_question CodeExpr1 t_colon CodeExpr1;" << endl; }; AssignRhs: CodeExpr1 try { cout << "AssignRhs = CodeExpr1;" << endl; }; SimpleVarRef: t_word try { cout << "SimpleVarRef = t_word;" << endl; }; AssignVarName: t_word try { cout << "AssignVarName = t_word;" << endl; }; VarRef: VarRef t_dot VarName try { cout << "VarRef = VarRef t_dot VarName;" << endl; }; VarRef: VarName try { cout << "VarRef = VarName;" << endl; }; VarName: t_word try { cout << "VarName = t_word;" << endl; }; VarName: t_word t_sopen t_integer t_sclose try { cout << "VarName = t_word t_sopen t_integer t_sclose;" << endl; }; CodeExpr1: CodeExpr1 t_equals t_equals CodeExpr2 try { cout << "CodeExpr1 = CodeExpr1 t_equals t_equals CodeExpr2;" << endl; }; CodeExpr1: CodeExpr1 t_gt CodeExpr2 try { cout << "CodeExpr1 = CodeExpr1 t_gt CodeExpr2;" << endl; }; CodeExpr1: CodeExpr1 t_lt CodeExpr2 try { cout << "CodeExpr1 = CodeExpr1 t_lt CodeExpr2;" << endl; }; CodeExpr1: CodeExpr1 t_gt t_equals CodeExpr2 try { cout << "CodeExpr1 = CodeExpr1 t_gt t_equals CodeExpr2;" << endl; }; CodeExpr1: CodeExpr1 t_lt t_equals CodeExpr2 try { cout << "CodeExpr1 = CodeExpr1 t_lt t_equals CodeExpr2;" << endl; }; CodeExpr1: CodeExpr2 try { cout << "CodeExpr1 = CodeExpr2;" << endl; }; CodeExpr2: CodeExpr2 t_plus CodeExpr3 try { cout << "CodeExpr2 = CodeExpr2 t_plus CodeExpr3;" << endl; }; CodeExpr2: CodeExpr2 t_minus CodeExpr3 try { cout << "CodeExpr2 = CodeExpr2 t_minus CodeExpr3;" << endl; }; CodeExpr2: CodeExpr2 t_amp CodeExpr3 try { cout << "CodeExpr2 = CodeExpr2 t_amp CodeExpr3;" << endl; }; CodeExpr2: CodeExpr3 try { cout << "CodeExpr2 = CodeExpr3;" << endl; }; CodeExpr3: CodeExpr3 t_star UnaryFactor try { cout << "CodeExpr3 = CodeExpr3 t_star UnaryFactor;" << endl; }; CodeExpr3: CodeExpr3 t_forward UnaryFactor try { cout << "CodeExpr3 = CodeExpr3 t_forward UnaryFactor;" << endl; }; CodeExpr3: UnaryFactor try { cout << "CodeExpr3 = UnaryFactor;" << endl; }; UnaryFactor: t_minus Factor try { cout << "UnaryFactor = t_minus Factor;" << endl; }; UnaryFactor: t_bang Factor try { cout << "UnaryFactor = t_bang Factor;" << endl; }; UnaryFactor: Factor try { cout << "UnaryFactor = Factor;" << endl; }; Factor: t_open CodeExpr1 t_close try { cout << "Factor = t_open CodeExpr1 t_close;" << endl; }; Factor: VarRef try { cout << "Factor = VarRef;" << endl; }; Factor: t_literal try { cout << "Factor = t_literal;" << endl; }; Factor: t_integer try { cout << "Factor = t_integer;" << endl; }; Factor: FunctionCall try { cout << "Factor = FunctionCall;" << endl; }; FunctionCall: t_word t_open ParamList t_close try { cout << "FunctionCall = t_word t_open ParamList t_close;" << endl; }; ParamList: NonLastParams LastParam try { cout << "ParamList = NonLastParams LastParam;" << endl; }; NonLastParams: NonLastParams CodeExpr1 t_comma try { cout << "NonLastParams = NonLastParams CodeExpr1 t_comma;" << endl; }; NonLastParams: try { cout << "NonLastParams = ;" << endl; }; LastParam: CodeExpr1 try { cout << "LastParam = CodeExpr1;" << endl; }; LastParam: try { cout << "LastParam = ;" << endl; }; WordOrExpression: WordOrExpression t_bar WordListOptionalFunc try { cout << "WordOrExpression = WordOrExpression t_bar WordListOptionalFunc;" << endl; }; WordOrExpression: WordListOptionalFunc try { cout << "WordOrExpression = WordListOptionalFunc;" << endl; }; WordListOptionalFunc: WordList t_copen PrepareCurFunc CodeStatements t_cclose try { cout << "WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose;" << endl; }; WordListOptionalFunc: WordList try { cout << "WordListOptionalFunc = WordList;" << endl; }; PrepareCurFunc: try { cout << "PrepareCurFunc = ;" << endl; }; WordList: WordList ProdWord try { cout << "WordList = WordList ProdWord;" << endl; }; WordList: try { cout << "WordList = ;" << endl; }; ProdWord: t_word try { cout << "ProdWord = t_word;" << endl; }; ProdWord: t_integer try { cout << "ProdWord = t_integer;" << endl; }; ProdWord: t_lt t_word t_gt try { cout << "ProdWord = t_lt t_word t_gt;" << endl; }; ProdWord: t_sopen t_word t_sclose try { cout << "ProdWord = t_sopen t_word t_sclose;" << endl; }; ProdWord: t_literal try { cout << "ProdWord = t_literal;" << endl; }; }%% %%{ write types; write data; }%% void Parser::init() { %% write init; } void Parser::finish() { %% write finish; } int Parser::parseLangEl( int type, const Token &tokenRef ) { const Token *token = &tokenRef; %% write exec; return errCount == 0 ? 0 : -1; } void ambiguity() { Parser parser; Token token; parser.init(); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void ll() { Parser parser; Token token; parser.init(); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_colon, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_colon, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_colon, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_star, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_star, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_star, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_star, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_colon, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_colon, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_plus, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_star, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_open, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_comma, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_close, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void howdoi() { Parser parser; Token token; parser.init(); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_amp, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_amp, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_amp, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_amp, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_amp, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_amp, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void lookup() { Parser parser; Token token; parser.init(); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_question, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void namesp() { Parser parser; Token token; parser.init(); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void nullprods() { Parser parser; Token token; parser.init(); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void scratch() { Parser parser; Token token; parser.init(); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void variables() { Parser parser; Token token; parser.init(); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_bar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_literal, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_minus, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_lt, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_gt, token ); parser.parseLangEl( t_equals, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_copen, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_dot, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_sopen, token ); parser.parseLangEl( t_integer, token ); parser.parseLangEl( t_sclose, token ); parser.parseLangEl( t_cclose, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_character, token ); parser.parseLangEl( t_dollar, token ); parser.parseLangEl( t_word, token ); parser.parseLangEl( t_semi, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } int main() { ambiguity(); ll(); howdoi(); lookup(); namesp(); nullprods(); scratch(); variables(); } #ifdef _____OUTPUT_____ ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_word; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_integer; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_dollar SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; ProdWord = t_word; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_integer; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_dollar SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; start = Statements; 0 ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_literal; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_literal; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr1 t_gt t_equals CodeExpr2; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1 t_question CodeExpr1 t_colon CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_literal; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_literal; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_literal; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_literal; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr1 t_gt CodeExpr2; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; Factor = t_open CodeExpr1 t_close; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; Factor = t_open CodeExpr1 t_close; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1 t_question CodeExpr1 t_colon CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr1 t_lt CodeExpr2; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; Factor = t_open CodeExpr1 t_close; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; Factor = t_open CodeExpr1 t_close; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1 t_question CodeExpr1 t_colon CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = CodeExpr3 t_star UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; Factor = t_open CodeExpr1 t_close; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = CodeExpr3 t_star UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; Factor = t_open CodeExpr1 t_close; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = CodeExpr3 t_star UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; Factor = t_open CodeExpr1 t_close; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = CodeExpr3 t_star UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; Factor = t_open CodeExpr1 t_close; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr1 t_gt CodeExpr2; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1 t_question CodeExpr1 t_colon CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr1 t_lt CodeExpr2; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1 t_question CodeExpr1 t_colon CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_plus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = CodeExpr3 t_star UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_minus CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; NonLastParams = ; LastParam = ; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_literal; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; NonLastParams = ; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; NonLastParams = NonLastParams CodeExpr1 t_comma; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; LastParam = CodeExpr1; ParamList = NonLastParams LastParam; FunctionCall = t_word t_open ParamList t_close; Factor = FunctionCall; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; VarName = t_word t_sopen t_integer t_sclose; VarRef = VarName; VarName = t_word; VarRef = VarRef t_dot VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; VarName = t_word t_sopen t_integer t_sclose; VarRef = VarName; VarName = t_word; VarRef = VarRef t_dot VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; VarName = t_word t_sopen t_integer t_sclose; VarRef = VarName; VarName = t_word; VarRef = VarRef t_dot VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; VarName = t_word t_sopen t_integer t_sclose; VarRef = VarName; VarName = t_word; VarRef = VarRef t_dot VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_lt t_word t_gt; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_question SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_dollar SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; ProductionName = t_word; WordList = ; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_lt t_word t_gt; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_question SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_dollar SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_dollar SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_lt t_word t_gt; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_question SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_dollar SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; ProdWord = t_lt t_word t_gt; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_question SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_dollar SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_lt t_word t_gt; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_question SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_dollar SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; ProdWord = t_lt t_word t_gt; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_question SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_dollar SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_lt t_word t_gt; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_question SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_question SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_lt t_word t_gt; Pattern = ProdWord; Expression = ; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_integer; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_lt t_word t_gt; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_dollar SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_lt t_word t_gt; Pattern = ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_question SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_lt t_word t_gt; Pattern = ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_question SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_lt t_word t_gt; Pattern = ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_question SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; start = Statements; 0 ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_amp CodeExpr3; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_amp CodeExpr3; VarName = t_word; VarRef = VarName; VarName = t_word; VarRef = VarRef t_dot VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_amp CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; VarName = t_word; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_amp CodeExpr3; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_amp CodeExpr3; VarName = t_word; VarRef = VarName; VarName = t_word; VarRef = VarRef t_dot VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr2 t_amp CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_word; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; VarName = t_word; VarRef = VarName; ExpVarRef = t_dollar t_copen VarRef t_cclose; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; start = Statements; 0 ProductionName = t_word; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statement; ProductionName = t_word; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; VarName = t_word; VarRef = VarName; VarName = t_word t_sopen t_integer t_sclose; VarRef = VarRef t_dot VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; VarName = t_word; VarRef = VarName; VarName = t_word t_sopen t_integer t_sclose; VarRef = VarRef t_dot VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; VarName = t_word; VarRef = VarName; VarName = t_word t_sopen t_integer t_sclose; VarRef = VarRef t_dot VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; VarName = t_word t_sopen t_integer t_sclose; VarRef = VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; VarName = t_word; VarRef = VarName; VarName = t_word t_sopen t_integer t_sclose; VarRef = VarRef t_dot VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; AssignVarName = t_word; VarName = t_word; VarRef = VarName; VarName = t_word t_sopen t_integer t_sclose; VarRef = VarRef t_dot VarName; Factor = VarRef; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_word; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; VarName = t_word; VarRef = VarName; ExpVarRef = t_question t_copen VarRef t_cclose; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; ProdWord = t_word; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; VarName = t_word; VarRef = VarName; ExpVarRef = t_question t_copen VarRef t_cclose; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; start = Statements; 0 ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_literal; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_word; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; VarName = t_word; VarRef = VarName; VarName = t_word t_sopen t_integer t_sclose; VarRef = VarRef t_dot VarName; ExpVarRef = t_dollar t_copen VarRef t_cclose; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; VarName = t_word; VarRef = VarName; VarName = t_word t_sopen t_integer t_sclose; VarRef = VarRef t_dot VarName; ExpVarRef = t_dollar t_copen VarRef t_cclose; ExpItem = ExpVarRef; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_word; Pattern = ProdWord; ProdWord = t_word; Pattern = Pattern ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; VarName = t_word; VarRef = VarName; VarName = t_word; VarRef = VarRef t_dot VarName; ExpVarRef = t_dollar t_copen VarRef t_cclose; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; VarName = t_word; VarRef = VarName; VarName = t_word; VarRef = VarRef t_dot VarName; ExpVarRef = t_dollar t_copen VarRef t_cclose; ExpItem = ExpVarRef; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; start = Statements; 0 ProductionName = t_word; WordList = ; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statement; ProdWord = t_word; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; ProdWord = t_word; Pattern = Pattern ProdWord; ProdWord = t_word; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; VarName = t_word; VarRef = VarName; ExpVarRef = t_dollar t_copen VarRef t_cclose; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; start = Statements; 0 ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr1 t_equals t_equals CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statement; ProdWord = t_lt t_word t_gt; Pattern = ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; start = Statements; 0 ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_literal; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordListOptionalFunc; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; PrepareCurFunc = ; CodeStatements = ; AssignVarName = t_word; Factor = t_literal; UnaryFactor = Factor; CodeExpr3 = UnaryFactor; CodeExpr2 = CodeExpr3; CodeExpr1 = CodeExpr2; AssignRhs = CodeExpr1; CodeStatement = AssignVarName t_equals AssignRhs t_semi; CodeStatements = CodeStatements CodeStatement; WordListOptionalFunc = WordList t_copen PrepareCurFunc CodeStatements t_cclose; WordOrExpression = WordOrExpression t_bar WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProductionName = t_word; WordList = ; ProdWord = t_word; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_sopen t_word t_sclose; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; ProdWord = t_lt t_word t_gt; WordList = WordList ProdWord; WordListOptionalFunc = WordList; WordOrExpression = WordListOptionalFunc; Production = ProductionName t_minus t_gt WordOrExpression t_semi ; Statement = Production; Statements = Statements Statement; ProdWord = t_word; Pattern = ProdWord; ProdWord = t_lt t_word t_gt; Pattern = Pattern ProdWord; Expression = ; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; VarName = t_word; VarRef = VarName; VarName = t_word t_sopen t_integer t_sclose; VarRef = VarRef t_dot VarName; ExpVarRef = t_dollar t_copen VarRef t_cclose; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; VarName = t_word; VarRef = VarName; VarName = t_word t_sopen t_integer t_sclose; VarRef = VarRef t_dot VarName; ExpVarRef = t_dollar t_copen VarRef t_cclose; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_dollar SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_word; ExpItem = ExpAny; Expression = Expression ExpItem; ExpAny = t_character; ExpItem = ExpAny; Expression = Expression ExpItem; SimpleVarRef = t_word; ExpVarRef = t_dollar SimpleVarRef; ExpItem = ExpVarRef; Expression = Expression ExpItem; Rule = Pattern t_equals Expression t_semi; Statement = Rule; Statements = Statements Statement; start = Statements; 0 #endif kelbt-0.15/test/backtrack1.kl0000664000175000017500000000540711136220252016415 0ustar thurstonthurston#include #include using namespace std; //#define LOG_ACTIONS //#define LOG_BACKTRACK struct Token { }; struct LangEl; struct Parser { %%{ parser Parser; # Token names. token tok_plus, tok_mult, tok_number; }%% %% write instance_data; void init(); int parseLangEl( int type, const Token &token ); void finish(); }; %% write token_defs; %%{ parser Parser; # Expect an expression. start: E try { cout << "start = E;" << endl; }; # Expressions returns a float result; nonterm E { double res; }; # Top level of expressions support addition. E: E tok_plus F try { cout << "E = E tok_plus F;" << endl; }; E: F try { cout << "E = F;" << endl; }; # Factor returns a float result; nonterm F { double res; }; F: tok_number tok_plus try { cout << "F = tok_number tok_plus;" << endl; } undo { cout << "UNDOING F = tok_number tok_plus;" << endl; }; F: tok_number try { cout << "F = tok_number;" << endl; }; # Second level supports multiplication. F: F tok_mult tok_number try { cout << "F = F tok_mult tok_number;" << endl; }; }%% %%{ write types; write data; }%% void Parser::init() { %% write init; } void Parser::finish() { %% write finish; } int Parser::parseLangEl( int type, const Token &tokenRef ) { const Token *token = &tokenRef; %% write exec; return errCount == 0 ? 0 : -1; } void test0() { Parser parser; Token token; parser.init(); parser.parseLangEl( tok_number, token ); parser.parseLangEl( tok_plus, token ); parser.parseLangEl( tok_number, token ); parser.parseLangEl( tok_mult, token ); parser.parseLangEl( tok_number, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test1() { Parser parser; Token token; parser.init(); parser.parseLangEl( tok_number, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test2() { Parser parser; Token token; parser.init(); parser.parseLangEl( tok_number, token ); parser.parseLangEl( tok_plus, token ); parser.parseLangEl( tok_number, token ); parser.parseLangEl( tok_plus, token ); parser.parseLangEl( tok_number, token ); parser.parseLangEl( tok_plus, token ); parser.parseLangEl( tok_number, token ); parser.parseLangEl( tok_mult, token ); parser.parseLangEl( tok_number, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } int main() { test0(); test1(); test2(); } #ifdef _____OUTPUT_____ F = tok_number; E = F; F = tok_number; F = F tok_mult tok_number; E = E tok_plus F; start = E; 0 F = tok_number; E = F; start = E; 0 F = tok_number; E = F; F = tok_number; E = E tok_plus F; F = tok_number; E = E tok_plus F; F = tok_number; F = F tok_mult tok_number; E = E tok_plus F; start = E; 0 #endif kelbt-0.15/test/Makefile0000664000175000017500000000157111072514631015523 0ustar thurstonthurston# # Copyright 2006 Adrian Thurston # # This file is part of Kelbt. # # Kelbt is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Kelbt is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Kelbt; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA test: @./runtests clean: rm -f *.c *.cpp *.m *.d *.bin *.exp *.out distclean: clean kelbt-0.15/test/g43.kl0000664000175000017500000000027310572350155015011 0ustar thurstonthurston// @IGNORE: yes %% non_lalr token a; token b; token c; # This grammar is LR(1) but not SLR nor LALR(1). start: a A a; start: b A b; start: a B b; start: b B a; A: c; B: c; %% kelbt-0.15/test/runtests0000775000175000017500000000406011072514631015674 0ustar thurstonthurston#!/bin/bash # # Copyright 2006 Adrian Thurston # # This file is part of Kelbt. # # Kelbt is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Kelbt is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Kelbt; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA [ -z "$*" ] && set -- *.kl compiler=`sed '/^#define CXX/s/#define CXX *//p;d' ../config.h` cflags="-Wall -O3" function test_error { exit 1; } for test_case; do root=${test_case%.kl}; if ! [ -f "$test_case" ]; then echo "runtests: not a file: $test_case"; >&2 exit 1; fi ignore=`sed '/@IGNORE:/s/^.*: *//p;d' $test_case` if [ "$ignore" = yes ]; then continue; fi lang=`sed '/@LANG:/s/^.*: *//p;d' $test_case` if [ -z "$lang" ]; then lang="c++"; fi kelbt=../kelbt/kelbt expected_out=$root.exp; sed '1,/_____OUTPUT_____/d;$d' $test_case > $expected_out additional_cflags=`sed '/@CFLAGS:/s/^.*: *//p;d' $test_case` [ -n "$additional_cflags" ] && cflags="$cflags $additional_cflags" case $lang in c++) code_suffix=cpp; compiler=g++; ;; c) code_suffix=c; compiler=gcc; ;; esac code_src=$root.$code_suffix; binary=$root.bin; output=$root.out; echo "$kelbt $test_case -o $code_src" if ! $kelbt $test_case -o $code_src; then test_error; fi echo "$compiler $cflags -o $binary $code_src" if ! $compiler $cflags -o $binary $code_src; then test_error; fi echo -n "running $binary ... "; ./$binary > $output; if diff $expected_out $output > /dev/null; then echo "passed"; else echo "FAILED"; test_error; fi; done kelbt-0.15/test/simple2.kl0000664000175000017500000000166011136220252015757 0ustar thurstonthurston// @IGNORE: yes #include #include using namespace::std; %% simple2 { token And; token id; token open; token close; token star; start: E { cout << "start = E;" << endl; }; E: F open And F close star { cout << "E = F open And F close star;" << endl; }; E: { cout << "E = ;" << endl; }; F: id { cout << "F = id;" << endl; }; F: open E close { cout << "F = open E close;" << endl; }; } void test0() { Parser parser; Token token; parser.init(); parser.parseLangEl( id, token ); parser.parseLangEl( open, token ); parser.parseLangEl( And, token ); parser.parseLangEl( open, token ); parser.parseLangEl( close, token ); parser.parseLangEl( close, token ); parser.parseLangEl( star, token ); parser.parseLangEl( Parser_tk_eof, token ); cout << parser.finish() << endl; } int main() { test0(); } #ifdef _____OUTPUT_____ F = id; E = ; F = open E close; E = F open And F close star; start = E; 0 #endif kelbt-0.15/test/backtrack3.kl0000664000175000017500000000367711136220252016426 0ustar thurstonthurston #include #include using namespace std; //#define LOG_ACTIONS //#define LOG_BACKTRACK struct Token { }; struct LangEl; struct Parser { %%{ parser Parser; # Token names. token number, id, stringlit; }%% %% write instance_data; void init(); int parseLangEl( int type, const Token &tokenRef ); void finish(); }; %% write token_defs; %%{ parser Parser; start: prefix choice1 choice2 stringlit id try { cout << "start: prefix choice1 choice2 stringlit id;" << endl; }; prefix: id try { cout << "prefix: id;" << endl; }; choice1: number number try { cout << "choice1: number number;" << endl; } undo { cout << "UNDOING choice1: number number;" << endl; }; choice1: number try { cout << "choice1: number;" << endl; }; choice2: stringlit id try { cout << "choice2: stringlit id;" << endl; } undo { cout << "UNDOING choice2: stringlit id;" << endl; }; choice2: number number try { cout << "choice2: number number;" << endl; }; choice2: id number try { cout << "choice2: id number;" << endl; }; choice2: number try { cout << "choice2: number;" << endl; }; }%% %%{ write types; write data; }%% void Parser::init() { %% write init; } void Parser::finish() { %% write finish; } int Parser::parseLangEl( int type, const Token &tokenRef ) { const Token *token = &tokenRef; %% write exec; return errCount == 0 ? 0 : -1; } void test0() { Parser parser; Token token; parser.init(); parser.parseLangEl( id, token ); parser.parseLangEl( number, token ); parser.parseLangEl( number, token ); parser.parseLangEl( stringlit, token ); parser.parseLangEl( id, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } int main() { test0(); } #ifdef _____OUTPUT_____ prefix: id; choice1: number number; choice2: stringlit id; UNDOING choice2: stringlit id; UNDOING choice1: number number; choice1: number; choice2: number; start: prefix choice1 choice2 stringlit id; 0 #endif kelbt-0.15/test/calc1.kl0000664000175000017500000000701411136220252015366 0ustar thurstonthurston #include #include using namespace std; struct Token { }; struct LangEl; struct Parser { %%{ parser Parser; # Token names. token tok_plus, tok_mult, tok_number; }%% %% write instance_data; void init(); int parseLangEl( int type, const Token &tokenRef ); void finish(); void token( int tokid ); }; %% write token_defs; %%{ parser Parser; # Expect an expression. start: E try { cout << "start = E;" << endl; }; # Expressions returns a float result; nonterm E { double res; }; # Top level of expressions support addition. E: E tok_plus F try { cout << "E = E tok_plus F;" << endl; }; E: F try { cout << "E = F;" << endl; }; # Factor returns a float result; nonterm F { double res; }; # Second level supports multiplication. F: tok_number tok_mult F try { cout << "F = tok_number tok_mult F;" << endl; }; F: tok_number try { cout << "F = tok_number;" << endl; }; }%% %%{ write types; write data; }%% void Parser::init() { %% write init; } void Parser::finish() { %% write finish; } int Parser::parseLangEl( int type, const Token &tokenRef ) { const Token *token = &tokenRef; %% write exec; return errCount == 0 ? 0 : -1; } void Parser::token( int tokid ) { Token token; int result = parseLangEl( tokid, token ); if ( result < 0 ) cout << "parse error" << endl; } void test0() { Parser parser; parser.init(); parser.token( tok_number ); parser.token( tok_plus ); parser.token( tok_number ); parser.token( tok_mult ); parser.token( tok_number ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test1() { Parser parser; parser.init(); parser.token( tok_number ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test2() { Parser parser; parser.init(); parser.token( tok_number ); parser.token( tok_plus ); parser.token( tok_number ); parser.token( tok_plus ); parser.token( tok_number ); parser.token( tok_plus ); parser.token( tok_number ); parser.token( tok_mult ); parser.token( tok_number ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test3() { Parser parser; parser.init(); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test4() { Parser parser; parser.init(); parser.token( tok_plus ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test5() { Parser parser; parser.init(); parser.token( tok_number ); parser.token( tok_plus ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test6() { Parser parser; parser.init(); parser.token( tok_number ); parser.token( tok_mult ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } void test7() { Parser parser; parser.init(); parser.token( tok_number ); parser.token( tok_mult ); parser.token( tok_number ); parser.token( tok_number ); parser.token( Parser_tk_eof ); parser.finish(); cout << parser.errCount << endl; } int main() { test0(); test1(); test2(); test3(); test4(); test5(); test6(); test7(); } #ifdef _____OUTPUT_____ F = tok_number; E = F; F = tok_number; F = tok_number tok_mult F; E = E tok_plus F; start = E; 0 F = tok_number; E = F; start = E; 0 F = tok_number; E = F; F = tok_number; E = E tok_plus F; F = tok_number; E = E tok_plus F; F = tok_number; F = tok_number tok_mult F; E = E tok_plus F; start = E; 0 parse error 1 parse error 1 F = tok_number; E = F; parse error 1 parse error 1 parse error 1 #endif kelbt-0.15/test/conflicts2.kl0000664000175000017500000000065710572350155016470 0ustar thurstonthurston// @IGNORE: yes %% reduce_reduce token comma; token id; token colon; # This is an example of a reduce-reduce conflict. The problem arises because # both type and name have comma in their follow set. start: param_spec return_spec comma; param_spec: type; param_spec: name_list colon type; return_spec: type; return_spec: name colon type; type: id; name: id; name_list: name; name_list: name comma name_list; %% kelbt-0.15/test/ada2.kl0000664000175000017500000226723211136220252015226 0ustar thurstonthurston/* * This test grammar defived from the final project of Steve Hanov, Forrest * Payton and Adrian Thurston for the course CS444: Introduction to Compiler * Construction at the University of Waterloo. Ported and stripped down to work * with keller. * * Jan 2003 * Ada/CS grammar * * Steve Hanov * Forrest Payton * Adrian Thurston * * Notes: * - raise statements take ID's, not string literals * - prag statements take ID's, not string literals * - functions may take string literals * - there is no character type, only string literals * - The $ opperator (EOF) is not included * - names may refer to values or locations * - choice lists may include multiple "others" in any order * * The grammer is headed by the production start: ... * * Table of contents: * PROGRAM CONSTRUCTION * Package Specification * specification and body options * private options and declarations * exceptions handler * DECLARATION * Decleration Statements * object declaration (, : ;) * type declaration * record * array * enumeration * access * subtype declaration * sub program declaration * STATEMENTS * prag * null * assign * call * read * write * block * loops * if * exit * return * case * raise * EXPRESSIONS * logical * relational * addition * unary sign * multiplication * unary abs, not and ** * factors * Name * simple name * name sufficies * parameters * Aggeragate sufficies * Ranges * discrete ranges * subtype definitions * constraints (range and index) * Literals */ #include #include #include using namespace std; using std::cout; using std::cerr; using std::endl; //#define LOG_ACTIONS struct Token { }; struct LangEl; struct Parser { %%{ parser Parser; token error; ## -- C declarations -- # ##--------------------------------------------------# # identifies seperate compilation token kw_separate; # identifier token ID; # compiler directive token kw_pragma; token kw_package; token kw_private; token kw_body; token kw_procedure; token kw_function; token kw_return; token kw_in; token kw_out; token kw_begin; token kw_exception; token kw_raise; token kw_end; token kw_declare; token kw_constant; token kw_use; token kw_type; token kw_is; token kw_access; token kw_record; token kw_array; token kw_of; token kw_subtype; token kw_range; token kw_if; token kw_then; token kw_else; token kw_elsif; token kw_case; token kw_when; token kw_others; token kw_for; token kw_loop; token kw_while; token kw_exit; token kw_reverse; token kw_abs; token kw_and; token kw_mod; token kw_not; token kw_or; token kw_null; # new keywords token kw_new; token kw_all; token kw_read; token kw_write; token kw_next; token kw_assign; token kw_true; token kw_false; token lit_integer; token lit_float; token lit_string; token op_field_qualification; # . token op_left_bracket; # ( token op_right_bracket; # ) token op_exponentiation; # ** token op_mult; # * token op_div; # / token op_plus; # + token op_minus; # - token op_cat; # & token op_eq; # = token op_neq; # /= token op_lt; # < token op_lteq; # <= token op_gt; # > token op_gteq; # >= token op_assign; # := token de_single_quote; # ' token de_dot_dot; # .. token de_colon; # : token de_comma; # , token de_pipe; # | token de_arrow; # => token de_unconstrained; # <> token de_semicolon; # ; }%% %% write instance_data; void init(); int parseLangEl( int type, const Token &tokenRef ); void finish(); }; %% write token_defs; %%{ parser Parser; #-------------------------------------------------- # -- Grammer rules -- # ==========>>>> START <<<<========== start: input try { cout << "start = input;" << endl; }; # start of program input: compilation prag_list try { cout << "input = compilation prag_list;" << endl; }; # ============================================================== # ================= BEGIN PROGRAM CONSTRUCTION ================= # a compilation is a list of packages with optional compiler directives compilation: prag_list kw_package p_spec_or_body try { cout << "compilation = prag_list kw_package p_spec_or_body;" << endl; }; compilation: compilation prag_list kw_package p_spec_or_body try { cout << "compilation = compilation prag_list kw_package p_spec_or_body;" << endl; }; # pragma list 0+ prag_list: prag_list prag_st try { cout << "prag_list = prag_list prag_st;" << endl; }; prag_list: try { cout << "prag_list = ;" << endl; }; # Package ID. Used to capture the package id into the scope for the package. package_ID: ID try { cout << "package_ID = ID;" << endl; }; # component pieces of a packege # HEADER or FULL # is [] # # # # end []; p_spec_or_body: package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon try { cout << "p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon;" << endl; }; # error p_spec_or_body: package_ID kw_is error kw_end id_option de_semicolon try { cout << "p_spec_or_body = package_ID kw_is error kw_end id_option de_semicolon;" << endl; }; p_spec_or_body: package_ID kw_is error kw_end try { cout << "p_spec_or_body = package_ID kw_is error kw_end;" << endl; }; #steve: Need a form: "package body A is separate;" p_spec_or_body: kw_body package_ID kw_is kw_separate de_semicolon try { cout << "p_spec_or_body = kw_body package_ID kw_is kw_separate de_semicolon;" << endl; }; # optional body with use (as there is a declaration section body_opt: try { cout << "body_opt = ;" << endl; }; body_opt: kw_body use_opt body_dec_list kw_begin stmt_list exception_opt try { cout << "body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt;" << endl; }; # optional statements body_opt: kw_body use_opt body_dec_list exception_opt try { cout << "body_opt = kw_body use_opt body_dec_list exception_opt;" << endl; }; # error body_opt: kw_body error try { cout << "body_opt = kw_body error;" << endl; }; # COMPLIMENT to HEADER # body is [] # # begin # # [] # end []; p_spec_or_body: kw_body package_ID kw_is use_opt body_dec_list kw_begin stmt_list exception_opt kw_end id_option de_semicolon try { cout << "p_spec_or_body = kw_body package_ID kw_is use_opt body_dec_list kw_begin stmt_list exception_opt kw_end id_option de_semicolon;" << endl; }; p_spec_or_body: kw_body package_ID kw_is use_opt body_dec_list exception_opt kw_end id_option de_semicolon try { cout << "p_spec_or_body = kw_body package_ID kw_is use_opt body_dec_list exception_opt kw_end id_option de_semicolon;" << endl; }; # error p_spec_or_body: kw_body package_ID kw_is error kw_end id_option de_semicolon try { cout << "p_spec_or_body = kw_body package_ID kw_is error kw_end id_option de_semicolon;" << endl; }; p_spec_or_body: kw_body package_ID kw_is error kw_end try { cout << "p_spec_or_body = kw_body package_ID kw_is error kw_end;" << endl; }; # the use statement option use_opt: try { cout << "use_opt = ;" << endl; }; use_opt: kw_use id_list de_semicolon try { cout << "use_opt = kw_use id_list de_semicolon;" << endl; }; # optional exception section #exceptions_opt = ; #exceptions_opt = exceptions; # optional id (also ends blocks) id_option: try { cout << "id_option = ;" << endl; }; id_option: ID try { cout << "id_option = ID;" << endl; }; # list of spec declarations spec_dec_list: try { cout << "spec_dec_list = ;" << endl; }; spec_dec_list: spec_dec_list spec_dec try { cout << "spec_dec_list = spec_dec_list spec_dec;" << endl; }; # specification declaration section spec_dec: kw_type ID kw_is kw_private de_semicolon try { cout << "spec_dec = kw_type ID kw_is kw_private de_semicolon;" << endl; }; spec_dec: dec_stmt try { cout << "spec_dec = dec_stmt;" << endl; }; # error spec_dec: kw_type ID error de_semicolon try { cout << "spec_dec = kw_type ID error de_semicolon;" << endl; }; # -- begin private --- # private part option private_opt: try { cout << "private_opt = ;" << endl; }; private_opt: private_list try { cout << "private_opt = private_list;" << endl; }; # private [] private_list: private_list private_item try { cout << "private_list = private_list private_item;" << endl; }; private_list: kw_private use_opt private_item try { cout << "private_list = kw_private use_opt private_item;" << endl; }; # items under private part of a packege private_item: kw_subtype ID kw_is sub_type de_semicolon try { cout << "private_item = kw_subtype ID kw_is sub_type de_semicolon;" << endl; }; private_item: kw_type ID kw_is type_def de_semicolon try { cout << "private_item = kw_type ID kw_is type_def de_semicolon;" << endl; }; private_item: exception_dec_st try { cout << "private_item = exception_dec_st;" << endl; }; # error private_item: kw_subtype error de_semicolon try { cout << "private_item = kw_subtype error de_semicolon;" << endl; }; private_item: kw_type error de_semicolon try { cout << "private_item = kw_type error de_semicolon;" << endl; }; #added by steve for test39.ada private_item: object_dec try { cout << "private_item = object_dec;" << endl; }; # --- BEGINE EXCEPTION --- # an exception statement exceptions: kw_exception handler_list try { cout << "exceptions = kw_exception handler_list;" << endl; }; # list of exception cases handler_list: try { cout << "handler_list = ;" << endl; }; handler_list: handler_list kw_when hand_options try { cout << "handler_list = handler_list kw_when hand_options;" << endl; }; # => hand_options: kw_others de_arrow stmt_list try { cout << "hand_options = kw_others de_arrow stmt_list;" << endl; }; hand_options: h_name_list de_arrow stmt_list try { cout << "hand_options = h_name_list de_arrow stmt_list;" << endl; }; # list of names h_name_list: name try { cout << "h_name_list = name;" << endl; }; h_name_list: h_name_list de_pipe name try { cout << "h_name_list = h_name_list de_pipe name;" << endl; }; # --- END EXCEPTIONS --- # ================== END PROGRAM CONSTRUCTION ================== # ============================================================== # ============================================================== # ===================== BEGIN DECLARATIONS ===================== # a list of declarations body_dec_list: try { cout << "body_dec_list = ;" << endl; }; body_dec_list: body_dec_list body_dec_st try { cout << "body_dec_list = body_dec_list body_dec_st;" << endl; }; # the declaration statements body_dec_st: sub_body_dec try { cout << "body_dec_st = sub_body_dec;" << endl; }; body_dec_st: dec_stmt try { cout << "body_dec_st = dec_stmt;" << endl; }; # ---------------------------------------------- # ---------------------------------------------- # Set of declaration statements dec_stmt: object_dec try { cout << "dec_stmt = object_dec;" << endl; }; dec_stmt: type_dec_st try { cout << "dec_stmt = type_dec_st;" << endl; }; dec_stmt: exception_dec_st try { cout << "dec_stmt = exception_dec_st;" << endl; }; dec_stmt: sub_dec_st try { cout << "dec_stmt = sub_dec_st;" << endl; }; dec_stmt: prag_st try { cout << "dec_stmt = prag_st;" << endl; }; dec_stmt: sub_pro_dec_st try { cout << "dec_stmt = sub_pro_dec_st;" << endl; }; # ---------------------------------------------- # ---------------------------------------------- # Object declaration. (id list with possible constant and init) # object {,} : [constant] [:= ]; object_dec: id_list de_colon con_opt type_or_sub init_opt de_semicolon try { cout << "object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon;" << endl; }; # error object_dec: id_list error de_semicolon try { cout << "object_dec = id_list error de_semicolon;" << endl; }; # constant option con_opt: try { cout << "con_opt = ;" << endl; }; con_opt: kw_constant try { cout << "con_opt = kw_constant;" << endl; }; # initialization option init_opt: try { cout << "init_opt = ;" << endl; }; init_opt: op_assign expr try { cout << "init_opt = op_assign expr;" << endl; }; exception_dec_st: id_list de_colon kw_exception de_semicolon try { cout << "exception_dec_st = id_list de_colon kw_exception de_semicolon;" << endl; }; # --- BEGIN TYPE DEC --------------------------- # type or sub choice type_or_sub: typet try { cout << "type_or_sub = typet;" << endl; }; type_or_sub: sub_def try { cout << "type_or_sub = sub_def;" << endl; }; # Type name goes to ID. Non-terminal stores the idToken. type_name: ID try { cout << "type_name = ID;" << endl; }; # allows disambiguating over scope. typet: overld_resolve try { cout << "typet = overld_resolve;" << endl; }; typet: type_def try { cout << "typet = type_def;" << endl; }; overld_resolve: overld_resolve_more try { cout << "overld_resolve = overld_resolve_more;" << endl; }; overld_resolve_more: overld_resolve_more op_field_qualification ID try { cout << "overld_resolve_more = overld_resolve_more op_field_qualification ID;" << endl; }; overld_resolve_more: ID try { cout << "overld_resolve_more = ID;" << endl; }; # 1+ list of identifiers id_list: id_list_more try { cout << "id_list = id_list_more;" << endl; }; id_list_more: ID try { cout << "id_list_more = ID;" << endl; }; id_list_more: id_list_more de_comma ID try { cout << "id_list_more = id_list_more de_comma ID;" << endl; }; # complete or incomplete type declarations type_dec_st: kw_type ID kw_is type_def de_semicolon try { cout << "type_dec_st = kw_type ID kw_is type_def de_semicolon;" << endl; }; type_dec_st: kw_type ID de_semicolon try { cout << "type_dec_st = kw_type ID de_semicolon;" << endl; }; # different type definitions type_def: record_def try { cout << "type_def = record_def;" << endl; }; type_def: array_def try { cout << "type_def = array_def;" << endl; }; type_def: enum_def try { cout << "type_def = enum_def;" << endl; }; type_def: kw_access sub_type try { cout << "type_def = kw_access sub_type;" << endl; }; # -- begin record ------------ # the record record_def: kw_record r_compon_list kw_end kw_record try { cout << "record_def = kw_record r_compon_list kw_end kw_record;" << endl; }; # a list of recod elements # null;, 1+ components or 0+ components and a varient r_compon_list: null_st try { cout << "r_compon_list = null_st;" << endl; }; r_compon_list: r_components try { cout << "r_compon_list = r_components;" << endl; }; # list of components with at least one component or variant # e.g. (component)*(component | variant) # record component : ; # record variant case t : integer is {variant} end case; r_components: id_list de_colon type_or_sub de_semicolon r_components try { cout << "r_components = id_list de_colon type_or_sub de_semicolon r_components;" << endl; }; r_components: id_list de_colon type_or_sub de_semicolon try { cout << "r_components = id_list de_colon type_or_sub de_semicolon;" << endl; }; r_components: kw_case ID de_colon type_name kw_is r_variant_list kw_end kw_case de_semicolon try { cout << "r_components = kw_case ID de_colon type_name kw_is r_variant_list kw_end kw_case de_semicolon;" << endl; }; # list of 1+ variants # variant: when => components # Note: add_exp is a simple expression (less logical and relational-ish) r_variant_list: kw_when add_exp de_arrow r_compon_list try { cout << "r_variant_list = kw_when add_exp de_arrow r_compon_list;" << endl; }; r_variant_list: r_variant_list kw_when add_exp de_arrow r_compon_list try { cout << "r_variant_list = r_variant_list kw_when add_exp de_arrow r_compon_list;" << endl; }; # -- end record -------------- # -- begin array ------------ # option of constrained or not # array ( option list ) of # -- array_def: kw_array op_left_bracket uncon_list op_right_bracket kw_of type_or_sub try { cout << "array_def = kw_array op_left_bracket uncon_list op_right_bracket kw_of type_or_sub;" << endl; }; array_def: kw_array op_left_bracket con_list op_right_bracket kw_of type_or_sub try { cout << "array_def = kw_array op_left_bracket con_list op_right_bracket kw_of type_or_sub;" << endl; }; # the unconstrained array uncon_list: uncon_list de_comma index_sub try { cout << "uncon_list = uncon_list de_comma index_sub;" << endl; }; uncon_list: index_sub try { cout << "uncon_list = index_sub;" << endl; }; # index subtype definition index_sub: type_name kw_range de_unconstrained try { cout << "index_sub = type_name kw_range de_unconstrained;" << endl; }; # the constrained array # Note: compensates for restriction of dis_range con_list: con_list_more try { cout << "con_list = con_list_more;" << endl; }; con_list_more: con_list_more de_comma dis_range try { cout << "con_list_more = con_list_more de_comma dis_range;" << endl; }; con_list_more: dis_range try { cout << "con_list_more = dis_range;" << endl; }; # -- end array -------------- # -- begin enumeration ------------ # is an id list enum_def: op_left_bracket id_list op_right_bracket try { cout << "enum_def = op_left_bracket id_list op_right_bracket;" << endl; }; # -- end enumeration -------------- # --- END TYPE DEC ---------------- # Sub program body declaration. sub_body_dec: sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon try { cout << "sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon;" << endl; }; # error sub_body_dec: sub_pro_spec kw_is error kw_end id_opt de_semicolon try { cout << "sub_body_dec = sub_pro_spec kw_is error kw_end id_opt de_semicolon;" << endl; }; # optional exception exception_opt: try { cout << "exception_opt = ;" << endl; }; exception_opt: exceptions try { cout << "exception_opt = exceptions;" << endl; }; # optional id id_opt: try { cout << "id_opt = ;" << endl; }; id_opt: ID try { cout << "id_opt = ID;" << endl; }; id_opt: lit_string try { cout << "id_opt = lit_string;" << endl; }; # sub program declaration sub_pro_dec_st: sub_pro_spec de_semicolon try { cout << "sub_pro_dec_st = sub_pro_spec de_semicolon;" << endl; }; # a sub program specification # procedure or function sub_pro_spec: kw_procedure proc_designator formal_opt try { cout << "sub_pro_spec = kw_procedure proc_designator formal_opt;" << endl; }; sub_pro_spec: kw_function func_designator formal_opt kw_return ID try { cout << "sub_pro_spec = kw_function func_designator formal_opt kw_return ID;" << endl; }; # error sub_pro_spec: kw_procedure error op_right_bracket try { cout << "sub_pro_spec = kw_procedure error op_right_bracket;" << endl; }; sub_pro_spec: kw_function error ID try { cout << "sub_pro_spec = kw_function error ID;" << endl; }; formal_opt: op_left_bracket param_dec_list op_right_bracket try { cout << "formal_opt = op_left_bracket param_dec_list op_right_bracket;" << endl; }; formal_opt: try { cout << "formal_opt = ;" << endl; }; # ---additional constructions for sub program declaration # designator a name or opperator symbol in the form of a string literal func_designator: ID try { cout << "func_designator = ID;" << endl; }; func_designator: lit_string try { cout << "func_designator = lit_string;" << endl; }; proc_designator: ID try { cout << "proc_designator = ID;" << endl; }; # list of semi delimited parameters param_dec_list: param_dec_list de_semicolon param_dec try { cout << "param_dec_list = param_dec_list de_semicolon param_dec;" << endl; }; param_dec_list: param_dec try { cout << "param_dec_list = param_dec;" << endl; }; # a parameter param_dec: id_list de_colon mode ID try { cout << "param_dec = id_list de_colon mode ID;" << endl; }; # optional modes mode: try { cout << "mode = ;" << endl; }; mode: kw_in try { cout << "mode = kw_in;" << endl; }; mode: kw_out try { cout << "mode = kw_out;" << endl; }; mode: kw_in kw_out try { cout << "mode = kw_in kw_out;" << endl; }; # -- end sub programs # ====================== END DECLARATIONS ====================== # ============================================================== # ============================================================== # ====================== BEGIN STATEMENTS ====================== # a list of statments stmt_list: stmt_star try { cout << "stmt_list = stmt_star;" << endl; }; stmt_star: try { cout << "stmt_star = ;" << endl; }; stmt_star: stmt_star statement try { cout << "stmt_star = stmt_star statement;" << endl; }; # -------------------------------------------------------------- # SET OF ALL STATEMENTS # -------------------------------------------------------------- # PRAG: pragma ; # NULL: null; # ASSIGN: := ; # CALL: ; # BLOCK: [declare ...] begin ... [exception ...] end; # LOOP: [while | for in ] loop ... end loop; # IF: if then ... [elsif then ...][else ...] end if; # EXIT: exit [when ]; # RETURN: # CASE: case is {when : ...} end case; # RAISE: raise ; # READ: # WRITE: statement: prag_st try { cout << "statement = prag_st;" << endl; }; statement: null_st try { cout << "statement = null_st;" << endl; }; statement: assign_st try { cout << "statement = assign_st;" << endl; }; statement: call_st try { cout << "statement = call_st;" << endl; }; statement: block_st try { cout << "statement = block_st;" << endl; }; statement: loop_st try { cout << "statement = loop_st;" << endl; }; statement: if_st try { cout << "statement = if_st;" << endl; }; statement: exit_st try { cout << "statement = exit_st;" << endl; }; statement: return_st try { cout << "statement = return_st;" << endl; }; statement: case_st try { cout << "statement = case_st;" << endl; }; statement: raise_st try { cout << "statement = raise_st;" << endl; }; statement: read_st try { cout << "statement = read_st;" << endl; }; statement: write_st try { cout << "statement = write_st;" << endl; }; # -------------------------------------------------------------- # -------------------------------------------------------------- # PRAGMA STATEMENT prag_st: kw_pragma ID de_semicolon try { cout << "prag_st = kw_pragma ID de_semicolon;" << endl; }; # error prag_st: kw_pragma error de_semicolon try { cout << "prag_st = kw_pragma error de_semicolon;" << endl; }; # NULL STATEMENT null_st: kw_null de_semicolon try { cout << "null_st = kw_null de_semicolon;" << endl; }; # ASSIGNMENT assign_st: name op_assign expr de_semicolon try { cout << "assign_st = name op_assign expr de_semicolon;" << endl; }; # error assign_st: name op_assign error de_semicolon try { cout << "assign_st = name op_assign error de_semicolon;" << endl; }; # CALL STATEMENT call_st: name de_semicolon try { cout << "call_st = name de_semicolon;" << endl; }; # error call_st: ID error de_semicolon try { cout << "call_st = ID error de_semicolon;" << endl; }; # --- BEGIN READ --- # Read statement read_st: kw_read op_left_bracket r_name_list op_right_bracket de_semicolon try { cout << "read_st = kw_read op_left_bracket r_name_list op_right_bracket de_semicolon;" << endl; }; # error read_st: kw_read error op_right_bracket de_semicolon try { cout << "read_st = kw_read error op_right_bracket de_semicolon;" << endl; }; # parameters to read (a name list) r_name_list: r_name_list de_semicolon name try { cout << "r_name_list = r_name_list de_semicolon name;" << endl; }; r_name_list: r_name_list de_semicolon kw_next try { cout << "r_name_list = r_name_list de_semicolon kw_next;" << endl; }; r_name_list: name try { cout << "r_name_list = name;" << endl; }; r_name_list: kw_next try { cout << "r_name_list = kw_next;" << endl; }; # --- END READ --- # --- BEGIN WRITE --- # write statement write_st: kw_write op_left_bracket w_name_list op_right_bracket de_semicolon try { cout << "write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon;" << endl; }; # error write_st: kw_write error op_right_bracket de_semicolon try { cout << "write_st = kw_write error op_right_bracket de_semicolon;" << endl; }; # parameters of write w_name_list: w_name_list de_semicolon w_param try { cout << "w_name_list = w_name_list de_semicolon w_param;" << endl; }; w_name_list: w_param try { cout << "w_name_list = w_param;" << endl; }; # specific write parameter with optional length specification # Write next or or ,length # Steve: Changed "name" to expr. w_param: kw_next try { cout << "w_param = kw_next;" << endl; }; w_param: expr try { cout << "w_param = expr;" << endl; }; w_param: expr de_comma lit_integer try { cout << "w_param = expr de_comma lit_integer;" << endl; }; # --- END WRITE --- # --- BEGIN BLOCK --- # further block information is located above statements # --- # [ :][declare ...] begin ... [exception ...] end; block_st: opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon try { cout << "block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon;" << endl; }; block_st: ID de_colon opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon try { cout << "block_st = ID de_colon opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon;" << endl; }; # error block_st: opt_decl kw_begin error kw_end id_option de_semicolon try { cout << "block_st = opt_decl kw_begin error kw_end id_option de_semicolon;" << endl; }; block_st: ID de_colon opt_decl kw_begin error kw_end id_option de_semicolon try { cout << "block_st = ID de_colon opt_decl kw_begin error kw_end id_option de_semicolon;" << endl; }; # blocks may have a declaration section, possible empty opt_decl: try { cout << "opt_decl = ;" << endl; }; opt_decl: kw_declare use_opt body_dec_list try { cout << "opt_decl = kw_declare use_opt body_dec_list;" << endl; }; # --- END BLOCK --- # --- BEGIN LOOPS --- # Loops include simple (loop) and advanved (for, while) # --- # Loop statements (with optional id:) loop_st: loop_body try { cout << "loop_st = loop_body;" << endl; }; loop_st: ID de_colon loop_body try { cout << "loop_st = ID de_colon loop_body;" << endl; }; # optional front followed by the basic loop loop_body: adv_loop stmt_list kw_end kw_loop de_semicolon try { cout << "loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon;" << endl; }; # error loop_body: adv_loop error kw_end kw_loop de_semicolon try { cout << "loop_body = adv_loop error kw_end kw_loop de_semicolon;" << endl; }; loop_body: adv_loop error kw_end kw_loop try { cout << "loop_body = adv_loop error kw_end kw_loop;" << endl; }; loop_body: adv_loop error kw_end de_semicolon try { cout << "loop_body = adv_loop error kw_end de_semicolon;" << endl; }; # advanced loop components adv_loop: kw_loop try { cout << "adv_loop = kw_loop;" << endl; }; adv_loop: kw_while expr kw_loop try { cout << "adv_loop = kw_while expr kw_loop;" << endl; }; adv_loop: kw_for ID kw_in dis_range kw_loop try { cout << "adv_loop = kw_for ID kw_in dis_range kw_loop;" << endl; }; adv_loop: kw_for ID kw_in kw_reverse dis_range kw_loop try { cout << "adv_loop = kw_for ID kw_in kw_reverse dis_range kw_loop;" << endl; }; # error adv_loop: kw_while error kw_loop try { cout << "adv_loop = kw_while error kw_loop;" << endl; }; adv_loop: kw_for error kw_loop try { cout << "adv_loop = kw_for error kw_loop;" << endl; }; # --- END LOOPS --- # --- BEGIN IF --- # If statement if then if_st: kw_if expr kw_then stmt_list else_if try { cout << "if_st = kw_if expr kw_then stmt_list else_if;" << endl; }; # error if_st: kw_if error kw_end kw_if de_semicolon try { cout << "if_st = kw_if error kw_end kw_if de_semicolon;" << endl; }; if_st: kw_if error kw_end kw_if try { cout << "if_st = kw_if error kw_end kw_if;" << endl; }; # Elsif lists else_if: kw_elsif expr kw_then stmt_list else_if try { cout << "else_if = kw_elsif expr kw_then stmt_list else_if;" << endl; }; else_if: end_if try { cout << "else_if = end_if;" << endl; }; # optional else end_if: kw_else stmt_list kw_end kw_if de_semicolon try { cout << "end_if = kw_else stmt_list kw_end kw_if de_semicolon;" << endl; }; end_if: kw_end kw_if de_semicolon try { cout << "end_if = kw_end kw_if de_semicolon;" << endl; }; # --- END IF --- # --- BEGIN EXIT --- # exit statment # March 15: Steve changed exit to exit # cause it makes more sense. exit_st: kw_exit de_semicolon try { cout << "exit_st = kw_exit de_semicolon;" << endl; }; exit_st: kw_exit ID de_semicolon try { cout << "exit_st = kw_exit ID de_semicolon;" << endl; }; exit_st: kw_exit kw_when expr de_semicolon try { cout << "exit_st = kw_exit kw_when expr de_semicolon;" << endl; }; exit_st: kw_exit ID kw_when expr de_semicolon try { cout << "exit_st = kw_exit ID kw_when expr de_semicolon;" << endl; }; # error exit_st: kw_exit error de_semicolon try { cout << "exit_st = kw_exit error de_semicolon;" << endl; }; # --- END EXIT --- # --- BEGIN RETURN --- # Return statements return_st: kw_return de_semicolon try { cout << "return_st = kw_return de_semicolon;" << endl; }; return_st: kw_return expr de_semicolon try { cout << "return_st = kw_return expr de_semicolon;" << endl; }; # error return_st: kw_return error de_semicolon try { cout << "return_st = kw_return error de_semicolon;" << endl; }; # --- END RETURN --- # --- BEGIN CASE --- # consisting of the statment, a section of 0 or more when, # an optional other and choices build from expressions and ranges of expressions # --- # case statment case_st: kw_case expr kw_is when_list others kw_end kw_case de_semicolon try { cout << "case_st = kw_case expr kw_is when_list others kw_end kw_case de_semicolon;" << endl; }; # error case_st: kw_case error kw_end kw_case de_semicolon try { cout << "case_st = kw_case error kw_end kw_case de_semicolon;" << endl; }; case_st: kw_case error kw_end kw_case try { cout << "case_st = kw_case error kw_end kw_case;" << endl; }; # list of cases when_list: try { cout << "when_list = ;" << endl; }; when_list: when_list kw_when choice_list de_arrow stmt_list try { cout << "when_list = when_list kw_when choice_list de_arrow stmt_list;" << endl; }; # a list of choices # choice | ... | choice => statements choice_list: choice try { cout << "choice_list = choice;" << endl; }; choice_list: choice de_pipe choice_list try { cout << "choice_list = choice de_pipe choice_list;" << endl; }; # a choice is an expressions or a range choice: expr try { cout << "choice = expr;" << endl; }; choice: add_exp de_dot_dot add_exp try { cout << "choice = add_exp de_dot_dot add_exp;" << endl; }; # optional others case others: try { cout << "others = ;" << endl; }; others: kw_when kw_others de_arrow stmt_list try { cout << "others = kw_when kw_others de_arrow stmt_list;" << endl; }; # --- END CASE --- # --- BEGIN RAISE --- # the raise statement raise_st: kw_raise name de_semicolon try { cout << "raise_st = kw_raise name de_semicolon;" << endl; }; # --- END RAISE --- # ======================= END STATEMENTS ======================= # ============================================================== # ============================================================== # ====================== BEGIN EXPRESSION ====================== # --- BEGIN OPERATORS --- # All expressions are described below with precidence # --- expr: log_exp try { cout << "expr = log_exp;" << endl; }; # logical operators log_exp: log_exp kw_and rel_exp try { cout << "log_exp = log_exp kw_and rel_exp;" << endl; }; log_exp: log_exp kw_or rel_exp try { cout << "log_exp = log_exp kw_or rel_exp;" << endl; }; log_exp: log_exp kw_and kw_then rel_exp try { cout << "log_exp = log_exp kw_and kw_then rel_exp;" << endl; }; log_exp: log_exp kw_or kw_else rel_exp try { cout << "log_exp = log_exp kw_or kw_else rel_exp;" << endl; }; log_exp: rel_exp try { cout << "log_exp = rel_exp;" << endl; }; # nonassociative relational operators rel_exp: add_exp op_eq add_exp try { cout << "rel_exp = add_exp op_eq add_exp;" << endl; }; rel_exp: add_exp op_neq add_exp try { cout << "rel_exp = add_exp op_neq add_exp;" << endl; }; rel_exp: add_exp op_lt add_exp try { cout << "rel_exp = add_exp op_lt add_exp;" << endl; }; rel_exp: add_exp op_lteq add_exp try { cout << "rel_exp = add_exp op_lteq add_exp;" << endl; }; rel_exp: add_exp op_gt add_exp try { cout << "rel_exp = add_exp op_gt add_exp;" << endl; }; rel_exp: add_exp op_gteq add_exp try { cout << "rel_exp = add_exp op_gteq add_exp;" << endl; }; rel_exp: add_exp try { cout << "rel_exp = add_exp;" << endl; }; # additive operators add_exp: add_exp op_plus sign_exp try { cout << "add_exp = add_exp op_plus sign_exp;" << endl; }; add_exp: add_exp op_minus sign_exp try { cout << "add_exp = add_exp op_minus sign_exp;" << endl; }; add_exp: add_exp op_cat sign_exp try { cout << "add_exp = add_exp op_cat sign_exp;" << endl; }; add_exp: sign_exp try { cout << "add_exp = sign_exp;" << endl; }; # sign operators sign_exp: mult_exp try { cout << "sign_exp = mult_exp;" << endl; }; # multiplicitive operators mult_exp: mult_exp op_mult unary_exp try { cout << "mult_exp = mult_exp op_mult unary_exp;" << endl; }; mult_exp: mult_exp op_div unary_exp try { cout << "mult_exp = mult_exp op_div unary_exp;" << endl; }; mult_exp: mult_exp kw_mod unary_exp try { cout << "mult_exp = mult_exp kw_mod unary_exp;" << endl; }; mult_exp: unary_exp try { cout << "mult_exp = unary_exp;" << endl; }; # unary operators unary_exp: kw_abs unary_exp try { cout << "unary_exp = kw_abs unary_exp;" << endl; }; unary_exp: kw_not unary_exp try { cout << "unary_exp = kw_not unary_exp;" << endl; }; unary_exp: op_plus unary_exp try { cout << "unary_exp = op_plus unary_exp;" << endl; }; unary_exp: op_minus unary_exp try { cout << "unary_exp = op_minus unary_exp;" << endl; }; unary_exp: factor_exp op_exponentiation factor_exp try { cout << "unary_exp = factor_exp op_exponentiation factor_exp;" << endl; }; unary_exp: factor_exp try { cout << "unary_exp = factor_exp;" << endl; }; # --- END OPERATORS --- # lowest level, converts from literals factor_exp: op_left_bracket expr op_right_bracket try { cout << "factor_exp = op_left_bracket expr op_right_bracket;" << endl; }; factor_exp: literal try { cout << "factor_exp = literal;" << endl; }; factor_exp: name_or_agg try { cout << "factor_exp = name_or_agg;" << endl; }; factor_exp: kw_new type_name try { cout << "factor_exp = kw_new type_name;" << endl; }; # --- NAME --- # identifier # identifier.identifier."string".identifier()() # --- # a simple or complex name may be ended in .all name: ID try { cout << "name = ID;" << endl; }; name: ID n_sufx_list try { cout << "name = ID n_sufx_list;" << endl; }; name: ID op_field_qualification kw_all try { cout << "name = ID op_field_qualification kw_all;" << endl; }; name: ID n_sufx_list op_field_qualification kw_all try { cout << "name = ID n_sufx_list op_field_qualification kw_all;" << endl; }; # list of sufficies 0+ n_sufx_list: name_suffix try { cout << "n_sufx_list = name_suffix;" << endl; }; n_sufx_list: n_sufx_list name_suffix try { cout << "n_sufx_list = n_sufx_list name_suffix;" << endl; }; # -- array indexing and field qualifications # prefix is a procedure was a procedure call name_suffix: op_left_bracket params op_right_bracket try { cout << "name_suffix = op_left_bracket params op_right_bracket;" << endl; }; # prefix is a quantifier (package, dec, record) name_suffix: op_field_qualification ID try { cout << "name_suffix = op_field_qualification ID;" << endl; }; # prefix is a quantifier name_suffix: op_field_qualification lit_string try { cout << "name_suffix = op_field_qualification lit_string;" << endl; }; # prefix is a typename OR # prefix is an item if ID is a predefined function name name_suffix: de_single_quote ID try { cout << "name_suffix = de_single_quote ID;" << endl; }; # one or more comma seperated expressions params: params de_comma expr try { cout << "params = params de_comma expr;" << endl; }; params: expr try { cout << "params = expr;" << endl; }; # --- END NAME --- # --- AGGEREGATES --- # # '( , ... , | | ... | others => ) # --- # a name or a name with an aggregate suffix on the end name_or_agg: ID opt_agg_suff try { cout << "name_or_agg = ID opt_agg_suff;" << endl; }; name_or_agg: ID n_sufx_list opt_agg_suff try { cout << "name_or_agg = ID n_sufx_list opt_agg_suff;" << endl; }; name_or_agg: ID op_field_qualification kw_all opt_agg_suff try { cout << "name_or_agg = ID op_field_qualification kw_all opt_agg_suff;" << endl; }; name_or_agg: ID n_sufx_list op_field_qualification kw_all opt_agg_suff try { cout << "name_or_agg = ID n_sufx_list op_field_qualification kw_all opt_agg_suff;" << endl; }; # optional aggregate suffix opt_agg_suff: try { cout << "opt_agg_suff = ;" << endl; }; opt_agg_suff: agg_suffix try { cout << "opt_agg_suff = agg_suffix;" << endl; }; # the aggregate suffix agg_suffix: de_single_quote op_left_bracket agg_list op_right_bracket try { cout << "agg_suffix = de_single_quote op_left_bracket agg_list op_right_bracket;" << endl; }; # aggregate list T'(agg_list) agg_list: agg_elem try { cout << "agg_list = agg_elem;" << endl; }; agg_list: agg_elem de_comma agg_list try { cout << "agg_list = agg_elem de_comma agg_list;" << endl; }; # aggeragate choice E or A=>E agg_elem: expr try { cout << "agg_elem = expr;" << endl; }; agg_elem: agg_choices de_arrow expr try { cout << "agg_elem = agg_choices de_arrow expr;" << endl; }; # list of choices agg_choices: agg_item try { cout << "agg_choices = agg_item;" << endl; }; agg_choices: agg_choices de_pipe agg_item try { cout << "agg_choices = agg_choices de_pipe agg_item;" << endl; }; # aggeragate items compose choices agg_item: dis_range_or_add_exp try { cout << "agg_item = dis_range_or_add_exp;" << endl; }; agg_item: kw_others try { cout << "agg_item = kw_others;" << endl; }; # --- END AGGERAGATES --- # --- SUBTYPE, RANGES and DISCREET RANGES --- # subtype declaration --- sub_dec_st: kw_subtype ID kw_is sub_type de_semicolon try { cout << "sub_dec_st = kw_subtype ID kw_is sub_type de_semicolon;" << endl; }; # subtype (sub_def is used in expressions) sub_type: type_name try { cout << "sub_type = type_name;" << endl; }; sub_type: sub_def try { cout << "sub_type = sub_def;" << endl; }; # a subtype with no index constraint (used by discrete range only) sub_type_no_index: type_name try { cout << "sub_type_no_index = type_name;" << endl; }; sub_type_no_index: sub_def_range_const try { cout << "sub_type_no_index = sub_def_range_const;" << endl; }; # subtype definition sub_def: sub_def_index_const try { cout << "sub_def = sub_def_index_const;" << endl; }; sub_def: sub_def_range_const try { cout << "sub_def = sub_def_range_const;" << endl; }; # subtype definition index constraint # identifier ( , ... ) sub_def_index_const: type_name index_constraint try { cout << "sub_def_index_const = type_name index_constraint;" << endl; }; index_constraint: op_left_bracket dis_range_list op_right_bracket try { cout << "index_constraint = op_left_bracket dis_range_list op_right_bracket;" << endl; }; # subtype definition range constraint # [identifier] range .. sub_def_range_const: range_constraint try { cout << "sub_def_range_const = range_constraint;" << endl; }; sub_def_range_const: type_name range_constraint try { cout << "sub_def_range_const = type_name range_constraint;" << endl; }; range_constraint: kw_range range try { cout << "range_constraint = kw_range range;" << endl; }; # .. range: add_exp de_dot_dot add_exp try { cout << "range = add_exp de_dot_dot add_exp;" << endl; }; # discrete range dis_range: range try { cout << "dis_range = range;" << endl; }; dis_range: sub_type_no_index try { cout << "dis_range = sub_type_no_index;" << endl; }; # A list of discrete ranges. dis_range_list: dis_range try { cout << "dis_range_list = dis_range;" << endl; }; dis_range_list: dis_range_list de_comma dis_range try { cout << "dis_range_list = dis_range_list de_comma dis_range;" << endl; }; # discrete range or add expression. dis_range_or_add_exp: add_exp try { cout << "dis_range_or_add_exp = add_exp;" << endl; }; dis_range_or_add_exp: add_exp de_dot_dot add_exp try { cout << "dis_range_or_add_exp = add_exp de_dot_dot add_exp;" << endl; }; dis_range_or_add_exp: sub_def_range_const try { cout << "dis_range_or_add_exp = sub_def_range_const;" << endl; }; # --- END SUBTYPE, RANGES and DISCREET RANGES --- # --- LITERAL --- # All literals = 1 2.3 "45" # --- # the literals literal: lit_integer try { cout << "literal = lit_integer;" << endl; }; literal: lit_float try { cout << "literal = lit_float;" << endl; }; literal: lit_string try { cout << "literal = lit_string;" << endl; }; # --- END LITERAL # ======================= END EXPRESSION ======================= # ============================================================== #conflict type_name opt_agg_suff = type_name; #conflict rel_exp dis_range_or_add_exp = rel_exp; }%% %%{ write types; write data; }%% void Parser::init() { %% write init; } void Parser::finish() { %% write finish; } int Parser::parseLangEl( int type, const Token &tokenRef ) { const Token *token = &tokenRef; %% write exec; return errCount == 0 ? 0 : -1; } void test0() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_type, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_access, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_type, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_access, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_type, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_access, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_type, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_access, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( kw_new, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( kw_new, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( kw_new, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( kw_new, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_access, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( kw_new, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( kw_new, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( kw_new, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( kw_new, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( kw_new, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( kw_all, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test1() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_type, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_array, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_of, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test2() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_constant, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_type, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_array, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_of, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test3() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_then, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_else, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_and, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_and, token ); parser.parseLangEl( kw_then, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_or, token ); parser.parseLangEl( kw_else, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_or, token ); parser.parseLangEl( kw_else, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test4() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_pipe, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( kw_others, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( kw_others, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( kw_others, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( kw_others, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( kw_others, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_pipe, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_pipe, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_pipe, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_pipe, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_pipe, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_pipe, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_case, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test5() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test6() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_lt, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_then, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_package, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test7() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test8() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_raise, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test9() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_raise, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_raise, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_raise, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_raise, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test10() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_raise, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_raise, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_raise, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_raise, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test11() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_raise, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_raise, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_raise, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_raise, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test12() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test13() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_eq, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_neq, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_eq, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( kw_then, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_else, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_neq, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( kw_then, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_else, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_gt, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_gt, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_gteq, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_gteq, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_gteq, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_lt, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_lt, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_lteq, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_lteq, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_lteq, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test14() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_then, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_elsif, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_then, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_else, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_then, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test15() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_eq, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_neq, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_eq, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_then, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_else, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_neq, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_then, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_else, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_gt, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_gt, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_gteq, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_gteq, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_gteq, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_lt, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_lt, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_lteq, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_lteq, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_lteq, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test16() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_type, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_subtype, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_range, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_while, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_while, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_while, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( kw_reverse, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( kw_reverse, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( kw_reverse, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_range, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( kw_range, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test17() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( kw_abs, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test18() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_package, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_use, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test19() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_eq, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_then, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_else, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_cat, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_cat, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_field_qualification, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_div, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_cat, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test20() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_constant, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_type, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_array, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_of, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( kw_out, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( kw_out, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( kw_out, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_package, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( kw_out, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_gt, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_then, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_elsif, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_lt, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_then, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( kw_out, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_while, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_lt, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_while, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_gteq, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exit, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_gt, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( kw_out, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_neq, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_then, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_null, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_package, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_use, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_mult, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_plus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_mod, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test21() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_type, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_subtype, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_range, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_procedure, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_declare, token ); parser.parseLangEl( kw_subtype, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_range, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_exception, token ); parser.parseLangEl( kw_when, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_arrow, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test22() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_cat, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_cat, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_function, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_for, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_in, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_dot_dot, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_eq, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( kw_then, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_else, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_cat, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_cat, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_if, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( kw_loop, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_return, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( kw_use, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_cat, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( op_cat, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_comma, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_cat, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } void test23() { Parser parser; Token token; parser.init(); parser.parseLangEl( kw_package, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( kw_is, token ); parser.parseLangEl( kw_body, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_float, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( op_minus, token ); parser.parseLangEl( lit_integer, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_colon, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_assign, token ); parser.parseLangEl( lit_string, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_begin, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_write, token ); parser.parseLangEl( op_left_bracket, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( op_right_bracket, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( kw_end, token ); parser.parseLangEl( ID, token ); parser.parseLangEl( de_semicolon, token ); parser.parseLangEl( Parser_tk_eof, token ); parser.finish(); cout << parser.errCount << endl; } int main() { test0(); test1(); test2(); test3(); test4(); test5(); test6(); test7(); test8(); test9(); test10(); test11(); test12(); test13(); test14(); test15(); test16(); test17(); test18(); test19(); test20(); test21(); test22(); test23(); } #ifdef _____OUTPUT_____ prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; type_name = ID; sub_type = type_name; type_def = kw_access sub_type; type_dec_st = kw_type ID kw_is type_def de_semicolon; dec_stmt = type_dec_st; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; type_name = ID; sub_type = type_name; type_def = kw_access sub_type; type_dec_st = kw_type ID kw_is type_def de_semicolon; dec_stmt = type_dec_st; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; type_name = ID; sub_type = type_name; type_def = kw_access sub_type; type_dec_st = kw_type ID kw_is type_def de_semicolon; dec_stmt = type_dec_st; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; type_name = ID; sub_type = type_name; type_def = kw_access sub_type; type_dec_st = kw_type ID kw_is type_def de_semicolon; dec_stmt = type_dec_st; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; proc_designator = ID; formal_opt = ; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; proc_designator = ID; formal_opt = ; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; stmt_star = ; name = ID; type_name = ID; factor_exp = kw_new type_name; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; type_name = ID; factor_exp = kw_new type_name; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID op_field_qualification kw_all; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID op_field_qualification kw_all; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID op_field_qualification kw_all; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; type_name = ID; factor_exp = kw_new type_name; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; type_name = ID; factor_exp = kw_new type_name; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID op_field_qualification kw_all; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID op_field_qualification kw_all; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID op_field_qualification kw_all; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; type_name = ID; sub_type = type_name; type_def = kw_access sub_type; typet = type_def; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; type_name = ID; factor_exp = kw_new type_name; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; type_name = ID; factor_exp = kw_new type_name; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID op_field_qualification kw_all; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID op_field_qualification kw_all; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID op_field_qualification kw_all; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; name = ID; type_name = ID; factor_exp = kw_new type_name; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID op_field_qualification kw_all; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; type_name = ID; factor_exp = kw_new type_name; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID op_field_qualification kw_all; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID op_field_qualification kw_all opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; type_name = ID; factor_exp = kw_new type_name; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID op_field_qualification kw_all; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; con_list_more = dis_range; con_list = con_list_more; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; array_def = kw_array op_left_bracket con_list op_right_bracket kw_of type_or_sub; type_def = array_def; type_dec_st = kw_type ID kw_is type_def de_semicolon; dec_stmt = type_dec_st; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; proc_designator = ID; formal_opt = ; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; opt_decl = ; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; opt_decl = ; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_decl = ; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; opt_decl = ; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; opt_decl = ; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; opt_decl = ; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = kw_constant; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; init_opt = op_assign expr; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; con_list_more = dis_range; con_list = con_list_more; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; array_def = kw_array op_left_bracket con_list op_right_bracket kw_of type_or_sub; type_def = array_def; type_dec_st = kw_type ID kw_is type_def de_semicolon; dec_stmt = type_dec_st; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; proc_designator = ID; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ID; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; proc_designator = ID; id_list_more = ID; id_list = id_list_more; mode = kw_in; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; end_if = kw_else stmt_list kw_end kw_if de_semicolon; else_if = end_if; if_st = kw_if expr kw_then stmt_list else_if; statement = if_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = ID; formal_opt = ; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = ID; formal_opt = ; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = log_exp kw_and rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = log_exp kw_and kw_then rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = log_exp kw_or kw_else rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = log_exp kw_or kw_else rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; when_list = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; choice = expr; choice_list = choice; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; when_list = when_list kw_when choice_list de_arrow stmt_list; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; choice = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; choice = add_exp de_dot_dot add_exp; choice_list = choice; choice_list = choice de_pipe choice_list; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; when_list = when_list kw_when choice_list de_arrow stmt_list; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; others = kw_when kw_others de_arrow stmt_list; case_st = kw_case expr kw_is when_list others kw_end kw_case de_semicolon; statement = case_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; when_list = ; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; others = kw_when kw_others de_arrow stmt_list; case_st = kw_case expr kw_is when_list others kw_end kw_case de_semicolon; statement = case_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; when_list = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; choice = add_exp de_dot_dot add_exp; choice_list = choice; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; when_list = when_list kw_when choice_list de_arrow stmt_list; others = ; case_st = kw_case expr kw_is when_list others kw_end kw_case de_semicolon; statement = case_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; when_list = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; choice = add_exp de_dot_dot add_exp; choice_list = choice; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; when_list = when_list kw_when choice_list de_arrow stmt_list; others = ; case_st = kw_case expr kw_is when_list others kw_end kw_case de_semicolon; statement = case_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; when_list = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; choice = add_exp de_dot_dot add_exp; choice_list = choice; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; when_list = when_list kw_when choice_list de_arrow stmt_list; others = ; case_st = kw_case expr kw_is when_list others kw_end kw_case de_semicolon; statement = case_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; when_list = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; choice = add_exp de_dot_dot add_exp; choice_list = choice; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; when_list = when_list kw_when choice_list de_arrow stmt_list; others = ; case_st = kw_case expr kw_is when_list others kw_end kw_case de_semicolon; statement = case_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; when_list = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; choice = add_exp de_dot_dot add_exp; choice_list = choice; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; when_list = when_list kw_when choice_list de_arrow stmt_list; others = ; case_st = kw_case expr kw_is when_list others kw_end kw_case de_semicolon; statement = case_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; when_list = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; choice = add_exp de_dot_dot add_exp; choice_list = choice; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; when_list = when_list kw_when choice_list de_arrow stmt_list; others = ; case_st = kw_case expr kw_is when_list others kw_end kw_case de_semicolon; statement = case_st; stmt_star = stmt_star statement; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; when_list = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; choice = add_exp de_dot_dot add_exp; choice_list = choice; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; when_list = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; choice = add_exp de_dot_dot add_exp; choice_list = choice; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; when_list = when_list kw_when choice_list de_arrow stmt_list; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; choice = add_exp de_dot_dot add_exp; choice_list = choice; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; when_list = when_list kw_when choice_list de_arrow stmt_list; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; others = kw_when kw_others de_arrow stmt_list; case_st = kw_case expr kw_is when_list others kw_end kw_case de_semicolon; statement = case_st; stmt_star = stmt_star statement; stmt_list = stmt_star; when_list = when_list kw_when choice_list de_arrow stmt_list; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; others = kw_when kw_others de_arrow stmt_list; case_st = kw_case expr kw_is when_list others kw_end kw_case de_semicolon; statement = case_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; when_list = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; choice = expr; choice_list = choice; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; when_list = when_list kw_when choice_list de_arrow stmt_list; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; others = kw_when kw_others de_arrow stmt_list; case_st = kw_case expr kw_is when_list others kw_end kw_case de_semicolon; statement = case_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; when_list = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; choice = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; choice = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; choice = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; choice = expr; choice_list = choice; choice_list = choice de_pipe choice_list; choice_list = choice de_pipe choice_list; choice_list = choice de_pipe choice_list; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; when_list = when_list kw_when choice_list de_arrow stmt_list; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; choice = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; choice = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; choice = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; choice = expr; choice_list = choice; choice_list = choice de_pipe choice_list; choice_list = choice de_pipe choice_list; choice_list = choice de_pipe choice_list; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; when_list = when_list kw_when choice_list de_arrow stmt_list; others = ; case_st = kw_case expr kw_is when_list others kw_end kw_case de_semicolon; statement = case_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ID; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; body_dec_list = ; func_designator = ID; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ; p_spec_or_body = kw_body package_ID kw_is use_opt body_dec_list kw_begin stmt_list exception_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; body_dec_list = ; func_designator = ID; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_lt add_exp; log_exp = rel_exp; expr = log_exp; stmt_star = ; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = n_sufx_list name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; name_suffix = op_field_qualification ID; n_sufx_list = n_sufx_list name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; end_if = kw_end kw_if de_semicolon; else_if = end_if; if_st = kw_if expr kw_then stmt_list else_if; statement = if_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; exception_opt = ; id_option = ; p_spec_or_body = kw_body package_ID kw_is use_opt body_dec_list exception_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; package_ID = ID; use_opt = ; body_dec_list = ; stmt_star = ; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = n_sufx_list name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ; p_spec_or_body = kw_body package_ID kw_is use_opt body_dec_list kw_begin stmt_list exception_opt kw_end id_option de_semicolon; compilation = compilation prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; opt_decl = ; stmt_star = ; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; use_opt = ; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; init_opt = op_assign expr; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; use_opt = ; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; raise_st = kw_raise name de_semicolon; statement = raise_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; id_list_more = ID; id_list = id_list_more; exception_dec_st = id_list de_colon kw_exception de_semicolon; dec_stmt = exception_dec_st; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; proc_designator = ID; formal_opt = ; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; raise_st = kw_raise name de_semicolon; statement = raise_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; raise_st = kw_raise name de_semicolon; statement = raise_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; use_opt = ; body_dec_list = ; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; name = ID; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; raise_st = kw_raise name de_semicolon; statement = raise_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; raise_st = kw_raise name de_semicolon; statement = raise_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; proc_designator = ID; formal_opt = ; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; proc_designator = ID; formal_opt = ; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; stmt_star = ; use_opt = ; body_dec_list = ; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; use_opt = ; body_dec_list = ; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; raise_st = kw_raise name de_semicolon; statement = raise_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; exception_opt = ; body_opt = kw_body use_opt body_dec_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; proc_designator = ID; formal_opt = ; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; proc_designator = ID; formal_opt = ; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; stmt_star = ; use_opt = ; body_dec_list = ; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; use_opt = ; body_dec_list = ; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; raise_st = kw_raise name de_semicolon; statement = raise_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; exception_opt = ; body_opt = kw_body use_opt body_dec_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = compilation prag_list kw_package p_spec_or_body; prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; proc_designator = ID; formal_opt = ; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; proc_designator = ID; formal_opt = ; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; stmt_star = ; use_opt = ; body_dec_list = ; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; use_opt = ; body_dec_list = ; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; raise_st = kw_raise name de_semicolon; statement = raise_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; exceptions = kw_exception handler_list; exception_opt = exceptions; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; exception_opt = ; body_opt = kw_body use_opt body_dec_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = compilation prag_list kw_package p_spec_or_body; prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; proc_designator = ID; formal_opt = ; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; proc_designator = ID; formal_opt = ; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; stmt_star = ; use_opt = ; body_dec_list = ; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; use_opt = ; body_dec_list = ; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; raise_st = kw_raise name de_semicolon; statement = raise_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; exceptions = kw_exception handler_list; exception_opt = exceptions; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; exceptions = kw_exception handler_list; exception_opt = exceptions; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = compilation prag_list kw_package p_spec_or_body; prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name_suffix = op_field_qualification ID; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = compilation prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; id_list_more = ID; id_list = id_list_more; exception_dec_st = id_list de_colon kw_exception de_semicolon; dec_stmt = exception_dec_st; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; proc_designator = ID; formal_opt = ; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; raise_st = kw_raise name de_semicolon; statement = raise_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_decl = ; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; raise_st = kw_raise name de_semicolon; statement = raise_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; raise_st = kw_raise name de_semicolon; statement = raise_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; use_opt = ; body_dec_list = ; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; name = ID; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; raise_st = kw_raise name de_semicolon; statement = raise_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; func_designator = ID; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; opt_decl = ; stmt_star = ; opt_decl = ; stmt_star = ; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_decl = ; stmt_star = ; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; unary_exp = op_minus unary_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; unary_exp = op_minus unary_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; unary_exp = op_minus unary_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_eq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; unary_exp = op_minus unary_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_neq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_eq add_exp; log_exp = rel_exp; expr = log_exp; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; end_if = kw_else stmt_list kw_end kw_if de_semicolon; else_if = end_if; if_st = kw_if expr kw_then stmt_list else_if; statement = if_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_neq add_exp; log_exp = rel_exp; expr = log_exp; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; end_if = kw_else stmt_list kw_end kw_if de_semicolon; else_if = end_if; if_st = kw_if expr kw_then stmt_list else_if; statement = if_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_gt add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_gt add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_gteq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_gteq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_gteq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_lt add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_lt add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_lteq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_lteq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_lteq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; stmt_star = ; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; stmt_star = ; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; stmt_star = ; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; end_if = kw_else stmt_list kw_end kw_if de_semicolon; else_if = end_if; else_if = kw_elsif expr kw_then stmt_list else_if; if_st = kw_if expr kw_then stmt_list else_if; statement = if_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; end_if = kw_end kw_if de_semicolon; else_if = end_if; if_st = kw_if expr kw_then stmt_list else_if; statement = if_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ID; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; unary_exp = op_minus unary_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; unary_exp = op_minus unary_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_eq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; unary_exp = op_minus unary_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_neq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_eq add_exp; log_exp = rel_exp; expr = log_exp; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; end_if = kw_else stmt_list kw_end kw_if de_semicolon; else_if = end_if; if_st = kw_if expr kw_then stmt_list else_if; statement = if_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_neq add_exp; log_exp = rel_exp; expr = log_exp; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; end_if = kw_else stmt_list kw_end kw_if de_semicolon; else_if = end_if; if_st = kw_if expr kw_then stmt_list else_if; statement = if_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_gt add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_gt add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_gteq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_gteq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_gteq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_lt add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_lt add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_lteq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_lteq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_lteq add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; enum_def = op_left_bracket id_list op_right_bracket; type_def = enum_def; type_dec_st = kw_type ID kw_is type_def de_semicolon; dec_stmt = type_dec_st; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; range_constraint = kw_range range; sub_def_range_const = range_constraint; sub_def = sub_def_range_const; sub_type = sub_def; sub_dec_st = kw_subtype ID kw_is sub_type de_semicolon; dec_stmt = sub_dec_st; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; adv_loop = kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; exit_st = kw_exit de_semicolon; statement = exit_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; adv_loop = kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; exit_st = kw_exit kw_when expr de_semicolon; statement = exit_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; adv_loop = kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; exit_st = kw_exit kw_when expr de_semicolon; statement = exit_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; exit_st = kw_exit de_semicolon; statement = exit_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; adv_loop = kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; adv_loop = kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; exit_st = kw_exit ID de_semicolon; statement = exit_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = ID de_colon loop_body; statement = loop_st; stmt_star = stmt_star statement; adv_loop = kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; adv_loop = kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; exit_st = kw_exit ID kw_when expr de_semicolon; statement = exit_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = ID de_colon loop_body; statement = loop_st; stmt_star = stmt_star statement; adv_loop = kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; adv_loop = kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; exit_st = kw_exit ID kw_when expr de_semicolon; statement = exit_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; exit_st = kw_exit de_semicolon; statement = exit_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; exit_st = kw_exit de_semicolon; statement = exit_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = ID de_colon loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; adv_loop = kw_while expr kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; exit_st = kw_exit de_semicolon; statement = exit_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; adv_loop = kw_while expr kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; exit_st = kw_exit de_semicolon; statement = exit_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; adv_loop = kw_while expr kw_loop; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in kw_reverse dis_range kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in kw_reverse dis_range kw_loop; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; exit_st = kw_exit de_semicolon; statement = exit_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in kw_reverse dis_range kw_loop; stmt_star = ; exit_st = kw_exit de_semicolon; statement = exit_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; type_name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; range_constraint = kw_range range; sub_def_range_const = type_name range_constraint; sub_type_no_index = sub_def_range_const; dis_range = sub_type_no_index; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; exit_st = kw_exit ID de_semicolon; statement = exit_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = ID de_colon loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; range_constraint = kw_range range; sub_def_range_const = range_constraint; sub_type_no_index = sub_def_range_const; dis_range = sub_type_no_index; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; use_opt = ; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; exit_st = kw_exit de_semicolon; statement = exit_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; type_name = ID; sub_type_no_index = type_name; dis_range = sub_type_no_index; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; use_opt = ; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; use_opt = ; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; exit_st = kw_exit kw_when expr de_semicolon; statement = exit_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; use_opt = ; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; exit_st = kw_exit ID kw_when expr de_semicolon; statement = exit_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = ID de_colon loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ID; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; spec_dec = dec_stmt; spec_dec_list = spec_dec_list spec_dec; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; spec_dec = dec_stmt; spec_dec_list = spec_dec_list spec_dec; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; spec_dec = dec_stmt; spec_dec_list = spec_dec_list spec_dec; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; spec_dec = dec_stmt; spec_dec_list = spec_dec_list spec_dec; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; spec_dec = dec_stmt; spec_dec_list = spec_dec_list spec_dec; private_opt = ; use_opt = ; body_dec_list = ; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; unary_exp = op_minus unary_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; unary_exp = op_minus unary_exp; unary_exp = kw_abs unary_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; body_dec_list = ; func_designator = ID; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; stmt_list = stmt_star; exception_opt = ; id_option = ; p_spec_or_body = kw_body package_ID kw_is use_opt body_dec_list kw_begin stmt_list exception_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; package_ID = ID; id_list_more = ID; id_list = id_list_more; use_opt = kw_use id_list de_semicolon; body_dec_list = ; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; factor_exp = op_left_bracket expr op_right_bracket; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; factor_exp = op_left_bracket expr op_right_bracket; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; factor_exp = op_left_bracket expr op_right_bracket; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; factor_exp = op_left_bracket expr op_right_bracket; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; factor_exp = op_left_bracket expr op_right_bracket; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; unary_exp = op_minus unary_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; factor_exp = op_left_bracket expr op_right_bracket; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ; p_spec_or_body = kw_body package_ID kw_is use_opt body_dec_list kw_begin stmt_list exception_opt kw_end id_option de_semicolon; compilation = compilation prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; func_designator = lit_string; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec_list de_semicolon param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; name_suffix = op_field_qualification lit_string; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = n_sufx_list name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = lit_string; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec_list de_semicolon param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; name_suffix = op_field_qualification lit_string; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = n_sufx_list name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = lit_string; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec_list de_semicolon param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; name_suffix = op_field_qualification lit_string; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = n_sufx_list name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = lit_string; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec_list de_semicolon param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; name_suffix = op_field_qualification lit_string; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = n_sufx_list name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = lit_string; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec_list de_semicolon param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; init_opt = op_assign expr; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; func_designator = lit_string; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec_list de_semicolon param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_eq add_exp; log_exp = rel_exp; expr = log_exp; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_cat sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_cat sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; end_if = kw_else stmt_list kw_end kw_if de_semicolon; else_if = end_if; if_st = kw_if expr kw_then stmt_list else_if; statement = if_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = lit_string; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec_list de_semicolon param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; name_suffix = op_field_qualification lit_string; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = n_sufx_list name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; factor_exp = op_left_bracket expr op_right_bracket; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; factor_exp = op_left_bracket expr op_right_bracket; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_div unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = add_exp op_cat sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = kw_constant; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; init_opt = op_assign expr; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; spec_dec = dec_stmt; spec_dec_list = spec_dec_list spec_dec; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; con_list_more = dis_range; con_list = con_list_more; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; array_def = kw_array op_left_bracket con_list op_right_bracket kw_of type_or_sub; type_def = array_def; type_dec_st = kw_type ID kw_is type_def de_semicolon; dec_stmt = type_dec_st; spec_dec = dec_stmt; spec_dec_list = spec_dec_list spec_dec; func_designator = ID; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; id_list_more = ID; id_list = id_list_more; mode = kw_in kw_out; param_dec = id_list de_colon mode ID; param_dec_list = param_dec_list de_semicolon param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; sub_pro_dec_st = sub_pro_spec de_semicolon; dec_stmt = sub_pro_dec_st; spec_dec = dec_stmt; spec_dec_list = spec_dec_list spec_dec; func_designator = ID; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; id_list_more = ID; id_list = id_list_more; mode = kw_in kw_out; param_dec = id_list de_colon mode ID; param_dec_list = param_dec_list de_semicolon param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; sub_pro_dec_st = sub_pro_spec de_semicolon; dec_stmt = sub_pro_dec_st; spec_dec = dec_stmt; spec_dec_list = spec_dec_list spec_dec; proc_designator = ID; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; id_list_more = ID; id_list = id_list_more; mode = kw_in kw_out; param_dec = id_list de_colon mode ID; param_dec_list = param_dec_list de_semicolon param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_procedure proc_designator formal_opt; sub_pro_dec_st = sub_pro_spec de_semicolon; dec_stmt = sub_pro_dec_st; spec_dec = dec_stmt; spec_dec_list = spec_dec_list spec_dec; private_opt = ; body_opt = ; id_option = ID; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; package_ID = ID; use_opt = ; body_dec_list = ; func_designator = ID; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; id_list_more = ID; id_list = id_list_more; mode = kw_in kw_out; param_dec = id_list de_colon mode ID; param_dec_list = param_dec_list de_semicolon param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_gt add_exp; log_exp = rel_exp; expr = log_exp; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_lt add_exp; log_exp = rel_exp; expr = log_exp; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; end_if = kw_end kw_if de_semicolon; else_if = end_if; else_if = kw_elsif expr kw_then stmt_list else_if; if_st = kw_if expr kw_then stmt_list else_if; statement = if_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ID; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; id_list_more = ID; id_list = id_list_more; mode = kw_in kw_out; param_dec = id_list de_colon mode ID; param_dec_list = param_dec_list de_semicolon param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; init_opt = op_assign expr; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; init_opt = op_assign expr; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; adv_loop = kw_loop; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_lt add_exp; log_exp = rel_exp; expr = log_exp; adv_loop = kw_while expr kw_loop; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_gteq add_exp; log_exp = rel_exp; expr = log_exp; adv_loop = kw_while expr kw_loop; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_gt add_exp; log_exp = rel_exp; expr = log_exp; exit_st = kw_exit kw_when expr de_semicolon; statement = exit_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ID; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; proc_designator = ID; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; id_list_more = ID; id_list = id_list_more; mode = kw_in kw_out; param_dec = id_list de_colon mode ID; param_dec_list = param_dec_list de_semicolon param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_neq add_exp; log_exp = rel_exp; expr = log_exp; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_minus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; stmt_list = stmt_star; end_if = kw_end kw_if de_semicolon; else_if = end_if; if_st = kw_if expr kw_then stmt_list else_if; statement = if_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ID; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; null_st = kw_null de_semicolon; statement = null_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ID; p_spec_or_body = kw_body package_ID kw_is use_opt body_dec_list kw_begin stmt_list exception_opt kw_end id_option de_semicolon; compilation = compilation prag_list kw_package p_spec_or_body; prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; body_opt = ; id_option = ID; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = compilation prag_list kw_package p_spec_or_body; prag_list = ; package_ID = ID; id_list_more = ID; id_list = id_list_more; use_opt = kw_use id_list de_semicolon; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; proc_designator = ID; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; stmt_star = ; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ID; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; factor_exp = op_left_bracket expr op_right_bracket; unary_exp = factor_exp; mult_exp = unary_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; factor_exp = op_left_bracket expr op_right_bracket; unary_exp = factor_exp; mult_exp = mult_exp op_mult unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_plus sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; factor_exp = op_left_bracket expr op_right_bracket; unary_exp = factor_exp; mult_exp = unary_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = mult_exp kw_mod unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; name = ID n_sufx_list; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_option = ; p_spec_or_body = kw_body package_ID kw_is use_opt body_dec_list kw_begin stmt_list exception_opt kw_end id_option de_semicolon; compilation = compilation prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; enum_def = op_left_bracket id_list op_right_bracket; type_def = enum_def; type_dec_st = kw_type ID kw_is type_def de_semicolon; dec_stmt = type_dec_st; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; range_constraint = kw_range range; sub_def_range_const = range_constraint; sub_def = sub_def_range_const; sub_type = sub_def; sub_dec_st = kw_subtype ID kw_is sub_type de_semicolon; dec_stmt = sub_dec_st; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; proc_designator = ID; formal_opt = ; sub_pro_spec = kw_procedure proc_designator formal_opt; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; init_opt = op_assign expr; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; call_st = name de_semicolon; statement = call_st; stmt_star = stmt_star statement; use_opt = ; body_dec_list = ; type_name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; range_constraint = kw_range range; sub_def_range_const = type_name range_constraint; sub_def = sub_def_range_const; sub_type = sub_def; sub_dec_st = kw_subtype ID kw_is sub_type de_semicolon; dec_stmt = sub_dec_st; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; opt_decl = kw_declare use_opt body_dec_list; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; id_option = ; block_st = opt_decl kw_begin stmt_list exception_opt kw_end id_option de_semicolon; statement = block_st; stmt_star = stmt_star statement; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; handler_list = ; name = ID; h_name_list = name; stmt_star = ; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; hand_options = h_name_list de_arrow stmt_list; handler_list = handler_list kw_when hand_options; exceptions = kw_exception handler_list; exception_opt = exceptions; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; func_designator = ID; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_cat sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_cat sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; func_designator = ID; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec; id_list_more = ID; id_list = id_list_more; mode = ; param_dec = id_list de_colon mode ID; param_dec_list = param_dec_list de_semicolon param_dec; formal_opt = op_left_bracket param_dec_list op_right_bracket; sub_pro_spec = kw_function func_designator formal_opt kw_return ID; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; range = add_exp de_dot_dot add_exp; dis_range = range; adv_loop = kw_for ID kw_in dis_range kw_loop; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp op_eq add_exp; log_exp = rel_exp; expr = log_exp; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; stmt_star = ; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_cat sign_exp; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_cat sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; stmt_list = stmt_star; end_if = kw_else stmt_list kw_end kw_if de_semicolon; else_if = end_if; if_st = kw_if expr kw_then stmt_list else_if; statement = if_st; stmt_star = stmt_star statement; stmt_list = stmt_star; loop_body = adv_loop stmt_list kw_end kw_loop de_semicolon; loop_st = loop_body; statement = loop_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; return_st = kw_return expr de_semicolon; statement = return_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; id_opt = ; sub_body_dec = sub_pro_spec kw_is body_dec_list kw_begin stmt_list exception_opt kw_end id_opt de_semicolon; body_dec_st = sub_body_dec; body_dec_list = body_dec_list body_dec_st; stmt_star = ; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; id_list_more = ID; id_list = id_list_more; use_opt = kw_use id_list de_semicolon; body_dec_list = ; id_list_more = ID; id_list_more = id_list_more de_comma ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; init_opt = ; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; name = ID; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_cat sign_exp; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_cat sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = expr; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; params = params de_comma expr; name_suffix = op_left_bracket params op_right_bracket; n_sufx_list = name_suffix; opt_agg_suff = ; name_or_agg = ID n_sufx_list opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; name = ID; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; name = ID; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; assign_st = name op_assign expr de_semicolon; statement = assign_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = add_exp op_cat sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_name_list de_semicolon w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = compilation prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 prag_list = ; package_ID = ID; use_opt = ; spec_dec_list = ; private_opt = ; use_opt = ; body_dec_list = ; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; init_opt = op_assign expr; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; init_opt = op_assign expr; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; init_opt = op_assign expr; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; literal = lit_float; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; init_opt = op_assign expr; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; init_opt = op_assign expr; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; literal = lit_integer; factor_exp = literal; unary_exp = factor_exp; unary_exp = op_minus unary_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; init_opt = op_assign expr; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; id_list_more = ID; id_list = id_list_more; con_opt = ; overld_resolve_more = ID; overld_resolve = overld_resolve_more; typet = overld_resolve; type_or_sub = typet; literal = lit_string; factor_exp = literal; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; init_opt = op_assign expr; object_dec = id_list de_colon con_opt type_or_sub init_opt de_semicolon; dec_stmt = object_dec; body_dec_st = dec_stmt; body_dec_list = body_dec_list body_dec_st; stmt_star = ; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; opt_agg_suff = ; name_or_agg = ID opt_agg_suff; factor_exp = name_or_agg; unary_exp = factor_exp; mult_exp = unary_exp; sign_exp = mult_exp; add_exp = sign_exp; rel_exp = add_exp; log_exp = rel_exp; expr = log_exp; w_param = expr; w_name_list = w_param; write_st = kw_write op_left_bracket w_name_list op_right_bracket de_semicolon; statement = write_st; stmt_star = stmt_star statement; stmt_list = stmt_star; exception_opt = ; body_opt = kw_body use_opt body_dec_list kw_begin stmt_list exception_opt; id_option = ID; p_spec_or_body = package_ID kw_is use_opt spec_dec_list private_opt body_opt kw_end id_option de_semicolon; compilation = prag_list kw_package p_spec_or_body; prag_list = ; input = compilation prag_list; start = input; 0 #endif kelbt-0.15/CREDITS0000664000175000017500000000050511261244247014123 0ustar thurstonthurston Kelbt Backtracking Parser Generator =================================== Kelbt was written by Adrian Thurston Thanks to the following people for feedback and fixes. Steve Horne, Gilles J. Séguin, Josef Goettgens, David Keller, Diego 'Flameeyes' Pettenò kelbt-0.15/TODO0000664000175000017500000000051010706505341013565 0ustar thurstonthurstonShould be possible to define a nonterminal type as some kind of simple type, As it is, the user is forced to make it into a structure which is referenced by a pointer. Should also be possible to set the default type for all nonterminals. The parse tables use up a lot of static memory. Need a compressed table representation. kelbt-0.15/aapl/0000775000175000017500000000000011707046233014020 5ustar thurstonthurstonkelbt-0.15/aapl/quicksort.h0000664000175000017500000001145711072514631016222 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_QUICKSORT_H #define _AAPL_QUICKSORT_H #include "insertsort.h" #ifdef AAPL_NAMESPACE namespace Aapl { #endif /** * \addtogroup sort * @{ */ /** * \class QuickSort * \brief Quick sort an array of data. * * QuickSort can be used to sort any array of objects of type T provided a * compare class is given. QuickSort is in-place. It does not require any * temporary storage. * * Objects are not made aware that they are being moved around in memory. * Assignment operators, constructors and destructors are never invoked by the * sort. * * QuickSort runs in O(n*log(n)) time in the average case. It is faster than * mergsort in the average case because it does less moving of data. The * performance of quicksort depends mostly on the choice of pivot. This * implementation picks the pivot as the median of first, middle, last. This * choice of pivot avoids the O(n^2) worst case for input already sorted, but * it is still possible to encounter the O(n^2) worst case. For example an * array of identical elements will run in O(n^2) * * QuickSort is not a stable sort. Elements with the same key will not have * their relative ordering preserved. QuickSort switches to an InsertSort * when the size of the array being sorted is small. This happens when * directly sorting a small array or when QuickSort calls iteself recursively * on a small portion of a larger array. */ /*@}*/ /* QuickSort. */ template class QuickSort : public InsertSort { public: /* Sorting interface routine. */ void sort(T *data, long len); private: /* Recursive worker. */ void doSort(T *start, T *end); T *partition(T *start, T *end); inline T *median(T *start, T *end); }; #define _QS_INSERTION_THRESH 16 /* Finds the median of start, middle, end. */ template T *QuickSort:: median(T *start, T *end) { T *pivot, *mid = start + (end-start)/2; /* CChoose the pivot. */ if ( compare(*start, *mid) < 0 ) { if ( compare(*mid, *end) < 0 ) pivot = mid; else if ( compare(*start, *end) < 0 ) pivot = end; else pivot = start; } else if ( compare(*start, *end) < 0 ) pivot = start; else if ( compare(*mid, *end) < 0 ) pivot = end; else pivot = mid; return pivot; } template T *QuickSort:: partition(T *start, T *end) { /* Use the median of start, middle, end as the pivot. First save * it off then move the last element to the free spot. */ char pcPivot[sizeof(T)]; T *pivot = median(start, end); memcpy( pcPivot, pivot, sizeof(T) ); if ( pivot != end ) memcpy( pivot, end, sizeof(T) ); T *first = start-1; T *last = end; pivot = (T*) pcPivot; /* Shuffle element to the correct side of the pivot, ending * up with the free spot where the pivot will go. */ while ( true ) { /* Throw one element ahead to the free spot at last. */ while ( true ) { first += 1; if ( first == last ) goto done; if ( compare( *first, *pivot ) > 0 ) { memcpy(last, first, sizeof(T)); break; } } /* Throw one element back to the free spot at first. */ while ( true ) { last -= 1; if ( last == first ) goto done; if ( compare( *last, *pivot ) < 0 ) { memcpy(first, last, sizeof(T)); break; } } } done: /* Put the pivot into the middle spot for it. */ memcpy( first, pivot, sizeof(T) ); return first; } template< class T, class Compare> void QuickSort:: doSort(T *start, T *end) { long len = end - start + 1; if ( len > _QS_INSERTION_THRESH ) { /* Use quicksort. */ T *pivot = partition( start, end ); doSort(start, pivot-1); doSort(pivot+1, end); } else if ( len > 1 ) { /* Array is small, use insertion sort. */ InsertSort::sort( start, len ); } } /** * \brief Quick sort an array of data. */ template< class T, class Compare> void QuickSort::sort(T *data, long len) { /* Call recursive worker. */ doSort(data, data+len-1); } #ifdef AAPL_NAMESPACE } #endif #endif /* _AAPL_QUICKSORT_H */ kelbt-0.15/aapl/bstset.h0000664000175000017500000000474511072514631015504 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_BSTSET_H #define _AAPL_BSTSET_H /** * \addtogroup bst * @{ */ /** * \class BstSet * \brief Binary search table for types that are the key. * * BstSet is suitable for types that comprise the entire key. Rather than look * into the element to retrieve the key, the element is the key. A class that * contains a comparison routine for the key must be given. */ /*@}*/ #include "compare.h" #include "vector.h" #define BST_TEMPL_DECLARE class Key, class Compare = CmpOrd, \ class Resize = ResizeExpn #define BST_TEMPL_DEF class Key, class Compare, class Resize #define BST_TEMPL_USE Key, Compare, Resize #define GET_KEY(el) (el) #define BstTable BstSet #define Element Key #define BSTSET #include "bstcommon.h" #undef BST_TEMPL_DECLARE #undef BST_TEMPL_DEF #undef BST_TEMPL_USE #undef GET_KEY #undef BstTable #undef Element #undef BSTSET /** * \fn BstSet::insert(const Key &key, Key **lastFound) * \brief Insert the given key. * * If the given key does not already exist in the table then it is inserted. * The key's copy constructor is used to place the item in the table. If * lastFound is given, it is set to the new entry created. If the insert fails * then lastFound is set to the existing key of the same value. * * \returns The new element created upon success, null upon failure. */ /** * \fn BstSet::insertMulti(const Key &key) * \brief Insert the given key even if it exists already. * * If the key exists already then it is placed next to some other key of the * same value. InsertMulti cannot fail. The key's copy constructor is used to * place the item in the table. * * \returns The new element created. */ #endif /* _AAPL_BSTSET_H */ kelbt-0.15/aapl/dlist.h0000664000175000017500000000360711072514631015313 0ustar thurstonthurston/* * Copyright 2001 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_DLIST_H #define _AAPL_DLIST_H #define BASE_EL(name) name #define DLMEL_TEMPDEF class Element #define DLMEL_TEMPUSE Element #define DList DList /** * \addtogroup dlist * @{ */ /** * \class DList * \brief Basic doubly linked list. * * DList is the standard by-structure list type. This class requires the * programmer to declare a list element type that has the necessary next and * previous pointers in it. This can be achieved by inheriting from the * DListEl class or by simply adding next and previous pointers directly into * the list element class. * * DList does not assume ownership of elements in the list. If the elements * are known to reside on the heap, the provided empty() routine can be used to * delete all elements, however the destructor will not call this routine, it * will simply abandon all the elements. It is up to the programmer to * explicitly de-allocate items when necessary. * * \include ex_dlist.cpp */ /*@}*/ #include "dlcommon.h" #undef BASE_EL #undef DLMEL_TEMPDEF #undef DLMEL_TEMPUSE #undef DList #endif /* _AAPL_DLIST_H */ kelbt-0.15/aapl/avlcommon.h0000664000175000017500000011633111072514631016166 0ustar thurstonthurston/* * Copyright 2001 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* This header is not wrapped in ifndef becuase it is not intended to * be included by the user. */ #include #ifdef AAPL_NAMESPACE namespace Aapl { #endif #ifdef WALKABLE /* This is used by AvlTree, AvlMel and AvlMelKey so it * must be protected by global ifdefs. */ #ifndef __AAPL_AVLI_EL__ #define __AAPL_AVLI_EL__ /** * \brief Tree element properties for linked AVL trees. * * AvliTreeEl needs to be inherited by classes that intend to be element in an * AvliTree. */ template struct AvliTreeEl { /** * \brief Tree pointers connecting element in a tree. */ SubClassEl *left, *right, *parent; /** * \brief Linked list pointers. */ SubClassEl *prev, *next; /** * \brief Height of the tree rooted at this element. * * Height is required by the AVL balancing algorithm. */ long height; }; #endif /* __AAPL_AVLI_EL__ */ #else /* not WALKABLE */ /* This is used by All the non walkable trees so it must be * protected by a global ifdef. */ #ifndef __AAPL_AVL_EL__ #define __AAPL_AVL_EL__ /** * \brief Tree element properties for linked AVL trees. * * AvlTreeEl needs to be inherited by classes that intend to be element in an * AvlTree. */ template struct AvlTreeEl { /** * \brief Tree pointers connecting element in a tree. */ SubClassEl *left, *right, *parent; /** * \brief Height of the tree rooted at this element. * * Height is required by the AVL balancing algorithm. */ long height; }; #endif /* __AAPL_AVL_EL__ */ #endif /* def WALKABLE */ #if defined( AVLTREE_MAP ) #ifdef WALKABLE /** * \brief Tree element for AvliMap * * Stores the key and value pair. */ template struct AvliMapEl : public AvliTreeEl< AvliMapEl > { AvliMapEl(const Key &key) : key(key) { } AvliMapEl(const Key &key, const Value &value) : key(key), value(value) { } const Key &getKey() const { return key; } /** \brief The key. */ Key key; /** \brief The value. */ Value value; }; #else /* not WALKABLE */ /** * \brief Tree element for AvlMap * * Stores the key and value pair. */ template struct AvlMapEl : public AvlTreeEl< AvlMapEl > { AvlMapEl(const Key &key) : key(key) { } AvlMapEl(const Key &key, const Value &value) : key(key), value(value) { } const Key &getKey() const { return key; } /** \brief The key. */ Key key; /** \brief The value. */ Value value; }; #endif /* def WALKABLE */ #elif defined( AVLTREE_SET ) #ifdef WALKABLE /** * \brief Tree element for AvliSet * * Stores the key. */ template struct AvliSetEl : public AvliTreeEl< AvliSetEl > { AvliSetEl(const Key &key) : key(key) { } const Key &getKey() const { return key; } /** \brief The key. */ Key key; }; #else /* not WALKABLE */ /** * \brief Tree element for AvlSet * * Stores the key. */ template struct AvlSetEl : public AvlTreeEl< AvlSetEl > { AvlSetEl(const Key &key) : key(key) { } const Key &getKey() const { return key; } /** \brief The key. */ Key key; }; #endif /* def WALKABLE */ #endif /* AVLTREE_SET */ /* Common AvlTree Class */ template < AVLMEL_CLASSDEF > class AvlTree #if !defined( AVL_KEYLESS ) && defined ( WALKABLE ) : public Compare, public BASELIST #elif !defined( AVL_KEYLESS ) : public Compare #elif defined( WALKABLE ) : public BASELIST #endif { public: /** * \brief Create an empty tree. */ #ifdef WALKABLE AvlTree() : root(0), treeSize(0) { } #else AvlTree() : root(0), head(0), tail(0), treeSize(0) { } #endif /** * \brief Perform a deep copy of the tree. * * Each element is duplicated for the new tree. Copy constructors are used * to create the new elements. */ AvlTree(const AvlTree &other); #if defined( AVLTREE_MAP ) || defined( AVLTREE_SET ) /** * \brief Clear the contents of the tree. * * All element are deleted. */ ~AvlTree() { empty(); } /** * \brief Perform a deep copy of the tree. * * Each element is duplicated for the new tree. Copy constructors are used * to create the new element. If this tree contains items, they are first * deleted. * * \returns A reference to this. */ AvlTree &operator=( const AvlTree &tree ); /** * \brief Transfer the elements of another tree into this. * * First deletes all elements in this tree. */ void transfer( AvlTree &tree ); #else /** * \brief Abandon all elements in the tree. * * Tree elements are not deleted. */ ~AvlTree() {} /** * \brief Perform a deep copy of the tree. * * Each element is duplicated for the new tree. Copy constructors are used * to create the new element. If this tree contains items, they are * abandoned. * * \returns A reference to this. */ AvlTree &operator=( const AvlTree &tree ); /** * \brief Transfer the elements of another tree into this. * * All elements in this tree are abandoned first. */ void transfer( AvlTree &tree ); #endif #ifndef AVL_KEYLESS /* Insert a element into the tree. */ Element *insert( Element *element, Element **lastFound = 0 ); #ifdef AVL_BASIC /* Find a element in the tree. Returns the element if * element exists, false otherwise. */ Element *find( const Element *element ) const; #else Element *insert( const Key &key, Element **lastFound = 0 ); #ifdef AVLTREE_MAP Element *insert( const Key &key, const Value &val, Element **lastFound = 0 ); #endif /* Find a element in the tree. Returns the element if * key exists, false otherwise. */ Element *find( const Key &key ) const; /* Detach a element from the tree. */ Element *detach( const Key &key ); /* Detach and delete a element from the tree. */ bool remove( const Key &key ); #endif /* AVL_BASIC */ #endif /* AVL_KEYLESS */ /* Detach a element from the tree. */ Element *detach( Element *element ); /* Detach and delete a element from the tree. */ void remove( Element *element ); /* Free all memory used by tree. */ void empty(); /* Abandon all element in the tree. Does not delete element. */ void abandon(); /** Root element of the tree. */ Element *root; #ifndef WALKABLE Element *head, *tail; #endif /** The number of element in the tree. */ long treeSize; /** \brief Return the number of elements in the tree. */ long length() const { return treeSize; } /** \brief Return the number of elements in the tree. */ long size() const { return treeSize; } /* Various classes for setting the iterator */ struct Iter; struct IterFirst { IterFirst( const AvlTree &t ) : t(t) { } const AvlTree &t; }; struct IterLast { IterLast( const AvlTree &t ) : t(t) { } const AvlTree &t; }; struct IterNext { IterNext( const Iter &i ) : i(i) { } const Iter &i; }; struct IterPrev { IterPrev( const Iter &i ) : i(i) { } const Iter &i; }; #ifdef WALKABLE /** * \brief Avl Tree Iterator. * \ingroup iterators */ struct Iter { /* Default construct. */ Iter() : ptr(0) { } /* Construct from an avl tree and iterator-setting classes. */ Iter( const AvlTree &t ) : ptr(t.head) { } Iter( const IterFirst &af ) : ptr(af.t.head) { } Iter( const IterLast &al ) : ptr(al.t.tail) { } Iter( const IterNext &an ) : ptr(findNext(an.i.ptr)) { } Iter( const IterPrev &ap ) : ptr(findPrev(ap.i.ptr)) { } /* Assign from a tree and iterator-setting classes. */ Iter &operator=( const AvlTree &tree ) { ptr = tree.head; return *this; } Iter &operator=( const IterFirst &af ) { ptr = af.t.head; return *this; } Iter &operator=( const IterLast &al ) { ptr = al.t.tail; return *this; } Iter &operator=( const IterNext &an ) { ptr = findNext(an.i.ptr); return *this; } Iter &operator=( const IterPrev &ap ) { ptr = findPrev(ap.i.ptr); return *this; } /** \brief Less than end? */ bool lte() const { return ptr != 0; } /** \brief At end? */ bool end() const { return ptr == 0; } /** \brief Greater than beginning? */ bool gtb() const { return ptr != 0; } /** \brief At beginning? */ bool beg() const { return ptr == 0; } /** \brief At first element? */ bool first() const { return ptr && ptr->BASE_EL(prev) == 0; } /** \brief At last element? */ bool last() const { return ptr && ptr->BASE_EL(next) == 0; } /** \brief Implicit cast to Element*. */ operator Element*() const { return ptr; } /** \brief Dereference operator returns Element&. */ Element &operator *() const { return *ptr; } /** \brief Arrow operator returns Element*. */ Element *operator->() const { return ptr; } /** \brief Move to next item. */ inline Element *operator++(); /** \brief Move to next item. */ inline Element *operator++(int); /** \brief Move to next item. */ inline Element *increment(); /** \brief Move to previous item. */ inline Element *operator--(); /** \brief Move to previous item. */ inline Element *operator--(int); /** \brief Move to previous item. */ inline Element *decrement(); /** \brief Return the next item. Does not modify this. */ IterNext next() const { return IterNext( *this ); } /** \brief Return the previous item. Does not modify this. */ IterPrev prev() const { return IterPrev( *this ); } private: static Element *findPrev( Element *element ) { return element->BASE_EL(prev); } static Element *findNext( Element *element ) { return element->BASE_EL(next); } public: /** \brief The iterator is simply a pointer. */ Element *ptr; }; #else /** * \brief Avl Tree Iterator. * \ingroup iterators */ struct Iter { /* Default construct. */ Iter() : ptr(0), tree(0) { } /* Construct from a tree and iterator-setting classes. */ Iter( const AvlTree &t ) : ptr(t.head), tree(&t) { } Iter( const IterFirst &af ) : ptr(af.t.head), tree(&af.t) { } Iter( const IterLast &al ) : ptr(al.t.tail), tree(&al.t) { } Iter( const IterNext &an ) : ptr(findNext(an.i.ptr)), tree(an.i.tree) { } Iter( const IterPrev &ap ) : ptr(findPrev(ap.i.ptr)), tree(ap.i.tree) { } /* Assign from a tree and iterator-setting classes. */ Iter &operator=( const AvlTree &t ) { ptr = t.head; tree = &t; return *this; } Iter &operator=( const IterFirst &af ) { ptr = af.t.head; tree = &af.t; return *this; } Iter &operator=( const IterLast &al ) { ptr = al.t.tail; tree = &al.t; return *this; } Iter &operator=( const IterNext &an ) { ptr = findNext(an.i.ptr); tree = an.i.tree; return *this; } Iter &operator=( const IterPrev &ap ) { ptr = findPrev(ap.i.ptr); tree = ap.i.tree; return *this; } /** \brief Less than end? */ bool lte() const { return ptr != 0; } /** \brief At end? */ bool end() const { return ptr == 0; } /** \brief Greater than beginning? */ bool gtb() const { return ptr != 0; } /** \brief At beginning? */ bool beg() const { return ptr == 0; } /** \brief At first element? */ bool first() const { return ptr && ptr == tree->head; } /** \brief At last element? */ bool last() const { return ptr && ptr == tree->tail; } /** \brief Implicit cast to Element*. */ operator Element*() const { return ptr; } /** \brief Dereference operator returns Element&. */ Element &operator *() const { return *ptr; } /** \brief Arrow operator returns Element*. */ Element *operator->() const { return ptr; } /** \brief Move to next item. */ inline Element *operator++(); /** \brief Move to next item. */ inline Element *operator++(int); /** \brief Move to next item. */ inline Element *increment(); /** \brief Move to previous item. */ inline Element *operator--(); /** \brief Move to previous item. */ inline Element *operator--(int); /** \brief Move to previous item. */ inline Element *decrement(); /** \brief Return the next item. Does not modify this. */ IterNext next() const { return IterNext( *this ); } /** \brief Return the previous item. Does not modify this. */ IterPrev prev() const { return IterPrev( *this ); } private: static Element *findPrev( Element *element ); static Element *findNext( Element *element ); public: /** \brief The iterator is simply a pointer. */ Element *ptr; /* The list is not walkable so we need to keep a pointerto the tree * so we can test against head and tail in O(1) time. */ const AvlTree *tree; }; #endif /** \brief Return first element. */ IterFirst first() { return IterFirst( *this ); } /** \brief Return last element. */ IterLast last() { return IterLast( *this ); } protected: /* Recursive worker for the copy constructor. */ Element *copyBranch( Element *element ); /* Recursively delete element in the tree. */ void deleteChildrenOf(Element *n); /* rebalance the tree beginning at the leaf whose * grandparent is unbalanced. */ Element *rebalance(Element *start); /* Move up the tree from a given element, recalculating the heights. */ void recalcHeights(Element *start); /* Move up the tree and find the first element whose * grand-parent is unbalanced. */ Element *findFirstUnbalGP(Element *start); /* Move up the tree and find the first element which is unbalanced. */ Element *findFirstUnbalEl(Element *start); /* Replace a element in the tree with another element not in the tree. */ void replaceEl(Element *element, Element *replacement); /* Remove a element from the tree and put another (normally a child of element) * in its place. */ void removeEl(Element *element, Element *filler); /* Once an insertion point is found at a leaf then do the insert. */ void attachRebal( Element *element, Element *parentEl, Element *lastLess ); }; /* Copy constructor. New up each item. */ template AvlTree:: AvlTree(const AvlTree &other) #ifdef WALKABLE : /* Make an empty list, copyBranch will fill in the details for us. */ BASELIST() #endif { treeSize = other.treeSize; root = other.root; #ifndef WALKABLE head = 0; tail = 0; #endif /* If there is a root, copy the tree. */ if ( other.root != 0 ) root = copyBranch( other.root ); } #if defined( AVLTREE_MAP ) || defined( AVLTREE_SET ) /* Assignment does deep copy. */ template AvlTree &AvlTree:: operator=( const AvlTree &other ) { /* Clear the tree first. */ empty(); /* Reset the list pointers, the tree copy will fill in the list for us. */ #ifdef WALKABLE BASELIST::abandon(); #else head = 0; tail = 0; #endif /* Copy the entire tree. */ treeSize = other.treeSize; root = other.root; if ( other.root != 0 ) root = copyBranch( other.root ); return *this; } template void AvlTree:: transfer(AvlTree &other) { /* Clear the tree first. */ empty(); treeSize = other.treeSize; root = other.root; #ifdef WALKABLE BASELIST::head = other.BASELIST::head; BASELIST::tail = other.BASELIST::tail; BASELIST::listLen = other.BASELIST::listLen; #else head = other.head; tail = other.tail; #endif other.abandon(); } #else /* ! AVLTREE_MAP && ! AVLTREE_SET */ /* Assignment does deep copy. This version does not clear the tree first. */ template AvlTree &AvlTree:: operator=( const AvlTree &other ) { /* Reset the list pointers, the tree copy will fill in the list for us. */ #ifdef WALKABLE BASELIST::abandon(); #else head = 0; tail = 0; #endif /* Copy the entire tree. */ treeSize = other.treeSize; root = other.root; if ( other.root != 0 ) root = copyBranch( other.root ); return *this; } template void AvlTree:: transfer(AvlTree &other) { treeSize = other.treeSize; root = other.root; #ifdef WALKABLE BASELIST::head = other.BASELIST::head; BASELIST::tail = other.BASELIST::tail; BASELIST::listLen = other.BASELIST::listLen; #else head = other.head; tail = other.tail; #endif other.abandon(); } #endif /* * Iterator operators. */ /* Prefix ++ */ template Element *AvlTree::Iter:: operator++() { return ptr = findNext( ptr ); } /* Postfix ++ */ template Element *AvlTree::Iter:: operator++(int) { Element *rtn = ptr; ptr = findNext( ptr ); return rtn; } /* increment */ template Element *AvlTree::Iter:: increment() { return ptr = findNext( ptr ); } /* Prefix -- */ template Element *AvlTree::Iter:: operator--() { return ptr = findPrev( ptr ); } /* Postfix -- */ template Element *AvlTree::Iter:: operator--(int) { Element *rtn = ptr; ptr = findPrev( ptr ); return rtn; } /* decrement */ template Element *AvlTree::Iter:: decrement() { return ptr = findPrev( ptr ); } #ifndef WALKABLE /* Move ahead one. */ template Element *AvlTree::Iter:: findNext( Element *element ) { /* Try to go right once then infinite left. */ if ( element->BASE_EL(right) != 0 ) { element = element->BASE_EL(right); while ( element->BASE_EL(left) != 0 ) element = element->BASE_EL(left); } else { /* Go up to parent until we were just a left child. */ while ( true ) { Element *last = element; element = element->BASE_EL(parent); if ( element == 0 || element->BASE_EL(left) == last ) break; } } return element; } /* Move back one. */ template Element *AvlTree::Iter:: findPrev( Element *element ) { /* Try to go left once then infinite right. */ if ( element->BASE_EL(left) != 0 ) { element = element->BASE_EL(left); while ( element->BASE_EL(right) != 0 ) element = element->BASE_EL(right); } else { /* Go up to parent until we were just a left child. */ while ( true ) { Element *last = element; element = element->BASE_EL(parent); if ( element == 0 || element->BASE_EL(right) == last ) break; } } return element; } #endif /* Recursive worker for tree copying. */ template Element *AvlTree:: copyBranch( Element *element ) { /* Duplicate element. Either the base element's copy constructor or defaul * constructor will get called. Both will suffice for initting the * pointers to null when they need to be. */ Element *retVal = new Element(*element); /* If the left tree is there, copy it. */ if ( retVal->BASE_EL(left) ) { retVal->BASE_EL(left) = copyBranch(retVal->BASE_EL(left)); retVal->BASE_EL(left)->BASE_EL(parent) = retVal; } #ifdef WALKABLE BASELIST::addAfter( BASELIST::tail, retVal ); #else if ( head == 0 ) head = retVal; tail = retVal; #endif /* If the right tree is there, copy it. */ if ( retVal->BASE_EL(right) ) { retVal->BASE_EL(right) = copyBranch(retVal->BASE_EL(right)); retVal->BASE_EL(right)->BASE_EL(parent) = retVal; } return retVal; } /* Once an insertion position is found, attach a element to the tree. */ template void AvlTree:: attachRebal( Element *element, Element *parentEl, Element *lastLess ) { /* Increment the number of element in the tree. */ treeSize += 1; /* Set element's parent. */ element->BASE_EL(parent) = parentEl; /* New element always starts as a leaf with height 1. */ element->BASE_EL(left) = 0; element->BASE_EL(right) = 0; element->BASE_EL(height) = 1; /* Are we inserting in the tree somewhere? */ if ( parentEl != 0 ) { /* We have a parent so we are somewhere in the tree. If the parent * equals lastLess, then the last traversal in the insertion went * left, otherwise it went right. */ if ( lastLess == parentEl ) { parentEl->BASE_EL(left) = element; #ifdef WALKABLE BASELIST::addBefore( parentEl, element ); #endif } else { parentEl->BASE_EL(right) = element; #ifdef WALKABLE BASELIST::addAfter( parentEl, element ); #endif } #ifndef WALKABLE /* Maintain the first and last pointers. */ if ( head->BASE_EL(left) == element ) head = element; /* Maintain the first and last pointers. */ if ( tail->BASE_EL(right) == element ) tail = element; #endif } else { /* No parent element so we are inserting the root. */ root = element; #ifdef WALKABLE BASELIST::addAfter( BASELIST::tail, element ); #else head = tail = element; #endif } /* Recalculate the heights. */ recalcHeights(parentEl); /* Find the first unbalance. */ Element *ub = findFirstUnbalGP(element); /* rebalance. */ if ( ub != 0 ) { /* We assert that after this single rotation the * tree is now properly balanced. */ rebalance(ub); } } #ifndef AVL_KEYLESS /** * \brief Insert an existing element into the tree. * * If the insert succeeds and lastFound is given then it is set to the element * inserted. If the insert fails then lastFound is set to the existing element in * the tree that has the same key as element. If the element's avl pointers are * already in use then undefined behaviour results. * * \returns The element inserted upon success, null upon failure. */ template Element *AvlTree:: insert( Element *element, Element **lastFound ) { long keyRelation; Element *curEl = root, *parentEl = 0; Element *lastLess = 0; while (true) { if ( curEl == 0 ) { /* We are at an external element and did not find the key we were * looking for. Attach underneath the leaf and rebalance. */ attachRebal( element, parentEl, lastLess ); if ( lastFound != 0 ) *lastFound = element; return element; } #ifdef AVL_BASIC keyRelation = compare( *element, *curEl ); #else keyRelation = compare( element->BASEKEY(getKey()), curEl->BASEKEY(getKey()) ); #endif /* Do we go left? */ if ( keyRelation < 0 ) { parentEl = lastLess = curEl; curEl = curEl->BASE_EL(left); } /* Do we go right? */ else if ( keyRelation > 0 ) { parentEl = curEl; curEl = curEl->BASE_EL(right); } /* We have hit the target. */ else { if ( lastFound != 0 ) *lastFound = curEl; return 0; } } } #ifdef AVL_BASIC /** * \brief Find a element in the tree with the given key. * * \returns The element if key exists, null if the key does not exist. */ template Element *AvlTree:: find( const Element *element ) const { Element *curEl = root; long keyRelation; while (curEl) { keyRelation = compare( *element, *curEl ); /* Do we go left? */ if ( keyRelation < 0 ) curEl = curEl->BASE_EL(left); /* Do we go right? */ else if ( keyRelation > 0 ) curEl = curEl->BASE_EL(right); /* We have hit the target. */ else { return curEl; } } return 0; } #else /** * \brief Insert a new element into the tree with given key. * * If the key is not already in the tree then a new element is made using the * Element(const Key &key) constructor and the insert succeeds. If lastFound is * given then it is set to the element inserted. If the insert fails then * lastFound is set to the existing element in the tree that has the same key as * element. * * \returns The new element upon success, null upon failure. */ template Element *AvlTree:: insert( const Key &key, Element **lastFound ) { long keyRelation; Element *curEl = root, *parentEl = 0; Element *lastLess = 0; while (true) { if ( curEl == 0 ) { /* We are at an external element and did not find the key we were * looking for. Create the new element, attach it underneath the leaf * and rebalance. */ Element *element = new Element( key ); attachRebal( element, parentEl, lastLess ); if ( lastFound != 0 ) *lastFound = element; return element; } keyRelation = compare( key, curEl->BASEKEY(getKey()) ); /* Do we go left? */ if ( keyRelation < 0 ) { parentEl = lastLess = curEl; curEl = curEl->BASE_EL(left); } /* Do we go right? */ else if ( keyRelation > 0 ) { parentEl = curEl; curEl = curEl->BASE_EL(right); } /* We have hit the target. */ else { if ( lastFound != 0 ) *lastFound = curEl; return 0; } } } #ifdef AVLTREE_MAP /** * \brief Insert a new element into the tree with key and value. * * If the key is not already in the tree then a new element is constructed and * the insert succeeds. If lastFound is given then it is set to the element * inserted. If the insert fails then lastFound is set to the existing element in * the tree that has the same key as element. This insert routine is only * available in AvlMap because it is the only class that knows about a Value * type. * * \returns The new element upon success, null upon failure. */ template Element *AvlTree:: insert( const Key &key, const Value &val, Element **lastFound ) { long keyRelation; Element *curEl = root, *parentEl = 0; Element *lastLess = 0; while (true) { if ( curEl == 0 ) { /* We are at an external element and did not find the key we were * looking for. Create the new element, attach it underneath the leaf * and rebalance. */ Element *element = new Element( key, val ); attachRebal( element, parentEl, lastLess ); if ( lastFound != 0 ) *lastFound = element; return element; } keyRelation = compare(key, curEl->getKey()); /* Do we go left? */ if ( keyRelation < 0 ) { parentEl = lastLess = curEl; curEl = curEl->BASE_EL(left); } /* Do we go right? */ else if ( keyRelation > 0 ) { parentEl = curEl; curEl = curEl->BASE_EL(right); } /* We have hit the target. */ else { if ( lastFound != 0 ) *lastFound = curEl; return 0; } } } #endif /* AVLTREE_MAP */ /** * \brief Find a element in the tree with the given key. * * \returns The element if key exists, null if the key does not exist. */ template Element *AvlTree:: find( const Key &key ) const { Element *curEl = root; long keyRelation; while (curEl) { keyRelation = compare( key, curEl->BASEKEY(getKey()) ); /* Do we go left? */ if ( keyRelation < 0 ) curEl = curEl->BASE_EL(left); /* Do we go right? */ else if ( keyRelation > 0 ) curEl = curEl->BASE_EL(right); /* We have hit the target. */ else { return curEl; } } return 0; } /** * \brief Find a element, then detach it from the tree. * * The element is not deleted. * * \returns The element detached if the key is found, othewise returns null. */ template Element *AvlTree:: detach(const Key &key) { Element *element = find( key ); if ( element ) { detach(element); } return element; } /** * \brief Find, detach and delete a element from the tree. * * \returns True if the element was found and deleted, false otherwise. */ template bool AvlTree:: remove(const Key &key) { /* Assume not found. */ bool retVal = false; /* Look for the key. */ Element *element = find( key ); if ( element != 0 ) { /* If found, detach the element and delete. */ detach( element ); delete element; retVal = true; } return retVal; } #endif /* AVL_BASIC */ #endif /* AVL_KEYLESS */ /** * \brief Detach and delete a element from the tree. * * If the element is not in the tree then undefined behaviour results. */ template void AvlTree:: remove(Element *element) { /* Detach and delete. */ detach(element); delete element; } /** * \brief Detach a element from the tree. * * If the element is not in the tree then undefined behaviour results. * * \returns The element given. */ template Element *AvlTree:: detach(Element *element) { Element *replacement, *fixfrom; long lheight, rheight; #ifdef WALKABLE /* Remove the element from the ordered list. */ BASELIST::detach( element ); #endif /* Update treeSize. */ treeSize--; /* Find a replacement element. */ if (element->BASE_EL(right)) { /* Find the leftmost element of the right subtree. */ replacement = element->BASE_EL(right); while (replacement->BASE_EL(left)) replacement = replacement->BASE_EL(left); /* If replacing the element the with its child then we need to start * fixing at the replacement, otherwise we start fixing at the * parent of the replacement. */ if (replacement->BASE_EL(parent) == element) fixfrom = replacement; else fixfrom = replacement->BASE_EL(parent); #ifndef WALKABLE if ( element == head ) head = replacement; #endif removeEl(replacement, replacement->BASE_EL(right)); replaceEl(element, replacement); } else if (element->BASE_EL(left)) { /* Find the rightmost element of the left subtree. */ replacement = element->BASE_EL(left); while (replacement->BASE_EL(right)) replacement = replacement->BASE_EL(right); /* If replacing the element the with its child then we need to start * fixing at the replacement, otherwise we start fixing at the * parent of the replacement. */ if (replacement->BASE_EL(parent) == element) fixfrom = replacement; else fixfrom = replacement->BASE_EL(parent); #ifndef WALKABLE if ( element == tail ) tail = replacement; #endif removeEl(replacement, replacement->BASE_EL(left)); replaceEl(element, replacement); } else { /* We need to start fixing at the parent of the element. */ fixfrom = element->BASE_EL(parent); #ifndef WALKABLE if ( element == head ) head = element->BASE_EL(parent); if ( element == tail ) tail = element->BASE_EL(parent); #endif /* The element we are deleting is a leaf element. */ removeEl(element, 0); } /* If fixfrom is null it means we just deleted * the root of the tree. */ if ( fixfrom == 0 ) return element; /* Fix the heights after the deletion. */ recalcHeights(fixfrom); /* Fix every unbalanced element going up in the tree. */ Element *ub = findFirstUnbalEl(fixfrom); while ( ub ) { /* Find the element to rebalance by moving down from the first unbalanced * element 2 levels in the direction of the greatest heights. On the * second move down, the heights may be equal ( but not on the first ). * In which case go in the direction of the first move. */ lheight = ub->BASE_EL(left) ? ub->BASE_EL(left)->BASE_EL(height) : 0; rheight = ub->BASE_EL(right) ? ub->BASE_EL(right)->BASE_EL(height) : 0; assert( lheight != rheight ); if (rheight > lheight) { ub = ub->BASE_EL(right); lheight = ub->BASE_EL(left) ? ub->BASE_EL(left)->BASE_EL(height) : 0; rheight = ub->BASE_EL(right) ? ub->BASE_EL(right)->BASE_EL(height) : 0; if (rheight > lheight) ub = ub->BASE_EL(right); else if (rheight < lheight) ub = ub->BASE_EL(left); else ub = ub->BASE_EL(right); } else { ub = ub->BASE_EL(left); lheight = ub->BASE_EL(left) ? ub->BASE_EL(left)->BASE_EL(height) : 0; rheight = ub->BASE_EL(right) ? ub->BASE_EL(right)->BASE_EL(height) : 0; if (rheight > lheight) ub = ub->BASE_EL(right); else if (rheight < lheight) ub = ub->BASE_EL(left); else ub = ub->BASE_EL(left); } /* rebalance returns the grandparant of the subtree formed * by the element that were rebalanced. * We must continue upward from there rebalancing. */ fixfrom = rebalance(ub); /* Find the next unbalaced element. */ ub = findFirstUnbalEl(fixfrom); } return element; } /** * \brief Empty the tree and delete all the element. * * Resets the tree to its initial state. */ template void AvlTree::empty() { if ( root ) { /* Recursively delete from the tree structure. */ deleteChildrenOf(root); delete root; root = 0; treeSize = 0; #ifdef WALKABLE BASELIST::abandon(); #endif } } /** * \brief Forget all element in the tree. * * Does not delete element. Resets the the tree to it's initial state. */ template void AvlTree::abandon() { root = 0; treeSize = 0; #ifdef WALKABLE BASELIST::abandon(); #endif } /* Recursively delete all the children of a element. */ template void AvlTree:: deleteChildrenOf( Element *element ) { /* Recurse left. */ if (element->BASE_EL(left)) { deleteChildrenOf(element->BASE_EL(left)); /* Delete left element. */ delete element->BASE_EL(left); element->BASE_EL(left) = 0; } /* Recurse right. */ if (element->BASE_EL(right)) { deleteChildrenOf(element->BASE_EL(right)); /* Delete right element. */ delete element->BASE_EL(right); element->BASE_EL(left) = 0; } } /* rebalance from a element whose gradparent is unbalanced. Only * call on a element that has a grandparent. */ template Element *AvlTree:: rebalance(Element *n) { long lheight, rheight; Element *a, *b, *c; Element *t1, *t2, *t3, *t4; Element *p = n->BASE_EL(parent); /* parent (Non-NUL). L*/ Element *gp = p->BASE_EL(parent); /* Grand-parent (Non-NULL). */ Element *ggp = gp->BASE_EL(parent); /* Great grand-parent (may be NULL). */ if (gp->BASE_EL(right) == p) { /* gp * \ * p */ if (p->BASE_EL(right) == n) { /* gp * \ * p * \ * n */ a = gp; b = p; c = n; t1 = gp->BASE_EL(left); t2 = p->BASE_EL(left); t3 = n->BASE_EL(left); t4 = n->BASE_EL(right); } else { /* gp * \ * p * / * n */ a = gp; b = n; c = p; t1 = gp->BASE_EL(left); t2 = n->BASE_EL(left); t3 = n->BASE_EL(right); t4 = p->BASE_EL(right); } } else { /* gp * / * p */ if (p->BASE_EL(right) == n) { /* gp * / * p * \ * n */ a = p; b = n; c = gp; t1 = p->BASE_EL(left); t2 = n->BASE_EL(left); t3 = n->BASE_EL(right); t4 = gp->BASE_EL(right); } else { /* gp * / * p * / * n */ a = n; b = p; c = gp; t1 = n->BASE_EL(left); t2 = n->BASE_EL(right); t3 = p->BASE_EL(right); t4 = gp->BASE_EL(right); } } /* Perform rotation. */ /* Tie b to the great grandparent. */ if ( ggp == 0 ) root = b; else if ( ggp->BASE_EL(left) == gp ) ggp->BASE_EL(left) = b; else ggp->BASE_EL(right) = b; b->BASE_EL(parent) = ggp; /* Tie a as a leftchild of b. */ b->BASE_EL(left) = a; a->BASE_EL(parent) = b; /* Tie c as a rightchild of b. */ b->BASE_EL(right) = c; c->BASE_EL(parent) = b; /* Tie t1 as a leftchild of a. */ a->BASE_EL(left) = t1; if ( t1 != 0 ) t1->BASE_EL(parent) = a; /* Tie t2 as a rightchild of a. */ a->BASE_EL(right) = t2; if ( t2 != 0 ) t2->BASE_EL(parent) = a; /* Tie t3 as a leftchild of c. */ c->BASE_EL(left) = t3; if ( t3 != 0 ) t3->BASE_EL(parent) = c; /* Tie t4 as a rightchild of c. */ c->BASE_EL(right) = t4; if ( t4 != 0 ) t4->BASE_EL(parent) = c; /* The heights are all recalculated manualy and the great * grand-parent is passed to recalcHeights() to ensure * the heights are correct up the tree. * * Note that recalcHeights() cuts out when it comes across * a height that hasn't changed. */ /* Fix height of a. */ lheight = a->BASE_EL(left) ? a->BASE_EL(left)->BASE_EL(height) : 0; rheight = a->BASE_EL(right) ? a->BASE_EL(right)->BASE_EL(height) : 0; a->BASE_EL(height) = (lheight > rheight ? lheight : rheight) + 1; /* Fix height of c. */ lheight = c->BASE_EL(left) ? c->BASE_EL(left)->BASE_EL(height) : 0; rheight = c->BASE_EL(right) ? c->BASE_EL(right)->BASE_EL(height) : 0; c->BASE_EL(height) = (lheight > rheight ? lheight : rheight) + 1; /* Fix height of b. */ lheight = a->BASE_EL(height); rheight = c->BASE_EL(height); b->BASE_EL(height) = (lheight > rheight ? lheight : rheight) + 1; /* Fix height of b's parents. */ recalcHeights(ggp); return ggp; } /* Recalculates the heights of all the ancestors of element. */ template void AvlTree:: recalcHeights(Element *element) { long lheight, rheight, new_height; while ( element != 0 ) { lheight = element->BASE_EL(left) ? element->BASE_EL(left)->BASE_EL(height) : 0; rheight = element->BASE_EL(right) ? element->BASE_EL(right)->BASE_EL(height) : 0; new_height = (lheight > rheight ? lheight : rheight) + 1; /* If there is no chage in the height, then there will be no * change in any of the ancestor's height. We can stop going up. * If there was a change, continue upward. */ if (new_height == element->BASE_EL(height)) return; else element->BASE_EL(height) = new_height; element = element->BASE_EL(parent); } } /* Finds the first element whose grandparent is unbalanced. */ template Element *AvlTree:: findFirstUnbalGP(Element *element) { long lheight, rheight, balanceProp; Element *gp; if ( element == 0 || element->BASE_EL(parent) == 0 || element->BASE_EL(parent)->BASE_EL(parent) == 0 ) return 0; /* Don't do anything if we we have no grandparent. */ gp = element->BASE_EL(parent)->BASE_EL(parent); while ( gp != 0 ) { lheight = gp->BASE_EL(left) ? gp->BASE_EL(left)->BASE_EL(height) : 0; rheight = gp->BASE_EL(right) ? gp->BASE_EL(right)->BASE_EL(height) : 0; balanceProp = lheight - rheight; if ( balanceProp < -1 || balanceProp > 1 ) return element; element = element->BASE_EL(parent); gp = gp->BASE_EL(parent); } return 0; } /* Finds the first element that is unbalanced. */ template Element *AvlTree:: findFirstUnbalEl(Element *element) { if ( element == 0 ) return 0; while ( element != 0 ) { long lheight = element->BASE_EL(left) ? element->BASE_EL(left)->BASE_EL(height) : 0; long rheight = element->BASE_EL(right) ? element->BASE_EL(right)->BASE_EL(height) : 0; long balanceProp = lheight - rheight; if ( balanceProp < -1 || balanceProp > 1 ) return element; element = element->BASE_EL(parent); } return 0; } /* Replace a element in the tree with another element not in the tree. */ template void AvlTree:: replaceEl(Element *element, Element *replacement) { Element *parent = element->BASE_EL(parent), *left = element->BASE_EL(left), *right = element->BASE_EL(right); replacement->BASE_EL(left) = left; if (left) left->BASE_EL(parent) = replacement; replacement->BASE_EL(right) = right; if (right) right->BASE_EL(parent) = replacement; replacement->BASE_EL(parent) = parent; if (parent) { if (parent->BASE_EL(left) == element) parent->BASE_EL(left) = replacement; else parent->BASE_EL(right) = replacement; } else root = replacement; replacement->BASE_EL(height) = element->BASE_EL(height); } /* Removes a element from a tree and puts filler in it's place. * Filler should be null or a child of element. */ template void AvlTree:: removeEl(Element *element, Element *filler) { Element *parent = element->BASE_EL(parent); if (parent) { if (parent->BASE_EL(left) == element) parent->BASE_EL(left) = filler; else parent->BASE_EL(right) = filler; } else root = filler; if (filler) filler->BASE_EL(parent) = parent; return; } #ifdef AAPL_NAMESPACE } #endif kelbt-0.15/aapl/resize.h0000664000175000017500000002237011072514631015473 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_RESIZE_H #define _AAPL_RESIZE_H #include #ifdef AAPL_NAMESPACE namespace Aapl { #endif /* This step is expressed in units of T. Changing this requires changes to * docs in ResizeLin constructor. */ #define LIN_DEFAULT_STEP 256 /* * Resizing macros giving different resize methods. */ /* If needed is greater than existing, give twice needed. */ #define EXPN_UP( existing, needed ) \ needed > existing ? (needed<<1) : existing /* If needed is less than 1 quarter existing, give twice needed. */ #define EXPN_DOWN( existing, needed ) \ needed < (existing>>2) ? (needed<<1) : existing /* If needed is greater than existing, give needed plus step. */ #define LIN_UP( existing, needed ) \ needed > existing ? (needed+step) : existing /* If needed is less than existing - 2 * step then give needed plus step. */ #define LIN_DOWN( existing, needed ) \ needed < (existing-(step<<1)) ? (needed+step) : existing /* Return existing. */ #define CONST_UP( existing, needed ) existing /* Return existing. */ #define CONST_DOWN( existing, needed ) existing /** * \addtogroup vector * @{ */ /** \class ResizeLin * \brief Linear table resizer. * * When an up resize or a down resize is needed, ResizeLin allocates the space * needed plus some user defined step. The result is that when growing the * vector in a linear fashion, the number of resizes is also linear. * * If only up resizing is done, then there will never be more than step unused * spaces in the vector. If down resizing is done as well, there will never be * more than 2*step unused spaces in the vector. The up resizing and down * resizing policies are offset to improve performance when repeatedly * inserting and removing a small number of elements relative to the step. * This scheme guarantees that repetitive inserting and removing of a small * number of elements will never result in repetative reallocation. * * The vectors pass sizes to the resizer in units of T, so the step gets * interpreted as units of T. */ /*@}*/ /* Linear resizing. */ class ResizeLin { protected: /** * \brief Default constructor. * * Intializes resize step to 256 units of the table type T. */ ResizeLin() : step(LIN_DEFAULT_STEP) { } /** * \brief Determine the new table size when up resizing. * * If the existing size is insufficient for the space needed, then allocate * the space needed plus the step. The step is in units of T. */ inline long upResize( long existing, long needed ) { return LIN_UP(existing, needed); } /** * \brief Determine the new table size when down resizing. * * If space needed is less than the existing - 2*step, then allocate the * space needed space plus the step. The step is in units of T. */ inline long downResize( long existing, long needed ) { return LIN_DOWN(existing, needed); } public: /** * \brief Step for linear resize. * * Amount of extra space in units of T added each time a resize must take * place. This may be changed at any time. The step should be >= 0. */ long step; }; /** * \addtogroup vector * @{ */ /** \class ResizeCtLin * \brief Linear table resizer with compile time step. * * When an up resize or a down resize is needed, ResizeCtLin allocates the * space needed plus some compile time defined step. The result is that when * growing the vector in a linear fashion, the number of resizes is also * linear. * * If only up resizing is done, then there will never be more than step unused * spaces in the vector. If down resizing is done as well, there will never be * more than 2*step unused spaces in the vector. The up resizing and down * resizing policies are offset to improve performance when repeatedly * inserting and removing a small number of elements relative to the step. * This scheme guarantees that repetitive inserting and removing of a small * number of elements will never result in repetative reallocation. * * The vectors pass sizes to the resizer in units of T, so the step gets * interpreted as units of T. */ /*@}*/ /* Linear resizing. */ template class ResizeCtLin { protected: /** * \brief Determine the new table size when up resizing. * * If the existing size is insufficient for the space needed, then allocate * the space needed plus the step. The step is in units of T. */ inline long upResize( long existing, long needed ) { return LIN_UP(existing, needed); } /** * \brief Determine the new table size when down resizing. * * If space needed is less than the existing - 2*step, then allocate the * space needed space plus the step. The step is in units of T. */ inline long downResize( long existing, long needed ) { return LIN_DOWN(existing, needed); } }; /** * \addtogroup vector * @{ */ /** \class ResizeConst * \brief Constant table resizer. * * When an up resize is needed the existing size is always used. ResizeConst * does not allow dynamic resizing. To use ResizeConst, the vector needs to be * constructed with and initial allocation amount otherwise it will be * unusable. */ /*@}*/ /* Constant table resizing. */ class ResizeConst { protected: /* Assert don't need more than exists. Return existing. */ static inline long upResize( long existing, long needed ); /** * \brief Determine the new table size when down resizing. * * Always returns the existing table size. */ static inline long downResize( long existing, long needed ) { return CONST_DOWN(existing, needed); } }; /** * \brief Determine the new table size when up resizing. * * If the existing size is insufficient for the space needed, then an assertion * will fail. Otherwise returns the existing size. */ inline long ResizeConst::upResize( long existing, long needed ) { assert( needed <= existing ); return CONST_UP(existing, needed); } /** * \addtogroup vector * @{ */ /** \class ResizeRunTime * \brief Run time settable table resizer. * * ResizeRunTime can have it's up and down resizing policies set at run time. * Both up and down policies can be set independently to one of Exponential, * Linear, or Constant. See the documentation for ResizeExpn, ResizeLin, and * ResizeConst for the details of the resizing policies. * * The policies may be changed at any time. The default policies are * both Exponential. */ /*@}*/ /* Run time resizing. */ class ResizeRunTime { protected: /** * \brief Default constuctor. * * The up and down resizing it initialized to Exponetial. The step * defaults to 256 units of T. */ inline ResizeRunTime(); /** * \brief Resizing policies. */ enum ResizeType { Exponential, /*!< Exponential resizing. */ Linear, /*!< Linear resizing. */ Constant /*!< Constant table size. */ }; inline long upResize( long existing, long needed ); inline long downResize( long existing, long needed ); public: /** * \brief Step for linear resize. * * Amount of extra space in units of T added each time a resize must take * place. This may be changed at any time. The step should be >= 0. */ long step; /** * \brief Up resizing policy. */ ResizeType upResizeType; /** * \brief Down resizing policy. */ ResizeType downResizeType; }; inline ResizeRunTime::ResizeRunTime() : step( LIN_DEFAULT_STEP ), upResizeType( Exponential ), downResizeType( Exponential ) { } /** * \brief Determine the new table size when up resizing. * * Type of up resizing is determined by upResizeType. Exponential, Linear and * Constant resizing is the same as that of ResizeExpn, ResizeLin and * ResizeConst. */ inline long ResizeRunTime::upResize( long existing, long needed ) { switch ( upResizeType ) { case Exponential: return EXPN_UP(existing, needed); case Linear: return LIN_UP(existing, needed); case Constant: assert( needed <= existing ); return CONST_UP(existing, needed); } return 0; }; /** * \brief Determine the new table size when down resizing. * * Type of down resizing is determined by downResiizeType. Exponential, Linear * and Constant resizing is the same as that of ResizeExpn, ResizeLin and * ResizeConst. */ inline long ResizeRunTime::downResize( long existing, long needed ) { switch ( downResizeType ) { case Exponential: return EXPN_DOWN(existing, needed); case Linear: return LIN_DOWN(existing, needed); case Constant: return CONST_DOWN(existing, needed); } return 0; } /* Don't need these anymore. */ #undef EXPN_UP #undef EXPN_DOWN #undef LIN_UP #undef LIN_DOWN #undef CONST_UP #undef CONST_DOWN #ifdef AAPL_NAMESPACE } #endif #endif /* _AAPL_RESIZE_H */ kelbt-0.15/aapl/vector.h0000664000175000017500000010502411072514631015472 0ustar thurstonthurston/* * Copyright 2002, 2006 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_VECTOR_H #define _AAPL_VECTOR_H #include #include #include #include #include "table.h" #ifdef AAPL_NAMESPACE namespace Aapl { #endif /** * \addtogroup vector * @{ */ /** \class Vector * \brief Dynamic array. * * This is typical vector implementation. It is a dynamic array that can be * used to contain complex data structures that have constructors and * destructors as well as simple types such as integers and pointers. * * Vector supports inserting, overwriting, and removing single or multiple * elements at once. Constructors and destructors are called wherever * appropriate. For example, before an element is overwritten, it's * destructor is called. * * Vector provides automatic resizing of allocated memory as needed and offers * different allocation schemes for controlling how the automatic allocation * is done. Two senses of the the length of the data is maintained: the * amount of raw memory allocated to the vector and the number of actual * elements in the vector. The various allocation schemes control how the * allocated space is changed in relation to the number of elements in the * vector. * * \include ex_vector.cpp */ /*@}*/ template < class T, class Resize = ResizeExpn > class Vector : public Table, public Resize { private: typedef Table BaseTable; public: /** * \brief Initialize an empty vector with no space allocated. * * If a linear resizer is used, the step defaults to 256 units of T. For a * runtime vector both up and down allocation schemes default to * Exponential. */ Vector() { } /** * \brief Create a vector that contains an initial element. * * The vector becomes one element in length. The element's copy * constructor is used to place the value in the vector. */ Vector(const T &val) { setAs(&val, 1); } /** * \brief Create a vector that contains an array of elements. * * The vector becomes len elements in length. Copy constructors are used * to place the new elements in the vector. */ Vector(const T *val, long len) { setAs(val, len); } /* Deep copy. */ Vector( const Vector &v ); /* Free all mem used by the vector. */ ~Vector() { empty(); } /* Delete all items. */ void empty(); /* Abandon the contents of the vector without deleteing. */ void abandon(); /* Transfers the elements of another vector into this vector. First emptys * the current vector. */ void transfer( Vector &v ); /* Perform a deep copy of another vector into this vector. */ Vector &operator=( const Vector &v ); /*@{*/ /** * \brief Insert one element at position pos. * * Elements in the vector from pos onward are shifted one space to the * right. The copy constructor is used to place the element into this * vector. If pos is greater than the length of the vector then undefined * behaviour results. If pos is negative then it is treated as an offset * relative to the length of the vector. */ void insert(long pos, const T &val) { insert(pos, &val, 1); } /* Insert an array of values. */ void insert(long pos, const T *val, long len); /** * \brief Insert all the elements from another vector at position pos. * * Elements in this vector from pos onward are shifted v.tabLen spaces to * the right. The element's copy constructor is used to copy the items * into this vector. The other vector is left unchanged. If pos is off the * end of the vector, then undefined behaviour results. If pos is negative * then it is treated as an offset relative to the length of the vector. * Equivalent to vector.insert(pos, other.data, other.tabLen). */ void insert(long pos, const Vector &v) { insert(pos, v.data, v.tabLen); } /* Insert len copies of val into the vector. */ void insertDup(long pos, const T &val, long len); /** * \brief Insert one new element using the default constrcutor. * * Elements in the vector from pos onward are shifted one space to the * right. The default constructor is used to init the new element. If pos * is greater than the length of the vector then undefined behaviour * results. If pos is negative then it is treated as an offset relative to * the length of the vector. */ void insertNew(long pos) { insertNew(pos, 1); } /* Insert len new items using default constructor. */ void insertNew(long pos, long len); /*@}*/ /*@{*/ /** * \brief Remove one element at position pos. * * The element's destructor is called. Elements to the right of pos are * shifted one space to the left to take up the free space. If pos is greater * than or equal to the length of the vector then undefined behavior results. * If pos is negative then it is treated as an offset relative to the length * of the vector. */ void remove(long pos) { remove(pos, 1); } /* Delete a number of elements. */ void remove(long pos, long len); /*@}*/ /*@{*/ /** * \brief Replace one element at position pos. * * If there is an existing element at position pos (if pos is less than * the length of the vector) then its destructor is called before the * space is used. The copy constructor is used to place the element into * the vector. If pos is greater than the length of the vector then * undefined behaviour results. If pos is negative then it is treated as * an offset relative to the length of the vector. */ void replace(long pos, const T &val) { replace(pos, &val, 1); } /* Replace with an array of values. */ void replace(long pos, const T *val, long len); /** * \brief Replace at position pos with all the elements of another vector. * * Replace at position pos with all the elements of another vector. The * other vector is left unchanged. If there are existing elements at the * positions to be replaced, then destructors are called before the space * is used. Copy constructors are used to place the elements into this * vector. It is allowable for the pos and length of the other vector to * specify a replacement that overwrites existing elements and creates new * ones. If pos is greater than the length of the vector then undefined * behaviour results. If pos is negative, then it is treated as an offset * relative to the length of the vector. */ void replace(long pos, const Vector &v) { replace(pos, v.data, v.tabLen); } /* Replace len items with len copies of val. */ void replaceDup(long pos, const T &val, long len); /** * \brief Replace at position pos with one new element. * * If there is an existing element at the position to be replaced (pos is * less than the length of the vector) then the element's destructor is * called before the space is used. The default constructor is used to * initialize the new element. If pos is greater than the length of the * vector then undefined behaviour results. If pos is negative, then it is * treated as an offset relative to the length of the vector. */ void replaceNew(long pos) { replaceNew(pos, 1); } /* Replace len items at pos with newly constructed objects. */ void replaceNew(long pos, long len); /*@}*/ /*@{*/ /** * \brief Set the contents of the vector to be val exactly. * * The vector becomes one element in length. Destructors are called on any * existing elements in the vector. The element's copy constructor is used * to place the val in the vector. */ void setAs(const T &val) { setAs(&val, 1); } /* Set to the contents of an array. */ void setAs(const T *val, long len); /** * \brief Set the vector to exactly the contents of another vector. * * The vector becomes v.tabLen elements in length. Destructors are called * on any existing elements. Copy constructors are used to place the new * elements in the vector. */ void setAs(const Vector &v) { setAs(v.data, v.tabLen); } /* Set as len copies of item. */ void setAsDup(const T &item, long len); /** * \brief Set the vector to exactly one new item. * * The vector becomes one element in length. Destructors are called on any * existing elements in the vector. The default constructor is used to * init the new item. */ void setAsNew() { setAsNew(1); } /* Set as newly constructed objects using the default constructor. */ void setAsNew(long len); /*@}*/ /*@{*/ /** * \brief Append one elment to the end of the vector. * * Copy constructor is used to place the element in the vector. */ void append(const T &val) { replace(BaseTable::tabLen, &val, 1); } /** * \brief Append len elements to the end of the vector. * * Copy constructors are used to place the elements in the vector. */ void append(const T *val, long len) { replace(BaseTable::tabLen, val, len); } /** * \brief Append the contents of another vector. * * The other vector is left unchanged. Copy constructors are used to place the * elements in the vector. */ void append(const Vector &v) { replace(BaseTable::tabLen, v.data, v.tabLen); } /** * \brief Append len copies of item. * * The copy constructor is used to place the item in the vector. */ void appendDup(const T &item, long len) { replaceDup(BaseTable::tabLen, item, len); } /** * \brief Append a single newly created item. * * The new element is initialized with the default constructor. */ void appendNew() { replaceNew(BaseTable::tabLen, 1); } /** * \brief Append len newly created items. * * The new elements are initialized with the default constructor. */ void appendNew(long len) { replaceNew(BaseTable::tabLen, len); } /*@}*/ /*@{*/ /** \fn Vector::prepend(const T &val) * \brief Prepend one elment to the front of the vector. * * Copy constructor is used to place the element in the vector. */ void prepend(const T &val) { insert(0, &val, 1); } /** * \brief Prepend len elements to the front of the vector. * * Copy constructors are used to place the elements in the vector. */ void prepend(const T *val, long len) { insert(0, val, len); } /** * \brief Prepend the contents of another vector. * * The other vector is left unchanged. Copy constructors are used to place the * elements in the vector. */ void prepend(const Vector &v) { insert(0, v.data, v.tabLen); } /** * \brief Prepend len copies of item. * * The copy constructor is used to place the item in the vector. */ void prependDup(const T &item, long len) { insertDup(0, item, len); } /** * \brief Prepend a single newly created item. * * The new element is initialized with the default constructor. */ void prependNew() { insertNew(0, 1); } /** * \brief Prepend len newly created items. * * The new elements are initialized with the default constructor. */ void prependNew(long len) { insertNew(0, len); } /*@}*/ /* Convenience access. */ T &operator[](int i) const { return BaseTable::data[i]; } long size() const { return BaseTable::tabLen; } /* Forward this so a ref can be used. */ struct Iter; /* Various classes for setting the iterator */ struct IterFirst { IterFirst( const Vector &v ) : v(v) { } const Vector &v; }; struct IterLast { IterLast( const Vector &v ) : v(v) { } const Vector &v; }; struct IterNext { IterNext( const Iter &i ) : i(i) { } const Iter &i; }; struct IterPrev { IterPrev( const Iter &i ) : i(i) { } const Iter &i; }; /** * \brief Vector Iterator. * \ingroup iterators */ struct Iter { /* Construct, assign. */ Iter() : ptr(0), ptrBeg(0), ptrEnd(0) { } /* Construct. */ Iter( const Vector &v ); Iter( const IterFirst &vf ); Iter( const IterLast &vl ); inline Iter( const IterNext &vn ); inline Iter( const IterPrev &vp ); /* Assign. */ Iter &operator=( const Vector &v ); Iter &operator=( const IterFirst &vf ); Iter &operator=( const IterLast &vl ); inline Iter &operator=( const IterNext &vf ); inline Iter &operator=( const IterPrev &vl ); /** \brief Less than end? */ bool lte() const { return ptr != ptrEnd; } /** \brief At end? */ bool end() const { return ptr == ptrEnd; } /** \brief Greater than beginning? */ bool gtb() const { return ptr != ptrBeg; } /** \brief At beginning? */ bool beg() const { return ptr == ptrBeg; } /** \brief At first element? */ bool first() const { return ptr == ptrBeg+1; } /** \brief At last element? */ bool last() const { return ptr == ptrEnd-1; } /* Return the position. */ long pos() const { return ptr - ptrBeg - 1; } T &operator[](int i) const { return ptr[i]; } /** \brief Implicit cast to T*. */ operator T*() const { return ptr; } /** \brief Dereference operator returns T&. */ T &operator *() const { return *ptr; } /** \brief Arrow operator returns T*. */ T *operator->() const { return ptr; } /** \brief Move to next item. */ T *operator++() { return ++ptr; } /** \brief Move to next item. */ T *operator++(int) { return ptr++; } /** \brief Move to next item. */ T *increment() { return ++ptr; } /** \brief Move n items forward. */ T *operator+=(long n) { return ptr+=n; } /** \brief Move to previous item. */ T *operator--() { return --ptr; } /** \brief Move to previous item. */ T *operator--(int) { return ptr--; } /** \brief Move to previous item. */ T *decrement() { return --ptr; } /** \brief Move n items back. */ T *operator-=(long n) { return ptr-=n; } /** \brief Return the next item. Does not modify this. */ inline IterNext next() const { return IterNext(*this); } /** \brief Return the previous item. Does not modify this. */ inline IterPrev prev() const { return IterPrev(*this); } /** \brief The iterator is simply a pointer. */ T *ptr; /* For testing endpoints. */ T *ptrBeg, *ptrEnd; }; /** \brief Return first element. */ IterFirst first() { return IterFirst( *this ); } /** \brief Return last element. */ IterLast last() { return IterLast( *this ); } protected: void makeRawSpaceFor(long pos, long len); void upResize(long len); void downResize(long len); }; /* Init a vector iterator with just a vector. */ template Vector::Iter::Iter( const Vector &v ) { if ( v.tabLen == 0 ) ptr = ptrBeg = ptrEnd = 0; else { ptr = v.data; ptrBeg = v.data-1; ptrEnd = v.data+v.tabLen; } } /* Init a vector iterator with the first of a vector. */ template Vector::Iter::Iter( const IterFirst &vf ) { if ( vf.v.tabLen == 0 ) ptr = ptrBeg = ptrEnd = 0; else { ptr = vf.v.data; ptrBeg = vf.v.data-1; ptrEnd = vf.v.data+vf.v.tabLen; } } /* Init a vector iterator with the last of a vector. */ template Vector::Iter::Iter( const IterLast &vl ) { if ( vl.v.tabLen == 0 ) ptr = ptrBeg = ptrEnd = 0; else { ptr = vl.v.data+vl.v.tabLen-1; ptrBeg = vl.v.data-1; ptrEnd = vl.v.data+vl.v.tabLen; } } /* Init a vector iterator with the next of some other iterator. */ template Vector::Iter::Iter( const IterNext &vn ) : ptr(vn.i.ptr+1), ptrBeg(vn.i.ptrBeg), ptrEnd(vn.i.ptrEnd) { } /* Init a vector iterator with the prev of some other iterator. */ template Vector::Iter::Iter( const IterPrev &vp ) : ptr(vp.i.ptr-1), ptrBeg(vp.i.ptrBeg), ptrEnd(vp.i.ptrEnd) { } /* Set a vector iterator with some vector. */ template typename Vector::Iter & Vector::Iter::operator=( const Vector &v ) { if ( v.tabLen == 0 ) ptr = ptrBeg = ptrEnd = 0; else { ptr = v.data; ptrBeg = v.data-1; ptrEnd = v.data+v.tabLen; } return *this; } /* Set a vector iterator with the first element in a vector. */ template typename Vector::Iter & Vector::Iter::operator=( const IterFirst &vf ) { if ( vf.v.tabLen == 0 ) ptr = ptrBeg = ptrEnd = 0; else { ptr = vf.v.data; ptrBeg = vf.v.data-1; ptrEnd = vf.v.data+vf.v.tabLen; } return *this; } /* Set a vector iterator with the last element in a vector. */ template typename Vector::Iter & Vector::Iter::operator=( const IterLast &vl ) { if ( vl.v.tabLen == 0 ) ptr = ptrBeg = ptrEnd = 0; else { ptr = vl.v.data+vl.v.tabLen-1; ptrBeg = vl.v.data-1; ptrEnd = vl.v.data+vl.v.tabLen; } return *this; } /* Set a vector iterator with the next of some other iterator. */ template typename Vector::Iter & Vector::Iter::operator=( const IterNext &vn ) { ptr = vn.i.ptr+1; ptrBeg = vn.i.ptrBeg; ptrEnd = vn.i.ptrEnd; return *this; } /* Set a vector iterator with the prev of some other iterator. */ template typename Vector::Iter & Vector::Iter::operator=( const IterPrev &vp ) { ptr = vp.i.ptr-1; ptrBeg = vp.i.ptrBeg; ptrEnd = vp.i.ptrEnd; return *this; } /** * \brief Forget all elements in the vector. * * The contents of the vector are reset to null without without the space * being freed. */ template void Vector:: abandon() { BaseTable::data = 0; BaseTable::tabLen = 0; BaseTable::allocLen = 0; } /** * \brief Transfer the contents of another vector into this vector. * * The dynamic array of the other vector is moved into this vector by * reference. If this vector is non-empty then its contents are first deleted. * Afterward the other vector will be empty. */ template void Vector:: transfer( Vector &v ) { empty(); BaseTable::data = v.data; BaseTable::tabLen = v.tabLen; BaseTable::allocLen = v.allocLen; v.abandon(); } /** * \brief Deep copy another vector into this vector. * * Copies the entire contents of the other vector into this vector. Any * existing contents are first deleted. Equivalent to setAs. * * \returns A reference to this. */ template Vector &Vector:: operator=( const Vector &v ) { setAs(v.data, v.tabLen); return *this; } /* Up resize the data for len elements using Resize::upResize to tell us the * new tabLen. Reads and writes allocLen. Does not read or write tabLen. */ template void Vector:: upResize(long len) { /* Ask the resizer what the new tabLen will be. */ long newLen = Resize::upResize(BaseTable::allocLen, len); /* Did the data grow? */ if ( newLen > BaseTable::allocLen ) { BaseTable::allocLen = newLen; if ( BaseTable::data != 0 ) { /* Table exists already, resize it up. */ BaseTable::data = (T*) realloc( BaseTable::data, sizeof(T) * newLen ); if ( BaseTable::data == 0 ) throw std::bad_alloc(); } else { /* Create the data. */ BaseTable::data = (T*) malloc( sizeof(T) * newLen ); if ( BaseTable::data == 0 ) throw std::bad_alloc(); } } } /* Down resize the data for len elements using Resize::downResize to determine * the new tabLen. Reads and writes allocLen. Does not read or write tabLen. */ template void Vector:: downResize(long len) { /* Ask the resizer what the new tabLen will be. */ long newLen = Resize::downResize( BaseTable::allocLen, len ); /* Did the data shrink? */ if ( newLen < BaseTable::allocLen ) { BaseTable::allocLen = newLen; if ( newLen == 0 ) { /* Simply free the data. */ free( BaseTable::data ); BaseTable::data = 0; } else { /* Not shrinking to size zero, realloc it to the smaller size. */ BaseTable::data = (T*) realloc( BaseTable::data, sizeof(T) * newLen ); if ( BaseTable::data == 0 ) throw std::bad_alloc(); } } } /** * \brief Perform a deep copy of the vector. * * The contents of the other vector are copied into this vector. This vector * gets the same allocation size as the other vector. All items are copied * using the element's copy constructor. */ template Vector:: Vector(const Vector &v) { BaseTable::tabLen = v.tabLen; BaseTable::allocLen = v.allocLen; if ( BaseTable::allocLen > 0 ) { /* Allocate needed space. */ BaseTable::data = (T*) malloc(sizeof(T) * BaseTable::allocLen); if ( BaseTable::data == 0 ) throw std::bad_alloc(); /* If there are any items in the src data, copy them in. */ T *dst = BaseTable::data, *src = v.data; for (long pos = 0; pos < BaseTable::tabLen; pos++, dst++, src++ ) new(dst) T(*src); } else { /* Nothing allocated. */ BaseTable::data = 0; } } /** \fn Vector::~Vector() * \brief Free all memory used by the vector. * * The vector is reset to zero elements. Destructors are called on all * elements in the vector. The space allocated for the vector is freed. */ /** * \brief Free all memory used by the vector. * * The vector is reset to zero elements. Destructors are called on all * elements in the vector. The space allocated for the vector is freed. */ template void Vector:: empty() { if ( BaseTable::data != 0 ) { /* Call All destructors. */ T *pos = BaseTable::data; for ( long i = 0; i < BaseTable::tabLen; pos++, i++ ) pos->~T(); /* Free the data space. */ free( BaseTable::data ); BaseTable::data = 0; BaseTable::tabLen = BaseTable::allocLen = 0; } } /** * \brief Set the contents of the vector to be len elements exactly. * * The vector becomes len elements in length. Destructors are called on any * existing elements in the vector. Copy constructors are used to place the * new elements in the vector. */ template void Vector:: setAs(const T *val, long len) { /* Call All destructors. */ long i; T *pos = BaseTable::data; for ( i = 0; i < BaseTable::tabLen; pos++, i++ ) pos->~T(); /* Adjust the allocated length. */ if ( len < BaseTable::tabLen ) downResize( len ); else if ( len > BaseTable::tabLen ) upResize( len ); /* Set the new data length to exactly len. */ BaseTable::tabLen = len; /* Copy data in. */ T *dst = BaseTable::data; const T *src = val; for ( i = 0; i < len; i++, dst++, src++ ) new(dst) T(*src); } /** * \brief Set the vector to len copies of item. * * The vector becomes len elements in length. Destructors are called on any * existing elements in the vector. The element's copy constructor is used to * copy the item into the vector. */ template void Vector:: setAsDup(const T &item, long len) { /* Call All destructors. */ T *pos = BaseTable::data; for ( long i = 0; i < BaseTable::tabLen; pos++, i++ ) pos->~T(); /* Adjust the allocated length. */ if ( len < BaseTable::tabLen ) downResize( len ); else if ( len > BaseTable::tabLen ) upResize( len ); /* Set the new data length to exactly len. */ BaseTable::tabLen = len; /* Copy item in one spot at a time. */ T *dst = BaseTable::data; for ( long i = 0; i < len; i++, dst++ ) new(dst) T(item); } /** * \brief Set the vector to exactly len new items. * * The vector becomes len elements in length. Destructors are called on any * existing elements in the vector. Default constructors are used to init the * new items. */ template void Vector:: setAsNew(long len) { /* Call All destructors. */ T *pos = BaseTable::data; for ( long i = 0; i < BaseTable::tabLen; pos++, i++ ) pos->~T(); /* Adjust the allocated length. */ if ( len < BaseTable::tabLen ) downResize( len ); else if ( len > BaseTable::tabLen ) upResize( len ); /* Set the new data length to exactly len. */ BaseTable::tabLen = len; /* Create items using default constructor. */ T *dst = BaseTable::data; for ( long i = 0; i < len; i++, dst++ ) new(dst) T(); } /** * \brief Replace len elements at position pos. * * If there are existing elements at the positions to be replaced, then * destructors are called before the space is used. Copy constructors are used * to place the elements into the vector. It is allowable for the pos and * length to specify a replacement that overwrites existing elements and * creates new ones. If pos is greater than the length of the vector then * undefined behaviour results. If pos is negative, then it is treated as an * offset relative to the length of the vector. */ template void Vector:: replace(long pos, const T *val, long len) { long endPos, i; T *item; /* If we are given a negative position to replace at then * treat it as a position relative to the length. */ if ( pos < 0 ) pos = BaseTable::tabLen + pos; /* The end is the one past the last item that we want * to write to. */ endPos = pos + len; /* Make sure we have enough space. */ if ( endPos > BaseTable::tabLen ) { upResize( endPos ); /* Delete any objects we need to delete. */ item = BaseTable::data + pos; for ( i = pos; i < BaseTable::tabLen; i++, item++ ) item->~T(); /* We are extending the vector, set the new data length. */ BaseTable::tabLen = endPos; } else { /* Delete any objects we need to delete. */ item = BaseTable::data + pos; for ( i = pos; i < endPos; i++, item++ ) item->~T(); } /* Copy data in using copy constructor. */ T *dst = BaseTable::data + pos; const T *src = val; for ( i = 0; i < len; i++, dst++, src++ ) new(dst) T(*src); } /** * \brief Replace at position pos with len copies of an item. * * If there are existing elements at the positions to be replaced, then * destructors are called before the space is used. The copy constructor is * used to place the element into this vector. It is allowable for the pos and * length to specify a replacement that overwrites existing elements and * creates new ones. If pos is greater than the length of the vector then * undefined behaviour results. If pos is negative, then it is treated as an * offset relative to the length of the vector. */ template void Vector:: replaceDup(long pos, const T &val, long len) { long endPos, i; T *item; /* If we are given a negative position to replace at then * treat it as a position relative to the length. */ if ( pos < 0 ) pos = BaseTable::tabLen + pos; /* The end is the one past the last item that we want * to write to. */ endPos = pos + len; /* Make sure we have enough space. */ if ( endPos > BaseTable::tabLen ) { upResize( endPos ); /* Delete any objects we need to delete. */ item = BaseTable::data + pos; for ( i = pos; i < BaseTable::tabLen; i++, item++ ) item->~T(); /* We are extending the vector, set the new data length. */ BaseTable::tabLen = endPos; } else { /* Delete any objects we need to delete. */ item = BaseTable::data + pos; for ( i = pos; i < endPos; i++, item++ ) item->~T(); } /* Copy data in using copy constructor. */ T *dst = BaseTable::data + pos; for ( long i = 0; i < len; i++, dst++ ) new(dst) T(val); } /** * \brief Replace at position pos with len new elements. * * If there are existing elements at the positions to be replaced, then * destructors are called before the space is used. The default constructor is * used to initialize the new elements. It is allowable for the pos and length * to specify a replacement that overwrites existing elements and creates new * ones. If pos is greater than the length of the vector then undefined * behaviour results. If pos is negative, then it is treated as an offset * relative to the length of the vector. */ template void Vector:: replaceNew(long pos, long len) { long endPos, i; T *item; /* If we are given a negative position to replace at then * treat it as a position relative to the length. */ if ( pos < 0 ) pos = BaseTable::tabLen + pos; /* The end is the one past the last item that we want * to write to. */ endPos = pos + len; /* Make sure we have enough space. */ if ( endPos > BaseTable::tabLen ) { upResize( endPos ); /* Delete any objects we need to delete. */ item = BaseTable::data + pos; for ( i = pos; i < BaseTable::tabLen; i++, item++ ) item->~T(); /* We are extending the vector, set the new data length. */ BaseTable::tabLen = endPos; } else { /* Delete any objects we need to delete. */ item = BaseTable::data + pos; for ( i = pos; i < endPos; i++, item++ ) item->~T(); } /* Copy data in using copy constructor. */ T *dst = BaseTable::data + pos; for ( long i = 0; i < len; i++, dst++ ) new(dst) T(); } /** * \brief Remove len elements at position pos. * * Destructor is called on all elements removed. Elements to the right of pos * are shifted len spaces to the left to take up the free space. If pos is * greater than or equal to the length of the vector then undefined behavior * results. If pos is negative then it is treated as an offset relative to the * length of the vector. */ template void Vector:: remove(long pos, long len) { long newLen, lenToSlideOver, endPos; T *dst, *item; /* If we are given a negative position to remove at then * treat it as a position relative to the length. */ if ( pos < 0 ) pos = BaseTable::tabLen + pos; /* The first position after the last item deleted. */ endPos = pos + len; /* The new data length. */ newLen = BaseTable::tabLen - len; /* The place in the data we are deleting at. */ dst = BaseTable::data + pos; /* Call Destructors. */ item = dst; for ( long i = 0; i < len; i += 1, item += 1 ) item->~T(); /* Shift data over if necessary. */ lenToSlideOver = BaseTable::tabLen - endPos; if ( len > 0 && lenToSlideOver > 0 ) memmove(dst, dst + len, sizeof(T)*lenToSlideOver); /* Shrink the data if necessary. */ downResize( newLen ); /* Set the new data length. */ BaseTable::tabLen = newLen; } /** * \brief Insert len elements at position pos. * * Elements in the vector from pos onward are shifted len spaces to the right. * The copy constructor is used to place the elements into this vector. If pos * is greater than the length of the vector then undefined behaviour results. * If pos is negative then it is treated as an offset relative to the length * of the vector. */ template void Vector:: insert(long pos, const T *val, long len) { /* If we are given a negative position to insert at then * treat it as a position relative to the length. */ if ( pos < 0 ) pos = BaseTable::tabLen + pos; /* Calculate the new length. */ long newLen = BaseTable::tabLen + len; /* Up resize, we are growing. */ upResize( newLen ); /* Shift over data at insert spot if needed. */ if ( len > 0 && pos < BaseTable::tabLen ) { memmove(BaseTable::data + pos + len, BaseTable::data + pos, sizeof(T)*(BaseTable::tabLen-pos)); } /* Copy data in element by element. */ T *dst = BaseTable::data + pos; const T *src = val; for ( long i = 0; i < len; i++, dst++, src++ ) new(dst) T(*src); /* Set the new length. */ BaseTable::tabLen = newLen; } /** * \brief Insert len copies of item at position pos. * * Elements in the vector from pos onward are shifted len spaces to the right. * The copy constructor is used to place the element into this vector. If pos * is greater than the length of the vector then undefined behaviour results. * If pos is negative then it is treated as an offset relative to the length * of the vector. */ template void Vector:: insertDup(long pos, const T &item, long len) { /* If we are given a negative position to insert at then * treat it as a position relative to the length. */ if ( pos < 0 ) pos = BaseTable::tabLen + pos; /* Calculate the new length. */ long newLen = BaseTable::tabLen + len; /* Up resize, we are growing. */ upResize( newLen ); /* Shift over data at insert spot if needed. */ if ( len > 0 && pos < BaseTable::tabLen ) { memmove(BaseTable::data + pos + len, BaseTable::data + pos, sizeof(T)*(BaseTable::tabLen-pos)); } /* Copy the data item in one at a time. */ T *dst = BaseTable::data + pos; for ( long i = 0; i < len; i++, dst++ ) new(dst) T(item); /* Set the new length. */ BaseTable::tabLen = newLen; } /** * \brief Insert len new elements using the default constructor. * * Elements in the vector from pos onward are shifted len spaces to the right. * Default constructors are used to init the new elements. If pos is off the * end of the vector then undefined behaviour results. If pos is negative then * it is treated as an offset relative to the length of the vector. */ template void Vector:: insertNew(long pos, long len) { /* If we are given a negative position to insert at then * treat it as a position relative to the length. */ if ( pos < 0 ) pos = BaseTable::tabLen + pos; /* Calculate the new length. */ long newLen = BaseTable::tabLen + len; /* Up resize, we are growing. */ upResize( newLen ); /* Shift over data at insert spot if needed. */ if ( len > 0 && pos < BaseTable::tabLen ) { memmove(BaseTable::data + pos + len, BaseTable::data + pos, sizeof(T)*(BaseTable::tabLen-pos)); } /* Init new data with default constructors. */ T *dst = BaseTable::data + pos; for ( long i = 0; i < len; i++, dst++ ) new(dst) T(); /* Set the new length. */ BaseTable::tabLen = newLen; } /* Makes space for len items, Does not init the items in any way. If pos is * greater than the length of the vector then undefined behaviour results. * Updates the length of the vector. */ template void Vector:: makeRawSpaceFor(long pos, long len) { /* Calculate the new length. */ long newLen = BaseTable::tabLen + len; /* Up resize, we are growing. */ upResize( newLen ); /* Shift over data at insert spot if needed. */ if ( len > 0 && pos < BaseTable::tabLen ) { memmove(BaseTable::data + pos + len, BaseTable::data + pos, sizeof(T)*(BaseTable::tabLen-pos)); } /* Save the new length. */ BaseTable::tabLen = newLen; } #ifdef AAPL_NAMESPACE } #endif #endif /* _AAPL_VECTOR_H */ kelbt-0.15/aapl/avltree.h0000664000175000017500000000446011072514631015634 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_AVLTREE_H #define _AAPL_AVLTREE_H #include "compare.h" /** * \addtogroup avltree * @{ */ /** * \class AvlTree * \brief Basic AVL tree. * * AvlTree is the standard by-structure AVL tree. To use this structure the * user must define an element type and give it the necessary properties. At * the very least it must have a getKey() function that will be used to * compare the relative ordering of elements and tree management data * necessary for the AVL algorithm. An element type can acquire the management * data by inheriting the AvlTreeEl class. * * AvlTree does not presume to manage the allocation of elements in the tree. * The destructor will not delete the items in the tree, instead the elements * must be explicitly de-allocated by the user if necessary and when it is * safe to do so. The empty() routine will traverse the tree and delete all * items. * * Since the tree does not manage the elements, it can contain elements that * are allocated statically or that are part of another data structure. * * \include ex_avltree.cpp */ /*@}*/ #define BASE_EL(name) name #define BASEKEY(name) name #define AVLMEL_CLASSDEF class Element, class Key, class Compare = CmpOrd #define AVLMEL_TEMPDEF class Element, class Key, class Compare #define AVLMEL_TEMPUSE Element, Key, Compare #define AvlTree AvlTree #include "avlcommon.h" #undef BASE_EL #undef BASEKEY #undef AVLMEL_CLASSDEF #undef AVLMEL_TEMPDEF #undef AVLMEL_TEMPUSE #undef AvlTree #endif /* _AAPL_AVLTREE_H */ kelbt-0.15/aapl/dlistval.h0000664000175000017500000000431711072514631016015 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_DLISTVAL_H #define _AAPL_DLISTVAL_H /** * \addtogroup dlist * @{ */ /** * \class DListVal * \brief By-value doubly linked list. * * This class is a doubly linked list that does not require a list element * type to be declared. The user instead gives a type that is to be stored in * the list element. When inserting a new data item, the value is copied into * a newly allocated element. This list is inteded to behave and be utilized * like the list template found in the STL. * * DListVal is different from the other lists in that it allocates elements * itself. The raw element insert interface is still exposed for convenience, * however, the list assumes all elements in the list are allocated on the * heap and are to be managed by the list. The destructor WILL delete the * contents of the list. If the list is ever copied in from another list, the * existing contents are deleted first. This is in contrast to DList and * DListMel, which will never delete their contents to allow for statically * allocated elements. * * \include ex_dlistval.cpp */ /*@}*/ #define BASE_EL(name) name #define DLMEL_TEMPDEF class T #define DLMEL_TEMPUSE T #define DList DListVal #define Element DListValEl #define DOUBLELIST_VALUE #include "dlcommon.h" #undef BASE_EL #undef DLMEL_TEMPDEF #undef DLMEL_TEMPUSE #undef DList #undef Element #undef DOUBLELIST_VALUE #endif /* _AAPL_DLISTVAL_H */ kelbt-0.15/aapl/insertsort.h0000664000175000017500000000506511072514631016410 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_INSERTSORT_H #define _AAPL_INSERTSORT_H #ifdef AAPL_NAMESPACE namespace Aapl { #endif /** * \addtogroup sort * @{ */ /** * \class InsertSort * \brief Insertion sort an array of data. * * InsertSort can be used to sort any array of objects of type T provided a * compare class is given. InsertSort is in-place. It does not require any * temporary storage. * * Objects are not made aware that they are being moved around in memory. * Assignment operators, constructors and destructors are never invoked by the * sort. * * InsertSort runs in O(n^2) time. It is most useful when sorting small arrays. * where it can outperform the O(n*log(n)) sorters due to its simplicity. * InsertSort is a not a stable sort. Elements with the same key will not have * their relative ordering preserved. */ /*@}*/ /* InsertSort. */ template class InsertSort : public Compare { public: /* Sorting interface routine. */ void sort(T *data, long len); }; /** * \brief Insertion sort an array of data. */ template void InsertSort::sort(T *data, long len) { /* For each next largest spot in the sorted array... */ for ( T *dest = data; dest < data+len-1; dest++ ) { /* Find the next smallest element in the unsorted array. */ T *smallest = dest; for ( T *src = dest+1; src < data+len; src++ ) { /* If src is smaller than the current src, then use it. */ if ( compare( *src, *smallest ) < 0 ) smallest = src; } if ( smallest != dest ) { /* Swap dest, smallest. */ char tmp[sizeof(T)]; memcpy( tmp, dest, sizeof(T) ); memcpy( dest, smallest, sizeof(T) ); memcpy( smallest, tmp, sizeof(T) ); } } } #ifdef AAPL_NAMESPACE } #endif #endif /* _AAPL_INSERTSORT_H */ kelbt-0.15/aapl/avlimelkey.h0000664000175000017500000000463011072514631016333 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_AVLIMELKEY_H #define _AAPL_AVLIMELKEY_H #include "compare.h" #include "dlistmel.h" /** * \addtogroup avlitree * @{ */ /** * \class AvliMelKey * \brief Linked AVL tree for element appearing in multiple trees with different keys. * * AvliMelKey is similar to AvliMel, except that an additional template * parameter, BaseKey, is provided for resolving ambiguous references to * getKey(). This means that if an element is stored in multiple trees, each * tree can use a different key for ordering the elements in it. Using * AvliMelKey an array of data structures can be indexed with an O(log(n)) * search on two or more of the values contained within it and without * allocating any additional data. * * AvliMelKey does not assume ownership of elements in the tree. The destructor * will not delete the elements. If the user wishes to explicitly deallocate * all the items in the tree the empty() routine is available. * * \include ex_avlimelkey.cpp */ /*@}*/ #define BASE_EL(name) BaseEl::name #define BASEKEY(name) BaseKey::name #define BASELIST DListMel< Element, BaseEl > #define AVLMEL_CLASSDEF class Element, class Key, class BaseEl, \ class BaseKey, class Compare = CmpOrd #define AVLMEL_TEMPDEF class Element, class Key, class BaseEl, \ class BaseKey, class Compare #define AVLMEL_TEMPUSE Element, Key, BaseEl, BaseKey, Compare #define AvlTree AvliMelKey #define WALKABLE #include "avlcommon.h" #undef BASE_EL #undef BASEKEY #undef BASELIST #undef AVLMEL_CLASSDEF #undef AVLMEL_TEMPDEF #undef AVLMEL_TEMPUSE #undef AvlTree #undef WALKABLE #endif /* _AAPL_AVLIMELKEY_H */ kelbt-0.15/aapl/svector.h0000664000175000017500000012072111072514631015656 0ustar thurstonthurston/* * Copyright 2002, 2006 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_SVECTOR_H #define _AAPL_SVECTOR_H #include #include #include #include #include "table.h" #ifdef AAPL_NAMESPACE namespace Aapl { #endif /** * \addtogroup vector * @{ */ /** \class SVector * \brief Copy-on-write dynamic array. * * SVector is a variant of Vector that employs copy-on-write behaviour. The * SVector copy constructor and = operator make shallow copies. If a vector * that references shared data is modified with insert, replace, append, * prepend, setAs or remove, a new copy is made so as not to interfere with * the shared data. However, shared individual elements may be modified by * bypassing the SVector interface. * * SVector is a dynamic array that can be used to contain complex data * structures that have constructors and destructors as well as simple types * such as integers and pointers. * * SVector supports inserting, overwriting, and removing single or multiple * elements at once. Constructors and destructors are called wherever * appropriate. For example, before an element is overwritten, it's * destructor is called. * * SVector provides automatic resizing of allocated memory as needed and * offers different allocation schemes for controlling how the automatic * allocation is done. Two senses of the the length of the data is * maintained: the amount of raw memory allocated to the vector and the number * of actual elements in the vector. The various allocation schemes control * how the allocated space is changed in relation to the number of elements in * the vector. */ /*@}*/ /* SVector */ template < class T, class Resize = ResizeExpn > class SVector : public STable, public Resize { private: typedef STable BaseTable; public: /** * \brief Initialize an empty vector with no space allocated. * * If a linear resizer is used, the step defaults to 256 units of T. For a * runtime vector both up and down allocation schemes default to * Exponential. */ SVector() { } /** * \brief Create a vector that contains an initial element. * * The vector becomes one element in length. The element's copy * constructor is used to place the value in the vector. */ SVector(const T &val) { setAs(&val, 1); } /** * \brief Create a vector that contains an array of elements. * * The vector becomes len elements in length. Copy constructors are used * to place the new elements in the vector. */ SVector(const T *val, long len) { setAs(val, len); } /* Shallow copy. */ SVector( const SVector &v ); /** * \brief Free all memory used by the vector. * * The vector is reset to zero elements. Destructors are called on all * elements in the vector. The space allocated for the vector is freed. */ ~SVector() { empty(); } /* Delete all items. */ void empty(); /** * \brief Deep copy another vector into this vector. * * Copies the entire contents of the other vector into this vector. Any * existing contents are first deleted. Equivalent to setAs. */ void deepCopy( const SVector &v ) { setAs(v.data, v.length()); } /* Perform a shallow copy of another vector. */ SVector &operator=( const SVector &v ); /*@{*/ /** * \brief Insert one element at position pos. * * Elements in the vector from pos onward are shifted one space to the * right. The copy constructor is used to place the element into this * vector. If pos is greater than the length of the vector then undefined * behaviour results. If pos is negative then it is treated as an offset * relative to the length of the vector. */ void insert(long pos, const T &val) { insert(pos, &val, 1); } /* Insert an array of values. */ void insert(long pos, const T *val, long len); /** * \brief Insert all the elements from another vector at position pos. * * Elements in this vector from pos onward are shifted v.length() spaces * to the right. The element's copy constructor is used to copy the items * into this vector. The other vector is left unchanged. If pos is off the * end of the vector, then undefined behaviour results. If pos is negative * then it is treated as an offset relative to the length of the vector. * Equivalent to vector.insert(pos, other.data, other.length()). */ void insert(long pos, const SVector &v) { insert(pos, v.data, v.length()); } /* Insert len copies of val into the vector. */ void insertDup(long pos, const T &val, long len); /** * \brief Insert one new element using the default constrcutor. * * Elements in the vector from pos onward are shifted one space to the right. * The default constructor is used to init the new element. If pos is greater * than the length of the vector then undefined behaviour results. If pos is * negative then it is treated as an offset relative to the length of the * vector. */ void insertNew(long pos) { insertNew(pos, 1); } /* Insert len new items using default constructor. */ void insertNew(long pos, long len); /*@}*/ /*@{*/ /** * \brief Remove one element at position pos. * * The element's destructor is called. Elements to the right of pos are * shifted one space to the left to take up the free space. If pos is greater * than or equal to the length of the vector then undefined behavior results. * If pos is negative then it is treated as an offset relative to the length * of the vector. */ void remove(long pos) { remove(pos, 1); } /* Delete a number of elements. */ void remove(long pos, long len); /*@}*/ /*@{*/ /** * \brief Replace one element at position pos. * * If there is an existing element at position pos (if pos is less than the * length of the vector) then its destructor is called before the space is * used. The copy constructor is used to place the element into the vector. * If pos is greater than the length of the vector then undefined behaviour * results. If pos is negative then it is treated as an offset relative to * the length of the vector. */ void replace(long pos, const T &val) { replace(pos, &val, 1); } /* Replace with an array of values. */ void replace(long pos, const T *val, long len); /** * \brief Replace at position pos with all the elements of another vector. * * Replace at position pos with all the elements of another vector. The other * vector is left unchanged. If there are existing elements at the positions * to be replaced, then destructors are called before the space is used. Copy * constructors are used to place the elements into this vector. It is * allowable for the pos and length of the other vector to specify a * replacement that overwrites existing elements and creates new ones. If pos * is greater than the length of the vector then undefined behaviour results. * If pos is negative, then it is treated as an offset relative to the length * of the vector. */ void replace(long pos, const SVector &v) { replace(pos, v.data, v.length()); } /* Replace len items with len copies of val. */ void replaceDup(long pos, const T &val, long len); /** * \brief Replace at position pos with one new element. * * If there is an existing element at the position to be replaced (pos is * less than the length of the vector) then the element's destructor is * called before the space is used. The default constructor is used to * initialize the new element. If pos is greater than the length of the * vector then undefined behaviour results. If pos is negative, then it is * treated as an offset relative to the length of the vector. */ void replaceNew(long pos) { replaceNew(pos, 1); } /* Replace len items at pos with newly constructed objects. */ void replaceNew(long pos, long len); /*@}*/ /*@{*/ /** * \brief Set the contents of the vector to be val exactly. * * The vector becomes one element in length. Destructors are called on any * existing elements in the vector. The element's copy constructor is used to * place the val in the vector. */ void setAs(const T &val) { setAs(&val, 1); } /* Set to the contents of an array. */ void setAs(const T *val, long len); /** * \brief Set the vector to exactly the contents of another vector. * * The vector becomes v.length() elements in length. Destructors are called * on any existing elements. Copy constructors are used to place the new * elements in the vector. */ void setAs(const SVector &v) { setAs(v.data, v.length()); } /* Set as len copies of item. */ void setAsDup(const T &item, long len); /** * \brief Set the vector to exactly one new item. * * The vector becomes one element in length. Destructors are called on any * existing elements in the vector. The default constructor is used to * init the new item. */ void setAsNew() { setAsNew(1); } /* Set as newly constructed objects using the default constructor. */ void setAsNew(long len); /*@}*/ /*@{*/ /** * \brief Append one elment to the end of the vector. * * Copy constructor is used to place the element in the vector. */ void append(const T &val) { replace(BaseTable::length(), &val, 1); } /** * \brief Append len elements to the end of the vector. * * Copy constructors are used to place the elements in the vector. */ void append(const T *val, long len) { replace(BaseTable::length(), val, len); } /** * \brief Append the contents of another vector. * * The other vector is left unchanged. Copy constructors are used to place * the elements in the vector. */ void append(const SVector &v) { replace(BaseTable::length(), v.data, v.length()); } /** * \brief Append len copies of item. * * The copy constructor is used to place the item in the vector. */ void appendDup(const T &item, long len) { replaceDup(BaseTable::length(), item, len); } /** * \brief Append a single newly created item. * * The new element is initialized with the default constructor. */ void appendNew() { replaceNew(BaseTable::length(), 1); } /** * \brief Append len newly created items. * * The new elements are initialized with the default constructor. */ void appendNew(long len) { replaceNew(BaseTable::length(), len); } /*@}*/ /*@{*/ /** * \brief Prepend one elment to the front of the vector. * * Copy constructor is used to place the element in the vector. */ void prepend(const T &val) { insert(0, &val, 1); } /** * \brief Prepend len elements to the front of the vector. * * Copy constructors are used to place the elements in the vector. */ void prepend(const T *val, long len) { insert(0, val, len); } /** * \brief Prepend the contents of another vector. * * The other vector is left unchanged. Copy constructors are used to place * the elements in the vector. */ void prepend(const SVector &v) { insert(0, v.data, v.length()); } /** * \brief Prepend len copies of item. * * The copy constructor is used to place the item in the vector. */ void prependDup(const T &item, long len) { insertDup(0, item, len); } /** * \brief Prepend a single newly created item. * * The new element is initialized with the default constructor. */ void prependNew() { insertNew(0, 1); } /** * \brief Prepend len newly created items. * * The new elements are initialized with the default constructor. */ void prependNew(long len) { insertNew(0, len); } /*@}*/ /* Convenience access. */ T &operator[](int i) const { return BaseTable::data[i]; } long size() const { return BaseTable::length(); } /* Various classes for setting the iterator */ struct Iter; struct IterFirst { IterFirst( const SVector &v ) : v(v) { } const SVector &v; }; struct IterLast { IterLast( const SVector &v ) : v(v) { } const SVector &v; }; struct IterNext { IterNext( const Iter &i ) : i(i) { } const Iter &i; }; struct IterPrev { IterPrev( const Iter &i ) : i(i) { } const Iter &i; }; /** * \brief Shared Vector Iterator. * \ingroup iterators */ struct Iter { /* Construct, assign. */ Iter() : ptr(0), ptrBeg(0), ptrEnd(0) { } /* Construct. */ Iter( const SVector &v ); Iter( const IterFirst &vf ); Iter( const IterLast &vl ); inline Iter( const IterNext &vn ); inline Iter( const IterPrev &vp ); /* Assign. */ Iter &operator=( const SVector &v ); Iter &operator=( const IterFirst &vf ); Iter &operator=( const IterLast &vl ); inline Iter &operator=( const IterNext &vf ); inline Iter &operator=( const IterPrev &vl ); /** \brief Less than end? */ bool lte() const { return ptr != ptrEnd; } /** \brief At end? */ bool end() const { return ptr == ptrEnd; } /** \brief Greater than beginning? */ bool gtb() const { return ptr != ptrBeg; } /** \brief At beginning? */ bool beg() const { return ptr == ptrBeg; } /** \brief At first element? */ bool first() const { return ptr == ptrBeg+1; } /** \brief At last element? */ bool last() const { return ptr == ptrEnd-1; } /* Return the position. */ long pos() const { return ptr - ptrBeg - 1; } T &operator[](int i) const { return ptr[i]; } /** \brief Implicit cast to T*. */ operator T*() const { return ptr; } /** \brief Dereference operator returns T&. */ T &operator *() const { return *ptr; } /** \brief Arrow operator returns T*. */ T *operator->() const { return ptr; } /** \brief Move to next item. */ T *operator++() { return ++ptr; } /** \brief Move to next item. */ T *operator++(int) { return ptr++; } /** \brief Move to next item. */ T *increment() { return ++ptr; } /** \brief Move to previous item. */ T *operator--() { return --ptr; } /** \brief Move to previous item. */ T *operator--(int) { return ptr--; } /** \brief Move to previous item. */ T *decrement() { return --ptr; } /** \brief Return the next item. Does not modify this. */ inline IterNext next() const { return IterNext(*this); } /** \brief Return the previous item. Does not modify this. */ inline IterPrev prev() const { return IterPrev(*this); } /** \brief The iterator is simply a pointer. */ T *ptr; /* For testing endpoints. */ T *ptrBeg, *ptrEnd; }; /** \brief Return first element. */ IterFirst first() { return IterFirst( *this ); } /** \brief Return last element. */ IterLast last() { return IterLast( *this ); } protected: void makeRawSpaceFor(long pos, long len); void setAsCommon(long len); long replaceCommon(long pos, long len); long insertCommon(long pos, long len); void upResize(long len); void upResizeDup(long len); void upResizeFromEmpty(long len); void downResize(long len); void downResizeDup(long len); }; /** * \brief Perform a shallow copy of the vector. * * Takes a reference to the contents of the other vector. */ template SVector:: SVector(const SVector &v) { /* Take a reference to other, if any data is allocated. */ if ( v.data == 0 ) BaseTable::data = 0; else { /* Get the source header, up the refcount and ref it. */ STabHead *srcHead = ((STabHead*) v.data) - 1; srcHead->refCount += 1; BaseTable::data = (T*) (srcHead + 1); } } /** * \brief Shallow copy another vector into this vector. * * Takes a reference to the other vector. The contents of this vector are * first emptied. * * \returns A reference to this. */ template SVector & SVector:: operator=( const SVector &v ) { /* First clean out the current contents. */ empty(); /* Take a reference to other, if any data is allocated. */ if ( v.data == 0 ) BaseTable::data = 0; else { /* Get the source header, up the refcount and ref it. */ STabHead *srcHead = ((STabHead*) v.data) - 1; srcHead->refCount += 1; BaseTable::data = (T*) (srcHead + 1); } return *this; } /* Init a vector iterator with just a vector. */ template SVector:: Iter::Iter( const SVector &v ) { long length; if ( v.data == 0 || (length=(((STabHead*)v.data)-1)->tabLen) == 0 ) ptr = ptrBeg = ptrEnd = 0; else { ptr = v.data; ptrBeg = v.data-1; ptrEnd = v.data+length; } } /* Init a vector iterator with the first of a vector. */ template SVector:: Iter::Iter( const IterFirst &vf ) { long length; if ( vf.v.data == 0 || (length=(((STabHead*)vf.v.data)-1)->tabLen) == 0 ) ptr = ptrBeg = ptrEnd = 0; else { ptr = vf.v.data; ptrBeg = vf.v.data-1; ptrEnd = vf.v.data+length; } } /* Init a vector iterator with the last of a vector. */ template SVector:: Iter::Iter( const IterLast &vl ) { long length; if ( vl.v.data == 0 || (length=(((STabHead*)vl.v.data)-1)->tabLen) == 0 ) ptr = ptrBeg = ptrEnd = 0; else { ptr = vl.v.data+length-1; ptrBeg = vl.v.data-1; ptrEnd = vl.v.data+length; } } /* Init a vector iterator with the next of some other iterator. */ template SVector:: Iter::Iter( const IterNext &vn ) : ptr(vn.i.ptr+1), ptrBeg(vn.i.ptrBeg), ptrEnd(vn.i.ptrEnd) { } /* Init a vector iterator with the prev of some other iterator. */ template SVector:: Iter::Iter( const IterPrev &vp ) : ptr(vp.i.ptr-1), ptrBeg(vp.i.ptrBeg), ptrEnd(vp.i.ptrEnd) { } /* Set a vector iterator with some vector. */ template typename SVector::Iter & SVector::Iter::operator=( const SVector &v ) { long length; if ( v.data == 0 || (length=(((STabHead*)v.data)-1)->tabLen) == 0 ) ptr = ptrBeg = ptrEnd = 0; else { ptr = v.data; ptrBeg = v.data-1; ptrEnd = v.data+length; } return *this; } /* Set a vector iterator with the first element in a vector. */ template typename SVector::Iter & SVector::Iter::operator=( const IterFirst &vf ) { long length; if ( vf.v.data == 0 || (length=(((STabHead*)vf.v.data)-1)->tabLen) == 0 ) ptr = ptrBeg = ptrEnd = 0; else { ptr = vf.v.data; ptrBeg = vf.v.data-1; ptrEnd = vf.v.data+length; } return *this; } /* Set a vector iterator with the last element in a vector. */ template typename SVector::Iter & SVector::Iter::operator=( const IterLast &vl ) { long length; if ( vl.v.data == 0 || (length=(((STabHead*)vl.v.data)-1)->tabLen) == 0 ) ptr = ptrBeg = ptrEnd = 0; else { ptr = vl.v.data+length-1; ptrBeg = vl.v.data-1; ptrEnd = vl.v.data+length; } return *this; } /* Set a vector iterator with the next of some other iterator. */ template typename SVector::Iter & SVector::Iter::operator=( const IterNext &vn ) { ptr = vn.i.ptr+1; ptrBeg = vn.i.ptrBeg; ptrEnd = vn.i.ptrEnd; return *this; } /* Set a vector iterator with the prev of some other iterator. */ template typename SVector::Iter & SVector::Iter::operator=( const IterPrev &vp ) { ptr = vp.i.ptr-1; ptrBeg = vp.i.ptrBeg; ptrEnd = vp.i.ptrEnd; return *this; } /* Up resize the data for len elements using Resize::upResize to tell us the * new length. Reads and writes allocLen. Does not read or write length. * Assumes that there is some data allocated already. */ template void SVector:: upResize(long len) { /* Get the current header. */ STabHead *head = ((STabHead*)BaseTable::data) - 1; /* Ask the resizer what the new length will be. */ long newLen = Resize::upResize(head->allocLen, len); /* Did the data grow? */ if ( newLen > head->allocLen ) { head->allocLen = newLen; /* Table exists already, resize it up. */ head = (STabHead*) realloc( head, sizeof(STabHead) + sizeof(T) * newLen ); if ( head == 0 ) throw std::bad_alloc(); /* Save the data pointer. */ BaseTable::data = (T*) (head + 1); } } /* Allocates a new buffer for an up resize that requires a duplication of the * data. Uses Resize::upResize to get the allocation length. Reads and writes * allocLen. This upResize does write the new length. Assumes that there is * some data allocated already. */ template void SVector:: upResizeDup(long len) { /* Get the current header. */ STabHead *head = ((STabHead*)BaseTable::data) - 1; /* Ask the resizer what the new length will be. */ long newLen = Resize::upResize(head->allocLen, len); /* Dereferencing the existing data, decrement the refcount. */ head->refCount -= 1; /* Table exists already, resize it up. */ head = (STabHead*) malloc( sizeof(STabHead) + sizeof(T) * newLen ); if ( head == 0 ) throw std::bad_alloc(); head->refCount = 1; head->allocLen = newLen; head->tabLen = len; /* Save the data pointer. */ BaseTable::data = (T*) (head + 1); } /* Up resize the data for len elements using Resize::upResize to tell us the * new length. Reads and writes allocLen. This upresize DOES write length. * Assumes that no data is allocated. */ template void SVector:: upResizeFromEmpty(long len) { /* There is no table yet. If the len is zero, then there is no need to * create a table. */ if ( len > 0 ) { /* Ask the resizer what the new length will be. */ long newLen = Resize::upResize(0, len); /* If len is greater than zero then we are always allocating the table. */ STabHead *head = (STabHead*) malloc( sizeof(STabHead) + sizeof(T) * newLen ); if ( head == 0 ) throw std::bad_alloc(); /* Set up the header and save the data pointer. Note that we set the * length here. This differs from the other upResizes. */ head->refCount = 1; head->allocLen = newLen; head->tabLen = len; BaseTable::data = (T*) (head + 1); } } /* Down resize the data for len elements using Resize::downResize to determine * the new length. Reads and writes allocLen. Does not read or write length. */ template void SVector:: downResize(long len) { /* If there is already no length, then there is nothing we can do. */ if ( BaseTable::data != 0 ) { /* Get the current header. */ STabHead *head = ((STabHead*)BaseTable::data) - 1; /* Ask the resizer what the new length will be. */ long newLen = Resize::downResize( head->allocLen, len ); /* Did the data shrink? */ if ( newLen < head->allocLen ) { if ( newLen == 0 ) { /* Simply free the data. */ free( head ); BaseTable::data = 0; } else { /* Save the new allocated length. */ head->allocLen = newLen; /* Not shrinking to size zero, realloc it to the smaller size. */ head = (STabHead*) realloc( head, sizeof(STabHead) + sizeof(T) * newLen ); if ( head == 0 ) throw std::bad_alloc(); /* Save the new data ptr. */ BaseTable::data = (T*) (head + 1); } } } } /* Allocate a new buffer for a down resize and duplication of the array. The * new array will be len long and allocation size will be determined using * Resize::downResize with the old array's allocLen. Does not actually copy * any data. Reads and writes allocLen and writes the new len. */ template void SVector:: downResizeDup(long len) { /* If there is already no length, then there is nothing we can do. */ if ( BaseTable::data != 0 ) { /* Get the current header. */ STabHead *head = ((STabHead*)BaseTable::data) - 1; /* Ask the resizer what the new length will be. */ long newLen = Resize::downResize( head->allocLen, len ); /* Detaching from the existing head, decrement the refcount. */ head->refCount -= 1; /* Not shrinking to size zero, malloc it to the smaller size. */ head = (STabHead*) malloc( sizeof(STabHead) + sizeof(T) * newLen ); if ( head == 0 ) throw std::bad_alloc(); /* Save the new allocated length. */ head->refCount = 1; head->allocLen = newLen; head->tabLen = len; /* Save the data pointer. */ BaseTable::data = (T*) (head + 1); } } /** * \brief Free all memory used by the vector. * * The vector is reset to zero elements. Destructors are called on all * elements in the vector. The space allocated for the vector is freed. */ template void SVector:: empty() { if ( BaseTable::data != 0 ) { /* Get the header and drop the refcount on the data. */ STabHead *head = ((STabHead*) BaseTable::data) - 1; head->refCount -= 1; /* If the refcount just went down to zero nobody else is referencing * the data. */ if ( head->refCount == 0 ) { /* Call All destructors. */ T *pos = BaseTable::data; for ( long i = 0; i < head->tabLen; pos++, i++ ) pos->~T(); /* Free the data space. */ free( head ); } /* Clear the pointer. */ BaseTable::data = 0; } } /* Prepare for setting the contents of the vector to some array len long. * Handles reusing the existing space, detaching from a common space or * growing from zero length automatically. */ template void SVector:: setAsCommon(long len) { if ( BaseTable::data != 0 ) { /* Get the header. */ STabHead *head = ((STabHead*)BaseTable::data) - 1; /* If the refCount is one, then we can reuse the space. Otherwise we * must detach from the referenced data create new space. */ if ( head->refCount == 1 ) { /* Call All destructors. */ T *pos = BaseTable::data; for ( long i = 0; i < head->tabLen; pos++, i++ ) pos->~T(); /* Adjust the allocated length. */ if ( len < head->tabLen ) downResize( len ); else if ( len > head->tabLen ) upResize( len ); if ( BaseTable::data != 0 ) { /* Get the header again and set the length. */ head = ((STabHead*)BaseTable::data) - 1; head->tabLen = len; } } else { /* Just detach from the data. */ head->refCount -= 1; BaseTable::data = 0; /* Make enough space. This will set the length. */ upResizeFromEmpty( len ); } } else { /* The table is currently empty. Make enough space. This will set the * length. */ upResizeFromEmpty( len ); } } /** * \brief Set the contents of the vector to be len elements exactly. * * The vector becomes len elements in length. Destructors are called on any * existing elements in the vector. Copy constructors are used to place the * new elements in the vector. */ template void SVector:: setAs(const T *val, long len) { /* Common stuff for setting the array to len long. */ setAsCommon( len ); /* Copy data in. */ T *dst = BaseTable::data; const T *src = val; for ( long i = 0; i < len; i++, dst++, src++ ) new(dst) T(*src); } /** * \brief Set the vector to len copies of item. * * The vector becomes len elements in length. Destructors are called on any * existing elements in the vector. The element's copy constructor is used to * copy the item into the vector. */ template void SVector:: setAsDup(const T &item, long len) { /* Do the common stuff for setting the array to len long. */ setAsCommon( len ); /* Copy item in one spot at a time. */ T *dst = BaseTable::data; for ( long i = 0; i < len; i++, dst++ ) new(dst) T(item); } /** * \brief Set the vector to exactly len new items. * * The vector becomes len elements in length. Destructors are called on any * existing elements in the vector. Default constructors are used to init the * new items. */ template void SVector:: setAsNew(long len) { /* Do the common stuff for setting the array to len long. */ setAsCommon( len ); /* Create items using default constructor. */ T *dst = BaseTable::data; for ( long i = 0; i < len; i++, dst++ ) new(dst) T(); } /* Make space in vector for a replacement at pos of len items. Handles reusing * existing space, detaching or growing from zero space. */ template long SVector:: replaceCommon(long pos, long len) { if ( BaseTable::data != 0 ) { /* Get the header. */ STabHead *head = ((STabHead*)BaseTable::data) - 1; /* If we are given a negative position to replace at then treat it as * a position relative to the length. This doesn't have any meaning * unless the length is at least one. */ if ( pos < 0 ) pos = head->tabLen + pos; /* The end is the one past the last item that we want to write to. */ long i, endPos = pos + len; if ( head->refCount == 1 ) { /* We can reuse the space. Make sure we have enough space. */ if ( endPos > head->tabLen ) { upResize( endPos ); /* Get the header again, whose addr may have changed after * resizing. */ head = ((STabHead*)BaseTable::data) - 1; /* Delete any objects we need to delete. */ T *item = BaseTable::data + pos; for ( i = pos; i < head->tabLen; i++, item++ ) item->~T(); /* We are extending the vector, set the new data length. */ head->tabLen = endPos; } else { /* Delete any objects we need to delete. */ T *item = BaseTable::data + pos; for ( i = pos; i < endPos; i++, item++ ) item->~T(); } } else { /* Use endPos to calc the end of the vector. */ long newLen = endPos; if ( newLen < head->tabLen ) newLen = head->tabLen; /* Duplicate and grow up to endPos. This will set the length. */ upResizeDup( newLen ); /* Copy from src up to pos. */ const T *src = (T*) (head + 1); T *dst = BaseTable::data; for ( i = 0; i < pos; i++, dst++, src++) new(dst) T(*src); /* Copy any items after the replace range. */ for ( i += len, src += len, dst += len; i < head->tabLen; i++, dst++, src++ ) new(dst) T(*src); } } else { /* There is no data initially, must grow from zero. This will set the * new length. */ upResizeFromEmpty( len ); } return pos; } /** * \brief Replace len elements at position pos. * * If there are existing elements at the positions to be replaced, then * destructors are called before the space is used. Copy constructors are used * to place the elements into the vector. It is allowable for the pos and * length to specify a replacement that overwrites existing elements and * creates new ones. If pos is greater than the length of the vector then * undefined behaviour results. If pos is negative, then it is treated as an * offset relative to the length of the vector. */ template void SVector:: replace(long pos, const T *val, long len) { /* Common work for replacing in the vector. */ pos = replaceCommon( pos, len ); /* Copy data in using copy constructor. */ T *dst = BaseTable::data + pos; const T *src = val; for ( long i = 0; i < len; i++, dst++, src++ ) new(dst) T(*src); } /** * \brief Replace at position pos with len copies of an item. * * If there are existing elements at the positions to be replaced, then * destructors are called before the space is used. The copy constructor is * used to place the element into this vector. It is allowable for the pos and * length to specify a replacement that overwrites existing elements and * creates new ones. If pos is greater than the length of the vector then * undefined behaviour results. If pos is negative, then it is treated as an * offset relative to the length of the vector. */ template void SVector:: replaceDup(long pos, const T &val, long len) { /* Common replacement stuff. */ pos = replaceCommon( pos, len ); /* Copy data in using copy constructor. */ T *dst = BaseTable::data + pos; for ( long i = 0; i < len; i++, dst++ ) new(dst) T(val); } /** * \brief Replace at position pos with len new elements. * * If there are existing elements at the positions to be replaced, then * destructors are called before the space is used. The default constructor is * used to initialize the new elements. It is allowable for the pos and length * to specify a replacement that overwrites existing elements and creates new * ones. If pos is greater than the length of the vector then undefined * behaviour results. If pos is negative, then it is treated as an offset * relative to the length of the vector. */ template void SVector:: replaceNew(long pos, long len) { /* Do the common replacement stuff. */ pos = replaceCommon( pos, len ); /* Copy data in using copy constructor. */ T *dst = BaseTable::data + pos; for ( long i = 0; i < len; i++, dst++ ) new(dst) T(); } /** * \brief Remove len elements at position pos. * * Destructor is called on all elements removed. Elements to the right of pos * are shifted len spaces to the left to take up the free space. If pos is * greater than or equal to the length of the vector then undefined behavior * results. If pos is negative then it is treated as an offset relative to the * length of the vector. */ template void SVector:: remove(long pos, long len) { /* If there is no data, we can't delete anything anyways. */ if ( BaseTable::data != 0 ) { /* Get the header. */ STabHead *head = ((STabHead*)BaseTable::data) - 1; /* If we are given a negative position to remove at then * treat it as a position relative to the length. */ if ( pos < 0 ) pos = head->tabLen + pos; /* The first position after the last item deleted. */ long endPos = pos + len; /* The New data length. */ long i, newLen = head->tabLen - len; if ( head->refCount == 1 ) { /* We are the only ones using the data. We can reuse * the existing space. */ /* The place in the data we are deleting at. */ T *dst = BaseTable::data + pos; /* Call Destructors. */ T *item = BaseTable::data + pos; for ( i = 0; i < len; i += 1, item += 1 ) item->~T(); /* Shift data over if necessary. */ long lenToSlideOver = head->tabLen - endPos; if ( len > 0 && lenToSlideOver > 0 ) memmove(BaseTable::data + pos, dst + len, sizeof(T)*lenToSlideOver); /* Shrink the data if necessary. */ downResize( newLen ); if ( BaseTable::data != 0 ) { /* Get the header again (because of the resize) and set the * new data length. */ head = ((STabHead*)BaseTable::data) - 1; head->tabLen = newLen; } } else { /* Must detach from the common data. Just copy the non-deleted * items from the common data. */ /* Duplicate and grow down to newLen. This will set the length. */ downResizeDup( newLen ); /* Copy over just the non-deleted parts. */ const T *src = (T*) (head + 1); T *dst = BaseTable::data; for ( i = 0; i < pos; i++, dst++, src++ ) new(dst) T(*src); /* ... and the second half. */ for ( i += len, src += len; i < head->tabLen; i++, src++, dst++ ) new(dst) T(*src); } } } /* Shift over existing data. Handles reusing existing space, detaching or * growing from zero space. */ template long SVector:: insertCommon(long pos, long len) { if ( BaseTable::data != 0 ) { /* Get the header. */ STabHead *head = ((STabHead*)BaseTable::data) - 1; /* If we are given a negative position to insert at then treat it as a * position relative to the length. This only has meaning if there is * existing data. */ if ( pos < 0 ) pos = head->tabLen + pos; /* Calculate the new length. */ long i, newLen = head->tabLen + len; if ( head->refCount == 1 ) { /* Up resize, we are growing. */ upResize( newLen ); /* Get the header again, (the addr may have changed after * resizing). */ head = ((STabHead*)BaseTable::data) - 1; /* Shift over data at insert spot if needed. */ if ( len > 0 && pos < head->tabLen ) { memmove( BaseTable::data + pos + len, BaseTable::data + pos, sizeof(T)*(head->tabLen - pos) ); } /* Grow the length by the len inserted. */ head->tabLen += len; } else { /* Need to detach from the existing array. Copy over the other * parts. This will set the length. */ upResizeDup( newLen ); /* Copy over the parts around the insert. */ const T *src = (T*) (head + 1); T *dst = BaseTable::data; for ( i = 0; i < pos; i++, dst++, src++ ) new(dst) T(*src); /* ... and the second half. */ for ( dst += len; i < head->tabLen; i++, src++, dst++ ) new(dst) T(*src); } } else { /* There is no existing data. Start from zero. This will set the * length. */ upResizeFromEmpty( len ); } return pos; } /** * \brief Insert len elements at position pos. * * Elements in the vector from pos onward are shifted len spaces to the right. * The copy constructor is used to place the elements into this vector. If pos * is greater than the length of the vector then undefined behaviour results. * If pos is negative then it is treated as an offset relative to the length * of the vector. */ template void SVector:: insert(long pos, const T *val, long len) { /* Do the common insertion stuff. */ pos = insertCommon( pos, len ); /* Copy data in element by element. */ T *dst = BaseTable::data + pos; const T *src = val; for ( long i = 0; i < len; i++, dst++, src++ ) new(dst) T(*src); } /** * \brief Insert len copies of item at position pos. * * Elements in the vector from pos onward are shifted len spaces to the right. * The copy constructor is used to place the element into this vector. If pos * is greater than the length of the vector then undefined behaviour results. * If pos is negative then it is treated as an offset relative to the length * of the vector. */ template void SVector:: insertDup(long pos, const T &item, long len) { /* Do the common insertion stuff. */ pos = insertCommon( pos, len ); /* Copy the data item in one at a time. */ T *dst = BaseTable::data + pos; for ( long i = 0; i < len; i++, dst++ ) new(dst) T(item); } /** * \brief Insert len new elements using the default constructor. * * Elements in the vector from pos onward are shifted len spaces to the right. * Default constructors are used to init the new elements. If pos is off the * end of the vector then undefined behaviour results. If pos is negative then * it is treated as an offset relative to the length of the vector. */ template void SVector:: insertNew(long pos, long len) { /* Do the common insertion stuff. */ pos = insertCommon( pos, len ); /* Init new data with default constructors. */ T *dst = BaseTable::data + pos; for ( long i = 0; i < len; i++, dst++ ) new(dst) T(); } /* Makes space for len items, Does not init the items in any way. If pos is * greater than the length of the vector then undefined behaviour results. * Updates the length of the vector. */ template void SVector:: makeRawSpaceFor(long pos, long len) { if ( BaseTable::data != 0 ) { /* Get the header. */ STabHead *head = ((STabHead*)BaseTable::data) - 1; /* Calculate the new length. */ long i, newLen = head->tabLen + len; if ( head->refCount == 1 ) { /* Up resize, we are growing. */ upResize( newLen ); /* Get the header again, (the addr may have changed after * resizing). */ head = ((STabHead*)BaseTable::data) - 1; /* Shift over data at insert spot if needed. */ if ( len > 0 && pos < head->tabLen ) { memmove( BaseTable::data + pos + len, BaseTable::data + pos, sizeof(T)*(head->tabLen - pos) ); } /* Grow the length by the len inserted. */ head->tabLen += len; } else { /* Need to detach from the existing array. Copy over the other * parts. This will set the length. */ upResizeDup( newLen ); /* Copy over the parts around the insert. */ const T *src = (T*) (head + 1); T *dst = BaseTable::data; for ( i = 0; i < pos; i++, dst++, src++ ) new(dst) T(*src); /* ... and the second half. */ for ( dst += len; i < head->tabLen; i++, src++, dst++ ) new(dst) T(*src); } } else { /* There is no existing data. Start from zero. This will set the * length. */ upResizeFromEmpty( len ); } } #ifdef AAPL_NAMESPACE } #endif #endif /* _AAPL_SVECTOR_H */ kelbt-0.15/aapl/bubblesort.h0000664000175000017500000000471211072514631016335 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_BUBBLESORT_H #define _AAPL_BUBBLESORT_H #ifdef AAPL_NAMESPACE namespace Aapl { #endif /** * \addtogroup sort * @{ */ /** * \class BubbleSort * \brief Bubble sort an array of data. * * BubbleSort can be used to sort any array of objects of type T provided a * compare class is given. BubbleSort is in-place. It does not require any * temporary storage. * * Objects are not made aware that they are being moved around in memory. * Assignment operators, constructors and destructors are never invoked by the * sort. * * BubbleSort runs in O(n^2) time. It is most useful when sorting arrays that * are nearly sorted. It is best when neighbouring pairs are out of place. * BubbleSort is a stable sort, meaning that objects with the same key have * their relative ordering preserved. */ /*@}*/ /* BubbleSort. */ template class BubbleSort : public Compare { public: /* Sorting interface routine. */ void sort(T *data, long len); }; /** * \brief Bubble sort an array of data. */ template void BubbleSort:: sort(T *data, long len) { bool changed = true; for ( long pass = 1; changed && pass < len; pass ++ ) { changed = false; for ( long i = 0; i < len-pass; i++ ) { /* Do we swap pos with the next one? */ if ( compare( data[i], data[i+1] ) > 0 ) { char tmp[sizeof(T)]; /* Swap the two items. */ memcpy( tmp, data+i, sizeof(T) ); memcpy( data+i, data+i+1, sizeof(T) ); memcpy( data+i+1, tmp, sizeof(T) ); /* Note that we made a change. */ changed = true; } } } } #ifdef AAPL_NAMESPACE } #endif #endif /* _AAPL_BUBBLESORT_H */ kelbt-0.15/aapl/bstcommon.h0000664000175000017500000005156211072514631016200 0ustar thurstonthurston/* * Copyright 2001 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* This header is not wrapped in ifndefs because it is * not intended to be included by users directly. */ #ifdef AAPL_NAMESPACE namespace Aapl { #endif /* Binary Search Table */ template < BST_TEMPL_DECLARE > class BstTable : public Compare, public Vector< Element, Resize > { typedef Vector BaseVector; typedef Table BaseTable; public: /** * \brief Default constructor. * * Create an empty binary search table. */ BstTable() { } /** * \brief Construct with initial value. * * Constructs a binary search table with an initial item. Uses the default * constructor for initializing Value. */ BstTable(const Key &key) { insert(key); } #if defined( BSTMAP ) /** * \brief Construct with initial value. * * Constructs a binary search table with an initial key/value pair. */ BstTable(const Key &key, const Value &val) { insert(key, val); } #endif #if ! defined( BSTSET ) /** * \brief Construct with initial value. * * Constructs a binary search table with an initial Element. */ BstTable(const Element &el) { insert(el); } #endif Element *insert(const Key &key, Element **lastFound = 0); Element *insertMulti(const Key &key); bool insert(const BstTable &other); void insertMulti(const BstTable &other); #if defined( BSTMAP ) Element *insert(const Key &key, const Value &val, Element **lastFound = 0); Element *insertMulti(const Key &key, const Value &val ); #endif #if ! defined( BSTSET ) Element *insert(const Element &el, Element **lastFound = 0); Element *insertMulti(const Element &el); #endif Element *find(const Key &key, Element **lastFound = 0) const; bool findMulti( const Key &key, Element *&lower, Element *&upper ) const; bool remove(const Key &key); bool remove(Element *item); long removeMulti(const Key &key); long removeMulti(Element *lower, Element *upper); /* The following provide access to the underlying insert and remove * functions that my be hidden by the BST insert and remove. The insertDup * and insertNew functions will never be hidden. They are provided for * consistency. The difference between the non-shared and the shared * tables is the documentation reference to the invoked function. */ #if !defined( SHARED_BST ) /*@{*/ /** \brief Call the insert of the underlying vector. * * Provides to access to the vector insert, which may become hidden. Care * should be taken to ensure that after the insert the ordering of * elements is preserved. * Invokes Vector::insert( long pos, const T &val ). */ void vinsert(long pos, const Element &val) { Vector< Element, Resize >::insert( pos, &val, 1 ); } /** \brief Call the insert of the underlying vector. * * Provides to access to the vector insert, which may become hidden. Care * should be taken to ensure that after the insert the ordering of * elements is preserved. * Invokes Vector::insert( long pos, const T *val, long len ). */ void vinsert(long pos, const Element *val, long len) { Vector< Element, Resize >::insert( pos, val, len ); } /** \brief Call the insert of the underlying vector. * * Provides to access to the vector insert, which may become hidden. Care * should be taken to ensure that after the insert the ordering of * elements is preserved. * Invokes Vector::insert( long pos, const Vector &v ). */ void vinsert(long pos, const BstTable &v) { Vector< Element, Resize >::insert( pos, v.data, v.tabLen ); } /*@}*/ /*@{*/ /** \brief Call the remove of the underlying vector. * * Provides access to the vector remove, which may become hidden. * Invokes Vector::remove( long pos ). */ void vremove(long pos) { Vector< Element, Resize >::remove( pos, 1 ); } /** \brief Call the remove of the underlying vector. * * Proves access to the vector remove, which may become hidden. * Invokes Vector::remove( long pos, long len ). */ void vremove(long pos, long len) { Vector< Element, Resize >::remove( pos, len ); } /*@}*/ #else /* SHARED_BST */ /*@{*/ /** \brief Call the insert of the underlying vector. * * Provides to access to the vector insert, which may become hidden. Care * should be taken to ensure that after the insert the ordering of * elements is preserved. * Invokes SVector::insert( long pos, const T &val ). */ void vinsert(long pos, const Element &val) { Vector< Element, Resize >::insert( pos, &val, 1 ); } /** \brief Call the insert of the underlying vector. * * Provides to access to the vector insert, which may become hidden. Care * should be taken to ensure that after the insert the ordering of * elements is preserved. * Invokes SVector::insert( long pos, const T *val, long len ). */ void vinsert(long pos, const Element *val, long len) { Vector< Element, Resize >::insert( pos, val, len ); } /** \brief Call the insert of the underlying vector. * * Provides to access to the vector insert, which may become hidden. Care * should be taken to ensure that after the insert the ordering of * elements is preserved. * Invokes SVector::insert( long pos, const SVector &v ). */ void vinsert(long pos, const BstTable &v) { Vector< Element, Resize >::insert( pos, v.data, v.length() ); } /*@}*/ /*@{*/ /** \brief Call the remove of the underlying vector. * * Provides access to the vector remove, which may become hidden. * Invokes SVector::remove( long pos ). */ void vremove(long pos) { Vector< Element, Resize >::remove( pos, 1 ); } /** \brief Call the remove of the underlying vector. * * Proves access to the vector remove, which may become hidden. * Invokes SVector::remove( long pos, long len ). */ void vremove(long pos, long len) { Vector< Element, Resize >::remove( pos, len ); } /*@}*/ #endif /* SHARED_BST */ }; #if 0 #if defined( SHARED_BST ) /** * \brief Construct a binary search table with an initial amount of * allocation. * * The table is initialized to have room for allocLength elements. The * table starts empty. */ template BstTable:: BstTable( long allocLen ) { /* Allocate the space if we are given a positive allocLen. */ if ( allocLen > 0 ) { /* Allocate the data needed. */ STabHead *head = (STabHead*) malloc( sizeof(STabHead) + sizeof(Element) * allocLen ); if ( head == 0 ) throw std::bad_alloc(); /* Set up the header and save the data pointer. */ head->refCount = 1; head->allocLen = allocLen; head->tabLen = 0; BaseTable::data = (Element*) (head + 1); } } #else /** * \brief Construct a binary search table with an initial amount of * allocation. * * The table is initialized to have room for allocLength elements. The * table starts empty. */ template BstTable:: BstTable( long allocLen ) { /* Allocate the space if we are given a positive allocLen. */ BaseTable::allocLen = allocLen; if ( BaseTable::allocLen > 0 ) { BaseTable::data = (Element*) malloc(sizeof(Element) * BaseTable::allocLen); if ( BaseTable::data == NULL ) throw std::bad_alloc(); } } #endif #endif /** * \brief Find the element with the given key and remove it. * * If multiple elements with the given key exist, then it is unspecified which * element will be removed. * * \returns True if an element is found and consequently removed, false * otherwise. */ template bool BstTable:: remove(const Key &key) { Element *el = find(key); if ( el != 0 ) { Vector< Element >::remove(el - BaseTable::data); return true; } return false; } /** * \brief Remove the element pointed to by item. * * If item does not point to an element in the tree, then undefined behaviour * results. If item is null, then remove has no effect. * * \returns True if item is not null, false otherwise. */ template bool BstTable:: remove( Element *item ) { if ( item != 0 ) { Vector< Element >::remove(item - BaseTable::data); return true; } return false; } /** * \brief Find and remove the entire range of elements with the given key. * * \returns The number of elements removed. */ template long BstTable:: removeMulti(const Key &key) { Element *low, *high; if ( findMulti(key, low, high) ) { /* Get the length of the range. */ long num = high - low + 1; Vector< Element >::remove(low - BaseTable::data, num); return num; } return 0; } template long BstTable:: removeMulti(Element *lower, Element *upper) { /* Get the length of the range. */ long num = upper - lower + 1; Vector< Element >::remove(lower - BaseTable::data, num); return num; } /** * \brief Find a range of elements with the given key. * * If any elements with the given key exist then lower and upper are set to * the low and high ends of the continous range of elements with the key. * Lower and upper will point to the first and last elements with the key. * * \returns True if any elements are found, false otherwise. */ template bool BstTable:: findMulti(const Key &key, Element *&low, Element *&high ) const { const Element *lower, *mid, *upper; long keyRelation; const long tblLen = BaseTable::length(); if ( BaseTable::data == 0 ) return false; lower = BaseTable::data; upper = BaseTable::data + tblLen - 1; while ( true ) { if ( upper < lower ) { /* Did not find the fd in the array. */ return false; } mid = lower + ((upper-lower)>>1); keyRelation = compare(key, GET_KEY(*mid)); if ( keyRelation < 0 ) upper = mid - 1; else if ( keyRelation > 0 ) lower = mid + 1; else { Element *lowEnd = BaseTable::data - 1; Element *highEnd = BaseTable::data + tblLen; lower = mid - 1; while ( lower != lowEnd && compare(key, GET_KEY(*lower)) == 0 ) lower--; upper = mid + 1; while ( upper != highEnd && compare(key, GET_KEY(*upper)) == 0 ) upper++; low = (Element*)lower + 1; high = (Element*)upper - 1; return true; } } } /** * \brief Find an element with the given key. * * If the find succeeds then lastFound is set to the element found. If the * find fails then lastFound is set the location where the key would be * inserted. If there is more than one element in the tree with the given key, * then it is unspecified which element is returned as the match. * * \returns The element found on success, null on failure. */ template Element *BstTable:: find( const Key &key, Element **lastFound ) const { const Element *lower, *mid, *upper; long keyRelation; const long tblLen = BaseTable::length(); if ( BaseTable::data == 0 ) return 0; lower = BaseTable::data; upper = BaseTable::data + tblLen - 1; while ( true ) { if ( upper < lower ) { /* Did not find the key. Last found gets the insert location. */ if ( lastFound != 0 ) *lastFound = (Element*)lower; return 0; } mid = lower + ((upper-lower)>>1); keyRelation = compare(key, GET_KEY(*mid)); if ( keyRelation < 0 ) upper = mid - 1; else if ( keyRelation > 0 ) lower = mid + 1; else { /* Key is found. Last found gets the found record. */ if ( lastFound != 0 ) *lastFound = (Element*)mid; return (Element*)mid; } } } template Element *BstTable:: insert(const Key &key, Element **lastFound) { const Element *lower, *mid, *upper; long keyRelation, insertPos; const long tblLen = BaseTable::length(); if ( tblLen == 0 ) { /* If the table is empty then go straight to insert. */ lower = BaseTable::data; goto insert; } lower = BaseTable::data; upper = BaseTable::data + tblLen - 1; while ( true ) { if ( upper < lower ) { /* Did not find the key in the array. * Place to insert at is lower. */ goto insert; } mid = lower + ((upper-lower)>>1); keyRelation = compare(key, GET_KEY(*mid)); if ( keyRelation < 0 ) upper = mid - 1; else if ( keyRelation > 0 ) lower = mid + 1; else { if ( lastFound != 0 ) *lastFound = (Element*)mid; return 0; } } insert: /* Get the insert pos. */ insertPos = lower - BaseTable::data; /* Do the insert. After makeRawSpaceFor, lower pointer is no good. */ BaseVector::makeRawSpaceFor(insertPos, 1); new(BaseTable::data + insertPos) Element(key); /* Set lastFound */ if ( lastFound != 0 ) *lastFound = BaseTable::data + insertPos; return BaseTable::data + insertPos; } template Element *BstTable:: insertMulti(const Key &key) { const Element *lower, *mid, *upper; long keyRelation, insertPos; const long tblLen = BaseTable::length(); if ( tblLen == 0 ) { /* If the table is empty then go straight to insert. */ lower = BaseTable::data; goto insert; } lower = BaseTable::data; upper = BaseTable::data + tblLen - 1; while ( true ) { if ( upper < lower ) { /* Did not find the key in the array. * Place to insert at is lower. */ goto insert; } mid = lower + ((upper-lower)>>1); keyRelation = compare(key, GET_KEY(*mid)); if ( keyRelation < 0 ) upper = mid - 1; else if ( keyRelation > 0 ) lower = mid + 1; else { lower = mid; goto insert; } } insert: /* Get the insert pos. */ insertPos = lower - BaseTable::data; /* Do the insert. */ BaseVector::makeRawSpaceFor(insertPos, 1); new(BaseTable::data + insertPos) Element(key); /* Return the element inserted. */ return BaseTable::data + insertPos; } /** * \brief Insert each element from other. * * Always attempts to insert all elements even if the insert of some item from * other fails. * * \returns True if all items inserted successfully, false if any insert * failed. */ template bool BstTable:: insert(const BstTable &other) { bool allSuccess = true; long otherLen = other.length(); for ( long i = 0; i < otherLen; i++ ) { Element *el = insert( other.data[i] ); if ( el == 0 ) allSuccess = false; } return allSuccess; } /** * \brief Insert each element from other even if the elements exist already. * * No individual insertMulti can fail. */ template void BstTable:: insertMulti(const BstTable &other) { long otherLen = other.length(); for ( long i = 0; i < otherLen; i++ ) insertMulti( other.data[i] ); } #if ! defined( BSTSET ) /** * \brief Insert the given element. * * If the key in the given element does not already exist in the table then a * new element is inserted. They element copy constructor is used to place the * element into the table. If lastFound is given, it is set to the new element * created. If the insert fails then lastFound is set to the existing element * of the same key. * * \returns The new element created upon success, null upon failure. */ template Element *BstTable:: insert(const Element &el, Element **lastFound ) { const Element *lower, *mid, *upper; long keyRelation, insertPos; const long tblLen = BaseTable::length(); if ( tblLen == 0 ) { /* If the table is empty then go straight to insert. */ lower = BaseTable::data; goto insert; } lower = BaseTable::data; upper = BaseTable::data + tblLen - 1; while ( true ) { if ( upper < lower ) { /* Did not find the key in the array. * Place to insert at is lower. */ goto insert; } mid = lower + ((upper-lower)>>1); keyRelation = compare(GET_KEY(el), GET_KEY(*mid)); if ( keyRelation < 0 ) upper = mid - 1; else if ( keyRelation > 0 ) lower = mid + 1; else { if ( lastFound != 0 ) *lastFound = (Element*)mid; return 0; } } insert: /* Get the insert pos. */ insertPos = lower - BaseTable::data; /* Do the insert. After makeRawSpaceFor, lower pointer is no good. */ BaseVector::makeRawSpaceFor(insertPos, 1); new(BaseTable::data + insertPos) Element(el); /* Set lastFound */ if ( lastFound != 0 ) *lastFound = BaseTable::data + insertPos; return BaseTable::data + insertPos; } /** * \brief Insert the given element even if it exists already. * * If the key in the given element exists already then the new element is * placed next to some other element of the same key. InsertMulti cannot fail. * The element copy constructor is used to place the element in the table. * * \returns The new element created. */ template Element *BstTable:: insertMulti(const Element &el) { const Element *lower, *mid, *upper; long keyRelation, insertPos; const long tblLen = BaseTable::length(); if ( tblLen == 0 ) { /* If the table is empty then go straight to insert. */ lower = BaseTable::data; goto insert; } lower = BaseTable::data; upper = BaseTable::data + tblLen - 1; while ( true ) { if ( upper < lower ) { /* Did not find the fd in the array. * Place to insert at is lower. */ goto insert; } mid = lower + ((upper-lower)>>1); keyRelation = compare(GET_KEY(el), GET_KEY(*mid)); if ( keyRelation < 0 ) upper = mid - 1; else if ( keyRelation > 0 ) lower = mid + 1; else { lower = mid; goto insert; } } insert: /* Get the insert pos. */ insertPos = lower - BaseTable::data; /* Do the insert. */ BaseVector::makeRawSpaceFor(insertPos, 1); new(BaseTable::data + insertPos) Element(el); /* Return the element inserted. */ return BaseTable::data + insertPos; } #endif #if defined( BSTMAP ) /** * \brief Insert the given key-value pair. * * If the given key does not already exist in the table then the key-value * pair is inserted. Copy constructors are used to place the pair in the * table. If lastFound is given, it is set to the new entry created. If the * insert fails then lastFound is set to the existing pair of the same key. * * \returns The new element created upon success, null upon failure. */ template Element *BstTable:: insert(const Key &key, const Value &val, Element **lastFound) { const Element *lower, *mid, *upper; long keyRelation, insertPos; const long tblLen = BaseTable::length(); if ( tblLen == 0 ) { /* If the table is empty then go straight to insert. */ lower = BaseTable::data; goto insert; } lower = BaseTable::data; upper = BaseTable::data + tblLen - 1; while ( true ) { if ( upper < lower ) { /* Did not find the fd in the array. * Place to insert at is lower. */ goto insert; } mid = lower + ((upper-lower)>>1); keyRelation = Compare::compare(key, mid->key); if ( keyRelation < 0 ) upper = mid - 1; else if ( keyRelation > 0 ) lower = mid + 1; else { if ( lastFound != NULL ) *lastFound = (Element*)mid; return 0; } } insert: /* Get the insert pos. */ insertPos = lower - BaseTable::data; /* Do the insert. */ BaseVector::makeRawSpaceFor(insertPos, 1); new(BaseTable::data + insertPos) Element(key, val); /* Set lastFound */ if ( lastFound != NULL ) *lastFound = BaseTable::data + insertPos; return BaseTable::data + insertPos; } /** * \brief Insert the given key-value pair even if the key exists already. * * If the key exists already then the key-value pair is placed next to some * other pair of the same key. InsertMulti cannot fail. Copy constructors are * used to place the pair in the table. * * \returns The new element created. */ template Element *BstTable:: insertMulti(const Key &key, const Value &val) { const Element *lower, *mid, *upper; long keyRelation, insertPos; const long tblLen = BaseTable::length(); if ( tblLen == 0 ) { /* If the table is empty then go straight to insert. */ lower = BaseTable::data; goto insert; } lower = BaseTable::data; upper = BaseTable::data + tblLen - 1; while ( true ) { if ( upper < lower ) { /* Did not find the key in the array. * Place to insert at is lower. */ goto insert; } mid = lower + ((upper-lower)>>1); keyRelation = Compare::compare(key, mid->key); if ( keyRelation < 0 ) upper = mid - 1; else if ( keyRelation > 0 ) lower = mid + 1; else { lower = mid; goto insert; } } insert: /* Get the insert pos. */ insertPos = lower - BaseTable::data; /* Do the insert. */ BaseVector::makeRawSpaceFor(insertPos, 1); new(BaseTable::data + insertPos) Element(key, val); /* Return the element inserted. */ return BaseTable::data + insertPos; } #endif #ifdef AAPL_NAMESPACE } #endif kelbt-0.15/aapl/table.h0000664000175000017500000001372111072514631015261 0ustar thurstonthurston/* * Copyright 2001, 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_TABLE_H #define _AAPL_TABLE_H #ifdef AAPL_NAMESPACE namespace Aapl { #endif /** * \addtogroup vector * @{ */ /** \class Table * \brief Base class for dynamic arrays. * * Table is used as the common data storage class for vectors. It does not * provide any methods to operate on the data and as such it is not intended * to be used directly. It exists so that algorithms that operatate on dynamic * arrays can be written without knowing about the various vector classes that * my exist. */ /*@}*/ /* Table class. */ template class Table { public: /* Default Constructor. */ inline Table(); /** * \brief Get the length of the vector. * * \returns the length of the vector. */ long length() const { return tabLen; } /** * \brief Table data. * * The pointer to the elements in the vector. Modifying the vector may * cause this pointer to change. */ T *data; /** * \brief Table length. * * The number of items of type T in the table. */ long tabLen; /** * \brief Allocated length. * * The number of items for which there is room in the current allocation. */ long allocLen; }; /** * \brief Default constructor * * Initialize table data to empty. */ template inline Table::Table() : data(0), tabLen(0), allocLen(0) { } /* Default shared table header class. */ struct STabHead { /** * \brief Table length. * * The number of items of type T in the table. */ long tabLen; /** * \brief Allocated length. * * The number of items for which there is room in the current allocation. */ long allocLen; /** * \brief Ref Count. * * The number of shared vectors referencing this data. */ long refCount; }; /** * \addtogroup vector * @{ */ /** \class STable * \brief Base class for implicitly shared dynamic arrays. * * STable is used as the common data storage class for shared vectors. It does * not provide any methods to operate on the data and as such it is not * intended to be used directly. It exists so that algorithms that operatate * on dynamic arrays can be written without knowing about the various shared * vector classes that my exist. */ /*@}*/ /* STable class. */ template class STable { public: /* Default Constructor. */ inline STable(); /** * \brief Get the length of the shared vector. * * \returns the length of the shared vector. */ long length() const { return data == 0 ? 0 : (((STabHead*)data) - 1)->tabLen; } /** * \brief Get header of the shared vector. * * \returns the header of the shared vector. */ STabHead *header() const { return data == 0 ? 0 : (((STabHead*)data) - 1); } /** * \brief Table data. * * The pointer to the elements in the vector. The shared table header is * located just behind the data. Modifying the vector may cause this * pointer to change. */ T *data; }; /** * \brief Default constructor * * Initialize shared table data to empty. */ template inline STable::STable() : data(0) { } /* If needed is greater than existing, give twice needed. */ #define EXPN_UP( existing, needed ) \ needed > existing ? (needed<<1) : existing /* If needed is less than 1 quarter existing, give twice needed. */ #define EXPN_DOWN( existing, needed ) \ needed < (existing>>2) ? (needed<<1) : existing /** * \addtogroup vector * @{ */ /** \class ResizeExpn * \brief Exponential table resizer. * * ResizeExpn is the default table resizer. When an up resize is needed, space * is doubled. When a down resize is needed, space is halved. The result is * that when growing the vector in a linear fashion, the number of resizes of * the allocated space behaves logarithmically. * * If only up resizes are done, there will never be more than 2 times the * needed space allocated. If down resizes are done as well, there will never * be more than 4 times the needed space allocated. ResizeExpn uses this 50% * usage policy on up resizing and 25% usage policy on down resizing to * improve performance when repeatedly inserting and removing a small number * of elements relative to the size of the array. This scheme guarantees that * repetitive inserting and removing of a small number of elements will never * result in repetative reallocation. * * The sizes passed to the resizer from the vectors are in units of T. */ /*@}*/ /* Exponential resizer. */ class ResizeExpn { protected: /** * \brief Determine the new table size when up resizing. * * If the existing size is insufficient for the space needed then allocate * twice the space needed. Otherwise use the existing size. * * \returns The new table size. */ static inline long upResize( long existing, long needed ) { return EXPN_UP( existing, needed ); } /** * \brief Determine the new table size when down resizing. * * If the space needed is less than one quarter of the existing size then * allocate twice the space needed. Otherwise use the exitsing size. * * \returns The new table size. */ static inline long downResize( long existing, long needed ) { return EXPN_DOWN( existing, needed ); } }; #undef EXPN_UP #undef EXPN_DOWN #ifdef AAPL_NAMESPACE } #endif #endif /* _AAPL_TABLE_H */ kelbt-0.15/aapl/avlset.h0000664000175000017500000000366411072514631015475 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_AVLSET_H #define _AAPL_AVLSET_H #include "compare.h" /** * \addtogroup avltree * @{ */ /** * \class AvlSet * \brief Key-only oriented tree. * * AvlSet stores only keys in elements that are managed by the tree. AvlSet * requires that a Key type and a class containing a compare() routine * for Key be given. Items are inserted with just a key value. * * AvlSet assumes all elements in the tree are allocated on the heap and are * to be managed by the tree. This means that the class destructor will delete * the contents of the tree. A deep copy will cause existing elements to be * deleted first. * * \include ex_avlset.cpp */ /*@}*/ #define AVLTREE_SET #define BASE_EL(name) name #define BASEKEY(name) name #define AVLMEL_CLASSDEF class Key, class Compare = CmpOrd #define AVLMEL_TEMPDEF class Key, class Compare #define AVLMEL_TEMPUSE Key, Compare #define AvlTree AvlSet #define Element AvlSetEl #include "avlcommon.h" #undef AVLTREE_SET #undef BASE_EL #undef BASEKEY #undef AVLMEL_CLASSDEF #undef AVLMEL_TEMPDEF #undef AVLMEL_TEMPUSE #undef AvlTree #undef Element #endif /* _AAPL_AVLSET_H */ kelbt-0.15/aapl/avlkeyless.h0000664000175000017500000000304611072514631016353 0ustar thurstonthurston/* * Copyright 2002, 2003 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_AVLKEYLESS_H #define _AAPL_AVLKEYLESS_H #include "compare.h" /** * \addtogroup avltree * @{ */ /** * \class AvlKeyless * \brief AVL tree that has no insert/find/remove functions that take a key. * * AvlKeyless is an implementation of the AVL tree rebalancing functionality * only. It provides the common code for the tiny AVL tree implementations. */ /*@}*/ #define BASE_EL(name) name #define AVLMEL_CLASSDEF class Element #define AVLMEL_TEMPDEF class Element #define AVLMEL_TEMPUSE Element #define AvlTree AvlKeyless #define AVL_KEYLESS #include "avlcommon.h" #undef BASE_EL #undef AVLMEL_CLASSDEF #undef AVLMEL_TEMPDEF #undef AVLMEL_TEMPUSE #undef AvlTree #undef AVL_KEYLESS #endif /* _AAPL_AVLKEYLESS_H */ kelbt-0.15/aapl/avlbasic.h0000664000175000017500000000345211072514631015756 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_AVLBASIC_H #define _AAPL_AVLBASIC_H #include "compare.h" /** * \addtogroup avltree * @{ */ /** * \class AvlBasic * \brief AVL Tree in which the entire element structure is the key. * * AvlBasic is an AVL tree that does not distinguish between the element that * it contains and the key. The entire element structure is the key that is * used to compare the relative ordering of elements. This is similar to the * BstSet structure. * * AvlBasic does not assume ownership of elements in the tree. Items must be * explicitly de-allocated. */ /*@}*/ #define BASE_EL(name) name #define BASEKEY(name) name #define AVLMEL_CLASSDEF class Element, class Compare #define AVLMEL_TEMPDEF class Element, class Compare #define AVLMEL_TEMPUSE Element, Compare #define AvlTree AvlBasic #define AVL_BASIC #include "avlcommon.h" #undef BASE_EL #undef BASEKEY #undef AVLMEL_CLASSDEF #undef AVLMEL_TEMPDEF #undef AVLMEL_TEMPUSE #undef AvlTree #undef AVL_BASIC #endif /* _AAPL_AVLBASIC_H */ kelbt-0.15/aapl/avlibasic.h0000664000175000017500000000354011072514631016125 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_AVLIBASIC_H #define _AAPL_AVLIBASIC_H #include "compare.h" /** * \addtogroup avlitree * @{ */ /** * \class AvliBasic * \brief Linked AVL Tree in which the entire element structure is the key. * * AvliBasic is a linked AVL tree that does not distinguish between the * element that it contains and the key. The entire element structure is the * key that is used to compare the relative ordering of elements. This is * similar to the BstSet structure. * * AvliBasic does not assume ownership of elements in the tree. Items must be * explicitly de-allocated. */ /*@}*/ #define BASE_EL(name) name #define BASEKEY(name) name #define AVLMEL_CLASSDEF class Element, class Compare #define AVLMEL_TEMPDEF class Element, class Compare #define AVLMEL_TEMPUSE Element, Compare #define AvlTree AvliBasic #define AVL_BASIC #define WALKABLE #include "avlcommon.h" #undef BASE_EL #undef BASEKEY #undef AVLMEL_CLASSDEF #undef AVLMEL_TEMPDEF #undef AVLMEL_TEMPUSE #undef AvlTree #undef AVL_BASIC #undef WALKABLE #endif /* _AAPL_AVLIBASIC_H */ kelbt-0.15/aapl/avlitree.h0000664000175000017500000000470211072514631016004 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_AVLITREE_H #define _AAPL_AVLITREE_H #include "compare.h" #include "dlistmel.h" /** * \addtogroup avlitree * @{ */ /** * \class AvliTree * \brief Linked AVL tree. * * AvliTree is the standard linked by-structure AVL tree. To use this * structure the user must define an element type and give it the necessary * properties. At the very least it must have a getKey() function that will be * used to compare the relative ordering of elements and tree management data * necessary for the AVL algorithm. An element type can acquire the management * data by inheriting the AvliTreeEl class. * * AvliTree does not presume to manage the allocation of elements in the tree. * The destructor will not delete the items in the tree, instead the elements * must be explicitly de-allocated by the user if necessary and when it is * safe to do so. The empty() routine will traverse the tree and delete all * items. * * Since the tree does not manage the elements, it can contain elements that * are allocated statically or that are part of another data structure. * * \include ex_avlitree.cpp */ /*@}*/ #define BASE_EL(name) name #define BASEKEY(name) name #define BASELIST DListMel< Element, AvliTreeEl > #define AVLMEL_CLASSDEF class Element, class Key, class Compare = CmpOrd #define AVLMEL_TEMPDEF class Element, class Key, class Compare #define AVLMEL_TEMPUSE Element, Key, Compare #define AvlTree AvliTree #define WALKABLE #include "avlcommon.h" #undef BASE_EL #undef BASEKEY #undef BASELIST #undef AVLMEL_CLASSDEF #undef AVLMEL_TEMPDEF #undef AVLMEL_TEMPUSE #undef AvlTree #undef WALKABLE #endif /* _AAPL_AVLITREE_H */ kelbt-0.15/aapl/sbstset.h0000664000175000017500000000532711072514631015664 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_SBSTSET_H #define _AAPL_SBSTSET_H /** * \addtogroup bst * @{ */ /** * \class SBstSet * \brief Copy-on-write binary search table for types that are the key. * * This is a set style binary search table that employs the copy-on-write * mechanism for storing table data. BstSet is suitable for types that * comprise the entire key. Rather than look into the element to retrieve the * key, the element is the key. A class that contains a comparison routine * for the key must be given. */ /*@}*/ #include "compare.h" #include "svector.h" #define BST_TEMPL_DECLARE class Key, class Compare = CmpOrd, \ class Resize = ResizeExpn #define BST_TEMPL_DEF class Key, class Compare, class Resize #define BST_TEMPL_USE Key, Compare, Resize #define GET_KEY(el) (el) #define BstTable SBstSet #define Vector SVector #define Table STable #define Element Key #define BSTSET #define SHARED_BST #include "bstcommon.h" #undef BST_TEMPL_DECLARE #undef BST_TEMPL_DEF #undef BST_TEMPL_USE #undef GET_KEY #undef BstTable #undef Vector #undef Table #undef Element #undef BSTSET #undef SHARED_BST /** * \fn SBstSet::insert(const Key &key, Key **lastFound) * \brief Insert the given key. * * If the given key does not already exist in the table then it is inserted. * The key's copy constructor is used to place the item in the table. If * lastFound is given, it is set to the new entry created. If the insert fails * then lastFound is set to the existing key of the same value. * * \returns The new element created upon success, null upon failure. */ /** * \fn SBstSet::insertMulti(const Key &key) * \brief Insert the given key even if it exists already. * * If the key exists already then it is placed next to some other key of the * same value. InsertMulti cannot fail. The key's copy constructor is used to * place the item in the table. * * \returns The new element created. */ #endif /* _AAPL_SBSTSET_H */ kelbt-0.15/aapl/bstmap.h0000664000175000017500000000575011072514631015463 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_BSTMAP_H #define _AAPL_BSTMAP_H #include "compare.h" #include "vector.h" #ifdef AAPL_NAMESPACE namespace Aapl { #endif /** * \brief Element for BstMap. * * Stores the key and value pair. */ template struct BstMapEl { BstMapEl() {} BstMapEl(const Key &key) : key(key) {} BstMapEl(const Key &key, const Value &val) : key(key), value(val) {} /** \brief The key */ Key key; /** \brief The value. */ Value value; }; #ifdef AAPL_NAMESPACE } #endif /** * \addtogroup bst * @{ */ /** * \class BstMap * \brief Binary search table for key and value pairs. * * BstMap stores key and value pairs in each element. The key and value can be * any type. A compare class for the key must be supplied. */ /*@}*/ #define BST_TEMPL_DECLARE class Key, class Value, \ class Compare = CmpOrd, class Resize = ResizeExpn #define BST_TEMPL_DEF class Key, class Value, class Compare, class Resize #define BST_TEMPL_USE Key, Value, Compare, Resize #define GET_KEY(el) ((el).key) #define BstTable BstMap #define Element BstMapEl #define BSTMAP #include "bstcommon.h" #undef BST_TEMPL_DECLARE #undef BST_TEMPL_DEF #undef BST_TEMPL_USE #undef GET_KEY #undef BstTable #undef Element #undef BSTMAP /** * \fn BstMap::insert(const Key &key, BstMapEl **lastFound) * \brief Insert the given key. * * If the given key does not already exist in the table then a new element * having key is inserted. They key copy constructor and value default * constructor are used to place the pair in the table. If lastFound is given, * it is set to the new entry created. If the insert fails then lastFound is * set to the existing pair of the same key. * * \returns The new element created upon success, null upon failure. */ /** * \fn BstMap::insertMulti(const Key &key) * \brief Insert the given key even if it exists already. * * If the key exists already then the new element having key is placed next * to some other pair of the same key. InsertMulti cannot fail. The key copy * constructor and the value default constructor are used to place the pair in * the table. * * \returns The new element created. */ #endif /* _AAPL_BSTMAP_H */ kelbt-0.15/aapl/avlimel.h0000664000175000017500000000462611072514631015627 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_AVLIMEL_H #define _AAPL_AVLIMEL_H #include "compare.h" #include "dlistmel.h" /** * \addtogroup avlitree * @{ */ /** * \class AvliMel * \brief Linked AVL tree for element appearing in multiple trees. * * AvliMel allows for an element to simultaneously be in multiple trees without * the trees interferring with one another. For each tree that the element is * to appear in, there must be a distinct set of AVL Tree management data that * can be unambiguously referenced with some base class name. This name * is passed to the tree as a template parameter and is used in the tree * algorithms. * * The element must use the same key type and value in each tree that it * appears in. If distinct keys are required, the AvliMelKey structure is * available. * * AvliMel does not assume ownership of elements in the tree. The destructor * will not delete the elements. If the user wishes to explicitly deallocate * all the items in the tree the empty() routine is available. * * \include ex_avlimel.cpp */ /*@}*/ #define BASE_EL(name) BaseEl::name #define BASEKEY(name) name #define BASELIST DListMel< Element, BaseEl > #define AVLMEL_CLASSDEF class Element, class Key, \ class BaseEl, class Compare = CmpOrd #define AVLMEL_TEMPDEF class Element, class Key, \ class BaseEl, class Compare #define AVLMEL_TEMPUSE Element, Key, BaseEl, Compare #define AvlTree AvliMel #define WALKABLE #include "avlcommon.h" #undef BASE_EL #undef BASEKEY #undef BASELIST #undef AVLMEL_CLASSDEF #undef AVLMEL_TEMPDEF #undef AVLMEL_TEMPUSE #undef AvlTree #undef WALKABLE #endif /* _AAPL_AVLIMEL_H */ kelbt-0.15/aapl/README0000664000175000017500000000035210572350155014700 0ustar thurstonthurstonThis directory contains the Aapl source distribution. For the documentation, build scripts, test programs, ChangeLog, etc. get the aapldev package. AaplDev and other information about Aapl is available from http://www.elude.ca/aapl/ kelbt-0.15/aapl/avlikeyless.h0000664000175000017500000000326711072514631016531 0ustar thurstonthurston/* * Copyright 2002, 2003 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_AVLIKEYLESS_H #define _AAPL_AVLIKEYLESS_H #include "compare.h" #include "dlistmel.h" /** * \addtogroup avlitree * @{ */ /** * \class AvliKeyless * \brief Linked AVL tree that has no insert/find/remove functions that take a * key. * * AvliKeyless is an implementation of the AVL tree rebalancing functionality * only. It provides the common code for the tiny AVL tree implementations. */ /*@}*/ #define BASE_EL(name) name #define BASELIST DListMel< Element, AvliTreeEl > #define AVLMEL_CLASSDEF class Element #define AVLMEL_TEMPDEF class Element #define AVLMEL_TEMPUSE Element #define AvlTree AvliKeyless #define WALKABLE #define AVL_KEYLESS #include "avlcommon.h" #undef BASE_EL #undef BASELIST #undef AVLMEL_CLASSDEF #undef AVLMEL_TEMPDEF #undef AVLMEL_TEMPUSE #undef AvlTree #undef WALKABLE #undef AVL_KEYLESS #endif /* _AAPL_AVLIKEYLESS_H */ kelbt-0.15/aapl/avlmap.h0000664000175000017500000000413411072514631015450 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_AVLMAP_H #define _AAPL_AVLMAP_H #include "compare.h" /** * \addtogroup avltree * @{ */ /** * \class AvlMap * \brief Key and value oriented AVL tree. * * AvlMap stores key and value pairs in elements that managed by the tree. It * is intendend to be similar to map template found in the STL. AvlMap * requires that a Key type, a Value type, and a class containing a compare() * routine for Key be given. Items can be inserted with just a key or with a * key and value pair. * * AvlMap assumes all elements in the tree are allocated on the heap and are * to be managed by the tree. This means that the class destructor will delete * the contents of the tree. A deep copy will cause existing elements to be * deleted first. * * \include ex_avlmap.cpp */ /*@}*/ #define AVLTREE_MAP #define BASE_EL(name) name #define BASEKEY(name) name #define AVLMEL_CLASSDEF class Key, class Value, class Compare = CmpOrd #define AVLMEL_TEMPDEF class Key, class Value, class Compare #define AVLMEL_TEMPUSE Key, Value, Compare #define AvlTree AvlMap #define Element AvlMapEl #include "avlcommon.h" #undef AVLTREE_MAP #undef BASE_EL #undef BASEKEY #undef AVLMEL_CLASSDEF #undef AVLMEL_TEMPDEF #undef AVLMEL_TEMPUSE #undef AvlTree #undef Element #endif /* _AAPL_AVLMAP_H */ kelbt-0.15/aapl/avlmel.h0000664000175000017500000000442211072514631015450 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_AVLMEL_H #define _AAPL_AVLMEL_H #include "compare.h" /** * \addtogroup avltree * @{ */ /** * \class AvlMel * \brief AVL tree for elements appearing in multiple trees. * * AvlMel allows for an element to simultaneously be in multiple trees without * the trees interferring with one another. For each tree that the element is * to appear in, there must be a distinct set of AVL Tree management data that * can be unambiguously referenced with some base class name. This name * is passed to the tree as a template parameter and is used in the tree * algorithms. * * The element must use the same key type and value in each tree that it * appears in. If distinct keys are required, the AvlMelKey structure is * available. * * AvlMel does not assume ownership of elements in the tree. The destructor * will not delete the elements. If the user wishes to explicitly deallocate * all the items in the tree the empty() routine is available. * * \include ex_avlmel.cpp */ /*@}*/ #define BASE_EL(name) BaseEl::name #define BASEKEY(name) name #define AVLMEL_CLASSDEF class Element, class Key, \ class BaseEl, class Compare = CmpOrd #define AVLMEL_TEMPDEF class Element, class Key, \ class BaseEl, class Compare #define AVLMEL_TEMPUSE Element, Key, BaseEl, Compare #define AvlTree AvlMel #include "avlcommon.h" #undef BASE_EL #undef BASEKEY #undef AVLMEL_CLASSDEF #undef AVLMEL_TEMPDEF #undef AVLMEL_TEMPUSE #undef AvlTree #endif /* _AAPL_AVLMEL_H */ kelbt-0.15/aapl/avlmelkey.h0000664000175000017500000000442311072514631016162 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_AVLMELKEY_H #define _AAPL_AVLMELKEY_H #include "compare.h" /** * \addtogroup avltree * @{ */ /** * \class AvlMelKey * \brief AVL tree for elements appearing in multiple trees with different keys. * * AvlMelKey is similar to AvlMel, except that an additional template * parameter, BaseKey, is provided for resolving ambiguous references to * getKey(). This means that if an element is stored in multiple trees, each * tree can use a different key for ordering the elements in it. Using * AvlMelKey an array of data structures can be indexed with an O(log(n)) * search on two or more of the values contained within it and without * allocating any additional data. * * AvlMelKey does not assume ownership of elements in the tree. The destructor * will not delete the elements. If the user wishes to explicitly deallocate * all the items in the tree the empty() routine is available. * * \include ex_avlmelkey.cpp */ /*@}*/ #define BASE_EL(name) BaseEl::name #define BASEKEY(name) BaseKey::name #define AVLMEL_CLASSDEF class Element, class Key, class BaseEl, \ class BaseKey, class Compare = CmpOrd #define AVLMEL_TEMPDEF class Element, class Key, class BaseEl, \ class BaseKey, class Compare #define AVLMEL_TEMPUSE Element, Key, BaseEl, BaseKey, Compare #define AvlTree AvlMelKey #include "avlcommon.h" #undef BASE_EL #undef BASEKEY #undef AVLMEL_CLASSDEF #undef AVLMEL_TEMPDEF #undef AVLMEL_TEMPUSE #undef AvlTree #endif /* _AAPL_AVLMELKEY_H */ kelbt-0.15/aapl/sbstmap.h0000664000175000017500000000632611072514631015646 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_SBSTMAP_H #define _AAPL_SBSTMAP_H #include "compare.h" #include "svector.h" #ifdef AAPL_NAMESPACE namespace Aapl { #endif /** * \brief Element for BstMap. * * Stores the key and value pair. */ template struct SBstMapEl { SBstMapEl() {} SBstMapEl(const Key &key) : key(key) {} SBstMapEl(const Key &key, const Value &val) : key(key), value(val) {} /** \brief The key */ Key key; /** \brief The value. */ Value value; }; #ifdef AAPL_NAMESPACE } #endif /** * \addtogroup bst * @{ */ /** * \class SBstMap * \brief Copy-on-write binary search table for key and value pairs. * * This is a map style binary search table that employs the copy-on-write * mechanism for table data. BstMap stores key and value pairs in each * element. The key and value can be any type. A compare class for the key * must be supplied. */ /*@}*/ #define BST_TEMPL_DECLARE class Key, class Value, \ class Compare = CmpOrd, class Resize = ResizeExpn #define BST_TEMPL_DEF class Key, class Value, class Compare, class Resize #define BST_TEMPL_USE Key, Value, Compare, Resize #define GET_KEY(el) ((el).key) #define BstTable SBstMap #define Vector SVector #define Table STable #define Element SBstMapEl #define BSTMAP #define SHARED_BST #include "bstcommon.h" #undef BST_TEMPL_DECLARE #undef BST_TEMPL_DEF #undef BST_TEMPL_USE #undef GET_KEY #undef BstTable #undef Vector #undef Table #undef Element #undef BSTMAP #undef SHARED_BST /** * \fn SBstMap::insert(const Key &key, BstMapEl **lastFound) * \brief Insert the given key. * * If the given key does not already exist in the table then a new element * having key is inserted. They key copy constructor and value default * constructor are used to place the pair in the table. If lastFound is given, * it is set to the new entry created. If the insert fails then lastFound is * set to the existing pair of the same key. * * \returns The new element created upon success, null upon failure. */ /** * \fn SBstMap::insertMulti(const Key &key) * \brief Insert the given key even if it exists already. * * If the key exists already then the new element having key is placed next * to some other pair of the same key. InsertMulti cannot fail. The key copy * constructor and the value default constructor are used to place the pair in * the table. * * \returns The new element created. */ #endif /* _AAPL_SBSTMAP_H */ kelbt-0.15/aapl/avliset.h0000664000175000017500000000406311072514631015640 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_AVLISET_H #define _AAPL_AVLISET_H #include "compare.h" #include "dlist.h" /** * \addtogroup avlitree * @{ */ /** * \class AvliSet * \brief Linked Key-only oriented tree. * * AvliSet stores only keys in elements that are managed by the tree. AvliSet * requires that a Key type and a class containing a compare() routine * for Key be given. Items are inserted with just a key value. * * AvliSet assumes all elements in the tree are allocated on the heap and are * to be managed by the tree. This means that the class destructor will delete * the contents of the tree. A deep copy will cause existing elements to be * deleted first. * * \include ex_avliset.cpp */ /*@}*/ #define AVLTREE_SET #define BASE_EL(name) name #define BASEKEY(name) name #define BASELIST DList< AvliSetEl > #define AVLMEL_CLASSDEF class Key, class Compare = CmpOrd #define AVLMEL_TEMPDEF class Key, class Compare #define AVLMEL_TEMPUSE Key, Compare #define AvlTree AvliSet #define Element AvliSetEl #define WALKABLE #include "avlcommon.h" #undef AVLTREE_SET #undef BASE_EL #undef BASEKEY #undef BASELIST #undef AVLMEL_CLASSDEF #undef AVLMEL_TEMPDEF #undef AVLMEL_TEMPUSE #undef AvlTree #undef Element #undef WALKABLE #endif /* _AAPL_AVLISET_H */ kelbt-0.15/aapl/bsttable.h0000664000175000017500000000515511072514631015774 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_BSTTABLE_H #define _AAPL_BSTTABLE_H #include "compare.h" #include "vector.h" /** * \addtogroup bst * @{ */ /** * \class BstTable * \brief Binary search table for structures that contain a key. * * This is the basic binary search table. It can be used to contain a * structure that has a key and possibly some data. The key should be a member * of the element class and accessible with getKey(). A class containing the * compare routine must be supplied. */ /*@}*/ #define BST_TEMPL_DECLARE class Element, class Key, \ class Compare = CmpOrd, class Resize = ResizeExpn #define BST_TEMPL_DEF class Element, class Key, class Compare, class Resize #define BST_TEMPL_USE Element, Key, Compare, Resize #define GET_KEY(el) ((el).getKey()) #define BSTTABLE #include "bstcommon.h" #undef BST_TEMPL_DECLARE #undef BST_TEMPL_DEF #undef BST_TEMPL_USE #undef GET_KEY #undef BSTTABLE /** * \fn BstTable::insert(const Key &key, Element **lastFound) * \brief Insert a new element with the given key. * * If the given key does not already exist in the table a new element is * inserted with the given key. A constructor taking only const Key& is used * to initialize the new element. If lastFound is given, it is set to the new * element created. If the insert fails then lastFound is set to the existing * element with the same key. * * \returns The new element created upon success, null upon failure. */ /** * \fn BstTable::insertMulti(const Key &key) * \brief Insert a new element even if the key exists already. * * If the key exists already then the new element is placed next to some * element with the same key. InsertMulti cannot fail. A constructor taking * only const Key& is used to initialize the new element. * * \returns The new element created. */ #endif /* _AAPL_BSTTABLE_H */ kelbt-0.15/aapl/COPYING0000664000175000017500000006363610572350155015071 0ustar thurstonthurston GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! kelbt-0.15/aapl/compare.h0000664000175000017500000001546011072514631015622 0ustar thurstonthurston/* * Copyright 2001 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_COMPARE_H #define _AAPL_COMPARE_H #include #include "table.h" #ifdef AAPL_NAMESPACE namespace Aapl { #endif /** * \defgroup compare Compare * \brief Basic compare clases. * * Compare classes are used by data structures that need to know the relative * ordering of elemets. To become a compare class, a class must imlement a * routine long compare(const T &key1, const T &key2) that behaves just like * strcmp. * * Compare classes are passed to the template data structure as a template * parameter and are inherited. In most cases the compare routine will base * the key comparision only on the two keys and the compare routine can * therefore be static. Though sometimes it is useful to include data in the * compare class and use this data in the comparison. For example the compare * class may contain a pointer to some other data structure to which the * comparison is delegated. * * @{ */ /** * \brief Compare two null terminated character sequences. * * This comparision class is a wrapper for strcmp. */ struct CmpStr { /** * \brief Compare two null terminated string types. */ static inline long compare(const char *k1, const char *k2) { return strcmp(k1, k2); } }; /** * \brief Compare a type for which < and > are implemented. * * CmpOrd is suitable for simple types such as integers and pointers that by * default have the less-than and greater-than operators defined. */ template struct CmpOrd { /** * \brief Compare two ordinal types. * * This compare routine copies its arguements in by value. */ static inline long compare(const T k1, const T k2) { if (k1 < k2) return -1; else if (k1 > k2) return 1; else return 0; } }; /** * \brief Compare two tables of type T * * Table comparison is useful for keying a data structure on a vector or * binary search table. T is the element type stored in the table. * CompareT is the comparison structure used to compare the individual values * in the table. */ template < class T, class CompareT = CmpOrd > struct CmpTable : public CompareT { /** * \brief Compare two tables storing type T. */ static inline long compare(const Table &t1, const Table &t2) { if ( t1.tabLen < t2.tabLen ) return -1; else if ( t1.tabLen > t2.tabLen ) return 1; else { T *i1 = t1.data, *i2 = t2.data; long len = t1.tabLen, cmpResult; for ( long pos = 0; pos < len; pos += 1, i1 += 1, i2 += 1 ) { cmpResult = CompareT::compare(*i1, *i2); if ( cmpResult != 0 ) return cmpResult; } return 0; } } }; /** * \brief Compare two tables of type T -- non-static version. * * CmpTableNs is identical to CmpTable, however the compare routine is * non-static. If the CompareT class contains a non-static compare, then this * version must be used because a static member cannot invoke a non-static * member. * * Table comparison is useful for keying a data structure on a vector or binary * search table. T is the element type stored in the table. CompareT * is the comparison structure used to compare the individual values in the * table. */ template < class T, class CompareT = CmpOrd > struct CmpTableNs : public CompareT { /** * \brief Compare two tables storing type T. */ inline long compare(const Table &t1, const Table &t2) { if ( t1.tabLen < t2.tabLen ) return -1; else if ( t1.tabLen > t2.tabLen ) return 1; else { T *i1 = t1.data, *i2 = t2.data; long len = t1.tabLen, cmpResult; for ( long pos = 0; pos < len; pos += 1, i1 += 1, i2 += 1 ) { cmpResult = CompareT::compare(*i1, *i2); if ( cmpResult != 0 ) return cmpResult; } return 0; } } }; /** * \brief Compare two implicitly shared tables of type T * * This table comparison is for data structures based on implicitly * shared tables. * * Table comparison is useful for keying a data structure on a vector or * binary search table. T is the element type stored in the table. * CompareT is the comparison structure used to compare the individual values * in the table. */ template < class T, class CompareT = CmpOrd > struct CmpSTable : public CompareT { /** * \brief Compare two tables storing type T. */ static inline long compare(const STable &t1, const STable &t2) { long t1Length = t1.length(); long t2Length = t2.length(); /* Compare lengths. */ if ( t1Length < t2Length ) return -1; else if ( t1Length > t2Length ) return 1; else { /* Compare the table data. */ T *i1 = t1.data, *i2 = t2.data; for ( long pos = 0; pos < t1Length; pos += 1, i1 += 1, i2 += 1 ) { long cmpResult = CompareT::compare(*i1, *i2); if ( cmpResult != 0 ) return cmpResult; } return 0; } } }; /** * \brief Compare two implicitly shared tables of type T -- non-static * version. * * This is a non-static table comparison for data structures based on * implicitly shared tables. If the CompareT class contains a non-static * compare, then this version must be used because a static member cannot * invoke a non-static member. * * Table comparison is useful for keying a data structure on a vector or * binary search table. T is the element type stored in the table. * CompareT is the comparison structure used to compare the individual values * in the table. */ template < class T, class CompareT = CmpOrd > struct CmpSTableNs : public CompareT { /** * \brief Compare two tables storing type T. */ inline long compare(const STable &t1, const STable &t2) { long t1Length = t1.length(); long t2Length = t2.length(); /* Compare lengths. */ if ( t1Length < t2Length ) return -1; else if ( t1Length > t2Length ) return 1; else { /* Compare the table data. */ T *i1 = t1.data, *i2 = t2.data; for ( long pos = 0; pos < t1Length; pos += 1, i1 += 1, i2 += 1 ) { long cmpResult = CompareT::compare(*i1, *i2); if ( cmpResult != 0 ) return cmpResult; } return 0; } } }; /*@}*/ #ifdef AAPL_NAMESPACE } #endif #endif /* _AAPL_COMPARE_H */ kelbt-0.15/aapl/avlimap.h0000664000175000017500000000433711072514631015626 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_AVLIMAP_H #define _AAPL_AVLIMAP_H #include "compare.h" #include "dlist.h" /** * \addtogroup avlitree * @{ */ /** * \class AvliMap * \brief Linked key and value oriented AVL tree. * * AvliMap stores key and value pairs in elements that managed by the tree. It * is intendend to be similar to map template found in the STL. AvliMap * requires that a Key type, a Value type, and a class containing a compare() * routine for Key be given. Items can be inserted with just a key or with a * key and value pair. * * AvliMap assumes all elements in the tree are allocated on the heap and are * to be managed by the tree. This means that the class destructor will delete * the contents of the tree. A deep copy will cause existing elements to be * deleted first. * * \include ex_avlimap.cpp */ /*@}*/ #define AVLTREE_MAP #define BASE_EL(name) name #define BASEKEY(name) name #define BASELIST DList< AvliMapEl > #define AVLMEL_CLASSDEF class Key, class Value, class Compare = CmpOrd #define AVLMEL_TEMPDEF class Key, class Value, class Compare #define AVLMEL_TEMPUSE Key, Value, Compare #define AvlTree AvliMap #define Element AvliMapEl #define WALKABLE #include "avlcommon.h" #undef AVLTREE_MAP #undef BASE_EL #undef BASEKEY #undef BASELIST #undef AVLMEL_CLASSDEF #undef AVLMEL_TEMPDEF #undef AVLMEL_TEMPUSE #undef AvlTree #undef Element #undef WALKABLE #endif /* _AAPL_AVLIMAP_H */ kelbt-0.15/aapl/dlistmel.h0000664000175000017500000000456311072514631016013 0ustar thurstonthurston/* * Copyright 2001 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_DLISTMEL_H #define _AAPL_DLISTMEL_H /** * \addtogroup dlist * @{ */ /** * \class DListMel * \brief Doubly linked list for elements that may appear in multiple lists. * * This class is similar to DList, except that the user defined list element * can inherit from multple DListEl classes and consequently be an element in * multiple lists. In other words, DListMel allows a single instance of a data * structure to be an element in multiple lists without the lists interfereing * with one another. * * For each list that an element class is to appear in, the element must have * unique next and previous pointers that can be unambiguously refered to with * some base class name. This name is given to DListMel as a template argument * so it can use the correct next and previous pointers in its list * operations. * * DListMel does not assume ownership of elements in the list. If the elements * are known to reside on the heap and are not contained in any other list or * data structure, the provided empty() routine can be used to delete all * elements, however the destructor will not call this routine, it will simply * abandon all the elements. It is up to the programmer to explicitly * de-allocate items when it is safe to do so. * * \include ex_dlistmel.cpp */ /*@}*/ #define BASE_EL(name) BaseEl::name #define DLMEL_TEMPDEF class Element, class BaseEl #define DLMEL_TEMPUSE Element, BaseEl #define DList DListMel #include "dlcommon.h" #undef BASE_EL #undef DLMEL_TEMPDEF #undef DLMEL_TEMPUSE #undef DList #endif /* _AAPL_DLISTMEL_H */ kelbt-0.15/aapl/sbsttable.h0000664000175000017500000000551611072514631016160 0ustar thurstonthurston/* * Copyright 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_SBSTTABLE_H #define _AAPL_SBSTTABLE_H #include "compare.h" #include "svector.h" /** * \addtogroup bst * @{ */ /** * \class SBstTable * \brief Copy-on-write binary search table for structures that contain a key. * * This is a basic binary search table that employs a copy-on-write data * storage mechanism. It can be used to contain a structure that has a key and * possibly some data. The key should be a member of the element class and * accessible with getKey(). A class containing the compare routine must be * supplied. */ /*@}*/ #define BST_TEMPL_DECLARE class Element, class Key, \ class Compare = CmpOrd, class Resize = ResizeExpn #define BST_TEMPL_DEF class Element, class Key, class Compare, class Resize #define BST_TEMPL_USE Element, Key, Compare, Resize #define GET_KEY(el) ((el).getKey()) #define BstTable SBstTable #define Vector SVector #define Table STable #define BSTTABLE #define SHARED_BST #include "bstcommon.h" #undef BST_TEMPL_DECLARE #undef BST_TEMPL_DEF #undef BST_TEMPL_USE #undef GET_KEY #undef BstTable #undef Vector #undef Table #undef BSTTABLE #undef SHARED_BST /** * \fn SBstTable::insert(const Key &key, Element **lastFound) * \brief Insert a new element with the given key. * * If the given key does not already exist in the table a new element is * inserted with the given key. A constructor taking only const Key& is used * to initialize the new element. If lastFound is given, it is set to the new * element created. If the insert fails then lastFound is set to the existing * element with the same key. * * \returns The new element created upon success, null upon failure. */ /** * \fn SBstTable::insertMulti(const Key &key) * \brief Insert a new element even if the key exists already. * * If the key exists already then the new element is placed next to some * element with the same key. InsertMulti cannot fail. A constructor taking * only const Key& is used to initialize the new element. * * \returns The new element created. */ #endif /* _AAPL_SBSTTABLE_H */ kelbt-0.15/aapl/dlcommon.h0000664000175000017500000005304611072514631016006 0ustar thurstonthurston/* * Copyright 2001 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* This header is not wrapped in ifndef becuase it is not intended to * be included by the user. */ #ifdef AAPL_NAMESPACE namespace Aapl { #endif #if defined( DOUBLELIST_VALUE ) /** * \brief Double list element for DListVal. * * DListValEl stores the type T of DListVal by value. */ template struct DListValEl { /** * \brief Construct a DListValEl with a given value. * * The only constructor available initializes the value element. This * enforces that DListVal elements are never created without having their * value intialzed by the user. T's copy constructor is used to copy the * value in. */ DListValEl( const T &val ) : value(val) { } /** * \brief Value stored by the list element. * * Value is always copied into new list elements using the copy * constructor. */ T value; /** * \brief List previous pointer. * * Points to the previous item in the list. If this is the first item in * the list, then prev is NULL. If this element is not in a list then * prev is undefined. */ DListValEl *prev; /** * \brief List next pointer. * * Points to the next item in the list. If this is the list item in the * list, then next is NULL. If this element is not in a list then next is * undefined. */ DListValEl *next; }; #else #ifndef __AAPL_DOUBLE_LIST_EL #define __AAPL_DOUBLE_LIST_EL /** * \brief Double list element properties. * * This class can be inherited to make a class suitable to be a double list * element. It simply provides the next and previous pointers. An alternative * is to put the next and previous pointers in the class directly. */ template struct DListEl { /** * \brief List previous pointer. * * Points to the previous item in the list. If this is the first item in * the list, then prev is NULL. If this element is not in a list then * prev is undefined. */ Element *prev; /** * \brief List next pointer. * * Points to the next item in the list. If this is the list item in the * list, then next is NULL. If this element is not in a list then next is * undefined. */ Element *next; }; #endif /* __AAPL_DOUBLE_LIST_EL */ #endif /* Doubly Linked List */ template class DList { public: /** \brief Initialize an empty list. */ DList() : head(0), tail(0), listLen(0) {} /** * \brief Perform a deep copy of the list. * * The elements of the other list are duplicated and put into this list. * Elements are copied using the copy constructor. */ DList(const DList &other); #ifdef DOUBLELIST_VALUE /** * \brief Clear the double list contents. * * All elements are deleted. */ ~DList() { empty(); } /** * \brief Assign another list into this list using a deep copy. * * The elements of the other list are duplicated and put into this list. * Each list item is created using the copy constructor. If this list * contains any elements before the copy, they are deleted first. * * \returns A reference to this. */ DList &operator=(const DList &other); /** * \brief Transfer the contents of another list into this list. * * The elements of the other list moved in. The other list will be empty * afterwards. If this list contains any elements before the copy, then * they are deleted. */ void transfer(DList &other); #else /** * \brief Abandon all elements in the list. * * List elements are not deleted. */ ~DList() {} /** * \brief Perform a deep copy of the list. * * The elements of the other list are duplicated and put into this list. * Each list item is created using the copy constructor. If this list * contains any elements before the copy, they are abandoned. * * \returns A reference to this. */ DList &operator=(const DList &other); /** * \brief Transfer the contents of another list into this list. * * The elements of the other list moved in. The other list will be empty * afterwards. If this list contains any elements before the copy, they * are abandoned. */ void transfer(DList &other); #endif #ifdef DOUBLELIST_VALUE /** * \brief Make a new element and prepend it to the front of the list. * * The item is copied into the new element using the copy constructor. * Equivalent to list.addBefore(list.head, item). */ void prepend(const T &item); /** * \brief Make a new element and append it to the end of the list. * * The item is copied into the new element using the copy constructor. * Equivalent to list.addAfter(list.tail, item). */ void append(const T &item); /** * \brief Make a new element and insert it immediately after an element in * the list. * * The item is copied into the new element using the copy constructor. If * prev_el is NULL then the new element is prepended to the front of the * list. If prev_el is not already in the list then undefined behaviour * results. Equivalent to list.addAfter(prev_el, new DListValEl(item)). */ void addAfter(Element *prev_el, const T &item); /** * \brief Make a new element and insert it immediately before an element * in the list. * * The item is copied into the new element using the copy construcotor. If * next_el is NULL then the new element is appended to the end of the * list. If next_el is not already in the list then undefined behaviour * results. Equivalent to list.addBefore(next_el, new DListValEl(item)). */ void addBefore(Element *next_el, const T &item); #endif /** * \brief Prepend a single element to the front of the list. * * If new_el is already an element of some list, then undefined behaviour * results. Equivalent to list.addBefore(list.head, new_el). */ void prepend(Element *new_el) { addBefore(head, new_el); } /** * \brief Append a single element to the end of the list. * * If new_el is alreay an element of some list, then undefined behaviour * results. Equivalent to list.addAfter(list.tail, new_el). */ void append(Element *new_el) { addAfter(tail, new_el); } /** * \brief Prepend an entire list to the beginning of this list. * * All items are moved, not copied. Afterwards, the other list is emtpy. * All items are prepended at once, so this is an O(1) operation. * Equivalent to list.addBefore(list.head, dl). */ void prepend(DList &dl) { addBefore(head, dl); } /** * \brief Append an entire list to the end of the list. * * All items are moved, not copied. Afterwards, the other list is empty. * All items are appened at once, so this is an O(1) operation. * Equivalent to list.addAfter(list.tail, dl). */ void append(DList &dl) { addAfter(tail, dl); } void addAfter(Element *prev_el, Element *new_el); void addBefore(Element *next_el, Element *new_el); void addAfter(Element *prev_el, DList &dl); void addBefore(Element *next_el, DList &dl); /** * \brief Detach the head of the list * * The element detached is not deleted. If there is no head of the list * (the list is empty) then undefined behaviour results. Equivalent to * list.detach(list.head). * * \returns The element detached. */ Element *detachFirst() { return detach(head); } /** * \brief Detach the tail of the list * * The element detached is not deleted. If there is no tail of the list * (the list is empty) then undefined behaviour results. Equivalent to * list.detach(list.tail). * * \returns The element detached. */ Element *detachLast() { return detach(tail); } /* Detaches an element from the list. Does not free any memory. */ Element *detach(Element *el); /** * \brief Detach and delete the first element in the list. * * If there is no first element (the list is empty) then undefined * behaviour results. Equivalent to delete list.detach(list.head); */ void removeFirst() { delete detach( head ); } /** * \brief Detach and delete the last element in the list. * * If there is no last element (the list is emtpy) then undefined * behaviour results. Equivalent to delete list.detach(list.tail); */ void removeLast() { delete detach( tail ); } /** * \brief Detach and delete an element from the list. * * If the element is not in the list, then undefined behaviour results. * Equivalent to delete list.detach(el); */ void remove(Element *el) { delete detach( el ); } void empty(); void abandon(); /** \brief The number of elements in the list. */ long length() const { return listLen; } /** \brief Head and tail of the linked list. */ Element *head, *tail; /** \brief The number of element in the list. */ long listLen; /* Convenience access. */ long size() const { return listLen; } /* Forward this so a ref can be used. */ struct Iter; /* Class for setting the iterator. */ struct IterFirst { IterFirst( const DList &l ) : l(l) { } const DList &l; }; struct IterLast { IterLast( const DList &l ) : l(l) { } const DList &l; }; struct IterNext { IterNext( const Iter &i ) : i(i) { } const Iter &i; }; struct IterPrev { IterPrev( const Iter &i ) : i(i) { } const Iter &i; }; /** * \brief Double List Iterator. * \ingroup iterators */ struct Iter { /* Default construct. */ Iter() : ptr(0) { } /* Construct from a double list. */ Iter( const DList &dl ) : ptr(dl.head) { } Iter( Element *el ) : ptr(el) { } Iter( const IterFirst &dlf ) : ptr(dlf.l.head) { } Iter( const IterLast &dll ) : ptr(dll.l.tail) { } Iter( const IterNext &dln ) : ptr(dln.i.ptr->BASE_EL(next)) { } Iter( const IterPrev &dlp ) : ptr(dlp.i.ptr->BASE_EL(prev)) { } /* Assign from a double list. */ Iter &operator=( const DList &dl ) { ptr = dl.head; return *this; } Iter &operator=( Element *el ) { ptr = el; return *this; } Iter &operator=( const IterFirst &af ) { ptr = af.l.head; return *this; } Iter &operator=( const IterLast &al ) { ptr = al.l.tail; return *this; } Iter &operator=( const IterNext &an ) { ptr = an.i.ptr->BASE_EL(next); return *this; } Iter &operator=( const IterPrev &ap ) { ptr = ap.i.ptr->BASE_EL(prev); return *this; } /** \brief Less than end? */ bool lte() const { return ptr != 0; } /** \brief At end? */ bool end() const { return ptr == 0; } /** \brief Greater than beginning? */ bool gtb() const { return ptr != 0; } /** \brief At beginning? */ bool beg() const { return ptr == 0; } /** \brief At first element? */ bool first() const { return ptr && ptr->BASE_EL(prev) == 0; } /** \brief At last element? */ bool last() const { return ptr && ptr->BASE_EL(next) == 0; } /** \brief Implicit cast to Element*. */ operator Element*() const { return ptr; } /** \brief Dereference operator returns Element&. */ Element &operator *() const { return *ptr; } /** \brief Arrow operator returns Element*. */ Element *operator->() const { return ptr; } /** \brief Move to next item. */ inline Element *operator++() { return ptr = ptr->BASE_EL(next); } /** \brief Move to next item. */ inline Element *increment() { return ptr = ptr->BASE_EL(next); } /** \brief Move to next item. */ inline Element *operator++(int); /** \brief Move to previous item. */ inline Element *operator--() { return ptr = ptr->BASE_EL(prev); } /** \brief Move to previous item. */ inline Element *decrement() { return ptr = ptr->BASE_EL(prev); } /** \brief Move to previous item. */ inline Element *operator--(int); /** \brief Return the next item. Does not modify this. */ inline IterNext next() const { return IterNext(*this); } /** \brief Return the prev item. Does not modify this. */ inline IterPrev prev() const { return IterPrev(*this); } /** \brief The iterator is simply a pointer. */ Element *ptr; }; /** \brief Return first element. */ IterFirst first() { return IterFirst(*this); } /** \brief Return last element. */ IterLast last() { return IterLast(*this); } }; /* Copy constructor, does a deep copy of other. */ template DList:: DList(const DList &other) : head(0), tail(0), listLen(0) { Element *el = other.head; while( el != 0 ) { append( new Element(*el) ); el = el->BASE_EL(next); } } #ifdef DOUBLELIST_VALUE /* Assignement operator does deep copy. */ template DList &DList:: operator=(const DList &other) { /* Free the old list. The value list assumes items were allocated on the * heap by itself. */ empty(); Element *el = other.head; while( el != 0 ) { append( new Element(*el) ); el = el->BASE_EL(next); } return *this; } template void DList:: transfer(DList &other) { /* Free the old list. The value list assumes items were allocated on the * heap by itself. */ empty(); head = other.head; tail = other.tail; listLen = other.listLen; other.abandon(); } #else /* Assignement operator does deep copy. */ template DList &DList:: operator=(const DList &other) { Element *el = other.head; while( el != 0 ) { append( new Element(*el) ); el = el->BASE_EL(next); } return *this; } template void DList:: transfer(DList &other) { head = other.head; tail = other.tail; listLen = other.listLen; other.abandon(); } #endif #ifdef DOUBLELIST_VALUE /* Prepend a new item. Inlining this bloats the caller with new overhead. */ template void DList:: prepend(const T &item) { addBefore(head, new Element(item)); } /* Append a new item. Inlining this bloats the caller with the new overhead. */ template void DList:: append(const T &item) { addAfter(tail, new Element(item)); } /* Add a new item after a prev element. Inlining this bloats the caller with * the new overhead. */ template void DList:: addAfter(Element *prev_el, const T &item) { addAfter(prev_el, new Element(item)); } /* Add a new item before a next element. Inlining this bloats the caller with * the new overhead. */ template void DList:: addBefore(Element *next_el, const T &item) { addBefore(next_el, new Element(item)); } #endif /* * The larger iterator operators. */ /* Postfix ++ */ template Element *DList::Iter:: operator++(int) { Element *rtn = ptr; ptr = ptr->BASE_EL(next); return rtn; } /* Postfix -- */ template Element *DList::Iter:: operator--(int) { Element *rtn = ptr; ptr = ptr->BASE_EL(prev); return rtn; } /** * \brief Insert an element immediately after an element in the list. * * If prev_el is NULL then new_el is prepended to the front of the list. If * prev_el is not in the list or if new_el is already in a list, then * undefined behaviour results. */ template void DList:: addAfter(Element *prev_el, Element *new_el) { /* Set the previous pointer of new_el to prev_el. We do * this regardless of the state of the list. */ new_el->BASE_EL(prev) = prev_el; /* Set forward pointers. */ if (prev_el == 0) { /* There was no prev_el, we are inserting at the head. */ new_el->BASE_EL(next) = head; head = new_el; } else { /* There was a prev_el, we can access previous next. */ new_el->BASE_EL(next) = prev_el->BASE_EL(next); prev_el->BASE_EL(next) = new_el; } /* Set reverse pointers. */ if (new_el->BASE_EL(next) == 0) { /* There is no next element. Set the tail pointer. */ tail = new_el; } else { /* There is a next element. Set it's prev pointer. */ new_el->BASE_EL(next)->BASE_EL(prev) = new_el; } /* Update list length. */ listLen++; } /** * \brief Insert an element immediatly before an element in the list. * * If next_el is NULL then new_el is appended to the end of the list. If * next_el is not in the list or if new_el is already in a list, then * undefined behaviour results. */ template void DList:: addBefore(Element *next_el, Element *new_el) { /* Set the next pointer of the new element to next_el. We do * this regardless of the state of the list. */ new_el->BASE_EL(next) = next_el; /* Set reverse pointers. */ if (next_el == 0) { /* There is no next elememnt. We are inserting at the tail. */ new_el->BASE_EL(prev) = tail; tail = new_el; } else { /* There is a next element and we can access next's previous. */ new_el->BASE_EL(prev) = next_el->BASE_EL(prev); next_el->BASE_EL(prev) = new_el; } /* Set forward pointers. */ if (new_el->BASE_EL(prev) == 0) { /* There is no previous element. Set the head pointer.*/ head = new_el; } else { /* There is a previous element, set it's next pointer to new_el. */ new_el->BASE_EL(prev)->BASE_EL(next) = new_el; } /* Update list length. */ listLen++; } /** * \brief Insert an entire list immediatly after an element in this list. * * Elements are moved, not copied. Afterwards, the other list is empty. If * prev_el is NULL then the elements are prepended to the front of the list. * If prev_el is not in the list then undefined behaviour results. All * elements are inserted into the list at once, so this is an O(1) operation. */ template void DList:: addAfter( Element *prev_el, DList &dl ) { /* Do not bother if dl has no elements. */ if ( dl.listLen == 0 ) return; /* Set the previous pointer of dl.head to prev_el. We do * this regardless of the state of the list. */ dl.head->BASE_EL(prev) = prev_el; /* Set forward pointers. */ if (prev_el == 0) { /* There was no prev_el, we are inserting at the head. */ dl.tail->BASE_EL(next) = head; head = dl.head; } else { /* There was a prev_el, we can access previous next. */ dl.tail->BASE_EL(next) = prev_el->BASE_EL(next); prev_el->BASE_EL(next) = dl.head; } /* Set reverse pointers. */ if (dl.tail->BASE_EL(next) == 0) { /* There is no next element. Set the tail pointer. */ tail = dl.tail; } else { /* There is a next element. Set it's prev pointer. */ dl.tail->BASE_EL(next)->BASE_EL(prev) = dl.tail; } /* Update the list length. */ listLen += dl.listLen; /* Empty out dl. */ dl.head = dl.tail = 0; dl.listLen = 0; } /** * \brief Insert an entire list immediately before an element in this list. * * Elements are moved, not copied. Afterwards, the other list is empty. If * next_el is NULL then the elements are appended to the end of the list. If * next_el is not in the list then undefined behaviour results. All elements * are inserted at once, so this is an O(1) operation. */ template void DList:: addBefore( Element *next_el, DList &dl ) { /* Do not bother if dl has no elements. */ if ( dl.listLen == 0 ) return; /* Set the next pointer of dl.tail to next_el. We do * this regardless of the state of the list. */ dl.tail->BASE_EL(next) = next_el; /* Set reverse pointers. */ if (next_el == 0) { /* There is no next elememnt. We are inserting at the tail. */ dl.head->BASE_EL(prev) = tail; tail = dl.tail; } else { /* There is a next element and we can access next's previous. */ dl.head->BASE_EL(prev) = next_el->BASE_EL(prev); next_el->BASE_EL(prev) = dl.tail; } /* Set forward pointers. */ if (dl.head->BASE_EL(prev) == 0) { /* There is no previous element. Set the head pointer.*/ head = dl.head; } else { /* There is a previous element, set it's next pointer to new_el. */ dl.head->BASE_EL(prev)->BASE_EL(next) = dl.head; } /* Update list length. */ listLen += dl.listLen; /* Empty out dl. */ dl.head = dl.tail = 0; dl.listLen = 0; } /** * \brief Detach an element from the list. * * The element is not deleted. If the element is not in the list, then * undefined behaviour results. * * \returns The element detached. */ template Element *DList:: detach(Element *el) { /* Set forward pointers to skip over el. */ if (el->BASE_EL(prev) == 0) head = el->BASE_EL(next); else { el->BASE_EL(prev)->BASE_EL(next) = el->BASE_EL(next); } /* Set reverse pointers to skip over el. */ if (el->BASE_EL(next) == 0) tail = el->BASE_EL(prev); else { el->BASE_EL(next)->BASE_EL(prev) = el->BASE_EL(prev); } /* Update List length and return element we detached. */ listLen--; return el; } /** * \brief Clear the list by deleting all elements. * * Each item in the list is deleted. The list is reset to its initial state. */ template void DList::empty() { Element *nextToGo = 0, *cur = head; while (cur != 0) { nextToGo = cur->BASE_EL(next); delete cur; cur = nextToGo; } head = tail = 0; listLen = 0; } /** * \brief Clear the list by forgetting all elements. * * All elements are abandoned, not deleted. The list is reset to it's initial * state. */ template void DList::abandon() { head = tail = 0; listLen = 0; } #ifdef AAPL_NAMESPACE } #endif kelbt-0.15/aapl/mergesort.h0000664000175000017500000000736611072514631016211 0ustar thurstonthurston/* * Copyright 2001, 2002 Adrian Thurston */ /* This file is part of Aapl. * * Aapl is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * Aapl is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with Aapl; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AAPL_MERGESORT_H #define _AAPL_MERGESORT_H #include "bubblesort.h" #ifdef AAPL_NAMESPACE namespace Aapl { #endif /** * \addtogroup sort * @{ */ /** * \class MergeSort * \brief Merge sort an array of data. * * MergeSort can be used to sort any array of objects of type T provided a * compare class is given. MergeSort is not in-place, it requires temporary * storage equal to the size of the array. The temporary storage is allocated * on the heap. * * Objects are not made aware that they are being moved around in memory. * Assignment operators, constructors and destructors are never invoked by the * sort. * * MergeSort runs in worst case O(n*log(n)) time. In most cases it is slower * than QuickSort because more copying is neccessary. But on the other hand, * it is a stable sort, meaning that objects with the same key have their * relative ordering preserved. Also, its worst case is better. MergeSort * switches to a BubbleSort when the size of the array being sorted is small. * This happens when directly sorting a small array or when MergeSort calls * itself recursively on a small portion of a larger array. */ /*@}*/ /* MergeSort. */ template class MergeSort : public BubbleSort { public: /* Sorting interface routine. */ void sort(T *data, long len); private: /* Recursive worker. */ void doSort(T *tmpStor, T *data, long len); }; #define _MS_BUBBLE_THRESH 16 /* Recursive mergesort worker. Split data, make recursive calls, merge * results. */ template< class T, class Compare> void MergeSort:: doSort(T *tmpStor, T *data, long len) { if ( len <= 1 ) return; if ( len <= _MS_BUBBLE_THRESH ) { BubbleSort::sort( data, len ); return; } long mid = len / 2; doSort( tmpStor, data, mid ); doSort( tmpStor + mid, data + mid, len - mid ); /* Merge the data. */ T *endLower = data + mid, *lower = data; T *endUpper = data + len, *upper = data + mid; T *dest = tmpStor; while ( true ) { if ( lower == endLower ) { /* Possibly upper left. */ if ( upper != endUpper ) memcpy( dest, upper, (endUpper - upper) * sizeof(T) ); break; } else if ( upper == endUpper ) { /* Only lower left. */ if ( lower != endLower ) memcpy( dest, lower, (endLower - lower) * sizeof(T) ); break; } else { /* Both upper and lower left. */ if ( compare(*lower, *upper) <= 0 ) memcpy( dest++, lower++, sizeof(T) ); else memcpy( dest++, upper++, sizeof(T) ); } } /* Copy back from the tmpStor array. */ memcpy( data, tmpStor, sizeof( T ) * len ); } /** * \brief Merge sort an array of data. */ template< class T, class Compare> void MergeSort::sort(T *data, long len) { /* Allocate the tmp space needed by merge sort, sort and free. */ T *tmpStor = (T*) new char[sizeof(T) * len]; doSort( tmpStor, data, len ); delete[] (char*) tmpStor; } #ifdef AAPL_NAMESPACE } #endif #endif /* _AAPL_MERGESORT_H */ kelbt-0.15/cxxprep/0000775000175000017500000000000011707046233014574 5ustar thurstonthurstonkelbt-0.15/cxxprep/version.mk0000664000175000017500000000004210572350155016606 0ustar thurstonthurstonVERSION = 0.1 PUBDATE = Sept 2005 kelbt-0.15/cxxprep/cpp.grm0000664000175000017500000005631611072514631016075 0ustar thurstonthurston% % Copyright 2004, 2005 Adrian Thurston % % This file is part of C++ Pre-Parser. % % C++ Pre-Parser is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. % % C++ Pre-Parser is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with C++ Pre-Parser; if not, write to the Free Software % Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA % % Derived from ISO/IEC C++ Standard 14822 first edition 1998-09-01 % % Want to control output formatting ourselves. #pragma -comment -raw tokens number % Decimal "0[uUlL]?[uUlL]?[uUlL]?" | "[123456789][0123456789]*[uUlL]?[uUlL]?[uUlL]?" % Octal | "0[01234567]+[uUlL]?[uUlL]?[uUlL]?" % Hex | "0[xX][\dABCDEFabcdef]+[uUlL]?" % Float | "\d+.\d*([eE][+-]?\d+)?[fFlL]?" | "\d*.\d+([eE][+-]?\d+)?[fFlL]?" | "\d+([eE][+-]?\d+)[fFlL]?" end tokens keys 'asm 'auto 'bool 'break 'case 'catch 'char 'class 'const 'const_cast 'continue 'default 'delete 'do 'double 'dynamic_cast 'else 'enum 'explicit 'export 'extern 'false 'float 'for 'friend 'goto 'if 'inline 'int 'long 'mutable 'namespace 'new 'operator 'private 'protected 'public 'register 'reinterpret_cast 'return 'shor 'short 'signed 'sizeof 'static 'static_cast 'struct 'switch 'template 'this 'throw 'true 'try 'typedef 'typeid 'typename 'union 'unsigned 'using 'virtual 'void 'vola 'volatile 'wchar_t 'while end keys compounds ':: '... '+= '-= '*= '/= '%= '^= '&= '|= '<< '>> '>>= '<<= '== '!= '<= '>= '&& '|| '.* '->* '-> '-- '++ end compounds comments /* */ // end comments compounds '$$ '<*> '<&> '({ '}) '(| '|) '<{ '}> '<| '|> ':/ ':+ ':- ':~ ':| end compounds % % A.2 Lexical Conventions % define literal [number] | [charlit] | [repeat stringlit+] | 'true | 'false end define % % A.4 Expressions % define primary_expression [literal] | 'this | '( [expression] ') | [id_expression] end define define id_expression [opt '::] [opt nested_name_specifier] [unqualified_id] end define define unqualified_id [id] [opt template_id_args] | [operator_function_id] | [conversion_function_id] | '~ [class_name] end define define nested_name_specifier [class_id] [opt template_id_args] ':: [nested_name_specifier_rest] | [namespace_name] [opt template_id_args] ':: [nested_name_specifier_rest] end define define nested_name_specifier_rest [opt nested_name_specifier] | 'template [nested_name_specifier] end define define postfix_expression [postfix_item] [repeat postfix_operator] end define define postfix_item [primary_expression] | [simple_type_specifier] '( [opt expression] ') | 'typename [opt '::] [opt nested_name_specifier] [type_name] '( [opt expression] ') | 'dynamic_cast [templ_arg_open] [type_id] [templ_arg_close] '( [expression] ') | 'static_cast [templ_arg_open] [type_id] [templ_arg_close] '( [expression] ') | 'reinterpret_cast [templ_arg_open] [type_id] [templ_arg_close] '( [expression] ') | 'const_cast [templ_arg_open] [type_id] [templ_arg_close] '( [expression] ') | 'typeid '( [expression] ') | 'typeid '( [type_id] ') end define define postfix_operator [square_open] [expression] [square_close] | '( [opt expression] ') | '. [opt 'template] [id_expression] | '-> [opt 'template] [id_expression] | '. [pseudo_destructor_name] | '-> [pseudo_destructor_name] | '++ | '-- end define define templ_arg_open '<| | '< end define define templ_arg_close '|> | '> end define define pseudo_destructor_name [opt '::] [opt nested_name_specifier] [type_name] ':: '~ [type_name] | [opt '::] [nested_name_specifier] 'template [template_id] ':: '~ [type_name] | [opt '::] [opt nested_name_specifier] '~ [type_name] end define define unary_expression [postfix_expression] | '++ [cast_expression] | '-- [cast_expression] | [unary_operator] [cast_expression] | 'sizeof [unary_expression] | 'sizeof '( [type_id] ') | [new_expression] | [delete_expression] end define define unary_operator '* | '& | '+ | '- | '! | '~ end define define new_expression [opt '::] 'new [opt new_placement] [new_type] end define define new_type [new_type_id] [opt new_initializer] | '( [type_id] ') [opt new_initializer] end define define new_placement '( [expression] ') end define define new_type_id [repeat type_specifier+] [new_declarator_opt] end define define new_declarator_opt [repeat ptr_operator] [repeat new_decl_array] end define define new_decl_array [square_open] [expression] [square_close] end define define new_initializer '( [opt expression] ') end define define delete_expression [opt '::] 'delete [cast_expression] | [opt '::] 'delete [square_open] [square_close] [cast_expression] end define define cast_expression [unary_expression] | '( [type_id] ') [cast_expression] end define define pm_expression [cast_expression] | [pm_expression] [SP] [pm_op] [SP] [cast_expression] end define define pm_op '.* | '->* end define define multiplicative_expression [pm_expression] | [multiplicative_expression] [SP] [multiplicative_op] [SP] [pm_expression] end define define multiplicative_op '* | '/ | '% end define define additive_expression [multiplicative_expression] | [additive_expression] [SP] [additive_op] [SP] [multiplicative_expression] end define define additive_op '+ | '- end define define shift_expression [additive_expression] | [shift_expression] [SP] [shift_op] [SP] [additive_expression] end define define shift_op '<< | '>> end define define relational_expression [shift_expression] | [relational_expression] [SP] [relational_op] [SP] [shift_expression] end define define relational_op '< | '> | '<= | '>= end define define equality_expression [relational_expression] | [equality_expression] [SP] [equality_op] [SP] [relational_expression] end define define equality_op '== | '!= end define define and_expression [equality_expression] | [and_expression] [SP] '& [SP] [equality_expression] end define define exclusive_or_expression [and_expression] | [exclusive_or_expression] [SP] '^ [SP] [and_expression] end define define inclusive_or_expression [exclusive_or_expression] | [inclusive_or_expression] [SP] '| [SP] [exclusive_or_expression] end define define logical_and_expression [inclusive_or_expression] | [logical_and_expression] [SP] '&& [SP] [inclusive_or_expression] end define define logical_or_expression [logical_and_expression] | [logical_or_expression] [SP] '|| [SP] [logical_and_expression] end define define conditional_expression [logical_or_expression] | [logical_or_expression] [SP] '? [SP] [expression] [SP] [conditional_colon] [SP] [assignment_expression] end define define conditional_colon ':| | ': end define define assignment_expression [conditional_expression] | [logical_or_expression] [SP] [assignment_operator] [SP] [assignment_expression] | [throw_expression] end define define assignment_operator '= | '*= | '/= | '%= | '+= | '-= | '>>= | '<<= | '&= | '^= | '|= end define define expression [assignment_expression] | [expression] ', [SP] [assignment_expression] end define define constant_expression [conditional_expression] end define % % A.5 Statements % define statement [labeled_statement] | [expression_statement] [NL] | [selection_statement] | [iteration_statement] | [jump_statement] [NL] | [declaration_statement] [NL] | [try_block] [NL] | [comment] [NL] | [compound_statement] [NL] end define define labeled_statement [EX] [id] [label_colon] [IN] [NL] [statement] | [EX] 'case [SP] [constant_expression] [label_colon] [IN] [NL] [statement] | [EX] 'default [SP] [label_colon] [IN] [NL] [statement] end define define label_colon ':~ | ': end define define expression_statement [opt expression] '; end define define compound_statement [EX] '{ [IN] [NL] [repeat statement] [EX] '} [IN] end define define selection_statement 'if [SP] '( [SP] [condition] [SP] ') [NL] [IN] [statement] [EX] [repeat else_if_part] [opt else_part] | 'switch [SP] '( [SP] [condition] [SP] ') [NL] [IN] [statement] [EX] end define define else_if_part 'else [SP] 'if '( [SP] [condition] [SP] ') [NL] [IN] [statement] [EX] end define define else_part 'else [NL] [IN] [statement] [EX] end define define iteration_statement 'while [SP] '( [SP] [condition] [SP] ) [NL] [IN] [statement] [EX] | 'do [NL] [IN] [statement] [EX] 'while '( [SP] [expression] [SP] ') '; [NL] | 'for [SP] '( [SP] [for_init_statement] [SP] [opt condition] '; [SP] [opt expression] [SP] ') [NL] [IN] [statement] [EX] end define define condition [expression] | [repeat type_specifier+] [declarator] [SP] '= [SP] [assignment_expression] end define define for_init_statement [expression_statement] | [simple_declaration] end define define jump_statement 'break '; | 'continue '; | 'return [SPON] [opt expression] [SPOFF] '; | 'goto [id] '; end define define declaration_statement [block_declaration] end define % % A.6 Declarations % define declaration [block_declaration] [NL] | [function_definition] [NL] | [template_declaration] | [explicit_instantiation] | [explicit_specialization] | [linkage_specification] [NL] | [namespace_definition] [NL] | [comment] [NL] end define define block_declaration [simple_declaration] | [asm_definition] | [namespace_alias_definition] | [using_declaration] | [using_directive] end define define simple_declaration [SPON] [repeat decl_specifier] [SPOFF] [SP] [list init_declarator] '; end define define decl_specifier [storage_class_specifier] | [type_specifier] | [function_specifier] | 'friend | 'typedef end define define storage_class_specifier 'auto | 'register | 'static | 'extern | 'mutable end define define function_specifier 'inline | 'virtual | 'explicit end define define type_specifier [simple_type_specifier] | [class_specifier] | [enum_specifier] | [elaborated_type_specifier] | [cv_qualifier] end define define simple_type_specifier [opt '::] [opt nested_name_specifier] [type_name] | 'char | 'wchar_t | 'bool | 'short | 'int | 'long | 'signed | 'unsigned | 'float | 'double | 'void end define define type_name [class_name] | [enum_name] end define define elaborated_type_specifier [class_key] [opt '::] [opt nested_name_specifier] [class_name] | 'enum [opt '::] [opt nested_name_specifier] [enum_name] | 'typename [opt '::] [opt nested_name_specifier] [type_name] end define define enum_name '[ 'en [id] '] | [id] end define define enum_specifier 'enum [opt enum_name] [NL] '{ [NL] [IN] [opt enumerator_definition_list] [opt ',] [NL] [EX] '} end define define enumerator_definition_list [enumerator_definition] [opt enumerator_definition_list_tail] end define define enumerator_definition_list_tail ', [NL] [enumerator_definition_list] end define define enumerator_definition [enumerator] | [enumerator] [SP] '= [SP] [constant_expression] end define define enumerator [id] end define define namespace_name '[ 'nn [id] '] | [id] end define define namespace_definition 'namespace [opt namespace_name] '{ [NL] [namespace_body] '} end define define namespace_alias_definition 'namespace [namespace_name] [SP] '= [SP] [qualified_namespace_specifier] '; [NL] end define define qualified_namespace_specifier [opt '::] [opt nested_name_specifier] [namespace_name] end define define namespace_body [repeat declaration] end define define using_declaration 'using [SPON] [id_expression] [SPOFF] '; | 'using [SPON] [type_id] [SPOFF]'; end define define using_directive 'using [SPON] 'namespace [opt '::] [opt nested_name_specifier] [namespace_name] [SPOFF]'; end define define asm_definition 'asm [SP] '( [stringlit] ') '; [NL] end define define linkage_specification 'extern [SP] [stringlit] [SP] '{ [NL] [repeat declaration] '} | 'extern [SP] [stringlit] [SP] [declaration] end define % % A.7 Declarators % define init_declarator [declarator] [opt initializer] end define define declarator [opt '$] [repeat ptr_operator] [declarator_or_declid] [repeat decl_array_or_param] end define define declarator_or_declid [declarator_id] | [decl_open] [declarator] [decl_close] end define define decl_open '(| | '( end define define decl_close '|) | ') end define define decl_array_or_param [param_decl_open] [opt parameter_declaration_clause] [param_decl_close] [SPON] [repeat cv_qualifier] [SPOFF] [opt exception_specification] | [square_open] [opt constant_expression] [square_close] end define define square_open '[ '[ | '[ end define define square_close '] '] | '] end define define param_decl_open '({ | '( end define define param_decl_close '}) | ') end define define ptr_operator [ptr_amp] | [opt '::] [opt nested_name_specifier] [ptr_star] [repeat cv_qualifier] end define define ptr_amp '<&> | '& end define define ptr_star '<*> | '* end define define cv_qualifier 'const | 'volatile end define define declarator_id [opt '::] [opt nested_name_specifier] [unqual_declarator_id] end define define unqual_declarator_id [declarator_name] [opt template_id_args] | '~ [declarator_name] | [operator_function_id] | [conversion_function_id] end define define declarator_name '[ 'di [id] '] | [id] end define define type_id [repeat type_specifier+] [opt abstract_declarator] end define define abstract_declarator [repeat ptr_operator+] [opt rec_abstract_declarator] [repeat abstract_decl_array_or_param] | [decl_open] [abstract_declarator] [decl_close] [repeat abstract_decl_array_or_param] end define define rec_abstract_declarator [decl_open] [abstract_declarator] [decl_close] end define define abstract_decl_array_or_param [param_decl_open] [opt parameter_declaration_clause] [param_decl_close] [repeat cv_qualifier] [opt exception_specification] | [square_open] [constant_expression] [square_close] end define define parameter_declaration_clause '... | [parameter_declaration_list] [opt trailing_dot_dot_dot] end define define parameter_declaration_list [parameter_declaration] [opt parameter_declaration_list_tail] end define define parameter_declaration_list_tail ', [SP] [parameter_declaration_list] end define define trailing_dot_dot_dot '... | ', '... end define define parameter_declaration [SPON] [repeat decl_specifier+] [SPOFF] [opt parameter_declarator] [opt parameter_init] end define define parameter_declarator [SP] [declarator] | [SP] [abstract_declarator] end define define parameter_init [SP] '= [SP] [assignment_expression] end define define function_definition [SPON] [repeat decl_specifier] [SPOFF] [SP] [declarator] [NL] [function_def_body] end define define function_def_body [function_try_block] | [opt ctor_initializer] [function_body] end define define function_body [IN] [compound_statement] [EX] end define define initializer [SP] '= [SP] [initializer_clause] | '( [expression] ') end define define initializer_clause [assignment_expression] | '{ [list initializer_clause+] [opt ',] '} | '{ '} end define % % A.8 Classes % define class_name [class_id] [opt template_id_args] end define define class_id '[ 'cn [id] '] | [id] end define define class_specifier [class_head] [NL] '{ [NL] [IN] [repeat member_item] [EX] '} end define define class_head [class_key] [opt class_name] [opt base_clause] | [class_key] [nested_name_specifier] [class_name] [opt base_clause] end define define class_key 'class | 'struct | 'union end define define member_item [member_declaration] | [access_specifier] [label_colon] [NL] end define define member_declaration [SPON] [repeat decl_specifier] [SPOFF] [SP] [list member_declarator] '; [NL] | [function_definition] [opt ';] [NL] | [using_declaration] [NL] | [template_declaration] [NL] end define define member_declarator [declarator] [opt member_declarator_part] | [declarator] [bitfield_colon] [constant_expression] end define define bitfield_colon ':/ | ': end define define member_declarator_part [pure_specifier] | [constant_initializer] end define define pure_specifier [SP] '= [SP] '0 end define define constant_initializer [SP] '= [SP] [constant_expression] end define % % A.9 Derived Classes % define base_clause [NL] [IN_8] [base_colon] [SP] [list base_specifier+] [EX_8] end define define base_colon ':+ | ': end define define base_specifier [opt '::] [opt nested_name_specifier] [class_name] | 'virtual [opt access_specifier] [opt '::] [opt nested_name_specifier] [class_name] | [access_specifier] [opt 'virtual] [opt '::] [opt nested_name_specifier] [class_name] end define define access_specifier 'private | 'protected | 'public end define % % A.10 Special Member Functions % define conversion_function_id 'operator [conversion_type_id] end define define conversion_type_id [repeat type_specifier+] [opt conversion_declarator] end define define conversion_declarator [ptr_operator] [opt conversion_declarator] end define define ctor_initializer [ctor_colon] [NL] [IN] [list mem_initializer] [EX] [NL] end define define ctor_colon ':- | ': end define define mem_initializer [mem_initializer_id] '( [opt expression] ') end define define mem_initializer_id [opt '::] [opt nested_name_specifier] [id] [opt template_id_args] end define % % A.11 Operator Overloading % define operator_function_id 'operator [operator] end define define operator 'new | 'delete | 'new [square_open] [square_close] | 'delete [square_open] [square_close] | '+ | '- | '* | '/ | '% | '^ | '& | '| | '~ | '! | '= | '< | '> | '+= | '-= | '*= | '/= | '%= | '^= | '&= | '|= | '<< | '>> | '>>= | '<<= | '== | '!= | '<= | '>= | '&& | '|| | '++ | '-- | ', | '.* | '->* | '-> | '( ') | [square_open] [square_close] end define % % A.12 Templates % define template_declaration [SPON] [opt 'export] 'template [SPOFF] [SP] [templ_param_open] [template_parameter_list] [templ_param_close] [SP] [declaration] end define define template_parameter_list [template_parameter] [opt template_parameter_list_tail] end define define template_parameter_list_tail ', [SP] [template_parameter_list] end define define templ_param_open '<{ | '< end define define templ_param_close '}> | '> end define define template_parameter [type_parameter] | [parameter_declaration] end define define type_parameter 'class [SPON] [opt id] [SPOFF] [opt type_parameter_init] | 'typename [SPON] [opt id] [SPOFF] [opt type_parameter_init] | 'template [SP] [templ_param_open] [list template_parameter] [templ_param_close] [SP] 'class [SPON] [opt id] [SPOFF] [opt type_parameter_templ_init] end define define type_parameter_init [SP] '= [SP] [type_id] end define define type_parameter_templ_init [SP] '= [SP] [id_expression] end define define template_id [template_name] [templ_arg_open] [list template_argument] [templ_arg_close] end define define template_id_args [templ_arg_open] [list template_argument] [templ_arg_close] end define define template_name [id] end define define template_argument [type_id] | [assignment_expression] end define define explicit_instantiation [opt 'extern] 'template [declaration] end define define explicit_specialization 'template [templ_param_open] [templ_param_close] [declaration] end define % % A.13 Exception Handling % define try_block 'try [compound_statement] [repeat handler+] end define define function_try_block 'try [opt ctor_initializer] [function_body] [repeat handler+] end define define handler 'catch '( [exception_declaration] ') [compound_statement] end define define exception_declaration [repeat type_specifier+] [declarator] | [repeat type_specifier+] [abstract_declarator] | [repeat type_specifier+] | '... end define define throw_expression 'throw [opt assignment_expression] end define define exception_specification 'throw '( [list type_id] ') end define % % Program % define cpp_program [SPOFF] [repeat declaration] end define % % Rules for undoing the disambiguation. % % Undo opening of parameter declaration. rule undoParamDeclOpen replace $ [param_decl_open] '({ by '( end rule % Undo closing of parameter declaration. rule undoParamDeclClose replace $ [param_decl_close] '}) by ') end rule % Undo opening of declarator brackets. rule undoDeclOpen replace $ [decl_open] '(| by '( end rule % Undo closing of declarator brackets. rule undoDeclClose replace $ [decl_close] '|) by ') end rule % Undo opening of template parameters. rule undoTemplParamOpen replace $ [templ_param_open] '<{ by '< end rule % Undo closing of template parameters. rule undoTemplParamClose replace $ [templ_param_close] '}> by '> end rule % Undo opening of template arguments. rule undoTemplArgOpen replace $ [templ_arg_open] '<| by '< end rule % Undo closing of template arguments. rule undoTemplArgClose replace $ [templ_arg_close] '|> by '> end rule % Undo opening of a square bracket. rule undoSquareOpen replace $ [square_open] '[ '[ by '[ end rule % Undo closing of a square bracket. rule undoSquareClose replace $ [square_close] '] '] by '] end rule % Undo <&> in a declarator. rule undoPtrAmp replace $ [ptr_amp] '<&> by '& end rule % Undo <*> in a declarator. rule undoPtrStar replace $ [ptr_star] '<*> by '* end rule % Undo a bitfield colon. rule undoBitfieldColon replace $ [bitfield_colon] ':/ by ': end rule % Undo a base specifier colon. rule undoBaseColon replace $ [base_colon] ':+ by ': end rule % Undo a constructor init colon. rule undoCtorColon replace $ [ctor_colon] ':- by ': end rule % Undo a label colon. rule undoLabelColon replace $ [label_colon] ':~ by ': end rule % Undo a label colon. rule undoConditionalColon replace $ [conditional_colon] ':| by ': end rule % Undo the the opening of a declarator. rule undoDeclaratorBar replace $ [opt '$] '$ by % Empty end rule % Undo the declarator name. rule undoDeclaratorName replace $ [declarator_name] '[ 'di Id [id] '] by Id end rule % Undo the namespace name. rule undoNamespaceName replace $ [namespace_name] '[ 'nn Id [id] '] by Id end rule % Undo the class id. rule undoClassId replace $ [class_id] '[ 'cn Id [id] '] by Id end rule % Undo the enumerator name. rule undoEnumName replace $ [enum_name] '[ 'en Id [id] '] by Id end rule rule undoInclude replace $ [declaration] Comment [comment] where Comment [grep "/* CXXPREP #include"] construct Zero [number] 0 construct TailPos [number] Zero [# Comment] [- 3] by Comment [: 12 TailPos] end rule % Tie all undo rules together. function undoDisambig replace [program] P [program] by P [undoParamDeclOpen] [undoParamDeclClose] [undoDeclOpen] [undoDeclClose] [undoTemplParamOpen] [undoTemplParamClose] [undoTemplArgOpen] [undoTemplArgClose] [undoSquareOpen] [undoSquareClose] [undoPtrAmp] [undoPtrStar] [undoBitfieldColon] [undoBaseColon] [undoCtorColon] [undoLabelColon] [undoConditionalColon] [undoDeclaratorName] [undoDeclaratorBar] [undoNamespaceName] [undoEnumName] [undoClassId] [undoInclude] end function kelbt-0.15/cxxprep/parser.kl0000664000175000017500000022005511072514631016421 0ustar thurstonthurston/* * Copyright 2004-2006 Adrian Thurston */ /* This file is part of C++ Pre-Parser. * * C++ Pre-Parser is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * C++ Pre-Parser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with C++ Pre-Parser; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "parser.h" #include "names.h" #include #include using namespace std; Buffer preToken; struct Parser_Lel_template_argument; void setNameData( NameData &nameData, LangEl *from ); void initNameData( NameData &nameData ); void makeTypeList( TypeList &typeList, Parser_Lel_template_argument *last ); %%{ parser Parser; token translate { /* Translate names. Take them from id to whatever they are. */ if ( input->type == TK_Lookup ) { if ( input->user.token.qual ) lookupQualified( input ); else lookupInStack( input ); } } undo { /* Undo the translation of names. Take them back to id. */ switch ( input->type ) { case TK_UnknownId: case TK_Identifier: case TK_NamespaceName: case TK_ClassName: case TK_TemplClassName: case TK_EnumName: case TK_TypedefName: case TK_TemplateId: input->type = TK_Lookup; break; } } final { writeToken( lel ); }; include "parser.kh"; # Start symbol. start: declaration_rep; # # Class Names # nonterm class_name { NameData nameData; }; class_name: TK_ClassName try { setNameData( $$->nameData, @1 ); }; class_name: TK_TemplClassName try { setNameData( $$->nameData, @1 ); }; class_name: TK_TemplClassName templ_arg_open template_argument_list_opt templ_arg_close try { setNameData( $$->nameData, @1 ); TypeList typeList; makeTypeList( typeList, $3->last ); /* Look for a specialization, otherwise use the base template class. */ Object *specObj = findSpecCovers( $1->object, &typeList ); if ( specObj != 0 ) { #ifdef LOG_REDUCE cerr << "found specialization" << endl; #endif $$->nameData.object = specObj; } }; templ_arg_open: '<' try { qualNs.push(0); $1->outType = TK_TemplArgOpen; } undo { qualNs.pop(); $1->outType = 0; }; nonterm templ_arg_close { Object *oldQualNs; }; templ_arg_close: '>' try { $$->oldQualNs = qualNs.pop(); $1->outType = TK_TemplArgClose; } undo { qualNs.push( $$->oldQualNs ); $1->outType = 0; }; # # Name qualfication # root_qual_opt: ; root_qual_opt: TK_NameSep; nested_name_specifier_opt: nested_name_specifier_opt qualifying_name TK_NameSep designated_qualifying_name TK_NameSep; nested_name_specifier_opt: nested_name_specifier_opt qualifying_name TK_NameSep; nested_name_specifier_opt: ; nested_name_specifier: nested_name_specifier designated_qualifying_name TK_NameSep; nested_name_specifier: nested_name_specifier qualifying_name TK_NameSep; nested_name_specifier: qualifying_name TK_NameSep; nonterm qualifying_name { Object *oldQualNs; }; qualifying_name: class_name try { $$->oldQualNs = qualNs.top(); qualNs.set( $1->nameData.object ); } undo { qualNs.set( $$->oldQualNs ); }; qualifying_name: TK_NamespaceName try { $$->oldQualNs = qualNs.top(); qualNs.set( $1->object ); } undo { qualNs.set( $$->oldQualNs ); }; qualifying_name: TK_TypedefName try { $$->oldQualNs = qualNs.top(); Object *pointsTo = $1->object->objType != 0 ? $1->object->objType->getObject() : 0; qualNs.set( pointsTo != 0 ? pointsTo : $1->object ); } undo { qualNs.set( $$->oldQualNs ); }; nonterm designated_qualifying_name { Object *oldQualNs; }; designated_qualifying_name: KW_Template TK_Identifier try { /* FIXME: nulling qualNs is not the right thing to do here. */ cerr << "FIXME: THIS IS NOT THE RIGHT THING TO DO" << endl; $$->oldQualNs = qualNs.top(); qualNs.set( 0 ); } undo { qualNs.set( $$->oldQualNs ); }; designated_qualifying_name: KW_Template TK_Identifier templ_arg_open template_argument_list_opt templ_arg_close try { /* FIXME: nulling qualNs is not the right thing to do here. */ cerr << "FIXME: THIS IS NOT THE RIGHT THING TO DO" << endl; $$->oldQualNs = qualNs.top(); qualNs.set( 0 ); } undo { qualNs.set( $$->oldQualNs ); }; nonterm qual_reset { Object *qualObj; }; qual_reset: try { $$->qualObj = qualNs.top(); qualNs.set(0); } undo { qualNs.set( $$->qualObj ); }; # # Id Expression # nonterm id_expression { NameData nameData; }; id_expression: root_qual_opt nested_name_specifier_opt TK_UnknownId qual_reset try { setNameData( $$->nameData, @3 ); $$->nameData.qualNs = $4->qualObj; }; id_expression: root_qual_opt nested_name_specifier_opt TK_Identifier qual_reset try { setNameData( $$->nameData, @3 ); $$->nameData.qualNs = $4->qualObj; }; id_expression: root_qual_opt nested_name_specifier_opt operator_function_id qual_reset try { $$->nameData.id = 0; $$->nameData.object = 0; $$->nameData.langEl = 0; $$->nameData.qualNs = $4->qualObj; }; id_expression: root_qual_opt nested_name_specifier_opt conversion_function_id qual_reset try { $$->nameData.id = 0; $$->nameData.object = 0; $$->nameData.langEl = 0; $$->nameData.qualNs = $4->qualObj; }; id_expression: root_qual_opt nested_name_specifier_opt '~' class_name qual_reset try { $$->nameData = $4->nameData; $$->nameData.qualNs = $5->qualObj; }; id_expression: root_qual_opt nested_name_specifier_opt template_id qual_reset try { $$->nameData = $3->nameData; $$->nameData.qualNs = $4->qualObj; }; nonterm template_id { NameData nameData; }; template_id: TK_TemplateId templ_arg_open template_argument_list_opt templ_arg_close try { setNameData( $$->nameData, @1 ); }; template_id: TK_TemplateId try { setNameData( $$->nameData, @1 ); }; # # Expressions # literal: TK_IntegerDecimal; literal: TK_IntegerOctal; literal: TK_IntegerHex; literal: TK_SingleLit; literal: TK_Float; literal: double_lit_list; literal: KW_True; literal: KW_False; double_lit_list: TK_DoubleLit double_lit_list; double_lit_list: TK_DoubleLit; nonterm primary_expression { Type *type; }; primary_expression: literal try { $$->type = 0; }; primary_expression: KW_This try { $$->type = 0; }; primary_expression: '(' expression ')' try { $$->type = 0; }; primary_expression: id_expression try { $$->type = $1->nameData.object != 0 ? $1->nameData.object->objType : 0; }; # This is an GNU extension. primary_expression: '(' '{' statement_rep '}' ')'; nonterm postfix_expression { Type *type; }; postfix_expression: primary_expression try { $$->type = $1->type; }; postfix_expression: postfix_expression '[' expression ']' try { $$->type = $1->type; }; postfix_expression: postfix_expression '(' expression_opt ')' try { $$->type = $1->type; }; postfix_expression: function_style_type_conv '(' expression_opt ')' try { $$->type = 0; }; postfix_expression: member_request_expr dot_arrow id_expression qual_reset try { $$->type = 0; }; postfix_expression: member_request_expr dot_arrow pseudo_destructor_call qual_reset try { $$->type = 0; }; postfix_expression: postfix_expression TK_PlusPlus try { $$->type = 0; }; postfix_expression: postfix_expression TK_MinusMinus try { $$->type = 0; }; postfix_expression: KW_DynamicCast templ_arg_open type_id templ_arg_close '(' expression ')' try { $$->type = 0; }; postfix_expression: KW_StaticCast templ_arg_open type_id templ_arg_close '(' expression ')' try { $$->type = 0; }; postfix_expression: KW_ReinterpretCast templ_arg_open type_id templ_arg_close '(' expression ')' try { $$->type = 0; }; postfix_expression: KW_ConstCast templ_arg_open type_id templ_arg_close '(' expression ')' try { $$->type = 0; }; postfix_expression: KW_Typeid '(' expression ')' try { $$->type = 0; }; postfix_expression: KW_Typeid '(' type_id ')' try { $$->type = 0; }; pseudo_destructor_call: root_qual_opt nested_name_specifier_opt '~' pdc_type_name qual_reset; nonterm member_request_expr { Object *oldQualNs; }; member_request_expr: postfix_expression try { /* FIXME: If no proper type is found, we must fail. */ #ifdef LOG_REDUCE cerr << "setting member request scope" << endl; #endif $$->oldQualNs = qualNs.top(); qualNs.set( $1->type != 0 ? $1->type->getObject() : 0 ); } undo { qualNs.set( $$->oldQualNs ); }; dot_arrow: TK_Arrow; dot_arrow: '.'; pdc_type_name: TK_EnumName; pdc_type_name: TK_TypedefName; function_style_type_conv: simple_type_specifier; unary_expression: postfix_expression; unary_expression: TK_PlusPlus cast_expression; unary_expression: TK_MinusMinus cast_expression; unary_expression: unary_operator cast_expression; unary_expression: KW_Sizeof '(' type_id ')'; unary_expression: KW_Sizeof unary_expression; unary_expression: new_expression; unary_expression: delete_expression; unary_operator: '*'; unary_operator: '&'; unary_operator: '+'; unary_operator: '-'; unary_operator: '!'; unary_operator: '~'; new_expression: root_qual_opt KW_New new_type_id new_initializer_opt qual_reset; new_expression: root_qual_opt KW_New new_placement new_type_id new_initializer_opt qual_reset; new_expression: root_qual_opt KW_New '(' type_id ')' new_initializer_opt qual_reset; new_expression: root_qual_opt KW_New new_placement '(' type_id ')' new_initializer_opt qual_reset; new_placement: '(' expression ')'; new_type_id: necs_type_specifier_seq new_declarator_opt; new_declarator: direct_new_declarator; new_declarator: ptr_operator_seq direct_new_declarator; new_declarator: ptr_operator_seq; new_declarator_opt: new_declarator; new_declarator_opt: ; direct_new_declarator: '[' expression ']'; direct_new_declarator: direct_new_declarator '[' constant_expression ']'; new_initializer: '(' expression_opt ')'; new_initializer_opt: new_initializer; new_initializer_opt: ; delete_expression: root_qual_opt KW_Delete cast_expression qual_reset; delete_expression: root_qual_opt KW_Delete '[' ']' cast_expression qual_reset; cast_expression: unary_expression; cast_expression: '(' type_id ')' cast_expression; pm_expression: pm_expression TK_ArrowStar cast_expression; pm_expression: pm_expression TK_DotStar cast_expression; pm_expression: cast_expression; multiplicative_expression: multiplicative_expression '*' pm_expression; multiplicative_expression: multiplicative_expression '/' pm_expression; multiplicative_expression: multiplicative_expression '%' pm_expression; multiplicative_expression: pm_expression; additive_expression: additive_expression '+' multiplicative_expression; additive_expression: additive_expression '-' multiplicative_expression; additive_expression: multiplicative_expression; shift_expression: shift_expression shift_left additive_expression; shift_expression: shift_expression shift_right additive_expression; shift_expression: additive_expression; relational_expression: relational_expression '<' shift_expression; relational_expression: relational_expression '>' shift_expression; relational_expression: relational_expression lt_eq shift_expression; relational_expression: relational_expression gt_eq shift_expression; relational_expression: shift_expression; equality_expression: equality_expression TK_EqualsEquals relational_expression; equality_expression: equality_expression TK_NotEquals relational_expression; equality_expression: relational_expression; and_expression: and_expression '&' equality_expression; and_expression: equality_expression; exclusive_or_expression: exclusive_or_expression '^' and_expression; exclusive_or_expression: and_expression; inclusive_or_expression: inclusive_or_expression '|' exclusive_or_expression; inclusive_or_expression: exclusive_or_expression; logical_and_expression: logical_and_expression TK_AndAnd inclusive_or_expression; logical_and_expression: inclusive_or_expression; logical_or_expression: logical_or_expression TK_OrOr logical_and_expression; logical_or_expression: logical_and_expression; conditional_expression: logical_or_expression; conditional_expression: logical_or_expression '?' expression ':' assignment_expression; assignment_expression: conditional_expression; assignment_expression: logical_or_expression assignment_op assignment_expression; assignment_expression: throw_expression; assignment_op: '='; assignment_op: TK_MultAssign; assignment_op: TK_DivAssign; assignment_op: TK_PercentAssign; assignment_op: TK_PlusAssign; assignment_op: TK_MinusAssign; assignment_op: TK_ShiftRightAssign; assignment_op: TK_ShiftLeftAssign; assignment_op: TK_AmpAssign; assignment_op: TK_CaretAssign; assignment_op: TK_BarAssign; expression: expression ',' assignment_expression; expression: assignment_expression; expression_opt: expression; expression_opt: ; constant_expression: conditional_expression; constant_expression_opt: constant_expression; constant_expression_opt: ; # # Statements # statement_rep: statement_rep statement; statement_rep: ; statement: declaration_statement commit; statement: labeled_statement commit; statement: expression_statement commit; statement: compound_statement commit; statement: selection_statement commit; statement: iteration_statement commit; statement: jump_statement commit; statement: try_block commit; labeled_statement: label_id ':' statement; labeled_statement: KW_Case constant_expression ':' statement; labeled_statement: KW_Default ':' statement; label_id: TK_UnknownId; label_id: TK_Identifier; label_id: TK_ClassName; label_id: TK_TemplClassName; label_id: TK_NamespaceName; label_id: TK_TypedefName; label_id: TK_EnumName; label_id: TK_TemplateId; compound_statement: '{' compound_begin statement_rep compound_end '}'; compound_begin: try { Object *newCompound = new Object; lookupNs.top()->push( newCompound ); declNs.push( newCompound ); } undo { declNs.pop(); lookupNs.top()->pop(); }; nonterm compound_end { Object *lookupNsTop; Object *declNsTop; }; compound_end: try { $$->lookupNsTop = lookupNs.top()->pop(); $$->declNsTop = declNs.pop(); } undo { declNs.push( $$->declNsTop ); lookupNs.top()->push( $$->declNsTop ); }; selection_statement: KW_If '(' condition ')' statement elseif_clauses else_clause; selection_statement: KW_Switch '(' condition ')' statement; elseif_clauses: elseif_clauses KW_Else KW_If '(' condition ')' statement; elseif_clauses: ; else_clause: KW_Else statement; else_clause: ; iteration_statement: KW_While '(' condition ')' statement; iteration_statement: KW_Do statement KW_While '(' expression ')' ';'; iteration_statement: KW_For '(' for_init_statement condition_opt ';' expression_opt ')' statement; jump_statement: KW_Break ';'; jump_statement: KW_Continue ';'; jump_statement: KW_Return expression_opt ';'; jump_statement: KW_Goto TK_Identifier ';'; for_init_statement: expression_statement; for_init_statement: stmt_block_declaration_forms ';'; condition: expression; condition: type_specifier_seq declarator '=' assignment_expression; condition_opt: condition; condition_opt: ; expression_statement: expression ';'; expression_statement: ';'; declaration_statement: stmt_block_declaration; stmt_block_declaration: stmt_block_declaration_forms ';'; stmt_block_declaration: using_declaration; stmt_block_declaration: using_directive; stmt_block_declaration_forms: declaration_start decl_specifier_mult_seq init_declarator_list_opt declaration_end; stmt_block_declaration_forms: declaration_start decl_specifier_sing decl_specifier_mult_rep init_declarator_list_opt declaration_end; stmt_block_declaration_forms: declaration_start decl_specifier_mult_seq decl_specifier_sing decl_specifier_mult_rep init_declarator_list_opt declaration_end; # # Declarations # declaration_rep: declaration_rep declaration; declaration_rep: ; declaration: block_declaration commit; declaration: function_definition commit; declaration: template_declaration commit; declaration: explicit_instantiation commit; declaration: explicit_specialization commit; declaration: linkage_specification commit; declaration: namespace_definition commit; block_declaration: simple_declaration; block_declaration: using_declaration; block_declaration: using_directive; simple_declaration: simple_declaration_forms ';'; simple_declaration_forms: declaration_start init_declarator_list_opt declaration_end; simple_declaration_forms: declaration_start decl_specifier_mult_seq init_declarator_list_opt declaration_end; simple_declaration_forms: declaration_start decl_specifier_sing decl_specifier_mult_rep init_declarator_list_opt declaration_end; simple_declaration_forms: declaration_start decl_specifier_mult_seq decl_specifier_sing decl_specifier_mult_rep init_declarator_list_opt declaration_end; # This non terminal sets up fresh local variables that will be used by the declaraion. # This is necessary since declarations may be nested. declaration_start: try { /* Push fresh variables for the declaration. */ declarationData.push( DeclarationData() ); declarationData.top().init(); declarationData.top().type = unknownType; declarationData.top().isTemplate = templDecl.top(); /* Reset the template declaration tracking var. */ templDecl.push(false); } undo { templDecl.pop(); declarationData.pop(); }; nonterm declaration_end { bool templDeclVal; DeclarationData declarationData; }; # Closes off a declaration. Frees the local variables used. declaration_end: try { $$->templDeclVal = templDecl.pop(); $$->declarationData = declarationData.pop(); } undo { templDecl.push( $$->templDeclVal ); declarationData.push( $$->declarationData ); }; decl_specifier_sing: type_specifier_sing try { declarationData.top().type = $1->type; }; decl_specifier_mult_rep: decl_specifier_mult_rep decl_specifier_mult; decl_specifier_mult_rep: ; decl_specifier_mult_seq: decl_specifier_mult_seq decl_specifier_mult; decl_specifier_mult_seq: decl_specifier_mult; decl_specifier_mult: type_specifier_mult; decl_specifier_mult: storage_class_specifier; decl_specifier_mult: function_specifier; decl_specifier_mult: KW_Friend try { declarationData.top().isFriend = true; }; decl_specifier_mult: KW_Typedef try { declarationData.top().isTypedef = true; }; storage_class_specifier: KW_Auto; storage_class_specifier: KW_Register; storage_class_specifier: KW_Static; storage_class_specifier: KW_Extern; storage_class_specifier: KW_Mutable; function_specifier: KW_Inline; function_specifier: KW_Virtual; function_specifier: KW_Explicit; nonterm type_specifier_seq { Type *type; Object *object; }; type_specifier_seq: type_specifier_mult_seq type_specifier_sing type_specifier_mult_rep try { $$->type = $2->type; $$->object = $2->object; }; type_specifier_seq: type_specifier_sing type_specifier_mult_rep try { $$->type = $1->type; $$->object = $1->object; }; nonterm type_specifier_sing { Type *type; Object *object; }; type_specifier_sing: simple_type_specifier try { $$->type = $1->type; $$->object = $1->object; }; type_specifier_sing: class_specifier try { $$->type = $1->object->objType; $$->object = $1->object; }; type_specifier_sing: enum_specifier try { $$->type = $1->object->objType; $$->object = $1->object; }; type_specifier_sing: elaborated_type_specifier try { // FIXME: Should always return a type here. $$->type = ($1->object != 0) ? $1->object->objType : 0; $$->object = $1->object; }; # Type specifier sequence without enum specifier or class specifier. necs_type_specifier_seq: type_specifier_mult_seq necs_type_specifier_sing type_specifier_mult_rep; necs_type_specifier_seq: necs_type_specifier_sing type_specifier_mult_rep; # Type specifier singular without enum specifier or class specifier. necs_type_specifier_sing: simple_type_specifier; necs_type_specifier_sing: elaborated_type_specifier; type_specifier_mult_rep: type_specifier_mult_rep type_specifier_mult; type_specifier_mult_rep: ; type_specifier_mult_seq: type_specifier_mult_seq type_specifier_mult; type_specifier_mult_seq: type_specifier_mult; type_specifier_mult: cv_qualifier; cv_qualifier: KW_Const; cv_qualifier: KW_Volatile; cv_qualifier: KW_Restrict; cv_qualifier_rep: cv_qualifier_rep cv_qualifier; cv_qualifier_rep: ; nonterm simple_type_specifier { Type *type; Object *object; }; simple_type_specifier: simple_type_specifier_name try { $$->type = $1->object->objType; $$->object = $1->object; }; simple_type_specifier: simple_type_specifier_kw_seq try { $$->type = $1->type; $$->object = 0; }; simple_type_specifier: KW_Typename root_qual_opt nested_name_specifier type_name qual_reset try { $$->type = $4->nameData.object->objType; $$->object = $4->nameData.object; }; simple_type_specifier: KW_Typename root_qual_opt nested_name_specifier TK_Identifier qual_reset try { $$->type = unknownType; $$->object = 0; }; simple_type_specifier: KW_Typename root_qual_opt nested_name_specifier TK_UnknownId qual_reset try { $$->type = unknownType; $$->object = 0; }; simple_type_specifier: KW_Typeof '(' TK_Identifier ')' try { $$->type = unknownType; $$->object = 0; }; nonterm simple_type_specifier_name { Object *object; }; simple_type_specifier_name: qual_type_name try { $$->object = $1->object; }; nonterm simple_type_specifier_kw_seq { Type *type; }; simple_type_specifier_kw_seq: simple_type_specifier_kw_seq simple_type_specifier_kw try { $$->type = addInProp( $1->type, $2->prop ); }; simple_type_specifier_kw_seq: simple_type_specifier_kw try { $$->type = newType( $1->prop ); }; nonterm simple_type_specifier_kw { Type::Property prop; }; simple_type_specifier_kw: KW_Void try { $$->prop = Type::Void; }; simple_type_specifier_kw: KW_Char try { $$->prop = Type::Char; }; simple_type_specifier_kw: KW_WcharT try { $$->prop = Type::Wchar_t; }; simple_type_specifier_kw: KW_Bool try { $$->prop = Type::Bool; }; simple_type_specifier_kw: KW_Int try { $$->prop = Type::Int; }; simple_type_specifier_kw: KW_Float try { $$->prop = Type::Float; }; simple_type_specifier_kw: KW_Double try { $$->prop = Type::Double; }; simple_type_specifier_kw: KW_Short try { $$->prop = Type::Short; }; simple_type_specifier_kw: KW_Long try { $$->prop = Type::Long; }; simple_type_specifier_kw: KW_Signed try { $$->prop = Type::Signed; }; simple_type_specifier_kw: KW_Unsigned try { $$->prop = Type::Unsigned; }; nonterm qual_type_name { Object *object; }; qual_type_name: root_qual_opt nested_name_specifier_opt type_name qual_reset try { $$->object = $3->nameData.object; }; # The type is in nameData.object->type. nonterm type_name { NameData nameData; }; type_name: class_name try { $$->nameData = $1->nameData; }; type_name: TK_EnumName try { setNameData( $$->nameData, @1 ); }; type_name: TK_TypedefName try { setNameData( $$->nameData, @1 ); }; type named_object_type { Object *object; Type *type; }; nonterm elaborated_type_specifier { Object *object; bool created; }; # NOTE: the typename case is moved to simple type specifier # to take advantage of its conflict resolution. elaborated_type_specifier: class_key nested_name_specifier_opt class_head_name qual_reset try { Object *qualNs = $4->qualObj; char *id = $3->nameData.id; $$->created = false; /* If we are in friend declaration we don't need a new class object. */ $$->object = 0; /* Get the ns the class is declared in. */ Object *parentNs = qualNs != 0 ? qualNs : declNs.top(); /* Look for the class in the given scope. */ $$->object = parentNs->findClass( id ); if ( $$->object == 0 ) $$->object = parentNs->findTemplateClass( id ); if ( $$->object == 0 && !declarationData.top().isFriend ) { $$->created = true; Object::Type bnsType = declarationData.top().isTemplate ? Object::TemplateClassType : Object::ClassType; $$->object = new Object( bnsType, id, *lookupNs.top() ); $$->object->objType = new Type( $$->object ); parentNs->insertObject( id, $$->object ); } $3->nameData.langEl->user.token.outType = TK_ClassName; } undo { /* Get the ns the class is declared in. */ Object *qualNs = $4->qualObj; Object *parentNs = qualNs != 0 ? qualNs : declNs.top(); if ( $$->created ) parentNs->removeObject( $$->object ); $3->nameData.langEl->user.token.outType = 0; }; elaborated_type_specifier: class_key nested_name_specifier_opt TK_TemplClassName templ_arg_open template_argument_list_opt templ_arg_close qual_reset try { /* FIXME: Lookup type specialization. */ $$->object = $3->object; }; elaborated_type_specifier: KW_Enum nested_name_specifier_opt enum_head_name qual_reset try { Object *qualNs = $4->qualObj; char *id = $3->data; /* If we are in friend declaration we don't need a new enum object. */ $$->object = 0; if ( ! declarationData.top().isFriend ) { /* Get the ns the enum is declared in. */ Object *parentNs = qualNs != 0 ? qualNs : declNs.top(); /* Look for the enum in the given scope. */ $$->object = parentNs->findEnum( id ); if ( $$->object == 0 ) { $$->created = true; $$->object = new Object( Object::EnumType, id ); $$->object->objType = new Type( $$->object ); parentNs->insertObject( id, $$->object ); } } } undo { /* Get the ns the class is declared in. */ Object *qualNs = $4->qualObj; Object *parentNs = qualNs != 0 ? qualNs : declNs.top(); if ( $$->created ) parentNs->removeObject( $$->object ); }; namespace_definition: named_namespace_definition; namespace_definition: unnamed_namespace_definition; named_namespace_definition: original_namespace_definition; named_namespace_definition: extension_namespace_definition; using_declaration: KW_Using id_expression ';' try { Object *object = $2->nameData.object; if ( object != 0 && object->data != 0 ) declNs.top()->insertObject( object->data, object ); } undo { Object *object = $2->nameData.object; if ( object != 0 && object->data != 0 ) declNs.top()->removeObject( object ); }; using_declaration: KW_Using type_id ';' try { Object *object = $2->object; if ( object != 0 && object->data != 0 ) declNs.top()->insertObject( object->data, object ); } undo { Object *object = $2->object; if ( object != 0 && object->data != 0 ) declNs.top()->removeObject( object ); }; using_directive: KW_Using KW_Namespace root_qual_opt nested_name_specifier_opt TK_NamespaceName qual_reset ';' try { /* This is a simple, incomplete guard against cycles in the graph of * using namespaces. A more sophisticated and complete guard would look * for longer cycles as well. Note that even gcc 3.3.5 does not bother. */ if ( declNs.top() != $5->object ) declNs.top()->nsChildren.append( $5->object ); } undo { if ( declNs.top() != $5->object ) { int tail = declNs.top()->nsChildren.length(); declNs.top()->nsChildren.remove( tail-1 ); } }; linkage_specification: KW_Extern TK_DoubleLit '{' declaration_rep '}'; linkage_specification: KW_Extern TK_DoubleLit declaration; # # Original namespace definition # original_namespace_definition: orig_namespace_def_name '{' declaration_rep namespace_end '}'; orig_namespace_def_name: KW_Namespace TK_UnknownId try { Object *nspace = new Object( Object::NamespaceType, $2->data, *lookupNs.top() ); curNamespace.top()->insertObject( $2->data, nspace ); curNamespace.push( nspace ); lookupNs.top()->push( nspace ); declNs.push( nspace ); } undo { Object *nspace = curNamespace.pop(); curNamespace.top()->removeObject( nspace ); lookupNs.top()->pop(); declNs.pop(); }; type named_object { Object *object; }; nonterm namespace_end uses named_object; namespace_end: try { /* Pop the current namespace. */ $$->object = curNamespace.pop(); lookupNs.top()->pop(); declNs.pop(); } undo { declNs.push( $$->object ); lookupNs.top()->push( $$->object ); curNamespace.push( $$->object ); }; # # Extension namespace definition # extension_namespace_definition: ext_namespace_def_name '{' declaration_rep namespace_end '}'; ext_namespace_def_name: KW_Namespace TK_NamespaceName try { Object *nspace = $2->object; curNamespace.push( nspace ); lookupNs.top()->push( nspace ); declNs.push( nspace ); } undo { curNamespace.pop(); lookupNs.top()->pop(); declNs.pop(); }; # # Unnamed namespace definition # unnamed_namespace_definition: unnamed_namespace_def_name '{' declaration_rep namespace_end '}'; unnamed_namespace_def_name: KW_Namespace try { Object *nspace = new Object( Object::NamespaceType, 0, *lookupNs.top() ); curNamespace.push( nspace ); lookupNs.top()->push( nspace ); declNs.push( nspace ); } undo { curNamespace.pop(); lookupNs.top()->pop(); declNs.pop(); }; # # Enumerations # nonterm enum_specifier uses named_object_type; enum_specifier: KW_Enum nested_name_specifier_opt enum_head_name qual_reset '{' enumerator_list_opt '}' try { /* FIXME: enum may exist already. */ char *id = $3->data; $$->object = new Object( Object::EnumType, id ); $$->object->objType = new Type( $$->object ); declNs.top()->insertObject( id, $$->object ); } undo { declNs.top()->removeObject( $$->object ); }; enum_specifier: KW_Enum '{' enumerator_list_opt '}' try { $$->object = new Object( Object::EnumType, 0 ); $$->object->objType = new Type( $$->object ); }; nonterm enum_head_name { char *data; }; enum_head_name: TK_ClassName try { $$->data = $1->data; }; enum_head_name: TK_TemplClassName try { $$->data = $1->data; }; enum_head_name: TK_NamespaceName try { $$->data = $1->data; }; enum_head_name: TK_TypedefName try { $$->data = $1->data; }; enum_head_name: TK_EnumName try { $$->data = $1->data; }; enum_head_name: TK_Identifier try { $$->data = $1->data; }; enum_head_name: TK_TemplateId try { $$->data = $1->data; }; enum_head_name: TK_UnknownId try { $$->data = $1->data; }; enumerator_list_opt: enumerator_list; enumerator_list_opt: enumerator_list ','; enumerator_list_opt: ; enumerator_list: enumerator_list ',' enumerator_definition; enumerator_list: enumerator_definition; nonterm enumerator_definition { Object *newId; }; enumerator_definition: enumerator_id try { $$->newId = new Object( Object::UnknownType, $1->id ); declNs.top()->insertObject( $1->id, $$->newId ); } undo { declNs.top()->removeObject( $$->newId ); }; enumerator_definition: enumerator_id '=' constant_expression try { $$->newId = new Object( Object::UnknownType, $1->id ); declNs.top()->insertObject( $1->id, $$->newId ); } undo { declNs.top()->removeObject( $$->newId ); }; nonterm enumerator_id { char *id; }; enumerator_id: TK_NamespaceName try { $$->id = $1->data; }; enumerator_id: TK_TypedefName try { $$->id = $1->data; }; enumerator_id: TK_EnumName try { $$->id = $1->data; }; enumerator_id: TK_ClassName try { $$->id = $1->data; }; enumerator_id: TK_TemplClassName try { $$->id = $1->data; }; enumerator_id: TK_TemplateId try { $$->id = $1->data; }; enumerator_id: TK_Identifier try { $$->id = $1->data; }; enumerator_id: TK_UnknownId try { $$->id = $1->data; }; # # Declarators # init_declarator_list_opt: init_declarator_list; init_declarator_list_opt: ; init_declarator_list: init_declarator_list ',' init_declarator; init_declarator_list: init_declarator; init_declarator: declarator initializer_opt; initializer_opt: '=' initializer_clause; initializer_opt: '(' expression ')'; initializer_opt: ; initializer_clause: assignment_expression; initializer_clause: '{' initializer_list '}'; initializer_clause: '{' initializer_list ',' '}'; initializer_clause: '{' '}'; initializer_list: initializer_list ',' initializer_clause; initializer_list: initializer_clause; nonterm declarator { Object *qualObj; Object *declScope; }; declarator: ptr_operator_seq declarator_id decl_array_or_param_rep declarator_end try { $$->qualObj = $4->qualObj; $$->declScope = $4->declScope; }; declarator: ptr_operator_seq '(' sub_declarator ')' decl_array_or_param_rep declarator_end try { $$->qualObj = $6->qualObj; $$->declScope = $6->declScope; $2->outType = TK_DeclaratorOpen; $4->outType = TK_DeclaratorClose; } undo { $2->outType = $4->outType = 0; }; declarator: declarator_id decl_array_or_param_rep declarator_end try { $$->qualObj = $3->qualObj; $$->declScope = $3->declScope; }; declarator: '(' sub_declarator ')' decl_array_or_param_rep declarator_end try { $$->qualObj = $5->qualObj; $$->declScope = $5->declScope; $1->outType = TK_DeclaratorOpen; $3->outType = TK_DeclaratorClose; } undo { $1->outType = $3->outType = 0; }; sub_declarator: ptr_operator_seq declarator_id decl_array_or_param_rep; sub_declarator: ptr_operator_seq '(' sub_declarator ')' decl_array_or_param_rep try { $2->outType = TK_DeclaratorOpen; $4->outType = TK_DeclaratorClose; } undo { $2->outType = $4->outType = 0; }; sub_declarator: '(' sub_declarator ')' decl_array_or_param_rep try { $1->outType = TK_DeclaratorOpen; $3->outType = TK_DeclaratorClose; } undo { $1->outType = $3->outType = 0; }; sub_declarator: declarator_id decl_array_or_param_rep; decl_array_or_param_rep: decl_array_or_param_rep decl_array_or_param; decl_array_or_param_rep: ; decl_array_or_param: '[' constant_expression_opt ']'; decl_array_or_param: '(' parameter_declaration_clause ')' cv_qualifier_rep exception_specification_opt try { $1->outType = TK_ParameterOpen; $3->outType = TK_ParameterClose; } undo { $1->outType = $3->outType = 0; }; nonterm declarator_id { Object *object; }; declarator_id: declarator_id_forms try { Object *qualNs = $1->nameData.qualNs; char *id = $1->nameData.id; Object *parentNs = qualNs != 0 ? qualNs : declNs.top(); /* Check if we are declaring a constructor or destructor. */ bool isConstructor = false; if ( parentNs->type == Object::ClassType || parentNs->type == Object::TemplateClassType ) { if ( parentNs->data != 0 && id != 0 && strcmp( parentNs->data, id ) == 0 ) { isConstructor = true; #ifdef LOG_REDUCE cerr << "making declarator " << id << " a constructor/destructor" << endl; #endif } } Object *object = 0; if ( id != 0 && !declarationData.top().isFriend && !isConstructor ) { if ( declarationData.top().isTypedef ) { object = new Object( Object::TypedefType, id ); object->objType = declarationData.top().type; parentNs->insertObject( id, object ); #ifdef LOG_REDUCE cerr << "making declarator " << id << " a typedef of "; if ( object->objType != 0 ) object->objType->print( cerr ); else cerr << "(NULL)"; cerr << endl; #endif } else if ( qualNs == 0 ) { if ( declarationData.top().isTemplate ) { /* If in a template declaration and the name is not qualified then * create the template id. */ object = new Object( Object::TemplateIdType, id ); object->objType = declarationData.top().type; declNs.top()->insertObject( id, object ); #ifdef LOG_REDUCE cerr << "making declarator " << id << " a template id" << endl; #endif } else { object = new Object( Object::IdType, id ); object->objType = declarationData.top().type; declNs.top()->insertObject( id, object ); #ifdef LOG_REDUCE cerr << "making declarator " << id << " an id with type "; if ( object->objType != 0 ) object->objType->print( cerr ); else cerr << "(NULL)"; cerr << endl; #endif } } } /* Make scope for declarator. */ $$->object = object; declaratorData.push( DeclaratorData() ); declaratorData.top().init(); declaratorData.top().qualObj = qualNs; /* If the declarator is qualified, push the qualification to the lookup stack. */ if ( qualNs != 0 ) lookupNs.push( &qualNs->lookupNs ); #ifdef LOG_REDUCE cerr << "reduced declarator_id: qualNs: " << qualNs << " id: " << (id != 0 ? id : "") << endl; #endif } undo { Object *qualNs = $1->nameData.qualNs; if ( qualNs != 0 ) lookupNs.pop(); declaratorData.pop(); /* If we made a new object, must remove and delete it. */ Object *namedObj = $$->object; if ( namedObj != 0 ) { switch ( namedObj->type ) { case Object::TypedefType: { Object *parentNs = qualNs != 0 ? qualNs : declNs.top(); parentNs->removeObject( namedObj ); break; } case Object::IdType: case Object::TemplateIdType: declNs.top()->removeObject( namedObj ); break; default: assert(false); } } }; nonterm declarator_end { Object *qualObj; Object *declScope; DeclaratorData prevDeclaratorData; }; # Undoes the setup done by declarator_id. declarator_end: try { /* Get the Declarator scope from the top of the declNs stack. */ Object *declScope = declaratorData.top().declScope; Object *qualObj = declaratorData.top().qualObj; $$->prevDeclaratorData = declaratorData.top(); declaratorData.pop(); if ( declScope != 0 ) declNs.pop(); if ( qualObj != 0 ) lookupNs.pop(); $$->qualObj = qualObj; $$->declScope = declScope; } undo { declaratorData.push( $$->prevDeclaratorData ); Object *declScope = declaratorData.top().declScope; Object *qualObj = declaratorData.top().qualObj; if ( declScope != 0 ) declNs.push( declScope ); if ( qualObj != 0 ) lookupNs.push( &qualObj->lookupNs ); }; nonterm declarator_id_forms { NameData nameData; }; declarator_id_forms: id_expression try { $$->nameData = $1->nameData; if ( $1->nameData.langEl != 0 ) { $1->nameData.langEl->user.token.outType = TK_DeclaratorId; } } undo { if ( $1->nameData.langEl != 0 ) $1->nameData.langEl->user.token.outType = 0; }; declarator_id_forms: root_qual_opt nested_name_specifier_opt type_name qual_reset try { /* Get any qualification and the id. */ $$->nameData = $3->nameData; $$->nameData.qualNs = $4->qualObj; }; declarator_id_forms: root_qual_opt nested_name_specifier_opt TK_ClassName qual_reset try { /* Get any qualification and the id. */ $$->nameData.id = $3->data; $$->nameData.object = $3->object; $$->nameData.qualNs = $4->qualObj; }; declarator_id_forms: root_qual_opt nested_name_specifier_opt '~' TK_ClassName qual_reset try { /* Get any qualification and the id. */ $$->nameData.id = $4->data; $$->nameData.object = $4->object; $$->nameData.qualNs = $5->qualObj; }; declarator_id_forms: root_qual_opt nested_name_specifier_opt '~' TK_UnknownId qual_reset try { /* Get any qualification and the id. */ $$->nameData.id = $4->data; $$->nameData.object = 0; $$->nameData.qualNs = $5->qualObj; }; nonterm type_id { Type *type; Object *object; }; type_id: type_specifier_seq abstract_declarator_opt try { $$->type = $1->type; $$->object = $1->object; }; abstract_declarator_opt: abstract_declarator; abstract_declarator_opt: ; abstract_declarator: ptr_operator_seq abstract_noid abstract_decl_array_or_param_rep declarator_end; abstract_declarator: ptr_operator_seq '(' sub_abstract_declarator ')' abstract_decl_array_or_param_rep declarator_end try { $2->outType = TK_DeclaratorOpen; $4->outType = TK_DeclaratorClose; } undo { $2->outType = $4->outType = 0; }; abstract_declarator: abstract_noid abstract_decl_array_or_param_seq declarator_end; abstract_declarator: '(' sub_abstract_declarator ')' abstract_decl_array_or_param_rep declarator_end try { $1->outType = TK_DeclaratorOpen; $3->outType = TK_DeclaratorClose; } undo { $1->outType = $3->outType = 0; }; sub_abstract_declarator: ptr_operator_seq abstract_noid abstract_decl_array_or_param_rep; sub_abstract_declarator: ptr_operator_seq '(' sub_abstract_declarator ')' abstract_decl_array_or_param_rep try { $2->outType = TK_DeclaratorOpen; $4->outType = TK_DeclaratorClose; } undo { $2->outType = $4->outType = 0; }; sub_abstract_declarator: '(' sub_abstract_declarator ')' abstract_decl_array_or_param_rep try { $1->outType = TK_DeclaratorOpen; $3->outType = TK_DeclaratorClose; } undo { $1->outType = $3->outType = 0; }; abstract_noid: try { /* Make scope for declarator. */ declaratorData.push( DeclaratorData() ); declaratorData.top().init(); } undo { declaratorData.pop(); }; abstract_decl_array_or_param_rep: abstract_decl_array_or_param_rep abstract_decl_array_or_param; abstract_decl_array_or_param_rep: ; abstract_decl_array_or_param_seq: abstract_decl_array_or_param_seq abstract_decl_array_or_param; abstract_decl_array_or_param_seq: abstract_decl_array_or_param; abstract_decl_array_or_param: '[' constant_expression_opt ']'; abstract_decl_array_or_param: '(' parameter_declaration_clause ')' cv_qualifier_rep exception_specification_opt try { $1->outType = TK_ParameterOpen; $3->outType = TK_ParameterClose; } undo { $1->outType = 0; $3->outType = 0; }; parameter_declaration_clause: pdc_start parameter_declaration_list; parameter_declaration_clause: pdc_start parameter_declaration_list TK_DotDotDot; parameter_declaration_clause: pdc_start parameter_declaration_list ',' TK_DotDotDot; parameter_declaration_clause: pdc_start TK_DotDotDot; parameter_declaration_clause: pdc_start ; nonterm pdc_start { bool createdScope; }; pdc_start: try { /* We are going to need a scope for the declarator. */ $$->createdScope = false; if ( declaratorData.top().declScope == 0 ) { $$->createdScope = true; Object *declScope = new Object; declNs.push( declScope ); declaratorData.top().declScope = declScope; } } undo { if ( $$->createdScope ) { declNs.pop(); declaratorData.top().declScope = 0; } }; parameter_declaration_list: parameter_declaration_list ',' parameter_declaration; parameter_declaration_list: parameter_declaration; parameter_declaration: declaration_start decl_specifier_mult_seq param_maybe_declarator maybe_parameter_init declaration_end; parameter_declaration: declaration_start decl_specifier_sing decl_specifier_mult_rep param_maybe_declarator maybe_parameter_init declaration_end; parameter_declaration: declaration_start decl_specifier_mult_seq decl_specifier_sing decl_specifier_mult_rep param_maybe_declarator maybe_parameter_init declaration_end; param_maybe_declarator: abstract_declarator; param_maybe_declarator: declarator; param_maybe_declarator: ; maybe_parameter_init: '=' constant_expression; maybe_parameter_init: ; ptr_operator: '&'; ptr_operator: root_qual_opt nested_name_specifier_opt '*' cv_qualifier_rep qual_reset; ptr_operator_seq: ptr_operator_seq ptr_operator; ptr_operator_seq: ptr_operator; ptr_operator_rep: ptr_operator_rep ptr_operator; ptr_operator_rep: ; function_definition: function_def_declaration ctor_initializer_opt commit function_body function_def_end; function_def_declaration: declaration_start function_def_declarator declaration_end; function_def_declaration: declaration_start decl_specifier_mult_seq function_def_declarator declaration_end; function_def_declaration: declaration_start decl_specifier_sing decl_specifier_mult_rep function_def_declarator declaration_end; function_def_declaration: declaration_start decl_specifier_mult_seq decl_specifier_sing decl_specifier_mult_rep function_def_declarator declaration_end; function_def_declarator: declarator try { Object *qualObj = $1->qualObj; Object *declScope = $1->declScope; /* This is for the function def end. */ declaratorData.push( DeclaratorData() ); declaratorData.top().qualObj = qualObj; declaratorData.top().declScope = declScope; if ( qualObj != 0 ) { /* Give the function body the scope of the qualifier. */ lookupNs.push( &qualObj->lookupNs ); } /* Make the declarator scope visible in the function body. */ lookupNs.top()->push( declScope ); } undo { /* Make the declarator scope visible in the function body. */ lookupNs.top()->pop( ); Object *qualObj = $1->qualObj; if ( qualObj != 0 ) lookupNs.pop( ); declaratorData.pop(); }; nonterm function_def_end { DeclaratorData prevDeclaratorData; }; function_def_end: try { $$->prevDeclaratorData = declaratorData.top(); Object *qualObj = declaratorData.top().qualObj; /* Pop the declarator scope. */ lookupNs.top()->pop(); if ( qualObj != 0 ) lookupNs.pop( ); declaratorData.pop(); } undo { declaratorData.push( $$->prevDeclaratorData ); Object *qualObj = $$->prevDeclaratorData.qualObj; Object *declScope = $$->prevDeclaratorData.declScope; if ( qualObj != 0 ) lookupNs.push( &qualObj->lookupNs ); lookupNs.top()->push( declScope ); }; function_body: '{' function_body_begin statement_rep function_body_end '}'; function_body_begin: try { Object *newFunctionBody = new Object; lookupNs.top()->push( newFunctionBody ); declNs.push( newFunctionBody ); } undo { declNs.pop(); lookupNs.top()->pop(); }; nonterm function_body_end { Object *functionBody; }; function_body_end: try { /* First undoes the function body begin work. Then undoes the setup in * function_def_declarator. */ $$->functionBody = declNs.pop(); lookupNs.top()->pop(); } undo { lookupNs.top()->push( $$->functionBody ); declNs.push( $$->functionBody ); }; # # Classes # nonterm class_specifier uses named_object_type; class_specifier: class_head base_clause_opt commit '{' class_member_rep class_body_end '}' try { $$->object = $1->object; }; nonterm class_body_end uses named_object; class_body_end: try { /* Get the class object before popping. If we undo we may need to repush. */ $$->object = declNs.top(); /* Pop the class Ns. */ lookupNs.pop(); declNs.pop(); } undo { lookupNs.push( &$$->object->lookupNs ); declNs.push( $$->object ); }; nonterm class_head { Object *object; bool created; TypeListMapEl *typeListMapEl; }; class_head: class_key try { /* Push a new anonymous class. */ Object::Type bnsType = declarationData.top().isTemplate ? Object::TemplateClassType : Object::ClassType; Object *newClass = new Object( bnsType, 0, *lookupNs.top() ); newClass->objType = new Type( newClass ); lookupNs.push( &newClass->lookupNs ); declNs.push( newClass ); $$->object = newClass; } undo { lookupNs.pop(); declNs.pop(); }; class_head: class_key nested_name_specifier_opt class_head_name qual_reset try { char *id = $3->nameData.id; Object *qualNs = $4->qualObj; /* Get the ns the class is declared in. */ Object *parentNs = declNs.top(); if ( qualNs != 0 ) parentNs = qualNs; /* Look for the class in the given scope. */ $$->created = false; Object *declaredClass = parentNs->findClass( id ); if ( declaredClass == 0 ) declaredClass = parentNs->findTemplateClass( id ); if ( declaredClass == 0 ) { /* Class does not exist in the parent scope, create it. */ $$->created = true; Object::Type bnsType = declarationData.top().isTemplate ? Object::TemplateClassType : Object::ClassType; declaredClass = new Object( bnsType, id, *lookupNs.top() ); declaredClass->objType = new Type( declaredClass ); /* FIXME: handle friends. Make the class visible only if we are NOT * in a friend declaration. The new class object is necessary to * properly process the body of the class. */ if ( ! declarationData.top().isFriend ) parentNs->insertObject( id, declaredClass ); } /* Push the found/new class. */ lookupNs.push( &declaredClass->lookupNs ); declNs.push( declaredClass ); $$->object = declaredClass; $3->nameData.langEl->user.token.outType = TK_ClassName; } undo { lookupNs.pop( ); declNs.pop( ); if ( $$->created ) { Object *parentNs = declNs.top(); if ( ! declarationData.top().isFriend ) parentNs->removeObject( $$->object ); } $3->nameData.langEl->user.token.outType = 0; }; class_head: class_key nested_name_specifier_opt TK_TemplClassName qual_reset templ_arg_open template_argument_list_opt templ_arg_close try { char *id = $3->data; Object *classObj = $3->object; /* Try to find the specializaition in the template class object. */ TypeList typeList; makeTypeList( typeList, $6->last ); Object *declaredClass = 0; declaredClass = classObj->findSpecExact( typeList ); if ( declaredClass == 0 ) { $$->created = true; #ifdef LOG_REDUCE cerr << "making template specialization" << endl; #endif Object::Type bnsType = declarationData.top().isTemplate ? Object::TemplateClassType : Object::ClassType; declaredClass = new Object( bnsType, id, classObj->lookupNs ); declaredClass->objType = new Type( declaredClass ); $$->typeListMapEl = classObj->typeListMap.insert( typeList, declaredClass ); } /* Push the new class. */ lookupNs.push( &declaredClass->lookupNs ); declNs.push( declaredClass ); $$->object = declaredClass; } undo { lookupNs.pop( ); declNs.pop(); if ( $$->created && $$->typeListMapEl != 0 ) { Object *classObj = $3->object; classObj->typeListMap.detach( $$->typeListMapEl ); } }; nonterm class_head_name { NameData nameData; }; class_head_name: TK_ClassName try { setNameData( $$->nameData, @1 ); }; class_head_name: TK_TemplClassName try { setNameData( $$->nameData, @1 ); }; class_head_name: TK_NamespaceName try { setNameData( $$->nameData, @1 ); }; class_head_name: TK_TypedefName try { setNameData( $$->nameData, @1 ); }; class_head_name: TK_EnumName try { setNameData( $$->nameData, @1 ); }; class_head_name: TK_UnknownId try { setNameData( $$->nameData, @1 ); }; class_head_name: TK_Identifier try { setNameData( $$->nameData, @1 ); }; class_head_name: TK_TemplateId try { setNameData( $$->nameData, @1 ); }; class_key: KW_Class; class_key: KW_Struct; class_key: KW_Union; class_member_rep: class_member_rep class_member; class_member_rep: ; class_member: member_declaration; class_member: access_specifier ':'; member_declaration: member_declaration_forms ';' commit; member_declaration: function_definition commit; member_declaration: using_declaration commit; member_declaration: template_declaration commit; member_declaration_forms: declaration_start member_declarator_list_opt declaration_end; member_declaration_forms: declaration_start decl_specifier_mult_seq member_declarator_list_opt declaration_end; member_declaration_forms: declaration_start decl_specifier_sing decl_specifier_mult_rep member_declarator_list_opt declaration_end; member_declaration_forms: declaration_start decl_specifier_mult_seq decl_specifier_sing decl_specifier_mult_rep member_declarator_list_opt declaration_end; member_declarator_list_opt: member_declarator_list; member_declarator_list_opt: ; member_declarator_list: member_declarator_list ',' member_declarator; member_declarator_list: member_declarator; member_declarator: declarator; member_declarator: declarator '=' constant_expression; member_declarator: declarator ':' constant_expression; member_declarator: ':' constant_expression; access_specifier: KW_Private; access_specifier: KW_Protected; access_specifier: KW_Public; access_specifier_opt: access_specifier; access_specifier_opt: ; # # Derived classes # base_clause: ':' base_specifier_list; base_clause_opt: base_clause; base_clause_opt: ; base_specifier_list: base_specifier_list ',' base_specifier; base_specifier_list: base_specifier; base_specifier: root_qual_opt nested_name_specifier_opt type_name qual_reset try { Object *inherit = $3->nameData.object; //if ( inherit->type == Object::TypedefType ) // inherit = inherit->origType->getObject(); declNs.top()->nsChildren.append( inherit ); } undo { int vectLen = declNs.top()->nsChildren.length(); declNs.top()->nsChildren.remove( vectLen - 1 ); }; base_specifier: KW_Virtual access_specifier_opt root_qual_opt nested_name_specifier_opt type_name qual_reset try { Object *inherit = $5->nameData.object; //if ( inherit->type == Object::TypedefType ) // inherit = inherit->origType->getObject(); declNs.top()->nsChildren.append( inherit ); } undo { int vectLen = declNs.top()->nsChildren.length(); declNs.top()->nsChildren.remove( vectLen - 1 ); }; base_specifier: access_specifier virtual_opt root_qual_opt nested_name_specifier_opt type_name qual_reset try { Object *inherit = $5->nameData.object; //if ( inherit->type == Object::TypedefType ) // inherit = inherit->origType->getObject(); declNs.top()->nsChildren.append( inherit ); } undo { int vectLen = declNs.top()->nsChildren.length(); declNs.top()->nsChildren.remove( vectLen - 1 ); }; virtual_opt: KW_Virtual; virtual_opt: ; # # Special member functions # conversion_function_id: KW_Operator conversion_type_id; conversion_type_id: necs_type_specifier_seq ptr_operator_rep; ctor_initializer_opt: ctor_initializer; ctor_initializer_opt: ; ctor_initializer: ':' mem_initializer_list; mem_initializer_list: mem_initializer_list ',' mem_initializer; mem_initializer_list: mem_initializer; mem_initializer: mem_initializer_id '(' expression_opt ')'; mem_initializer_id: root_qual_opt nested_name_specifier_opt TK_UnknownId qual_reset; mem_initializer_id: root_qual_opt nested_name_specifier_opt TK_Identifier qual_reset; mem_initializer_id: root_qual_opt nested_name_specifier_opt type_name qual_reset; mem_initializer_id: root_qual_opt nested_name_specifier_opt template_id qual_reset; # # Overloading # operator_function_id: KW_Operator operator; operator: '+'; operator: '-'; operator: '*'; operator: '/'; operator: '='; operator: '<'; operator: '>'; operator: '&'; operator: '|'; operator: '^'; operator: '%'; operator: '~'; operator: '!'; operator: '(' ')'; operator: '[' ']'; operator: KW_New; operator: KW_Delete; operator: TK_Arrow; operator: TK_PlusPlus; operator: TK_MinusMinus; operator: TK_MultAssign; operator: TK_DivAssign; operator: TK_PercentAssign; operator: TK_PlusAssign; operator: TK_MinusAssign; operator: TK_ShiftRightAssign; operator: TK_ShiftLeftAssign; operator: TK_AmpAssign; operator: TK_CaretAssign; operator: TK_BarAssign; operator: TK_EqualsEquals; operator: TK_NotEquals; operator: TK_AndAnd; operator: TK_OrOr; operator: lt_eq; operator: gt_eq; operator: shift_left; operator: shift_right; lt_eq: '<' '=' try { if ( $2->leader != 0 ) { #ifdef LOG_REDUCE cerr << "rejecting less-than equals-to" << endl; #endif reject(); } }; gt_eq: '>' '=' try { if ( $2->leader != 0 ) { #ifdef LOG_REDUCE cerr << "rejecting greater-than equals-to" << endl; #endif reject(); } }; shift_left: '<' '<' try { if ( $2->leader != 0 ) { #ifdef LOG_REDUCE cerr << "rejecting shift left" << endl; #endif reject(); } }; shift_right: '>' '>' try { if ( $2->leader != 0 ) { #ifdef LOG_REDUCE cerr << "rejecting shift right" << endl; #endif reject(); } }; # # Templates # nonterm template_declaration { Object *templateParamScope; }; template_declaration: template_declaration_params declaration try { templDecl.pop(); $$->templateParamScope = templateParamNs.pop(); } undo { templDecl.push(true); templateParamNs.push($$->templateParamScope); }; template_declaration_params: KW_Template '<' tpl_start template_parameter_list '>' commit try { templDecl.push(true); $2->outType = TK_TemplParamOpen; $5->outType = TK_TemplParamClose; } undo { templDecl.pop(); $2->outType = 0; $5->outType = 0; }; template_declaration_params: KW_Export KW_Template '<' tpl_start template_parameter_list '>' commit try { $3->outType = TK_TemplParamOpen; $6->outType = TK_TemplParamClose; } undo { $3->outType = 0; $6->outType = 0; }; tpl_start: try { /* Create a new scope for the template parameters. */ Object *newTemplateParamScope = new Object; templateParamNs.push( newTemplateParamScope ); } undo { templateParamNs.pop(); }; template_parameter_list: template_parameter_list ',' template_parameter; template_parameter_list: template_parameter; template_parameter: type_parameter; template_parameter: template_parameter_declaration; template_parameter_declaration: declaration_start decl_specifier_mult_seq param_maybe_declarator maybe_parameter_init declaration_end; template_parameter_declaration: declaration_start temp_param_decl_specifier_sing decl_specifier_mult_rep param_maybe_declarator maybe_parameter_init declaration_end; template_parameter_declaration: declaration_start decl_specifier_mult_seq temp_param_decl_specifier_sing decl_specifier_mult_rep param_maybe_declarator maybe_parameter_init declaration_end; temp_param_decl_specifier_sing: temp_param_type_specifier_sing; # Template parameters cannot support elaborated type specifer or class specifier. */ temp_param_type_specifier_sing: templ_simple_type_specifier; temp_param_type_specifier_sing: enum_specifier; templ_simple_type_specifier: simple_type_specifier_name; templ_simple_type_specifier: simple_type_specifier_kw_seq; nonterm type_parameter uses named_object; type_parameter: KW_Class type_param_id type_param_init_opt try { if ( $2->id != 0 ) { /* The lookup ns should be a template param scope. */ Object *newClass = new Object( Object::ClassType, $2->id, *lookupNs.top() ); templateParamNs.top()->insertObject( $2->id, newClass ); $$->object = newClass; } } undo { if ( $2->id != 0 ) templateParamNs.top()->removeObject( $$->object ); }; type_parameter: KW_Typename type_param_id type_param_init_opt try { if ( $2->id != 0 ) { Object *newClass = new Object( Object::ClassType, $2->id, *lookupNs.top() ); templateParamNs.top()->insertObject( $2->id, newClass ); $$->object = newClass; } } undo { if ( $2->id != 0 ) templateParamNs.top()->removeObject( $$->object ); }; type_parameter: KW_Template '<' tpl_start template_parameter_list '>' KW_Class type_param_id templ_type_param_init_opt try { if ( $7->id != 0 ) { Object *newClass = new Object( Object::TemplateClassType, $7->id, *lookupNs.top() ); templateParamNs.top()->insertObject( $7->id, newClass ); } $2->outType = TK_TemplParamOpen; $5->outType = TK_TemplParamClose; } undo { if ( $7->id != 0 ) templateParamNs.top()->removeObject( $$->object ); $2->outType = 0; $5->outType = 0; }; templ_type_param_init_opt: '=' id_expression; templ_type_param_init_opt: ; type_param_init_opt: '=' type_id; type_param_init_opt: ; nonterm type_param_id { char *id; }; type_param_id: TK_NamespaceName try { $$->id = $1->data; }; type_param_id: TK_TypedefName try { $$->id = $1->data; }; type_param_id: TK_EnumName try { $$->id = $1->data; }; type_param_id: TK_ClassName try { $$->id = $1->data; }; type_param_id: TK_TemplClassName try { $$->id = $1->data; }; type_param_id: TK_Identifier try { $$->id = $1->data; }; type_param_id: TK_TemplateId try { $$->id = $1->data; }; type_param_id: TK_UnknownId try { $$->id = $1->data; }; type_param_id: try { $$->id = 0; }; nonterm template_argument_list_opt { Parser_Lel_template_argument *last; }; template_argument_list_opt: template_argument_list try { $$->last = $1->last; }; template_argument_list_opt: try { $$->last = 0; }; nonterm template_argument_list { Parser_Lel_template_argument *last; }; template_argument_list: template_argument_list ',' template_argument try { $3->prev = $1->last; $$->last = $3; }; template_argument_list: template_argument try { $$->last = $1; }; nonterm template_argument { Type *type; Parser_Lel_template_argument *prev; }; template_argument: type_id try { $$->type = $1->type; $$->prev = 0; }; template_argument: assignment_expression try { $$->type = 0; $$->prev = 0; }; explicit_instantiation: KW_Template declaration; explicit_instantiation: declaration_start decl_specifier_mult_seq KW_Template declaration declaration_end; explicit_specialization: KW_Template '<' '>' declaration; # Not sure what this one is about? explicit_specialization: declaration_start decl_specifier_mult_seq KW_Template '<' '>' declaration declaration_end; # # Exception Handling. # try_block: KW_Try compound_statement handler_seq; handler_seq: handler_seq handler; handler_seq: handler; handler: KW_Catch '(' exception_declaration ')' compound_statement; exception_declaration: type_specifier_seq declarator; exception_declaration: type_specifier_seq abstract_declarator; exception_declaration: type_specifier_seq; exception_declaration: TK_DotDotDot; throw_expression: KW_Throw assignment_expression; throw_expression: KW_Throw; exception_specification_opt: exception_specification; exception_specification_opt: ; exception_specification: KW_Throw '(' type_id_list_opt ')'; type_id_list_opt: type_id_list; type_id_list_opt: ; type_id_list: type_id_list ',' type_id; type_id_list: type_id; }%% %%{ write types; write data; }%% void Parser::init() { %% write init; } int Parser::parseLangEl( int type, const Token *token ) { %% write exec; return errCount == 0 ? 0 : -1; } void setNameData( NameData &nameData, LangEl *langEl ) { nameData.id = langEl->user.token.data; nameData.object = langEl->user.token.object; nameData.qualNs = 0; nameData.langEl = langEl; } void initNameData( NameData &nameData ) { nameData.id = 0; nameData.object = 0; nameData.qualNs = 0; nameData.langEl = 0; } bool Parser::isNamespaceName( LangEl *lel, MapEl *mapEl ) { Object *object = mapEl->objectList.head; if ( object->type == Object::NamespaceType ) { lel->type = TK_NamespaceName; lel->user.token.object = object; #ifdef LOG_LOOKUP cerr << "found namespace name" << endl; #endif return true; } return false; } bool Parser::isTypedefName( LangEl *lel, MapEl *mapEl ) { Object *object = mapEl->objectList.head; if ( object->type == Object::TypedefType ) { lel->type = TK_TypedefName; lel->user.token.object = object; #ifdef LOG_LOOKUP cerr << "found typedef name" << endl; #endif return true; } return false; } bool Parser::isEnumName( LangEl *lel, MapEl *mapEl ) { Object *object = mapEl->objectList.head; if ( object->type == Object::EnumType ) { lel->type = TK_EnumName; lel->user.token.object = object; #ifdef LOG_LOOKUP cerr << "found enum name" << endl; #endif return true; } return false; } bool Parser::isClassName( LangEl *lel, MapEl *mapEl ) { Object *object = mapEl->objectList.head; if ( object->type == Object::ClassType ) { lel->type = TK_ClassName; lel->user.token.object = object; #ifdef LOG_LOOKUP cerr << "found class name" << endl; #endif return true; } return false; } bool Parser::isTemplateClassName( LangEl *lel, MapEl *mapEl ) { Object *object = mapEl->objectList.head; if ( object->type == Object::TemplateClassType ) { lel->type = TK_TemplClassName; lel->user.token.object = object; #ifdef LOG_LOOKUP cerr << "found template class name" << endl; #endif return true; } return false; } bool Parser::isTemplateId( LangEl *lel, MapEl *mapEl ) { Object *object = mapEl->objectList.head; if ( object->type == Object::TemplateIdType ) { lel->type = TK_TemplateId; lel->user.token.object = object; #ifdef LOG_LOOKUP cerr << "found template id name" << endl; #endif return true; } return false; } bool Parser::isId( LangEl *lel, MapEl *mapEl ) { Object *object = mapEl->objectList.head; if ( object->type == Object::IdType ) { lel->type = TK_Identifier; lel->user.token.object = object; #ifdef LOG_LOOKUP cerr << "found id, with type: "; if ( object->objType != 0 ) object->objType->print( cerr ); else cerr << "(NULL)"; cerr << endl; #endif return true; } return false; } bool Parser::lookupInStack( LangEl *lel ) { Token &token = lel->user.token; #ifdef LOG_LOOKUP cerr << "lookupInStack " << token.data << " ... "; #endif for ( FrameIter frame = *this; frame.lte(); frame++ ) { for ( ChildIter ci( *frame ); ci.lte(); ci++ ) { /* Get the frame to lookup in. The frame may null in the case of inheriting * a type that is not completely defined. */ Object *lookupIn = *ci; if ( lookupIn == 0 ) continue; /* Do the lookup across all types. */ MapEl *mapEl = lookupIn->map.find( token.data ); if ( mapEl != 0 && mapEl->objectList.head != 0 ) { /* Namespace Name. */ if ( isNamespaceName( lel, mapEl ) ) return true; /* Typedef Name. */ if ( isTypedefName( lel, mapEl ) ) return true; /* Enum Name. */ if ( isEnumName( lel, mapEl ) ) return true; /* Class Name. */ if ( isClassName( lel, mapEl ) ) return true; /* Template Class Name. */ if ( isTemplateClassName( lel, mapEl ) ) return true; /* Template Id. */ if ( isTemplateId( lel, mapEl ) ) return true; /* Id. */ if ( isId( lel, mapEl ) ) return true; } } } #ifdef LOG_LOOKUP cerr << "not found, setting to TK_UnknownId" << endl; #endif lel->type = TK_UnknownId; lel->user.token.object = 0; return false; } bool Parser::lookupQualified( LangEl *lel ) { Token &token = lel->user.token; Object *frame = qualNs.top(); if ( frame == 0 ) frame = rootNamespace; #ifdef LOG_LOOKUP cerr << "lookupQualified " << token.data << " ... "; #endif for ( ChildIter ci( frame ); ci.lte(); ci++ ) { /* Get the frame to lookup in. The frame may null in the case of * inheriting a type that is not completely defined. */ Object *lookupIn = *ci; if ( lookupIn == 0 ) continue; /* If we are looking inside a class, first check if it is the actual * class that we are interested in. */ if ( lookupIn->type == Object::ClassType ) { if ( lookupIn->data != 0 && strcmp( token.data, lookupIn->data ) == 0 ) { lel->type = TK_ClassName; lel->user.token.object = lookupIn; #ifdef LOG_LOOKUP cerr << "found class name" << endl; #endif return true; } } /* If we are looking inside a template class, first check if it is the * actual class that we are interested in. */ if ( lookupIn->type == Object::TemplateClassType ) { if ( strcmp( token.data, lookupIn->data ) == 0 ) { lel->type = TK_TemplClassName; lel->user.token.object = lookupIn; #ifdef LOG_LOOKUP cerr << "found template class name" << endl; #endif return true; } } /* Do the lookup across all types. */ MapEl *mapEl = lookupIn->map.find( token.data ); if ( mapEl != 0 && mapEl->objectList.head != 0 ) { /* Namespace Name. */ if ( isNamespaceName( lel, mapEl ) ) return true; /* Typedef Name. */ if ( isTypedefName( lel, mapEl ) ) return true; /* Enum Name. */ if ( isEnumName( lel, mapEl ) ) return true; /* Class Name. */ if ( isClassName( lel, mapEl ) ) return true; /* Template Class Name. */ if ( isTemplateClassName( lel, mapEl ) ) return true; /* Template Id. */ if ( isTemplateId( lel, mapEl ) ) return true; /* Id. */ if ( isId( lel, mapEl ) ) return true; } } #ifdef LOG_LOOKUP cerr << "not found, setting to TK_UnknownId" << endl; #endif lel->type = TK_UnknownId; lel->user.token.object = 0; return false; } void Parser::writeToken( LangEl *lel ) { Token &token = lel->user.token; if ( token.leader != 0 ) out << token.leader; if ( preToken.length > 0 ) { out.write( preToken.data, preToken.length ); preToken.clear(); } int type = token.outType != 0 ? token.outType : lel->type; switch ( type ) { case KW_Asm: out << "asm"; break; case KW_Auto: out << "auto"; break; case KW_Bool: out << "bool"; break; case KW_Break: out << "break"; break; case KW_Case: out << "case"; break; case KW_Catch: out << "catch"; break; case KW_Char: out << "char"; break; case KW_Class: out << "class"; break; case KW_Const: out << "const"; break; case KW_ConstCast: out << "const_cast"; break; case KW_Continue: out << "continue"; break; case KW_Default: out << "default"; break; case KW_Delete: out << "delete"; break; case KW_Do: out << "do"; break; case KW_Double: out << "double"; break; case KW_DynamicCast: out << "dynamic_cast"; break; case KW_Else: out << "else"; break; case KW_Enum: out << "enum"; break; case KW_Explicit: out << "explicit"; break; case KW_Export: out << "export"; break; case KW_Extern: out << "extern"; break; case KW_False: out << "false"; break; case KW_Float: out << "float"; break; case KW_For: out << "for"; break; case KW_Friend: out << "friend"; break; case KW_Goto: out << "goto"; break; case KW_If: out << "if"; break; case KW_Inline: out << "inline"; break; case KW_Int: out << "int"; break; case KW_Long: out << "long"; break; case KW_Mutable: out << "mutable"; break; case KW_Namespace: out << "namespace"; break; case KW_New: out << "new"; break; case KW_Operator: out << "operator"; break; case KW_Private: out << "private"; break; case KW_Protected: out << "protected"; break; case KW_Public: out << "public"; break; case KW_Register: out << "register"; break; case KW_ReinterpretCast: out << "reinterpret_cast"; break; case KW_Return: out << "return"; break; case KW_Short: out << "short"; break; case KW_Signed: out << "signed"; break; case KW_Sizeof: out << "sizeof"; break; case KW_Static: out << "static"; break; case KW_StaticCast: out << "static_cast"; break; case KW_Struct: out << "struct"; break; case KW_Switch: out << "switch"; break; case KW_Template: out << "template"; break; case KW_This: out << "this"; break; case KW_Throw: out << "throw"; break; case KW_True: out << "true"; break; case KW_Try: out << "try"; break; case KW_Typedef: out << "typedef"; break; case KW_Typeid: out << "typeid"; break; case KW_Typename: out << "typename"; break; case KW_Union: out << "union"; break; case KW_Unsigned: out << "unsigned"; break; case KW_Using: out << "using"; break; case KW_Virtual: out << "virtual"; break; case KW_Void: out << "void"; break; case KW_Volatile: out << "volatile"; break; case KW_WcharT: out << "wchar_t"; break; case KW_While: out << "while"; break; case KW_Typeof: out << "typeof"; break; case KW_Restrict: out << "restrict"; break; case TK_Arrow: out << "->"; break; case TK_PlusPlus: out << "++"; break; case TK_MinusMinus: out << "--"; break; case TK_ArrowStar: out << "->*"; break; case TK_DotStar: out << ".*"; break; case TK_EqualsEquals: out << "=="; break; case TK_NotEquals: out << "!="; break; case TK_AndAnd: out << "&&"; break; case TK_OrOr: out << "||"; break; case TK_MultAssign: out << "*="; break; case TK_DivAssign: out << "/="; break; case TK_PercentAssign: out << "%="; break; case TK_PlusAssign: out << "+="; break; case TK_MinusAssign: out << "-="; break; case TK_AmpAssign: out << "&="; break; case TK_CaretAssign: out << "^="; break; case TK_BarAssign: out << "|="; break; case TK_ShiftLeftAssign: out << "<<="; break; case TK_ShiftRightAssign: out << ">>="; break; case TK_DotDotDot: out << "..."; break; case TK_NameSep: out << "::"; break; case TK_ClassName: out << "[cn " << token.data << "]"; break; case TK_TemplClassName: out << "[tc " << token.data << "]"; break; case TK_NamespaceName: out << "[nn " << token.data << "]"; break; case TK_TypedefName: out << "[td " << token.data << "]"; break; case TK_EnumName: out << "[en " << token.data << "]"; break; case TK_Identifier: out << "[id " << token.data << "]"; break; case TK_TemplateId: out << "[ti " << token.data << "]"; break; case TK_DeclaratorId: out << "[di " << token.data << "]"; break; case TK_ParameterOpen: out << "({"; break; case TK_ParameterClose: out << "})"; break; case TK_DeclaratorOpen: out << "(|"; break; case TK_DeclaratorClose: out << "|)"; break; case TK_TemplArgOpen: out << "<|"; break; case TK_TemplArgClose: out << "|>"; break; case TK_TemplParamOpen: out << "<{"; break; case TK_TemplParamClose: out << "}>"; break; #if 0 case TK_PointerAmp: out << "<&>"; break; case TK_PointerStar: out << "<*>"; break; case TK_BitfieldColon: out << ":/"; break; case TK_BaseClauseColon: out << ":+"; break; case TK_CtorColon: out << ":-"; break; case TK_LabelColon: out << ":~"; break; case TK_CondExprColon: out << ":|"; break; #endif case TK_Integer: case TK_DoubleLit: case TK_SingleLit: case TK_Float: case TK_IntegerOctal: case TK_IntegerDecimal: case TK_IntegerHex: case TK_UnknownId: cout << token.data; break; default: if ( type <= 128 ) { switch ( lel->type ) { case '[': out << "[["; break; case ']': out << "]]"; break; default: out << (char) lel->type; break; } } break; } } int Parser::parseToken( int tok, bool qual, char *data, char *leader ) { Token token; token.outType = 0; token.data = data; token.leader = leader; token.qual = qual; return parseLangEl( tok, &token ); } void makeTypeList( TypeList &typeList, Parser_Lel_template_argument *last ) { int length = 0; Parser_Lel_template_argument *argument = last; while ( argument != 0 ) { length += 1; argument = argument->prev; } typeList.setAsNew( length ); argument = last; for ( int pos = length-1; pos >= 0; pos--, argument = argument->prev ) typeList[pos] = argument->type; } kelbt-0.15/cxxprep/names.cpp0000664000175000017500000001270211072514631016402 0ustar thurstonthurston/* * Copyright 2004, 2005 Adrian Thurston */ /* This file is part of C++ Pre-Parser. * * C++ Pre-Parser is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * C++ Pre-Parser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with C++ Pre-Parser; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "names.h" #include "parser.h" #include using namespace std; ostream &indent( int in ) { while ( in-- > 0 ) cerr << " "; return cerr; } void ChildIter::operator++(int) { child = frame->nsChildren; while ( child.lte() ) { /* A node may have an non Object type as a base type. */ if ( *child != 0 ) { stack.push( child ); frame = *child; return; } again: child.increment(); } if ( stack.stack.length() > 0 ) { child = stack.pop(); goto again; } atEnd = true; } void Buffer::empty() { if ( data != 0 ) { free( data ); data = 0; length = 0; allocated = 0; } } void Buffer::upAllocate( int len ) { if ( data == 0 ) data = (char*) malloc( len ); else data = (char*) realloc( data, len ); allocated = len; } #define SA_BLOCK_SIZE 262144 /* Length does not include null terminator. */ char *StrAlloc::allocate( const char *data, int len ) { if ( block == 0 || pos+len+1 > SA_BLOCK_SIZE ) { block = new char [SA_BLOCK_SIZE]; pos = 0; } /* Copy the data in, null terminate it, get a ptr to the return val and * then advance the position over the data. */ memcpy( block+pos, data, len ); block[pos+len] = 0; char *rtnVal = block + pos; pos += len + 1; return rtnVal; } std::ostream &Type::print( std::ostream &out ) { switch ( type ) { case BuiltinType: if ( sign == Unsigned ) out << "un"; out << "signed "; switch ( keyType ) { case Long: out << "long"; break; case Int: out << "int"; break; case Short: out << "short"; break; case Char: out << "char"; break; case Wchar_t: out << "wchar_t"; break; case Bool: out << "bool"; break; case Float: out << "float"; break; case Double: out << "double"; break; case Void: out << "void"; break; default: break; } break; case ObjectType: out << "object: " << object << " "; switch ( object->type ) { case Object::ClassType: out << "class "; break; case Object::TemplateClassType: out << "template class "; break; case Object::EnumType: out << "enum "; break; default: out << "OTHER "; break; } out << (object->data != 0 ? object->data : "(NULL)" ); break; case TemplParamType: out << "template param"; break; case UnknownType: out << "unknown type"; break; } return out; } std::ostream &TypeList::print( std::ostream &out ) { for ( Iter pt = first(); pt.lte(); pt++ ) { if ( *pt == 0 ) out << " 0" << endl; else { out << " "; (*pt)->print( out ) << endl; } } return out; } bool Parser::typeListsMatch( Object *baseNs, TypeList *specList, TypeList *argList ) { if ( specList->length() != argList->length() ) return false; for ( TypeList::Iter sli = *specList, ali = *argList; sli.lte(); sli++, ali++ ) { if ( *sli != templParamType && *sli != *ali ) return false; } return true; } int Parser::numTemplParams( TypeList *typeList ) { int numTemplParams = 0; for ( TypeList::Iter tli = *typeList; tli.lte(); tli++ ) { if ( *tli == templParamType ) numTemplParams += 1; } return numTemplParams; } void Parser::clearLessSpecific( Vector &matched, TypeList *typeList ) { for ( int ri = 0; ri < matched.length(); ) { if ( numTemplParams( typeList ) < numTemplParams( &matched[ri]->key ) ) matched.remove( ri ); else ri += 1; } } Object *Parser::findSpecCovers( Object *baseNs, TypeList *typeList ) { Vector matched; for ( TypeListMap::Iter tli = baseNs->typeListMap; tli.lte(); tli++ ) { if ( typeListsMatch( baseNs, &tli->key, typeList ) ) { clearLessSpecific( matched, &tli->key ); matched.append( tli ); } } /* FIXME: if results contains more than one item we simply return the * first. Really our callers should be dealing with the error. */ if ( matched.length() > 0 ) return matched[0]->value; return 0; } Type *Parser::reduceType( Type *type ) { if ( type->type == Type::TemplParamType ) return templParamType; else if ( type->type == Type::UnknownType ) return unknownType; else { TypeMapEl *result = typeMap.find( type ); if ( result != 0 ) return result->key; else { Type *newType = new Type( *type ); typeMap.insert( newType ); return newType; } } } Type *Parser::newType( Type::Property prop ) { Type newType; newType.type = Type::BuiltinType; if ( Type::isSign( prop ) ) { newType.sign = prop; newType.keyType = Type::Int; } else { newType.sign = Type::Signed; newType.keyType = prop; } newType.object = 0; return reduceType( &newType ); } Type *Parser::addInProp( Type *type, Type::Property prop ) { Type newType = *type; if ( Type::isSign( prop ) ) newType.sign = prop; else newType.keyType = prop; return reduceType( &newType ); } kelbt-0.15/cxxprep/filtarg0000775000175000017500000000043510572350155016154 0ustar thurstonthurston#!/bin/bash pn=`dirname $0` for arg; do newArg=`echo "$arg" | sed ' s/^-W[-\/,.a-zA-Z_0-9]*//g s/^-c//g s/^-g//g s/^-pipe//g s/^-pthread//g s/^-pedantic//g s/^-f[a-zA-Z0-9-]*//g '` filtArgs="$filtArgs $newArg" done echo echo $filtArgs echo $pn/cxxprep $filtArgs kelbt-0.15/cxxprep/scanner.h0000664000175000017500000000252711072514631016401 0ustar thurstonthurston/* * Copyright 2004, 2005 Adrian Thurston */ /* This file is part of C++ Pre-Parser. * * C++ Pre-Parser is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * C++ Pre-Parser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with C++ Pre-Parser; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _SCANNER_H #define _SCANNER_H #include #include "bstset.h" #include "parser.h" extern BstSet ignoreKeys; struct Scanner { Scanner( std::ostream &out, char *inputFile ) : out(out), line(0), parser(out) { } std::ostream &out; int line; Parser parser; StrAlloc strAlloc; Buffer leaderBuf; void token( int tok, bool qual = false ); void finish(); int cs, act; char *tokstart, *tokend; void init(); int execute( char *, int len ); }; #endif /* _SCANNER_H */ kelbt-0.15/cxxprep/undo.lex0000664000175000017500000000416511072514631016256 0ustar thurstonthurston/* * Copyright 2004, 2005 Adrian Thurston */ /* This file is part of C++ Pre-Parser. * * C++ Pre-Parser is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * C++ Pre-Parser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with C++ Pre-Parser; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ %{ #include #include %} %% /* Find directives to pass through */ \/\*\ CXXPREP\ #.*\*\/ { yytext[ strlen(yytext)-2 ] = 0; fputs( yytext+11, stdout ); } \[di\ [^\]]*\] { yytext[ strlen(yytext)-1 ] = 0; fputs( yytext+4, stdout ); } \[cn\ [^\]]*\] { yytext[ strlen(yytext)-1 ] = 0; fputs( yytext+4, stdout ); } \[en\ [^\]]*\] { yytext[ strlen(yytext)-1 ] = 0; fputs( yytext+4, stdout ); } \[nn\ [^\]]*\] { yytext[ strlen(yytext)-1 ] = 0; fputs( yytext+4, stdout ); } /* Pass comments and literals throuh. */ \/\/.*\n fputs( yytext, stdout ); \/\*.*\*\/ fputs( yytext, stdout ); '([^'\\\n]|\\.)*' fputs( yytext, stdout ); \"([^"\\\n]|\\.)*\" fputs( yytext, stdout ); \$ /* Ignore */ /* Catch the qualifier sep so we don't make a mistake on C::~C(); */ "::" fputs( "::", stdout ); "[[" putchar( '[' ); "]]" putchar( ']' ); "({" putchar( '(' ); "})" putchar( ')' ); "(|" putchar( '(' ); "|)" putchar( ')' ); "<{" putchar( '<' ); "}>" putchar( '>' ); "<|" putchar( '<' ); "|>" putchar( '>' ); "<&>" putchar( '&' ); "<*>" putchar( '*' ); ":/" putchar( ':' ); ":+" putchar( ':' ); ":-" putchar( ':' ); ":~" putchar( ':' ); ":|" putchar( ':' ); %% int yywrap() { /* Once processessing of the input is done, no more. */ return 1; } int main() { yylex(); return 0; }; kelbt-0.15/cxxprep/scanner.rl0000664000175000017500000001330511072514631016563 0ustar thurstonthurston/* * Copyright 2004, 2005 Adrian Thurston */ /* This file is part of C++ Pre-Parser. * * C++ Pre-Parser is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * C++ Pre-Parser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with C++ Pre-Parser; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "scanner.h" using std::cout; using std::cerr; using std::endl; class Perfect_Hash { private: static inline unsigned int hash (const char *str, unsigned int len); public: static struct Keyword *in_word_set (const char *str, unsigned int len); }; %%{ machine Scanner; action line_inc { line += 1; } # Floating literals. fract_const = digit* '.' digit+ | digit+ '.'; exponent = [eE] [+\-]? digit+; float_suffix = [flFL]; main := |* # Single and double literals. ( 'L'? "'" ( [^'\\\n] | /\\./ )* "'" ) => { token( TK_SingleLit ); }; ( 'L'? '"' ( [^"\\\n] | /\\./ )* '"' ) => { token( TK_DoubleLit ); }; # Identifiers ( [a-zA-Z_] [a-zA-Z0-9_]* ) => { token( TK_Lookup ); }; # # Qualified Identifiers # ( '::' [a-zA-Z_] [a-zA-Z0-9_]* ) => { token( TK_NameSep ); /* It is okay to modify tokstart (but never tokend). */ tokstart += 2; token( TK_Lookup, true ); }; ( '::' '~' [a-zA-Z_] [a-zA-Z0-9_]* ) => { token( TK_NameSep ); token( '~' ); /* It is okay to modify tokstart (but never tokend). */ tokstart += 3; token( TK_Lookup, true ); }; ( '->' [a-zA-Z_] [a-zA-Z0-9_]* ) => { token( TK_Arrow ); /* It is okay to modify tokstart (but never tokend). */ tokstart += 2; token( TK_Lookup, true ); }; ( '.' [a-zA-Z_] [a-zA-Z0-9_]* ) => { token( '.' ); /* It is okay to modify tokstart (but never tokend). */ tokstart += 1; token( TK_Lookup, true ); }; # Floats. ( fract_const exponent? float_suffix? | digit+ exponent float_suffix? ) => { token( TK_Float ); }; # Integer decimal. Leading part buffered by float. ( ( '0' | [1-9] [0-9]* ) [ulUL]{0,3} ) => { token( TK_IntegerDecimal ); }; # Integer octal. Leading part buffered by float. ( '0' [0-9]+ [ulUL]{0,2} ) => { token( TK_IntegerOctal ); }; # Integer hex. Leading 0 buffered by float. ( '0x' [0-9a-fA-F]+ [ulUL]{0,2} ) => { token( TK_IntegerHex ); }; # Only buffer the second item, first buffered by symbol. */ '::' => { token( TK_NameSep ); }; '==' => { token( TK_EqualsEquals ); }; '!=' => { token( TK_NotEquals ); }; '&&' => { token( TK_AndAnd ); }; '||' => { token( TK_OrOr ); }; '*=' => { token( TK_MultAssign ); }; '/=' => { token( TK_DivAssign ); }; '%=' => { token( TK_PercentAssign ); }; '+=' => { token( TK_PlusAssign ); }; '-=' => { token( TK_MinusAssign ); }; '&=' => { token( TK_AmpAssign ); }; '^=' => { token( TK_CaretAssign ); }; '|=' => { token( TK_BarAssign ); }; '++' => { token( TK_PlusPlus ); }; '--' => { token( TK_MinusMinus ); }; '->' => { token( TK_Arrow ); }; '->*' => { token( TK_ArrowStar ); }; '.*' => { token( TK_DotStar ); }; '...' => { token( TK_DotDotDot ); }; # Single char symbols. ( punct - [#_"'{}] ) => { token( *tokstart ); }; # Handling the curly blocks in the scanner rather than lookup is dependent # on the token sequence being flushed out to the parser immediately upon # seeing '{' so that the parser can decide if we ignore the block. # Curly Open. '{' => { token( '{' ); }; # Curly close. '}' => { token( '}' ); }; # Preprocessor line. '#' [^\n]* '\n' => { line++; }; action leader { leaderBuf.append( tokstart, tokend-tokstart ); } # Comments and whitespace. ( '/*' (any | '\n' @line_inc)* :>> '*/' ) => leader; ( '//' any* :> '\n' @line_inc ) => leader; ( any - 10 - 33..126 )+ => leader; # Newline handling. '\n' => { /* Process the newline first. */ line++; leaderBuf.append( '\n' ); }; *|; }%% %% write data; void Scanner::init() { %% write init; line = 1; parser.init(); } int Scanner::execute( char *data, int len ) { char *p = data; char *pe = data + len; %% write exec; if ( cs == Scanner_error ) return -1; else if ( cs >= Scanner_first_final ) return 1; return 0; } void Scanner::token( int tok, bool qual ) { int len = tokend - tokstart; /* Translate keywords. */ if ( tok == TK_Lookup ) { Keyword *key = Perfect_Hash::in_word_set( tokstart, len ); if ( key != 0 ) tok = key->id; } #ifdef LOG_TOKENS cerr << "token: line: " << line << " id: " << tok << " data: "; cerr.write( tokstart, len ); cerr << " -> sending to parser" << endl; #endif char *data = 0; switch ( tok ) { case TK_Lookup: case TK_Integer: case TK_DoubleLit: case TK_SingleLit: case TK_Float: case TK_IntegerOctal: case TK_IntegerDecimal: case TK_IntegerHex: data = strAlloc.allocate( tokstart, len ); break; } char *leader = 0; if ( leaderBuf.length > 0 ) { leader = strAlloc.allocate( leaderBuf.data, leaderBuf.length ); leaderBuf.clear(); } int res = parser.parseToken( tok, qual, data, leader ); if ( res < 0 ) exit(1); } void Scanner::finish() { char eofChar = 0; execute( &eofChar, 1 ); /* Send the eof char to the parser. */ parser.parseToken( _eof, false, 0, 0 ); int result = parser.errCount; if ( result == 0 && leaderBuf.length > 0 ) cout.write( leaderBuf.data, leaderBuf.length ); } kelbt-0.15/cxxprep/examples/0000775000175000017500000000000011707046233016412 5ustar thurstonthurstonkelbt-0.15/cxxprep/examples/templid.cpp0000664000175000017500000000102610572350155020553 0ustar thurstonthurston/* * TXL is able to parse the first function call correctly because f < int * fails as a relational expression, however f < C succeeds as a relational * expression and so the entire expression gets incorrectly parsed as the * relational expression f < C > ( 1 ). To parse the statement correctly the * parser needs to know that f is a template id and that we should immediately * be trying to parse a template argument list. */ class C { }; template void f(int) { } int main() { f(1); f(1); return 0; } kelbt-0.15/cxxprep/test/0000775000175000017500000000000011707046233015553 5ustar thurstonthurstonkelbt-0.15/cxxprep/test/input17.cpp0000664000175000017500000000044010572350155017564 0ustar thurstonthurston int f( ... ); int f( int a ... ); int f( int a, ... ); int f( int(1) ); class C; C c(hello + 1); class D { void ((*d))(int i = 0, C &); }; template class F; int main() { void (*d)(int i = 0, C &); } template< template > class, class> class G; kelbt-0.15/cxxprep/test/output23.cpp0000664000175000017500000000035210572350155017764 0ustar thurstonthurston template <{class T}> struct [cn C] {}; struct [cn C]<|char|> { struct [cn D] { int $[di i]; }; }; typedef char $[di Char]; typedef [cn C]<|[cn Char]|> $[di Cchar]; int $[di main]({}) { [cn Cchar]::[cn D] $[di d]; return 0; } kelbt-0.15/cxxprep/test/output12.cpp0000664000175000017500000000044110572350155017761 0ustar thurstonthurston class [cn C] { }; namespace [nn ns] {} template <{class T}> class [cn CT] {}; int $[di main]({int $[di argc], char $<*>[di argv][[]]}) { C:~ int $[di i] = int(1); id:~ ns:~ case "hello":~ int $[di i] = int(1); case 1 + 2:~ int $[di i] = int(1); case a[[b]]:~ int $[di i] = int(1); } kelbt-0.15/cxxprep/test/input25.cpp0000664000175000017500000000042010572350155017561 0ustar thurstonthurstonnamespace ns1 { template struct C { struct D; static int f( int ) { return 0; } }; } namespace ns2 { struct E { E( int ) {} }; } ns2::E g( ns1::C< ns2::E >::f(1) ); ns2::E h( ns1::C< ns2::E >::D ); kelbt-0.15/cxxprep/test/output03.cpp0000664000175000017500000000071210572350155017762 0ustar thurstonthurston class [cn F] { struct [cn FH]{}; }; template <{class T}> class [cn TC] {}; class [cn C] { $~[di C]({float $[di f]}); $[di C]({int $[di i], int $<*>[di j]}); $[cn C]::~[di C]({}); $::[cn C]::~[di C]({}); $::~[di F]({}); // ~F(); $[di i]; void $[di func]({}) { ~[cn C](); ~[cn F](); ~G(); ::~[cn C](); ::~[cn F](); ::~[cn TC]<|int|>(); [cn F]::~[cn FH](); ~G(); ~[cn F]; ~::G; ::~[cn F]; ~G; } }; void $[di main]({}) { } kelbt-0.15/cxxprep/test/input11.cpp0000664000175000017500000000032210572350155017555 0ustar thurstonthurston struct C { struct B { int i; }; struct D : public B { int i;}; }; int main(int argc, char *argv[]) { ::C::D *p = new C::D; p->B::D::FOOBAR::i = 1; p.BB::SLDFJ = 3; int i = cout << p->B::i << endl; } kelbt-0.15/cxxprep/test/input10.cpp0000664000175000017500000000041210572350155017554 0ustar thurstonthurston class C { }; void main(int argc, char *argv[]) { C (*foo)(int); C(foo, bar)(int(1)); int i = sizeof( int() ); C (*foo); int i = int(1); int i = (int)(1); int i = (int*)(1); int i = (int())(1); int i = 1 + 2 + int(1*3) + typeid(int (a)*1*int((*a),1)); } kelbt-0.15/cxxprep/test/input06.cpp0000664000175000017500000000034610572350155017567 0ustar thurstonthurston class C { class S { }; template class Tmpl { class I {}; }; }; ::C::Tmpl<22.2--> foo; ::C::Tmpl<++static_cast(new C::Tmpl(foo))--> foo; C::Tmpl<::C::Tmplfoob(1.1)>> foo; int main() { } kelbt-0.15/cxxprep/test/output22.cpp0000664000175000017500000000060410572350155017763 0ustar thurstonthurston template <{class T, class U, class V}> struct [cn C] { struct [cn D] { static int $[di i]; }; }; template <{class T, class U}> struct [cn C]<|[cn T],[cn U],int|> { struct [cn E] { static int $[di i]; }; }; template <{class T}> struct [cn C]<|[cn T],int,int|> { struct [cn F] { static int $[di i]; }; }; int $[di main]({}) { [cn C]<|int,int,int|>::[cn F] $[di foo]; return 0; } kelbt-0.15/cxxprep/test/input23.cpp0000664000175000017500000000024110572350155017560 0ustar thurstonthurston template struct C {}; struct C { struct D { int i; }; }; typedef char Char; typedef C Cchar; int main() { Cchar::D d; return 0; } kelbt-0.15/cxxprep/test/input03.cpp0000664000175000017500000000045310572350155017563 0ustar thurstonthurston class F { struct FH{}; }; template class TC {}; class C { ~C(float f); C(int i, int *j); C::~C(); ::C::~C(); // ::~F(); // ~F(); i; void func() { ~C(); ~F(); ~G(); ::~C(); ::~F(); ::~TC(); F::~FH(); ~G(); ~F; ~::G; ::~F; ~G; } }; void main() { } kelbt-0.15/cxxprep/test/input21.cpp0000664000175000017500000000101410572350155017555 0ustar thurstonthurston template struct C { struct D { static int i; }; }; template struct C { struct E { static int i; }; }; template struct C { struct F { static int i; }; }; struct C { struct G { static int i; }; }; template int C::D::i = 0; template int C::E::i = 0; template int C::F::i = 0; int C::G::i = 0; int main() { return 0; } kelbt-0.15/cxxprep/test/input01.cpp0000664000175000017500000000250410572350155017560 0ustar thurstonthurstonnamespace ns { namespace ns { } class c1 { class c2 { }; template static int i, ns::k; int j; }; c1::c2 id; namespace ns2 { } } namespace ns { namespace ns2 { class C {} name; } } template class C { }; template class D { template static int l; class F {}; }; class Arg{}; int ns::c1::i; ::C< Arg> foo; ns::ns2::C D::*const *&::C::*i, *const v; template static int m; D::F fi; int D::l; int *(*foo); int foo()(); unsigned long int ::C::bar; unsigned long int ::ns::ns2::C::b; class{int(*sd)()()[];}; template class F{}; template void foo(int *); template void doo(int &*const b); namespace N { template class G {}; template void bar(); } class N::G { public: int i; }; class N::D_HiddenInN { public: int i; }; void f( int (*)(N::D_HiddenInN i, int, char c) ); void f( int (*d)(N::D_HiddenInN i, int, char c) ); int int; static g; class F {}; class I {}; class H { H (void*, H (*)); inline H (H H); inline H (int H); ::H (*f); inline static void H::H(); const i; inline e(H H, const i); class G { class I { class N {}; class C {}; }; }; }; H::H(); class I { }; H (*I)()()(); H::H(int); N::D_HiddenInN d_hidden; kelbt-0.15/cxxprep/test/input15.cpp0000664000175000017500000000024010572350155017560 0ustar thurstonthurston class C; class C::D; class C { D foo(); }; int main() { class D; C *c(int i); D *d(); int i = foo->C::poo( a[22][233]++ - ~11 || a ? c.hi(1-1):33); } kelbt-0.15/cxxprep/test/input04.cpp0000664000175000017500000000013310572350155017557 0ustar thurstonthurston void main(int argc, char *argv[]) { int i = --helloNed(1.1, i, i++); + ++foobar++(); } kelbt-0.15/cxxprep/test/output01.cpp0000664000175000017500000000410410572350155017757 0ustar thurstonthurstonnamespace [nn ns] { namespace [nn ns] { } class [cn c1] { class [cn c2] { }; template <{class}> static int $[di i], $[nn ns]::[di k]; int $[di j]; }; [cn c1]::[cn c2] $[di id]; namespace [nn ns2] { } } namespace [nn ns] { namespace [nn ns2] { class [cn C] {} $[di name]; } } template <{class, class A}> class [cn C] { }; template <{class, class A}> class [cn D] { template <{class}> static int $[di l]; class [cn F] {}; }; class [cn Arg]{}; int $[nn ns]::[cn c1]::[di i]<|[cn Arg]|>; ::[cn C]<| [cn Arg]|> $[di foo]; [nn ns]::[nn ns2]::[cn C] $[cn D]<|[cn Arg]|>::<*>const <*><&>::[cn C]<|[cn Arg]|>::<*>[di i], $<*>const [di v]; template <{class}> static int $[di m]; [cn D]<|[cn Arg]|>::[cn F] $[di fi]; int $[cn D]<|[cn Arg]|>::[di l]<|[cn Arg]|>; int $<*>(|<*>[di foo]|); int $[di foo]({})({}); unsigned long int $::[cn C]<|[cn Arg]|>::[di bar]; unsigned long int $::[nn ns]::[nn ns2]::[cn C]::[di b]; class{int$(|<*>[di sd]|)({})({})[[]];}; template <{class [cn C]}> class [cn F]{}; template <{class}> void $[di foo]({int <*>}); template <{class}> void $[di doo]({int $<&><*>const [di b]}); namespace [nn N] { template <{class T}> class [cn G] {}; template <{class T}> void $[di bar]({}); } class [nn N]::[cn G]<|int <*>const<*><&>(|<*>(|<*>|)|)|> { public:~ int $[di i]; }; class [nn N]::[cn D_HiddenInN] { public:~ int $[di i]; }; void $[di f]({ int (|<*>|)({[nn N]::[cn D_HiddenInN] $[di i], int, char $[di c]}) }); void $[di f]({ int $(|<*>[di d]|)({[nn N]::[cn D_HiddenInN] $[di i], int, char $[di c]}) }); int int; static $[di g]; class [cn F] {}; class [cn I] {}; class [cn H] { $[di H] ({void<*>, [cn H] (|<*>|)}); inline $[di H] ({[cn H] $[di H]}); inline $[di H] ({int $[di H]}); ::[cn H] $(|<*>[di f]|); inline static void $[cn H]::[di H]({}); const $[di i]; inline $[di e]({[cn H] $[di H], const $[di i]}); class [cn G] { class [cn I] { class [cn N] {}; class [cn C] {}; }; }; }; $[cn H]::[di H]({}); class [cn I] { }; [cn H] $(|<*>[di I]|)({})({})({}); $[cn H]::[di H]({int}); [nn N]::[cn D_HiddenInN] $[di d_hidden]; kelbt-0.15/cxxprep/test/output15.cpp0000664000175000017500000000040210572350155017761 0ustar thurstonthurston class [cn C]; class [cn C]::[cn D]; class [cn C] { [cn D] $[di foo]({}); }; int $[di main]({}) { class [cn D]; [cn C] $<*>[di c]({int $[di i]}); [cn D] $<*>[di d]({}); int $[di i] = foo->[cn C]::poo( a[[22]][[233]]++ - ~11 || a ? c.hi(1-1):|33); } kelbt-0.15/cxxprep/test/output16.cpp0000664000175000017500000000025310572350155017766 0ustar thurstonthurston typedef int $[di T1]; [cn T1] $[di i]; class [cn C] { typedef int $[di T2]; [cn T2] $[di foo]; int $[di f]({}) { typedef int $[di T3]; [cn T3] $[di foo]; } }; kelbt-0.15/cxxprep/test/output17.cpp0000664000175000017500000000066210572350155017773 0ustar thurstonthurston int $[di f]({ ... }); int $[di f]({ int $[di a] ... }); int $[di f]({ int $[di a], ... }); int $[di f]( int(1) ); class [cn C]; [cn C] $[di c](hello + 1); class [cn D] { void $(|(|<*>[di d]|)|)({int $[di i] = 0, [cn C] <&>}); }; template <{class}> class [cn F]; int $[di main]({}) { void $(|<*>[di d]|)({int $[di i] = 0, [cn C] <&>}); } template<{ template <{class T = [cn F]<| (1+2) |>}> class, class}> class [cn G]; kelbt-0.15/cxxprep/test/input26.cpp0000664000175000017500000000012710572350155017566 0ustar thurstonthurston class C { class C { C() {} }; }; int main() { i = C::C(); } kelbt-0.15/cxxprep/test/input20.cpp0000664000175000017500000000025110572350155017556 0ustar thurstonthurston struct C { char doit() { return 'c'; } }; template T g(C*c) { return (c->*f)(); } int main() { C c; g(&c); return 0; } kelbt-0.15/cxxprep/test/input19.cpp0000664000175000017500000000040410572350155017566 0ustar thurstonthurston class G; class H {}; template class I; template class J {}; template class I { }; template void foo(); template void bar() { } int main() { foo(hi); bar(hi); kar < new int*[22]; } kelbt-0.15/cxxprep/test/input12.cpp0000664000175000017500000000033010572350155017555 0ustar thurstonthurston class C { }; namespace ns {} template class CT {}; int main(int argc, char *argv[]) { C: int i = int(1); id: ns: case "hello": int i = int(1); case 1 + 2: int i = int(1); case a[b]: int i = int(1); } kelbt-0.15/cxxprep/test/input13.cpp0000664000175000017500000000025110572350155017560 0ustar thurstonthurston class C { }; namespace ns {} template class CT {}; class string{}; int main(int argc, char *argv[]) { for ( int (*i)(int K) = 1 ; i < 2 ; i(33)++) { } } kelbt-0.15/cxxprep/test/output11.cpp0000664000175000017500000000050610572350155017762 0ustar thurstonthurston struct [cn C] { struct [cn B] { int $[di i]; }; struct [cn D] :+ public [cn B] { int $[di i];}; }; int $[di main]({int $[di argc], char $<*>[di argv][[]]}) { ::[cn C]::[cn D] $<*>[di p] = new [cn C]::[cn D]; p->[cn B]::[cn D]::[cn FOOBAR]::i = 1; p.[cn BB]::SLDFJ = 3; int $[di i] = cout << p->[cn B]::i << endl; } kelbt-0.15/cxxprep/test/output07.cpp0000664000175000017500000000026210572350155017766 0ustar thurstonthurston class [cn C]{}; void $[di main]({int $[di argc], char $<*>[di argv][[]]}) { // sdflkj i*2.3 /**/ / f / /**/ 2.2; (new [cn C]<*><*><*>) * 2.2; (new [cn C]<*><*><*>)*2.2; } kelbt-0.15/cxxprep/test/output02.cpp0000664000175000017500000000141510572350155017762 0ustar thurstonthurston template <{class T}> class [cn C] { }; class [cn C]<|int|>; class [cn C]<|int|> { }; void $[di f]({ int $(|<*>[di f]|)[[2]]({int}) }); class [cn D] { [cn D] $<*>[di foo]; }; struct [cn E] { class [cn D] { void $[di e]({[cn E] $[di i]}); $[di D]({int $[di i]}); $[di D]({[cn D] $[di i]}); $[di D]({[cn D] $[di D]}); $~[di D]({}); virtual $~[di D]({}); // template class C; class [cn C]<|int <*>|> { $[cn E]::[di alsdfj]; }; class [cn D] {}; class [cn F] { $[cn E]::[cn D]::[cn F]::[di F]({int $[di i], const [cn F] $<*>[di k]}); }; }; void $[di length]({}) const {} }; class [cn Base] { public:~ virtual void $[di foo]({}); }; class [cn SubClass] { }; int $[di main]({}) { foo = [cn E]::[cn D](bar); bar = foo(88.8); } kelbt-0.15/cxxprep/test/input18.cpp0000664000175000017500000000041510572350155017567 0ustar thurstonthurston class C { }; template class D { }; typedef int I; typedef int ((*T))(int, char (*)(int)); class C; C c; I i; T t; namespace NS { using C; using D; using T; }; NS::T i = unsigned int(77) + NS::T(44) - NS::D<1>(a + b < c); void f () { class G; } kelbt-0.15/cxxprep/test/input27.cpp0000664000175000017500000000006210572350155017565 0ustar thurstonthurstonclass C; int main() { C( (hello || 1), 2 ); } kelbt-0.15/cxxprep/test/output13.cpp0000664000175000017500000000035110572350155017762 0ustar thurstonthurston class [cn C] { }; namespace [nn ns] {} template <{class T}> class [cn CT] {}; class [cn string]{}; int $[di main]({int $[di argc], char $<*>[di argv][[]]}) { for ( int $(|<*>[di i]|)({int $[di K]}) = 1 ; i < 2 ; i(33)++) { } } kelbt-0.15/cxxprep/test/output09.cpp0000664000175000017500000000030710572350155017770 0ustar thurstonthurston void $[di main]({int $[di argc], char $<*>[di argv][[]]}) { i = 0 + 1u + 10lL + 111Lu; o = 00 + 0123 + 01lL * 0LL; h = 0x33ABCDEFabcdefll + 0x0 + 0x0ll / 0x0UL; b = true - +(+false) * true++; } kelbt-0.15/cxxprep/test/input22.cpp0000664000175000017500000000044110572350155017561 0ustar thurstonthurston template struct C { struct D { static int i; }; }; template struct C { struct E { static int i; }; }; template struct C { struct F { static int i; }; }; int main() { C::F foo; return 0; } kelbt-0.15/cxxprep/test/output04.cpp0000664000175000017500000000017110572350155017762 0ustar thurstonthurston void $[di main]({int $[di argc], char $<*>[di argv][[]]}) { int $[di i] = --helloNed(1.1, i, i++); + ++foobar++(); } kelbt-0.15/cxxprep/test/output10.cpp0000664000175000017500000000056210572350155017763 0ustar thurstonthurston class [cn C] { }; void $[di main]({int $[di argc], char $<*>[di argv][[]]}) { [cn C] $(|<*>[di foo]|)({int}); [cn C](foo, bar)(int(1)); int $[di i] = sizeof( int() ); [cn C] $(|<*>[di foo]|); int $[di i] = int(1); int $[di i] = (int)(1); int $[di i] = (int<*>)(1); int $[di i] = (int())(1); int $[di i] = 1 + 2 + int(1*3) + typeid(int (a)*1*int((*a),1)); } kelbt-0.15/cxxprep/test/run-tests0000775000175000017500000000061310572350155017445 0ustar thurstonthurston#!/bin/bash # [ `dirname $0` != '.' ] && cd `dirname $0` out1=`mktemp -t cppnorm-test-XXXXXX` out2=`mktemp -t cppnorm-test-XXXXXX` for fn in input??.cpp; do echo $fn; ../cxxprep -n -t `basename $fn` < $fn > $out1 ../undo < $out1 > $out2 diff -u $out1 ${fn/input/output} diff -u $out2 ${fn} done rm $out1 rm $out2 shopt -s nullglob for d in data-*; do cd $d ./run-tests cd .. done kelbt-0.15/cxxprep/test/input14.cpp0000664000175000017500000000064310572350155017566 0ustar thurstonthurston template class string {}; template , template class TT = hi> class Other { T id; class FOO {}; TT *foobar(int i, char j, T&); }; class C { }; Other i = 22; C c = 33; Other::FOO j = 33; template class D { void foo(int); } FOO; template void bar(int i) { int j = 0; i = j - 0 - D(); } int main(int argc, char *argv[]) { } kelbt-0.15/cxxprep/test/output19.cpp0000664000175000017500000000051110572350155017766 0ustar thurstonthurston class [cn G]; class [cn H] {}; template <{class T}> class [cn I]; template <{class T}> class [cn J] {}; template <{class}> class [cn I]<|int|> { }; template <{class}> void $[di foo]({}); template <{class}> void $[di bar]({}) { } int $[di main]({}) { foo<|int|>(hi); bar<|int, (i<1), 1|>(hi); kar < new int<*>[[22]]; } kelbt-0.15/cxxprep/test/input05.cpp0000664000175000017500000000062310572350155017564 0ustar thurstonthurston class C { class S { }; template class Tmpl { class I {}; }; }; ::C::Tmpl foo; int main() { i = new (hi) ::C::Tmpl>::I [22.2]; i = ::new (this) int; laksdjf = delete new int[22.2]; laksdjf = delete[] sizeof(C); laksdjf = delete[] ++sizeof (::new (i--) int *&*[i++][1.1](foo,bar)) ; laksdjf = delete[] ++sizeof (::new (i--) (int (*)(unsigned, int))(foo,bar)) ; } kelbt-0.15/cxxprep/test/output06.cpp0000664000175000017500000000052610572350155017770 0ustar thurstonthurston class [cn C] { class [cn S] { }; template <{class T}> class [cn Tmpl] { class [cn I] {}; }; }; ::[cn C]::[cn Tmpl]<|22.2--|> $[di foo]; ::[cn C]::[cn Tmpl]<|++static_cast<|int<*>|>(new [cn C]::[cn Tmpl]<|int|>(foo))--|> $[di foo]; [cn C]::[cn Tmpl]<|::[cn C]::[cn Tmpl]<|abbacadabb.f(a)->foob(1.1)|>|> $[di foo]; int $[di main]({}) { } kelbt-0.15/cxxprep/test/output20.cpp0000664000175000017500000000040210572350155017755 0ustar thurstonthurston struct [cn C] { char $[di doit]({}) { return 'c'; } }; template <{typename T, [cn T] $(|[cn C]::<*>[di f]|)({})}> [cn T] $[di g]({[cn C]$<*>[di c]}) { return (c->*f)(); } int $[di main]({}) { [cn C] $[di c]; g<|char, &[cn C]::doit|>(&c); return 0; } kelbt-0.15/cxxprep/test/output18.cpp0000664000175000017500000000064010572350155017770 0ustar thurstonthurston class [cn C] { }; template <{class T}> class [cn D] { }; typedef int $[di I]; typedef int $(|(|<*>[di T]|)|)({int, char (|<*>|)({int})}); class [cn C]; [cn C] $[di c]; [cn I] $[di i]; [cn T] $[di t]; namespace [nn NS] { using [cn C]; using [cn D]; using [cn T]; }; [nn NS]::[cn T] $[di i] = unsigned int(77) + [nn NS]::[cn T](44) - [nn NS]::[cn D]<|1|>(a + b < c); void $[di f] ({}) { class [cn G]; } kelbt-0.15/cxxprep/test/output08.cpp0000664000175000017500000000120410572350155017764 0ustar thurstonthurston template <{class T}> class [cn C] {}; void $[di main]({int $[di argc], char $<*>[di argv][[]]}) { [cn C]<| (new [cn C]<| new int[[i>>1.1]] |> >> i(k--)) |> $[di c]; [cn C]<| (new [cn C]<|int|>) |> $[di c]; [cn C]<| (new [cn C]<|int|> > 0.0) |> $[di c]; [cn C]<| (new [cn C]<|int|> < 0.0) |> $[di c]; [cn C]<|int|> $[di foobar]({int $[di i], int <*><&>::<*>}); int $[di i] = j << 1.1; int $[di i] = j << 1.1 < 0.0; int $[di i] = j >> 1.1; int $[di i] = j >> 1.1 > 0.0; int $[di i] = ::j + 1.1 > 0.0; int $[di i] = j ++ + 1.1; int $[di i] = j +++ 1.1; int $[di i] = (j ++)+ 1.1 - ::[cn C]::getNum( static_cast<|int<*>|>(0.0) ); } kelbt-0.15/cxxprep/test/input07.cpp0000664000175000017500000000017710572350155017572 0ustar thurstonthurston class C{}; void main(int argc, char *argv[]) { // sdflkj i*2.3 /**/ / f / /**/ 2.2; (new C***) * 2.2; (new C***)*2.2; } kelbt-0.15/cxxprep/test/input24.cpp0000664000175000017500000000014610572350155017565 0ustar thurstonthurstonclass C { struct S; void f() { S w(int (a)); S x(int ()); S y((int)a); S z = int(a); } }; kelbt-0.15/cxxprep/test/input02.cpp0000664000175000017500000000077210572350155017566 0ustar thurstonthurston template class C { }; class C; class C { }; void f( int (*f)[2](int) ); class D { D *foo; }; struct E { class D { void e(E i); D(int i); D(D i); D(D D); ~D(); virtual ~D(); // template class C; class C { E::alsdfj; }; class D {}; class F { E::D::F::F(int i, const F *k); }; }; void length() const {} }; class Base { public: virtual void foo(); }; class SubClass { }; int main() { foo = E::D(bar); bar = foo(88.8); } kelbt-0.15/cxxprep/test/input16.cpp0000664000175000017500000000015310572350155017564 0ustar thurstonthurston typedef int T1; T1 i; class C { typedef int T2; T2 foo; int f() { typedef int T3; T3 foo; } }; kelbt-0.15/cxxprep/test/input08.cpp0000664000175000017500000000067710572350155017600 0ustar thurstonthurston template class C {}; void main(int argc, char *argv[]) { C< (new C< new int[i>>1.1] > >> i(k--)) > c; C< (new C) > c; C< (new C > 0.0) > c; C< (new C < 0.0) > c; C foobar(int i, int *&::*); int i = j << 1.1; int i = j << 1.1 < 0.0; int i = j >> 1.1; int i = j >> 1.1 > 0.0; int i = ::j + 1.1 > 0.0; int i = j ++ + 1.1; int i = j +++ 1.1; int i = (j ++)+ 1.1 - ::C::getNum( static_cast(0.0) ); } kelbt-0.15/cxxprep/test/input09.cpp0000664000175000017500000000025710572350155017573 0ustar thurstonthurston void main(int argc, char *argv[]) { i = 0 + 1u + 10lL + 111Lu; o = 00 + 0123 + 01lL * 0LL; h = 0x33ABCDEFabcdefll + 0x0 + 0x0ll / 0x0UL; b = true - +(+false) * true++; } kelbt-0.15/cxxprep/test/output05.cpp0000664000175000017500000000101110572350155017755 0ustar thurstonthurston class [cn C] { class [cn S] { }; template <{class T}> class [cn Tmpl] { class [cn I] {}; }; }; ::[cn C]::[cn Tmpl]<|[cn C]::[cn S]|> $[di foo]; int $[di main]({}) { i = new (hi) ::[cn C]::[cn Tmpl]<|[cn C]::[cn Tmpl]<|int|>|>::[cn I] [[22.2]]; i = ::new (this) int; laksdjf = delete new int[[22.2]]; laksdjf = delete[[]] sizeof([cn C]); laksdjf = delete[[]] ++sizeof (::new (i--) int <*><&><*>[[i++]][[1.1]](foo,bar)) ; laksdjf = delete[[]] ++sizeof (::new (i--) (int (|<*>|)({unsigned, int}))(foo,bar)) ; } kelbt-0.15/cxxprep/test/output21.cpp0000664000175000017500000000133310572350155017762 0ustar thurstonthurston template <{class T, class U, class V}> struct [cn C] { struct [cn D] { static int $[di i]; }; }; template <{class T, class U}> struct [cn C]<|[cn T],[cn U],int|> { struct [cn E] { static int $[di i]; }; }; template <{class T}> struct [cn C]<|[cn T],int,int|> { struct [cn F] { static int $[di i]; }; }; struct [cn C]<|int,int,int|> { struct [cn G] { static int $[di i]; }; }; template <{class T, class U, class V}> int $[cn C]<|[cn T], [cn U], [cn V]|>::[cn D]::[di i] = 0; template <{class T, class U}> int $[cn C]<|[cn T], [cn U], int|>::[cn E]::[di i] = 0; template <{class T}> int $[cn C]<|[cn T], int, int|>::[cn F]::[di i] = 0; int $[cn C]<|int, int, int|>::[cn G]::[di i] = 0; int $[di main]({}) { return 0; } kelbt-0.15/cxxprep/test/output14.cpp0000664000175000017500000000115410572350155017765 0ustar thurstonthurston template <{class T}> class [cn string] {}; template <{class T = [cn string]<|int|>, template <{class S}> class TT = hi}> class [cn Other] { [cn T] $[di id]; class [cn FOO] {}; [cn TT]<|[cn T]|> $<*>[di foobar]({int $[di i], char $[di j], [cn T]<&>}); }; class [cn C] { }; [cn Other]<|int|> $[di i] = 22; [cn C] $[di c] = 33; [cn Other]<|int|>::[cn FOO] $[di j] = 33; template <{class T}> class [cn D] { void $[di foo]({int}); } $[di FOO]; template <{class T}> void $[di bar]({int $[di i]}) { int $[di j] = 0; i = j - 0 - [cn D]<|int|>(); } int $[di main]({int $[di argc], char $<*>[di argv][[]]}) { } kelbt-0.15/cxxprep/test/input28.cpp0000664000175000017500000000015310572350155017567 0ustar thurstonthurston template class C {}; void f() { int i = 1 + C< 1 > ( 1 ) > 2; int i = 1 + C< 1 > ( 1 ) > (); } kelbt-0.15/cxxprep/parser.kh0000664000175000017500000001547511072514631016425 0ustar thurstonthurston/* * Copyright 2004-2006 Adrian Thurston */ /* This file is part of C++ Pre-Parser. * * C++ Pre-Parser is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * C++ Pre-Parser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with C++ Pre-Parser; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _PARSER_KH #define _PARSER_KH #include "names.h" #include "bstset.h" #include "dlist.h" struct Keyword { char *name; int id; }; struct CtxItem { CtxItem( int id, int state ) : id(id), state(state) { } int id; int state; }; struct CmpCtxItem { static int compare( const CtxItem &i1, const CtxItem &i2 ) { if ( i1.id < i2.id ) return -1; else if ( i1.id > i2.id ) return 1; else if ( i1.state < i2.state ) return -1; else if ( i1.state > i2.state ) return 1; return 0; } }; typedef BstSet CtxMap; %%{ parser Parser; token KW_Asm, KW_Auto, KW_Bool, KW_Break, KW_Case, KW_Catch, KW_Char, KW_Class, KW_Const, KW_ConstCast, KW_Continue, KW_Default, KW_Delete, KW_Do, KW_Double, KW_DynamicCast, KW_Else, KW_Enum, KW_Explicit, KW_Export, KW_Extern, KW_False, KW_Float, KW_For, KW_Friend, KW_Goto, KW_If, KW_Inline, KW_Int, KW_Long, KW_Mutable, KW_Namespace, KW_New, KW_Operator, KW_Private, KW_Protected, KW_Public, KW_Register, KW_ReinterpretCast, KW_Return, KW_Short, KW_Signed, KW_Sizeof, KW_Static, KW_StaticCast, KW_Struct, KW_Switch, KW_Template, KW_This, KW_Throw, KW_True, KW_Try, KW_Typedef, KW_Typeid, KW_Typename, KW_Union, KW_Unsigned, KW_Using, KW_Virtual, KW_Void, KW_Volatile, KW_WcharT, KW_While; token TK_DoubleLit, TK_SingleLit, TK_Float, TK_Identifier, TK_ClassName, TK_NameSep, TK_NamespaceName, TK_EnumName, TK_TypedefName, TK_Integer, TK_TemplClassName, TK_TemplateId, TK_Arrow, TK_PlusPlus, TK_MinusMinus, TK_ArrowStar, TK_DotStar, TK_ShiftLeft, TK_ShiftRight, TK_IntegerDecimal, TK_IntegerOctal, TK_IntegerHex, TK_LtEquals, TK_GtEquals, TK_EqualsEquals, TK_NotEquals, TK_AndAnd, TK_OrOr, TK_MultAssign, TK_DivAssign, TK_PercentAssign, TK_PlusAssign, TK_MinusAssign, TK_AmpAssign, TK_CaretAssign, TK_BarAssign, TK_ShiftLeftAssign, TK_ShiftRightAssign, TK_BitfieldId, TK_BitfieldColon, TK_DotDotDot, TK_PointerStar, TK_PointerAmp, TK_BaseClauseColon, TK_CtorColon, TK_LabelColon, TK_CondExprColon, TK_DeclaratorId, TK_ClassHeadName, TK_EnumHeadName, KW_Typeof, KW_Restrict, TK_Leader, TK_Lookup, TK_UnknownId; token TK_DeclaratorId, TK_ParameterOpen, TK_ParameterClose, TK_DeclaratorOpen, TK_DeclaratorClose, TK_TemplArgOpen, TK_TemplArgClose, TK_TemplParamOpen, TK_TemplParamClose; }%% struct Parser { %%{ parser Parser; write instance_data; }%% void init(); int parseLangEl( int type, const Token *token ); Parser( std::ostream &out ) : out(out) { /* Basic types. These are unique and so don't need to go into the map. */ templParamType = new Type; templParamType->type = Type::TemplParamType; unknownType = new Type; unknownType->type = Type::UnknownType; /* Init the root/current namespace. */ rootNamespace = new Object(Object::NamespaceType, 0, Stack()); lookupNs.push( new Stack ); lookupNs.top()->push( rootNamespace ); declNs.push( rootNamespace ); curNamespace.push( rootNamespace ); qualNs.push(0); /* Create default types in the root namespace. */ char *vaListId = strdup( "__builtin_va_list" ); Object *vaListTypedef = new Object( Object::TypedefType, vaListId ); vaListTypedef->objType = unknownType; rootNamespace->insertObject( vaListId, vaListTypedef ); /* Information transferred from a declaration's type to the * declaration. */ templDecl.push(false); declarationData.push( DeclarationData() ); declarationData.top().init(); } void writeToken( LangEl *lel ); int parseToken( int tok, bool qual, char *data, char *leader ); bool isNamespaceName( LangEl *lel, MapEl *mapEl ); bool isEnumName( LangEl *lel, MapEl *mapEl ); bool isClassName( LangEl *lel, MapEl *mapEl ); bool isTemplateClassName( LangEl *lel, MapEl *mapEl ); bool isTemplateId( LangEl *lel, MapEl *mapEl ); bool isTypedefName( LangEl *lel, MapEl *mapEl ); bool isId( LangEl *lel, MapEl *mapEl ); bool lookupInStack( LangEl *lel ); bool lookupQualified( LangEl *lel ); std::ostream &out; Object *rootNamespace; Stack< Stack *> lookupNs; Stack declNs; Stack curNamespace; Stack templateParamNs; /* Information transferred from a declaration's type to its declarator. */ Stack templDecl; Stack declarationData; Stack declaratorData; /* Used by the parser to store the baseNs of the last qualification. */ Stack qualNs; /* Type structures are globally unique. This map gets you the singleton * structure for each type, allowing type comparisons by pointer. */ Type *templParamType; Type *unknownType; TypeMap typeMap; Type *newType( Type::Property prop ); Type *addInProp( Type *type, Type::Property prop ); Type *reduceType( Type *type ); int numTemplParams( TypeList *typeList ); void clearLessSpecific( Vector &matched, TypeList *typeList ); bool typeListsMatch( Object *baseNs, TypeList *specList, TypeList *argList ); Object *findSpecCovers( Object *baseNs, TypeList *typeList ); }; %% write token_defs; struct FrameIter { FrameIter( Parser &p ) : p(p) { if ( p.templateParamNs.stack.length() > 0 ) { state = TemplParams; pos = p.templateParamNs.stack; } else { state = Lookup; pos = p.lookupNs.top()->stack; } }; Object *operator*() { return *pos; } void operator++(int) { pos.increment(); if ( state == TemplParams && pos.end() ) { state = Lookup; pos = p.lookupNs.top()->stack; } } Parser &p; Stack::Iter pos; enum State { TemplParams, Lookup } state; bool lte() { return state == TemplParams || pos.lte(); } }; /* Iterate through a structure's tree of base classes and namespace usages * (children in the tree). This iteration defines the order of lookup in a * class's and namespace's scope. */ struct ChildIter { ChildIter( Object *frame ) : frame(frame), atEnd(false) { } BaseNsVect::Iter child; Stack< BaseNsVect::Iter > stack; Object *frame; bool atEnd; Object *operator*() { return frame; } void operator++(int); bool lte() { return !atEnd; } }; #endif /* _PARSER_KH */ kelbt-0.15/cxxprep/README0000664000175000017500000000153010572350155015453 0ustar thurstonthurston C++ Pre-Parser ============== C++ Pre-Parser is a program for making the analysis and transformation of C++ somewhat easier. The pre-parser specializes symbols to their various uses, resolves names to the language entities they represent and adds symbols to the input. The "undo" program is can be used to remove the disambiguation symbols from the output of CxxPrep. The TXL grammar file "cpp.grm" includes a rule "undoDisambig" for removing the disambuation symbols. A skeleton TXL program for use with CxxPrep follows: include "cpp.grm" define program [cpp_program] end define function main replace [program] P [program] by P [undoDisambig] end function BUILDING CxxPrep ================ CxxPrep requires a recent version of Ragel State Machine compiler. kelbt-0.15/cxxprep/keys.gperf0000664000175000017500000000420611072514631016573 0ustar thurstonthurston/* * Copyright 2004, 2005 Adrian Thurston */ /* This file is part of C++ Pre-Parser. * * C++ Pre-Parser is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * C++ Pre-Parser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with C++ Pre-Parser; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ %{ #include #include "parser.h" %} %compare-strncmp struct Keyword; %% asm, KW_Asm auto, KW_Auto bool, KW_Bool break, KW_Break case, KW_Case catch, KW_Catch char, KW_Char class, KW_Class const, KW_Const const_cast, KW_ConstCast continue, KW_Continue default, KW_Default delete, KW_Delete do, KW_Do double, KW_Double dynamic_cast, KW_DynamicCast else, KW_Else enum, KW_Enum explicit, KW_Explicit export, KW_Export extern, KW_Extern false, KW_False float, KW_Float for, KW_For friend, KW_Friend goto, KW_Goto if, KW_If inline, KW_Inline int, KW_Int long, KW_Long mutable, KW_Mutable namespace, KW_Namespace new, KW_New operator, KW_Operator private, KW_Private protected, KW_Protected public, KW_Public register, KW_Register reinterpret_cast, KW_ReinterpretCast return, KW_Return short, KW_Short signed, KW_Signed sizeof, KW_Sizeof static, KW_Static static_cast, KW_StaticCast struct, KW_Struct switch, KW_Switch template, KW_Template this, KW_This throw, KW_Throw true, KW_True try, KW_Try typedef, KW_Typedef typeid, KW_Typeid typename, KW_Typename union, KW_Union unsigned, KW_Unsigned using, KW_Using virtual, KW_Virtual void, KW_Void volatile, KW_Volatile wchar_t, KW_WcharT while, KW_While __typeof, KW_Typeof __typeof__, KW_Typeof __asm, KW_Asm __asm__, KW_Asm __restrict, KW_Restrict __restrict__, KW_Restrict kelbt-0.15/cxxprep/TODO0000664000175000017500000000020510572350155015261 0ustar thurstonthurstonHandle overloading ',' operator. Tell cxxprep that we are interested in certain files. Option to preserve preprocessor directives. kelbt-0.15/cxxprep/names.h0000664000175000017500000002127411072514631016053 0ustar thurstonthurston/* * Copyright 2004, 2005 Adrian Thurston */ /* This file is part of C++ Pre-Parser. * * C++ Pre-Parser is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * C++ Pre-Parser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with C++ Pre-Parser; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _NAMES_H #define _NAMES_H #include "dlist.h" #include "compare.h" #include "vector.h" #include "avlmap.h" #include "avltree.h" #include "avlset.h" #include #define LOG_TOKENS #define LOG_ACTIONS #define LOG_REDUCE #define LOG_LOOKUP #define LOG_BACKTRACK using std::ostream; struct Type; struct Object; /* This structure is used to keep track of information necessary to make a * declaration. While parsing a declaration it records the declaration's * attributes. */ struct DeclarationData { void init() { isTypedef = false; isFriend = false; isTemplate = false; type = 0; } bool isTypedef; bool isFriend; bool isTemplate; Type *type; }; /* This structure is used to keep track of information necessary to make a * declarator. */ struct DeclaratorData { void init() { qualObj = 0; declScope = 0; } Object *qualObj; Object *declScope; }; struct Parser_LangEl; typedef Parser_LangEl LangEl; struct Token { int outType; char *data; char *leader; bool qual; Object *object; }; struct NameData { char *id; Object *object; Object *qualNs; LangEl *langEl; }; struct Object; typedef AvlMap BaseNsMap; typedef AvlMapEl BaseNsMapEl; typedef DList ObjectList; struct MapEl : public AvlTreeEl { MapEl(char *data) : data(data) { } char *getKey() const { return data; } char *data; ObjectList objectList; }; typedef AvlTree Map; typedef Vector BaseNsVect; template struct Stack { void push( T obj ); void set( T obj ); T pop(); T &top(); typedef typename Vector::Iter Iter; Vector stack; }; template void Stack::push( T obj ) { stack.prepend( obj ); } template void Stack::set( T obj ) { stack.data[0] = obj; } template T &Stack::top() { return stack.data[0]; } template T Stack::pop() { T rtnVal = stack.data[0]; stack.remove( 0, 1 ); return rtnVal; } /* A growable buffer for collecting headers. */ struct Buffer { Buffer() : data(0), allocated(0), length(0) { } Buffer( const Buffer &other ) { data = (char*)malloc( other.allocated ); memcpy( data, other.data, other.length ); allocated = other.allocated; length = other.length; } ~Buffer() { empty(); } void append( const char p ) { if ( ++length > allocated ) upAllocate( length*2 ); data[length-1] = p; } void append( const char *str, int len ) { if ( (length += len) > allocated ) upAllocate( length*2 ); memcpy( data+length-len, str, len ); } void clear() { length = 0; } void upAllocate( int len ); void empty(); char *data; int allocated; int length; }; struct Type { enum TypeType { BuiltinType, ObjectType, TemplParamType, UnknownType }; /* For builtin types. */ enum Property { Signed, Unsigned, Long, Int, Short, Char, Wchar_t, Bool, Float, Double, Void }; Type() {} Type( Object *object ) : type(ObjectType), object(object) {} TypeType type; Property sign; Property keyType; Object *object; static bool isSign( Property prop ) { return prop == Signed || prop == Unsigned; } Object *getObject() { return type == ObjectType ? object : 0; } ostream &print( ostream &out ); }; struct CmpType { static int compare( const Type *type1, const Type *type2 ) { if ( type1->type < type2->type ) return -1; else if ( type1->type > type2->type ) return 1; else if ( type1->type == Type::BuiltinType ) { if ( type1->sign < type2->sign ) return -1; else if ( type1->sign > type2->sign ) return 1; else if ( type1->keyType < type2->keyType ) return -1; else if ( type1->keyType > type2->keyType ) return 1; return 0; } else if ( type1->type == Type::ObjectType ) { if ( type1->object < type2->object ) return -1; else if ( type1->object > type2->object ) return 1; return 0; } return 0; } }; typedef AvlSet TypeMap; typedef AvlSetEl TypeMapEl; struct TypeList : public Vector { ostream &print( ostream &out ); }; typedef CmpTable< Type*, CmpOrd > CmpTypeList; typedef AvlMap TypeListMap; typedef AvlMapEl TypeListMapEl; struct Object { enum Type { NamespaceType, ClassType, TemplateClassType, TypedefType, EnumType, IdType, TemplateIdType, UnknownType }; Object( ) : type(UnknownType), data(0), objType(0) {} Object( Type type, char *data ) : type(type), data(data), objType(0) {} Object( char *data ) : type(UnknownType), data(data), objType(0) {} Object( Type type, const Stack &lookupNs ) : type(type), data(0), objType(0), lookupNs(lookupNs) {} Object( Type type, char *data, const Stack &lookupNs ) : type(type), data(data), objType(0), lookupNs(lookupNs) { this->Object::lookupNs.push( this ); } Type type; char *data; ::Type *objType; Map map; TypeListMap typeListMap; Stack lookupNs; BaseNsVect nsChildren; inline Object *findObject( char *data ); inline void insertObject( char *data, Object *object ); inline void removeObject( Object *object ); inline Object *findNamespace( char *data ); inline Object *findClass( char *data ); inline Object *findTemplateClass( char *data ); inline Object *findTypedef( char *data ); inline Object *findEnum( char *data ); inline Object *findIdentifier( char *data ); inline Object *findTemplateId( char *data ); inline Object *findSpecExact( const TypeList &typeList ); Object *prev, *next; }; struct StrAlloc { StrAlloc() : block(0) {} /* Length does not include null terminator. */ char *allocate( const char *data, int len ); char *block; int pos; }; Object *Object::findObject( char *data ) { MapEl *mapEl = map.find( data ); return mapEl != 0 ? mapEl->objectList.head : 0; } void Object::insertObject( char *data, Object *object ) { MapEl *inMap; map.insert( data, &inMap ); inMap->objectList.prepend( object ); } void Object::removeObject( Object *object ) { MapEl *mapEl = map.find( object->data ); mapEl->objectList.detach( object ); } Object *Object::findNamespace( char *data ) { MapEl *mapEl = map.find( data ); if ( mapEl != 0 ) { for ( ObjectList::Iter obj = mapEl->objectList; obj.lte(); obj++ ) { if ( obj->type == NamespaceType ) return obj; } } return 0; } Object *Object::findClass( char *data ) { MapEl *mapEl = map.find( data ); if ( mapEl != 0 ) { for ( ObjectList::Iter obj = mapEl->objectList; obj.lte(); obj++ ) { if ( obj->type == ClassType ) return obj; } } return 0; } Object *Object::findTemplateClass( char *data ) { MapEl *mapEl = map.find( data ); if ( mapEl != 0 ) { for ( ObjectList::Iter obj = mapEl->objectList; obj.lte(); obj++ ) { if ( obj->type == TemplateClassType ) return obj; } } return 0; } Object *Object::findTypedef( char *data ) { MapEl *mapEl = map.find( data ); if ( mapEl != 0 ) { for ( ObjectList::Iter obj = mapEl->objectList; obj.lte(); obj++ ) { if ( obj->type == TypedefType ) return obj; } } return 0; } Object *Object::findEnum( char *data ) { MapEl *mapEl = map.find( data ); if ( mapEl != 0 ) { for ( ObjectList::Iter obj = mapEl->objectList; obj.lte(); obj++ ) { if ( obj->type == EnumType ) return obj; } } return 0; } Object *Object::findIdentifier( char *data ) { MapEl *mapEl = map.find( data ); if ( mapEl != 0 ) { for ( ObjectList::Iter obj = mapEl->objectList; obj.lte(); obj++ ) { if ( obj->type == IdType ) return obj; } } return 0; } Object *Object::findTemplateId( char *data ) { MapEl *mapEl = map.find( data ); if ( mapEl != 0 ) { for ( ObjectList::Iter obj = mapEl->objectList; obj.lte(); obj++ ) { if ( obj->type == TemplateIdType ) return obj; } } return 0; } Object *Object::findSpecExact( const TypeList &typeList ) { TypeListMapEl *mapEl = typeListMap.find( typeList ); return mapEl != 0 ? mapEl->value : 0; } #endif /* _NAMES_H */ kelbt-0.15/cxxprep/Makefile0000664000175000017500000000360111072514631016231 0ustar thurstonthurston# # Copyright 2004-2006 Adrian Thurston # # This file is part of C++ Pre-Parser. # # C++ Pre-Parser is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # C++ Pre-Parser is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with C++ Pre-Parser; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA TARG = scanner INCS = -I ../aapl DEFS = CFLAGS = -g -Wall LDFLAGS = -g CC_SRCS = main.cpp scanner.cpp parser.cpp keys.cpp names.cpp CC_HEADERS = parser.h #************************************* # Programs CXX = c++ AR = ar KELBT = ../kelbt/kelbt RAGEL = ragel RLCODEGEN = rlgen-cd # Get objects, dependencies from sources. OBJS = $(CC_SRCS:%.cpp=%.o) DEPS = $(CC_SRCS:%.cpp=.%.d) # Rules. all: cxxprep undo cxxprep: $(KELBT) $(CC_HEADERS) $(CC_SRCS) $(OBJS) $(CXX) $(LDFLAGS) -o $@ $(OBJS) undo: undo.lex flex -oundo.c undo.lex gcc -o undo undo.c keys.cpp: keys.gperf gperf -L C++ -t $< > $@ parser.h: parser.kh $(KELBT) $(KELBT) -o $@ $< parser.cpp: parser.kl parser.kh $(KELBT) $(KELBT) -o $@ $< %.cpp: %.rl $(RAGEL) $< | $(RLCODEGEN) -G2 -o $@ %.o: %.cpp @$(CXX) -M $(CFLAGS) $(DEFS) $(INCS) $< > .$*.d $(CXX) -c $(CFLAGS) $(DEFS) $(INCS) -o $@ $< distclean: clean clean: rm -Rf .*.d *.o cxxprep scanner.cpp \ parser.{h,cpp} keys.cpp undo.c undo -include $(DEPS) PREFIX = /usr/local install: install -d $(PREFIX)/bin install -m 755 cxxprep $(PREFIX)/bin/ kelbt-0.15/cxxprep/ChangeLog0000664000175000017500000000013010572350155016340 0ustar thurstonthurstonCxxPrep 0.1 - Sep 14, 2005 ========================== -Initial public release of code. kelbt-0.15/cxxprep/COPYING0000664000175000017500000004326010572350155015634 0ustar thurstonthurston GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. kelbt-0.15/cxxprep/DEFICIENCIES0000664000175000017500000000223310572350155016331 0ustar thurstonthurston---- CxxPrep does not lookup names on RHS of "." or "->" from within the type declaration space the of LHS. This would require evaluating the type of the LHS, which is a considerable amount of work to implement. ---- There is a limited implementation of the matching of the list template argument types to the partial template specializations. There is no unification of template parameter variables and a there is a simple approximation to the "most specialized matching" which is to take the match with the least number of template parameters. Template specializations with explicit values as template arguments cannot be matched by any parameter list. In any case that a template specialzation cannot be found when it should be, the root template is returned. ---- We do not guard against cycles longer than one arc in the namespace using graph. This is okay because it is not at all useful. If it does happen we can fall into an infinite loop if a name that does not exist is looked up. The following code will hang cxxprep (gcc 3.3.5 as well). namespace foo { namespace bar { using namespace foo; } using namespace bar; } int foo::bar::f(); kelbt-0.15/cxxprep/main.cpp0000664000175000017500000000741111072514631016224 0ustar thurstonthurston/* * Copyright 2004, 2005 Adrian Thurston */ /* This file is part of C++ Pre-Parser. * * C++ Pre-Parser is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * C++ Pre-Parser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with C++ Pre-Parser; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include "scanner.h" #include "names.h" using namespace std; char *inputName = 0; char *targetName = 0; char *outputName = 0; ostream *outputFile; /* EOF char used to flush out that last token. This should be a whitespace * token. */ #define LAST_CHAR 0 void feedToScanner( FILE *input ) { #define BUFSIZE 16384 static char buf[BUFSIZE]; /* Create and initialize the scanner. */ Scanner scanner( *outputFile, inputName ); scanner.init(); bool done = false; int have = 0; while ( !done ) { char *data = buf + have; int space = BUFSIZE - have; if ( space == 0 ) { /* We filled up the buffer trying to scan a token. */ cerr << "OUT OF BUFFER SPACE" << endl; exit(1); } int len = fread( data, 1, space, input ); if ( len == 0 ) { data[0] = LAST_CHAR, len++; done = true; } int rtn = scanner.execute( data, len ); if ( rtn < 0 ) { cerr << "SCANNER ERROR" << endl; exit(1); } /* Now set up the prefix. */ if ( scanner.tokstart == 0 ) have = 0; else { /* There is data that needs to be shifted over. */ have = data + len - scanner.tokstart; memmove( buf, scanner.tokstart, have ); scanner.tokend -= (scanner.tokstart-buf); scanner.tokstart = buf; } } scanner.finish(); } void usage() { cout << "cxxprep [options] file\n" " preprocess and parse the input file, uses g++ for preprocessing\n" "\n" "cxxprep [options] -n [file]\n" " inhibit the preprocessor, only parse the input file (or standard in)\n" "\n" "cxxprep [options] -p file\n" " inhibit the parser, only run the preprocessor\n" "\n" "options:\n" " -h -H -? print usage and exit\n" " -I dir include directories to pass to the preprocessor\n" " -D macro_def macro defintiions to pass to the preprocessor\n" " -k keyword keywords for the parser to ignore\n"; } int main( int argc, char **argv ) { std::ios::sync_with_stdio(false); while ( true ) { int opt = getopt( argc, argv, "hH?t:o:" ); if ( opt < 0 ) break; switch ( opt ) { case 't': targetName = ::optarg; break; case 'o': outputName = ::optarg; break; case 'h': case 'H': case '?': usage(); return 0; } } /* Open the input file. */ if ( optind < argc ) { inputName = argv[optind]; std::ifstream in( inputName ); if ( ! in.is_open() ) { cerr << "cxxprep: failed to open input file " << inputName << endl; exit(1); } } outputFile = &cout; if ( outputName != 0 ) { std::ofstream *out = new std::ofstream( outputName ); if ( ! out->is_open() ) { cerr << "cxxprep: failed to open output file " << outputName << endl; exit(1); } outputFile = out; } if ( targetName == 0 ) targetName = inputName; FILE *input = inputName != 0 ? fopen( inputName, "rt" ) : stdin; feedToScanner( input ); return 0; } kelbt-0.15/ChangeLog0000664000175000017500000002510011707044376014661 0ustar thurstonthurstonKelbt 0.15 - Jan 22, 2012 ========================= -Eliminated type-punned pointer warnings GCC emits for generated code. Kelbt 0.14 - Oct 1, 2009 ======================== -Added the -I option for specifying directories to look in for included files. -Added the location of the including file to the list of locations to search for included files. -Applied patch from David Keller: Hardcoded "Token" string should be Token(). -Fixed many of the test cases. Added missing includes and the _tk prefix to _eof. Kelbt 0.13 - Oct 6, 2008 ======================== -The uses statement can now reference nonterminals before they are defined. -Fixed a typo in an 'undefined type' error message. -Fixed graphviz generation. -Check rhs references for undo and final blocks, not just try blocks. -Now tracking the number of reductions that an token causes. -Use causeReduce counting to maintain a queue of un-translated tokens. When pulling off the queue tokens are translated. When causeReduce drops to zero during backtracking the token is put back onto the queue and un-translated. This balances translation with un-translation. -Fixed distclean target. -Production names and language element names should be const char*. -Updated scanner to Ragel 6.X. -Now fixing the ordering timestamps after advancing reductions. When transferring a reduction copy in the min time from the source transitions. Also remove gaps. This does not affect parsing, but improves graphviz output. -Gave the eof token a better name: _tk_eof. Allows multiple parsers in the same program and prevents clashes with "eof" which seems to be common. -Updated email address. -Fixed const correctness problems. Kelbt 0.12 - May 1, 2007 ======================== -Don't emit empty switch blocks for trial, undo and final actions. -Ignore write statements that are not at the root of the include stack. -Added an option (-l) for turning off the writing of line directives. -Improved error messages. -A commit is now always a full commit of the stack. It induces any remaining final actions and cleans up the stack. Motivation: it should be possible to reliably control when final actions are executed. In the previous scheme reliable control was not possible because if retries existed ahead of the scoped commit then the number of retries would not drop to zero and the final actions would not be executed. Further, no important practical uses for the scoped commit have surfaced. That is, there are no examples of needing to commit a production while preserving earlier alternatives. Therefore the added complexity of the scoped commit feature is not justified. -The malloc used by the final action execution/commit code has been eliminated and replaced with a pointer mechanism. -Added a class keyword for nonterminals and the token type. The keyword goes directly in front of the nonterm/type/token name. Constructors and destructors are invoked for nonterminal class types and the token type when it is a class. nonterm class Foo {}; type class Foo {}; token uses class MyToken; -Added the "write finish" statement which invokes destructors for the items still on the stack. -Blocks of LangEls are now tracked and freed in the finish code. -Kelbt now uses Ragel's import feature instead of repeating the definition of tokens inside the section parser. -The branch point printing function (-i) now prints dot sets to give you a sense of where in the grammar the conflicts are. -Added the shortest statement. This changes the default action ordering from a longest-match strategy to a shortest-match strategy. To make this work reliably the nonterminal which is to be made into a shortest match should be wrapped in a fresh nonterminal which is then specified using the shortest statement. This syntax will likely be improved in the future. shortest lifted_list; lifted_list: list; list: list item; list: ; -Did some cleanup of the syntax highlighting. Removed junk left over from the port of the ragel syntax file a long time ago. -Fixed an missing variable initialization. This eliminates errors reported by valgrind. -Added an install target to the makefiles. Kelbt 0.11 - Feb 12, 2007 ========================= -The commit and final block execution code now uses malloc to allocate an array of pointers instead of using a variable-sized array on the stack, which is not portable C. -Applied more fixes to cxxprep from Gilles J. Seguin. -Updated to the latest aapl. Kelbt 0.10 - Jan 27, 2007 ========================= -Applied fixes to cxxprep from Gilles J. Seguin. -Adopted Ragel's write statement style of generating code. The types of statements are: write instance_data; - the runtime data used by the parser. write token_defs; - pound defines for the tokens. write types; - data structures representing language elements. write data; - static data used by the parser. write init; - initialization code. write exec; - the parse loop. -The access statement was added. It can be used to specify where the instance data is located. For example, inside a structure: access parser->; -Removed return statements from the exec loop. Errors and regular exits now just drop out at the bottom of exec. -The generated code has been made compatible with C. -Added a C test. -The generated data structures and static data elements now have their names prefixed with the parser name. -The "token uses" statement was added. This allows the user to change the name of the data structure which contains token data. It defaults to "Token". token uses ParserToken; -Implemented single-line parser specifications. This is useful mostly for write statements. -Fixes to line directive writing were made. Kelbt 0.9 - Jan 22, 2007 ======================== -Fix to initialization code: the sentinel at the top of the stack needs to have its pointers initialized. Kelbt 0.8 - Jan 16, 2007 ======================== -Added a priority mechanism for tweaking control of the parser. Priorities are associated with characters in productions and these take precedence over the default ordered choice strategy. The ordered choice strategy is also an 'innermost' strategy where all the possibilities within a non-terminal take precedence over any characters which follow the non-terminal. Priorities let one override this in particular cases. -Line directives are now generated for inline code blocks which are passed through to the output file. -Access to the non-terminal element and the right hand side elements of the production being reduced now works properly in final actions. Kelbt 0.7 - Dec 8, 2006 ======================= -Added a credits file. -Kelbt no longer generates code which writes 'parse error' when parsing fails. This can be done by the caller of parseLangEl after looking at the return value. -The scanner is now a class. It tracks the current line and guards against passing tokens to the parser if no parser name has been given. -Separated the parsing of the 'parser' and 'include' statements from the scanner. Kelbt 0.6 - Dec 2, 2006 ======================= -Replaced the Flex scanner with a Ragel scanner. -Replaced the Bison parser with a Kelbt-0.5 parser. Kelbt is now self-hosting. Error handling is now broken and must be added back. -The code was cleaned up: a large amount of code left over from the initial fork from Ragel was removed. -Bug fix: when the retry point is at the root of the stack, meaning it is the only real element, we cannot consult the transition that the sentinel element below it took because that transition does not exist. There is no state and no type associated with the sentinel. This case is now caught and uses the start state directly. Kelbt 0.5 - Nov 18, 2006 ======================== -Fixed production-based commits which became broken when the state table construction was improved in the previous version. -The commit, execFinal and final functions were moved into the main processing loop. The execFinal that was called in finish() is now called from the main loop by setting a commit on the final shift of the eof transition which completes the parse. -The specified parser name is now used as the name of parser class when the functions are generated. -The startState variable was moved to the static table data section. The mutable parser data is no longer static. -The struct block was removed, as it is now depreciated. -Can no longer compile test cases with -pedantic and -ansi due to variable length arrays on stack. Kelbt 0.4 - Oct 30, 2006 ======================== -A considerable amount of code cleanup and was done. This includes removal of unused code, simplification of data structures and rewrites of LR state table construction functions. The unnecessary complexity was because kelbt was derived from a version of a keller which supported right-regular parsing. Along with the cleanup comes a speedup in LR table construction. -An improvement was made to the ordering algorithm. When it's time to assign an ordering to a reduction after recursing down a production, the old way was to find the expand-to state of the production and assign an ordering to any transition which had a reduction of the production. The problem here is that it assumes that every transition that has the reduction can follow that instance of the production. In reality this is not true. There may be some transitions that have the reduction, but which come from a different instance of the production. Now we make sure that we assign a time only to reductions on characters which can follow the production instance. We do this by computing the characters on the fly. This gives a more accurate ordering. Kelbt 0.3 - Aug 8, 2006 ======================= -Fixed a bug in LALR(1) state table construction which caused reductions actions for some middle-recursive grammars to not be added. For example this grammar fails to set a reduce of A-2 on the ')' character. S: A; S: B; A: '(' A ')'; A: '(' 'x' ')'; B: '(' B ')'; B: '(' 'x' ')'; Kelbt 0.2 - Aug 1, 2006 ======================= -Fixed the rejection command: It now immediately shifts the nonterminal being rejected before jumping to the parse error handling. Previously this nonterminal would get lost and would muck things up. -Added a test showing variable length list processing. -The cxxprep example can use the aapl in the root kelbt package. Kelbt 0.1 - Jun 26, 2006 ======================== -Initial release. kelbt-0.15/kelbt/0000775000175000017500000000000011707046235014206 5ustar thurstonthurstonkelbt-0.15/kelbt/fsmgraph.h0000664000175000017500000002672311072514631016173 0ustar thurstonthurston/* * Copyright 2001-2005 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _FSMGRAPH_H #define _FSMGRAPH_H #include #include "vector.h" #include "bstset.h" #include "compare.h" #include "avltree.h" #include "dlist.h" #include "bstmap.h" #include "sbstmap.h" #include "sbstset.h" #include "sbsttable.h" #include "avlset.h" #include "dlistmel.h" #include "avltree.h" /* Flags for states. */ #define SB_ISFINAL 0x04 #define SB_ISMARKED 0x08 #define SB_ISSTART 0x10 /* Flags for transitions. */ #define TB_ISMARKED 0x01 struct TransAp; struct StateAp; struct FsmAp; struct LongestMatchPart; struct Definition; struct KlangEl; typedef Vector ActDataList; struct ActionData { ActionData( int targ, ActDataList &actions, int commitLen ) : targ(targ), commitLen(commitLen), id(0), actions(actions) { } int targ; int commitLen; int id; ActDataList actions; }; struct CmpActionData { static int compare( const ActionData &ap1, const ActionData &ap2 ) { if ( ap1.targ < ap2.targ ) return -1; else if ( ap1.targ > ap2.targ ) return 1; else if ( ap1.commitLen < ap2.commitLen ) return -1; else if ( ap1.commitLen > ap2.commitLen ) return 1; else if ( ap1.id < ap2.id ) return -1; else if ( ap1.id > ap2.id ) return 1; return CmpTable< long, CmpOrd >:: compare( ap1.actions, ap2.actions ); } }; typedef AvlSet ActionSet; typedef AvlSetEl ActionSetEl; /* State list element for unambiguous access to list element. */ struct FsmListEl { StateAp *prev, *next; }; /* List pointers for the closure queue. Goes into state. */ struct ClosureQueueListEl { StateAp *prev, *next; }; /* Queue of states, transitions to be closed. */ typedef DListMel< StateAp, ClosureQueueListEl > StateClosureQueue; typedef DList TransClosureQueue; typedef BstSet< Definition*, CmpOrd > DefSet; typedef CmpTable< Definition*, CmpOrd > CmpDefSet; typedef BstSet< DefSet, CmpDefSet > DefSetSet; typedef Vector< Definition* > DefVect; typedef BstSet< long, CmpOrd > AlphSet; struct ExpandToEl { ExpandToEl( StateAp *state, int prodId ) : state(state), prodId(prodId) { } StateAp *state; int prodId; }; struct CmpExpandToEl { static inline int compare( const ExpandToEl &etel1, const ExpandToEl &etel2 ) { if ( etel1.state < etel2.state ) return -1; else if ( etel1.state > etel2.state ) return 1; else if ( etel1.prodId < etel2.prodId ) return -1; else if ( etel1.prodId > etel2.prodId ) return 1; else return 0; } }; typedef BstSet ExpandToSet; typedef BstSet< int, CmpOrd > IntSet; typedef CmpTable< int, CmpOrd > CmpIntSet; typedef BstSet< long, CmpOrd > LongSet; typedef CmpTable< long, CmpOrd > CmpLongSet; typedef BstMap< long, long, CmpOrd > LongMap; typedef BstMapEl< long, long > LongMapEl; typedef LongSet ProdIdSet; typedef CmpLongSet CmpProdIdSet; /* Set of states, list of states. */ typedef BstSet StateSet; typedef Vector StateVect; typedef DList StateList; typedef LongMap FollowToAdd; typedef LongMap ReductionMap; typedef LongMapEl ReductionMapEl; struct ProdIdPair { ProdIdPair( int onReduce, int length ) : onReduce(onReduce), length(length) {} int onReduce; int length; }; struct CmpProdIdPair { static inline int compare( const ProdIdPair &pair1, const ProdIdPair &pair2 ) { if ( pair1.onReduce < pair2.onReduce ) return -1; else if ( pair1.onReduce > pair2.onReduce ) return 1; else if ( pair1.length < pair2.length ) return -1; else if ( pair1.length > pair2.length ) return 1; else return 0; } }; typedef BstSet< ProdIdPair, CmpProdIdPair > ProdIdPairSet; /* Transition class that implements actions and priorities. */ struct TransAp { TransAp() : fromState(0), toState(0), isShift(false), isShiftReduce(false), shiftPrior(0) { } TransAp( const TransAp &other ) : lowKey(other.lowKey), fromState(0), toState(0), isShift(other.isShift), isShiftReduce(other.isShiftReduce), shiftPrior(other.shiftPrior), reductions(other.reductions), commits(other.commits) { } long lowKey; StateAp *fromState; StateAp *toState; /* Pointers for outlist. */ TransAp *prev, *next; /* Pointers for in-list. */ TransAp *ilprev, *ilnext; long maxPrior(); /* Parse Table construction data. */ bool isShift, isShiftReduce; int shiftPrior; ReductionMap reductions; ActDataList actions; ActDataList actOrds; ActDataList actPriors; ExpandToSet expandTo; ActionSetEl *actionSetEl; LongSet commits; LongSet afterShiftCommits; }; /* In transition list. Like DList except only has head pointers, which is all * that is required. Insertion and deletion is handled by the graph. This * class provides the iterator of a single list. */ struct TransInList { TransInList() : head(0) { } TransAp *head; struct Iter { /* Default construct. */ Iter() : ptr(0) { } /* Construct, assign from a list. */ Iter( const TransInList &il ) : ptr(il.head) { } Iter &operator=( const TransInList &dl ) { ptr = dl.head; return *this; } /* At the end */ bool lte() const { return ptr != 0; } bool end() const { return ptr == 0; } /* At the first, last element. */ bool first() const { return ptr && ptr->ilprev == 0; } bool last() const { return ptr && ptr->ilnext == 0; } /* Cast, dereference, arrow ops. */ operator TransAp*() const { return ptr; } TransAp &operator *() const { return *ptr; } TransAp *operator->() const { return ptr; } /* Increment, decrement. */ inline void operator++(int) { ptr = ptr->ilnext; } inline void operator--(int) { ptr = ptr->ilprev; } /* The iterator is simply a pointer. */ TransAp *ptr; }; }; typedef DList TransList; /* A element in a state dict. */ struct StateDictEl : public AvlTreeEl { StateDictEl(const StateSet &stateSet) : stateSet(stateSet) { } const StateSet &getKey() { return stateSet; } StateSet stateSet; StateAp *targState; }; /* Dictionary mapping a set of states to a target state. */ typedef AvlTree< StateDictEl, StateSet, CmpTable > StateDict; /* What items does a particular state encompass. */ typedef BstSet< long, CmpOrd > DotSet; typedef CmpTable< long, CmpOrd > CmpDotSet; /* Map of dot sets to states. */ typedef AvlTree< StateAp, DotSet, CmpDotSet > DotSetMap; typedef StateAp DotSetMapEl; typedef BstMap< long, TransAp* > TransMap; typedef BstMapEl< long, TransAp* > TransMapEl; /* State class that implements actions and priorities. */ struct StateAp : public ClosureQueueListEl, public AvlTreeEl< StateAp > { StateAp(); StateAp(const StateAp &other); ~StateAp(); /* Is the state final? */ bool isFinState() { return stateBits & SB_ISFINAL; } TransAp *findTrans( long key ) { TransMapEl *transMapEl = transMap.find( key ); if ( transMapEl == 0 ) return 0; return transMapEl->value; } /* In transition list. */ TransInList inRange; ProdIdPairSet pendingCommits; /* When duplicating the fsm we need to map each * state to the new state representing it. */ StateAp *stateMap; /* When merging states (state machine operations) this next pointer is * used for the list of states that need to be filled in. */ StateAp *alg_next; StateSet *stateSet; /* Identification for printing and stable minimization. */ int stateNum; /* A pointer to a dict element that contains the set of states this state * represents. This cannot go into alg, because alg.next is used during * the merging process. */ StateDictEl *stateDictEl; /* Bits controlling the behaviour of the state during collapsing to dfa. */ int stateBits; /* State list elements. */ StateAp *next, *prev; /* For dotset map. */ DotSet &getKey() { return dotSet; } /* Closure management. */ DotSet dotSet; DotSet dotSet2; bool onClosureQueue; bool inClosedMap; bool followMarked; bool onStateList; TransMap transMap; }; /* Compare lists of epsilon transitions. Entries are name ids of targets. */ typedef CmpTable< int, CmpOrd > CmpEpsilonTrans; /* Compare sets of context values. */ typedef CmpTable< int, CmpOrd > CmpContextSets; /* Graph class that implements actions and priorities. */ struct FsmAp { /* Constructors/Destructors. */ FsmAp(); FsmAp( const FsmAp &graph ); ~FsmAp(); /* The list of states. */ StateList stateList; StateList misfitList; /* The start state. */ StateAp *startState; /* The set of final states. */ StateSet finStateSet; /* Closure queues and maps. */ DotSetMap closedMap; StateClosureQueue stateClosureQueue; StateClosureQueue stateClosedList; TransClosureQueue transClosureQueue; StateAp *stateClosureHead; KlangEl **langElIndex; void setStartState( StateAp *state ); void unsetStartState( ); /* * Basic attaching and detaching. */ /* Common to attaching/detaching list and default. */ void attachToInList( StateAp *from, StateAp *to, TransAp *&head, TransAp *trans ); void detachFromInList( StateAp *from, StateAp *to, TransAp *&head, TransAp *trans ); /* Attach with a new transition. */ TransAp *attachNewTrans( StateAp *from, StateAp *to, long onChar1, long onChar2 ); /* Attach with an existing transition that already in an out list. */ void attachTrans( StateAp *from, StateAp *to, TransAp *trans ); /* Detach a transition from a target state. */ void detachTrans( StateAp *from, StateAp *to, TransAp *trans ); /* Detach a state from the graph. */ void detachState( StateAp *state ); /* * Callbacks. */ /* Add in the properties of srcTrans into this. */ void addInReduction( TransAp *dest, long prodId, long prior ); void addInTrans( TransAp *destTrans, TransAp *srcTrans ); void addInState( StateAp *destState, StateAp *srcState ); /* * Allocation. */ /* New up a state and add it to the graph. */ StateAp *addState(); /* * Fsm operators. */ /* Follow to the fin state of src fsm. */ StateAp *followFsm( StateAp *from, FsmAp *srcFsm ); /* * Final states */ /* Set and Unset a state as final. */ void setFinState( StateAp *state ); void unsetFinState( StateAp *state ); void unsetAllFinStates( ); /* Set State numbers starting at 0. */ void setStateNumbers(); /* * Path pruning */ /* Mark all states reachable from state. */ void markReachableFromHere( StateAp *state ); /* Removes states that cannot be reached by any path in the fsm and are * thus wasted silicon. */ void removeUnreachableStates(); /* Remove error actions from states on which the error transition will * never be taken. */ bool outListCovers( StateAp *state ); /* Remove states that are on the misfit list. */ void removeMisfits(); /* * Other */ /* Move the in trans into src into dest. */ void inTransMove(StateAp *dest, StateAp *src); int fsmLength( ); }; #endif /* _FSMGRAPH_H */ kelbt-0.15/kelbt/pcheck.cpp0000664000175000017500000000723111072521140016136 0ustar thurstonthurston/* * Copyright 2001, 2002, 2005 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "pcheck.h" /* Construct a new parameter checker with for paramSpec. */ ParamCheck::ParamCheck( const char *paramSpec, int argc, const char **argv ) : state(noparam), argOffset(0), curArg(0), iCurArg(1), paramSpec(paramSpec), argc(argc), argv(argv) { } /* Check a single option. Returns the index of the next parameter. Sets p to * the arg character if valid, 0 otherwise. Sets parg to the parameter arg if * there is one, NULL otherwise. */ bool ParamCheck::check() { bool requiresParam; if ( iCurArg >= argc ) { /* Off the end of the arg list. */ state = noparam; return false; } if ( argOffset != 0 && *argOffset == 0 ) { /* We are at the end of an arg string. */ iCurArg += 1; if ( iCurArg >= argc ) { state = noparam; return false; } argOffset = 0; } if ( argOffset == 0 ) { /* Set the current arg. */ curArg = argv[iCurArg]; /* We are at the beginning of an arg string. */ if ( argv[iCurArg] == 0 || /* Argv[iCurArg] is null. */ argv[iCurArg][0] != '-' || /* Not a param. */ argv[iCurArg][1] == 0 ) { /* Only a dash. */ parameter = 0; paramArg = 0; iCurArg += 1; state = noparam; return true; } argOffset = argv[iCurArg] + 1; } /* Get the arg char. */ char argChar = *argOffset; /* Loop over all the parms and look for a match. */ const char *pSpec = paramSpec; while ( *pSpec != 0 ) { char pSpecChar = *pSpec; /* If there is a ':' following the char then * it requires a parm. If a parm is required * then move ahead two in the parmspec. Otherwise * move ahead one in the parm spec. */ if ( pSpec[1] == ':' ) { requiresParam = true; pSpec += 2; } else { requiresParam = false; pSpec += 1; } /* Do we have a match. */ if ( argChar == pSpecChar ) { if ( requiresParam ) { if ( argOffset[1] == 0 ) { /* The param must follow. */ if ( iCurArg + 1 == argc ) { /* We are the last arg so there * cannot be a parameter to it. */ parameter = argChar; paramArg = 0; iCurArg += 1; argOffset = 0; state = invalid; return true; } else { /* the parameter to the arg is the next arg. */ parameter = pSpecChar; paramArg = argv[iCurArg + 1]; iCurArg += 2; argOffset = 0; state = match; return true; } } else { /* The param for the arg is built in. */ parameter = pSpecChar; paramArg = argOffset + 1; iCurArg += 1; argOffset = 0; state = match; return true; } } else { /* Good, we matched the parm and no * arg is required. */ parameter = pSpecChar; paramArg = 0; argOffset += 1; state = match; return true; } } } /* We did not find a match. Bad Argument. */ parameter = argChar; paramArg = 0; argOffset += 1; state = invalid; return true; } kelbt-0.15/kelbt/klparse.kl0000664000175000017500000002010411072514631016167 0ustar thurstonthurston/* * Copyright 2006 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "klparse.h" #include "kelbt.h" #include using std::cout; using std::cerr; using std::endl; %%{ parser Parser; include "klparse.kh"; start: statement_list; statement_list: statement_list statement; statement_list: ; statement: production_stmt commit; statement: token_stmt commit; statement: token_uses_stmt commit; statement: translate_stmt commit; statement: nonterm_stmt commit; statement: type_stmt commit; statement: access_stmt commit; statement: shortest_stmt commit; access_stmt: KW_Access TK_AccessData ';' final { pd.access = $2->data; }; production_stmt: TK_Word ':' prod_el_list opt_commit opt_reduction opt_undo opt_final ';' final { /* Get the language element. */ KlangEl *prodName = getKlangEl( &pd, $1->data, KlangEl::NonTerm ); /* Check that the element wasn't previously defined as something else. */ if ( prodName->type != KlangEl::Unknown && prodName->type != KlangEl::NonTerm ) { error($1->loc) << "'" << $1->data << "' already defined as something else" << endl; } else { prodName->type = KlangEl::NonTerm; Definition *newDef = new Definition( $1->loc, prodName, $3->prodElList, $4->commit, $5->inlineBlock, $6->inlineBlock, $7->inlineBlock, pd.prodList.length(), Definition::Production ); prodName->defList.append( newDef ); pd.prodList.append( newDef ); /* Start machine will trigger code generation. */ if ( strcmp($1->data, startDefName) == 0 ) sawStart = true; newDef->rhsLelVect = langElVect; newDef->rhsFactorVect = factorVect; langElVect.empty(); factorVect.empty(); } }; token_stmt: KW_Token token_list ';'; token_list: token_list ',' token_list_word; token_list: token_list_word; token_list_word: TK_Word final { /* Token name must be unique. */ KlangEl *tokName = getKlangEl( &pd, $1->data, KlangEl::Term ); if ( tokName->type != KlangEl::Unknown && tokName->type != KlangEl::Term ) error($1->loc) << "'" << $1 << "' already defined as something else" << endl; tokName->type = KlangEl::Term; }; token_uses_stmt: KW_Token KW_Uses opt_class TK_Word ';' final { pd.tokenStruct = $4->data; pd.tokenIsClass = $3->isClass; }; translate_stmt: KW_Token opt_translate opt_undo opt_final ';' final { pd.translateBlock = $2->inlineBlock; pd.undoTransBlock = $3->inlineBlock; pd.tokenFinalBlock = $4->inlineBlock; }; nonterm_stmt: KW_NonTerm opt_class TK_Word inline_list ';' final { /* Create/get the nonterminal. */ KlangEl *nonTerm = getKlangEl( &pd, $3->data, KlangEl::NonTerm ); /* Make a new inline block. */ InlineBlock *typeBlock = new InlineBlock( $3->loc, $4->inlineList ); /* Create/get the typedef. */ TypeDef *typeDef = getTypeDef( $3->data ); nonTerm->typeDef = typeDef; /* The typeDef should not already exist. */ if ( typeDef->typeBlock != 0 ) error($3->loc) << "redefintion of nonterminal type " << $3->data << endl; else { typeDef->typeBlock = typeBlock; typeDef->isClass = $2->isClass; } }; nonterm_stmt: KW_NonTerm TK_Word KW_Uses TK_Word ';' final { KlangEl *nonTerm = getKlangEl( &pd, $2->data, KlangEl::NonTerm ); nonTerm->typeDef = getTypeDef( $4->data ); }; nonterm opt_class { bool isClass; }; opt_class: KW_Class final { $$->isClass = true; }; opt_class: final { $$->isClass = false; }; type_stmt: KW_Type opt_class TK_Word inline_list ';' final { /* Create the inline block and create/get the typedef. */ InlineBlock *typeBlock = new InlineBlock( InputLoc($4->loc), $4->inlineList ); TypeDef *typeDef = getTypeDef( $3->data ); /* The typeDef should not already exist. */ if ( typeDef->typeBlock != 0 ) error($3->loc) << "redefintion of nonterminal type " << $3->data << endl; else { typeDef->typeBlock = typeBlock; typeDef->isClass = $2->isClass; } }; shortest_stmt: KW_Shortest TK_Word ';' final { KlangEl *nonTerm = getKlangEl( &pd, $2->data, KlangEl::NonTerm ); nonTerm->isShortest = true; }; nonterm inline_list { InlineList *inlineList; InputLoc loc; }; inline_list: inline_list inline_block_item final { $1->inlineList->append( $2->inlineItem ); $$->inlineList = $1->inlineList; $$->loc = $1->loc; }; inline_list: inline_block_item final { $$->inlineList = new InlineList; $$->inlineList->append( $1->inlineItem ); $$->loc = $1->loc; }; nonterm inline_block_item { InlineItem *inlineItem; InputLoc loc; }; inline_block_item: TK_Inline final { $$->inlineItem = new InlineItem( $1->loc, $1->data, InlineItem::Text ); $$->loc = $1->loc; }; inline_block_item: TK_Reference final { $$->inlineItem = new InlineItem( $1->loc, $1->data, InlineItem::Reference ); $$->loc = $1->loc; }; nonterm prod_el_list { ProdElList *prodElList; }; prod_el_list: prod_el_list prod_el final { $1->prodElList->append( $2->factor ); $$->prodElList = $1->prodElList; }; prod_el_list: final { $$->prodElList = new ProdElList; }; nonterm prod_el { Factor *factor; }; prod_el: opt_prior opt_commit TK_Word final { KlangEl *langEl = getKlangEl( &pd, $3->data, KlangEl::Unknown ); $$->factor = new Factor( $3->loc, $2->commit, langEl, $1->priorVal ); langElVect.append( langEl ); factorVect.append( $$->factor ); }; prod_el: opt_prior opt_commit TK_Literal final { /* Create a new factor node going to a concat literal. */ Literal *literal = new Literal( $3->loc, $3->data[0] ); $$->factor = new Factor( $3->loc, $2->commit, literal, $1->priorVal ); langElVect.append( 0 ); factorVect.append( $$->factor ); }; nonterm opt_commit { bool commit; }; opt_commit: final { $$->commit = false; }; opt_commit: KW_Commit final { $$->commit = true; }; nonterm opt_prior { int priorVal; }; opt_prior: KW_Pri '(' TK_Number ')' final { $$->priorVal = atoi( $3->data ); }; opt_prior: final { $$->priorVal = 0; }; type opt_inline_block { InlineBlock *inlineBlock; }; nonterm opt_reduction uses opt_inline_block; nonterm opt_undo uses opt_inline_block; nonterm opt_final uses opt_inline_block; nonterm opt_translate uses opt_inline_block; opt_reduction: final { $$->inlineBlock = 0; }; opt_reduction: KW_Try inline_list final { $$->inlineBlock = new InlineBlock( $2->loc, $2->inlineList ); }; opt_undo: final { $$->inlineBlock = 0; }; opt_undo: KW_Undo inline_list final { $$->inlineBlock = new InlineBlock( $2->loc, $2->inlineList ); }; opt_final: final { $$->inlineBlock = 0; }; opt_final: KW_Final inline_list final { $$->inlineBlock = new InlineBlock( $2->loc, $2->inlineList ); }; opt_translate: final { $$->inlineBlock = 0; }; opt_translate: KW_Translate inline_list final { $$->inlineBlock = new InlineBlock( $2->loc, $2->inlineList ); }; }%% %%{ write types; write data; }%% void Parser::init() { %% write init; } TypeDef *Parser::getTypeDef( char *data ) { TypeDefMapEl *inMap = 0, *inserted; inserted = pd.typeDefMap.insert( data, &inMap ); if ( inserted != 0 ) inserted->value = new TypeDef( data ); return inMap->value; } int Parser::parseLangEl( int type, const Token *token ) { %% write exec; return errCount == 0 ? 0 : -1; } int Parser::token( int line, int tokid, char *data ) { Token token; token.data = data; token.loc.line = line; token.loc.col = 1; //cout << "SENDING TOKEN: " << lelNames[tokid]; //if ( token.data != 0 ) // cout << " data: " << token.data; //cout << endl; return parseLangEl( tokid, &token ); } kelbt-0.15/kelbt/fsmattach.cpp0000664000175000017500000001233211072514631016660 0ustar thurstonthurston/* * Copyright 2001, 2005, 2006 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "fsmgraph.h" #include "kelbt.h" #include "parsedata.h" #include using namespace std; /* Insert a transition into an inlist. The head must be supplied. */ void FsmAp::attachToInList( StateAp *from, StateAp *to, TransAp *&head, TransAp *trans ) { trans->ilnext = head; trans->ilprev = 0; /* If in trans list is not empty, set the head->prev to trans. */ if ( head != 0 ) head->ilprev = trans; /* Now insert ourselves at the front of the list. */ head = trans; }; /* Detach a transition from an inlist. The head of the inlist must be supplied. */ void FsmAp::detachFromInList( StateAp *from, StateAp *to, TransAp *&head, TransAp *trans ) { /* Detach in the inTransList. */ if ( trans->ilprev == 0 ) head = trans->ilnext; else trans->ilprev->ilnext = trans->ilnext; if ( trans->ilnext != 0 ) trans->ilnext->ilprev = trans->ilprev; } /* Attach states on the default transition, range list or on out/in list key. * Type of attaching and is controlled by keyType. First makes a new * transition. If there is already a transition out from fromState on the * default, then will assertion fail. */ TransAp *FsmAp::attachNewTrans( StateAp *from, StateAp *to, long lowKey, long ) { /* Make the new transition. */ TransAp *retVal = new TransAp(); /* The transition is now attached. Remember the parties involved. */ retVal->fromState = from; retVal->toState = to; /* Make the entry in the out list for the transitions. */ from->transMap.append( TransMapEl( lowKey, retVal ) ); /* Set the the keys of the new trans. */ retVal->lowKey = lowKey; /* Attach using inRange as the head pointer. */ attachToInList( from, to, to->inRange.head, retVal ); return retVal; } /* Attach for range lists or for the default transition. Type of attaching is * controlled by the keyType parameter. This attach should be used when a * transition already is allocated and must be attached to a target state. * Does not handle adding the transition into the out list. */ void FsmAp::attachTrans( StateAp *from, StateAp *to, TransAp *trans ) { assert( trans->fromState == 0 && trans->toState == 0 ); trans->fromState = from; trans->toState = to; /* Attach using the inRange pointer as the head pointer. */ attachToInList( from, to, to->inRange.head, trans ); } /* Detach for out/in lists or for default transition. The type of detaching is * controlled by the keyType parameter. */ void FsmAp::detachTrans( StateAp *from, StateAp *to, TransAp *trans ) { assert( trans->fromState == from && trans->toState == to ); trans->fromState = 0; trans->toState = 0; /* Detach using to's inRange pointer as the head. */ detachFromInList( from, to, to->inRange.head, trans ); } /* Detach a state from the graph. Detaches and deletes transitions in and out * of the state. Empties inList and outList. Removes the state from the final * state set. A detached state becomes useless and should be deleted. */ void FsmAp::detachState( StateAp *state ) { /* Detach the in transitions from the inRange list of transitions. */ while ( state->inRange.head != 0 ) { /* Get pointers to the trans and the state. */ TransAp *trans = state->inRange.head; StateAp *fromState = trans->fromState; /* Detach the transitions from the source state. */ detachTrans( fromState, state, trans ); /* Ok to delete the transition. */ fromState->transMap.remove( trans->lowKey ); delete trans; } /* Detach out range transitions. */ for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) { detachTrans( state, trans->value->toState, trans->value ); delete trans->value; } /* Delete all of the out range pointers. */ state->transMap.empty(); /* Unset final stateness before detaching from graph. */ if ( state->stateBits & SB_ISFINAL ) finStateSet.remove( state ); } /* Move all the transitions that go into src so that they go into dest. */ void FsmAp::inTransMove( StateAp *dest, StateAp *src ) { /* Do not try to move in trans to and from the same state. */ assert( dest != src ); /* If src is the start state, dest becomes the start state. */ assert( src != startState ); /* Move the transitions in inRange. */ while ( src->inRange.head != 0 ) { /* Get trans and from state. */ TransAp *trans = src->inRange.head; StateAp *fromState = trans->fromState; /* Detach from src, reattach to dest. */ detachTrans( fromState, src, trans ); attachTrans( fromState, dest, trans ); } } kelbt-0.15/kelbt/klscan.cpp0000664000175000017500000015316211707046235016175 0ustar thurstonthurston #line 1 "klscan.rl" /* * Copyright 2006-2009 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "kelbt.h" #include "klparse.h" using std::ifstream; using std::istream; using std::ostream; using std::cout; using std::cerr; using std::endl; #line 40 "klscan.cpp" static const int section_parser_start = 7; static const int section_parser_first_final = 7; static const int section_parser_error = 0; static const int section_parser_en_main = 7; #line 39 "klscan.rl" struct Scanner { Scanner( const char *fileName, istream &input, ParserDict &parserDict, int include_depth ) : fileName(fileName), input(input), parserDict(parserDict), include_depth(include_depth), parser(0), curline(1) { #line 60 "klscan.cpp" { cs = section_parser_start; } #line 50 "klscan.rl" } void startSection( bool singleLineSpec ); void endSection(); void do_scan(); void try_token( int tokid ); void try_token( int tokid, char *start, char *end ); ifstream *tryOpenInclude( char **pathChecks, long &found ); char **makeIncludePathChecks( const char *thisFileName, const char *fileName ); /* Open an error message with the file name and line. */ ostream &error() { /* Keep the error count. */ gblErrorCount += 1; cerr << fileName << ":" << curline << ": "; return cerr; } const char *fileName; istream &input; ParserDict &parserDict; int include_depth; Parser *parser; int curline, inline_start_line; bool singleLineSpec; /* Write statements seen. */ bool writeInstanceData; bool writeTokenDefs; bool writeTypes; bool writeData; bool writeInit; bool writeExec; bool writeFinish; /* For section parser. */ int cs; char *captured; }; void Scanner::startSection( bool singleLineSpec ) { this->singleLineSpec = singleLineSpec; writeInstanceData = false; writeTokenDefs = false; writeTypes = false; writeData = false; writeInit = false; writeExec = false; writeFinish = false; } void Scanner::endSection() { if ( !::generateGraphviz ) { if ( writeInstanceData ) parser->pd.generateInstanceData(); if ( writeTokenDefs ) parser->pd.generateTokenDefs(); if ( writeTypes ) parser->pd.generateTypes(); if ( writeInit ) parser->pd.generateInit(); if ( writeData ) parser->pd.generateData(); if ( writeExec ) parser->pd.generateExec(); if ( writeFinish ) parser->pd.generateFinish(); if ( ! inhibitLineDirectives ) *outStream << "#line " << curline << " \"" << fileName << "\"\n"; } /* This causes us to use the parser with the last parser definition when * generating graphviz code. */ graphvizGenParser = parser; } void Scanner::try_token( int tokid ) { try_token( tokid, 0, 0 ); } bool isAbsolutePath( const char *path ) { return path[0] == '/'; } ifstream *Scanner::tryOpenInclude( char **pathChecks, long &found ) { char **check = pathChecks; ifstream *inFile = new ifstream; while ( *check != 0 ) { inFile->open( *check ); if ( inFile->is_open() ) { found = check - pathChecks; return inFile; } check += 1; } found = -1; delete inFile; return 0; } char **Scanner::makeIncludePathChecks( const char *thisFileName, const char *fileName ) { char **checks = 0; long nextCheck = 0; char *data = strdup(fileName); long length = strlen(fileName); /* Absolute path? */ if ( isAbsolutePath( data ) ) { checks = new char*[2]; checks[nextCheck++] = data; } else { /* Search from the the location of the current file. */ checks = new char *[2 + includePaths.length()]; const char *lastSlash = strrchr( thisFileName, '/' ); if ( lastSlash == 0 ) checks[nextCheck++] = data; else { long givenPathLen = (lastSlash - thisFileName) + 1; long checklen = givenPathLen + length; char *check = new char[checklen+1]; memcpy( check, thisFileName, givenPathLen ); memcpy( check+givenPathLen, data, length ); check[checklen] = 0; checks[nextCheck++] = check; } /* Search from the include paths given on the command line. */ for ( ArgsVector::Iter incp = includePaths; incp.lte(); incp++ ) { long pathLen = strlen( *incp ); long checkLen = pathLen + 1 + length; char *check = new char[checkLen+1]; memcpy( check, *incp, pathLen ); check[pathLen] = '/'; memcpy( check+pathLen+1, data, length ); check[checkLen] = 0; checks[nextCheck++] = check; } } checks[nextCheck] = 0; return checks; } void Scanner::try_token( int tokid, char *start, char *end ) { char *tokdata = 0; int *p = &tokid, *pe = &tokid + 1; if ( start != 0 ) { int len = end-start; tokdata = new char[len+1]; memcpy( tokdata, start, len ); tokdata[len] = 0; } #line 237 "klscan.cpp" { if ( p == pe ) goto _test_eof; switch ( cs ) { tr2: #line 228 "klscan.rl" { //cout << "PARSER STATEMENT" << endl; char *parserName = captured; ParserDictEl *pdEl = parserDict.find( parserName ); if ( pdEl != 0 ) { //cout << "USING EXISTING PARSER" << endl; delete[] parserName; } else { //cout << "CREATING NEW PARSER" << endl; pdEl = new ParserDictEl; pdEl->name = parserName; pdEl->parser = new Parser( fileName, parserName, *outStream ); pdEl->parser->init(); parserDict.insert( pdEl ); } parser = pdEl->parser; } goto st7; tr4: #line 250 "klscan.rl" { /* Make the list of files to try. */ char **checks = makeIncludePathChecks( this->fileName, captured ); /* Open the input file for reading. */ long found = 0; ifstream *inFile = tryOpenInclude( checks, found ); /* Open the input file for reading. */ if ( inFile == 0 ) error() << "include: could not open " << captured << " for reading" << endl; else { Scanner subScanner( checks[found], *inFile, parserDict, include_depth+1 ); subScanner.do_scan(); delete inFile; } } goto st7; tr6: #line 269 "klscan.rl" { if ( include_depth == 0 ) { char *writeArg = captured; if ( strcmp( writeArg, "instance_data" ) == 0 ) writeInstanceData = true; else if ( strcmp( writeArg, "token_defs" ) == 0 ) writeTokenDefs = true; else if ( strcmp( writeArg, "types" ) == 0 ) writeTypes = true; else if ( strcmp( writeArg, "data" ) == 0 ) writeData = true; else if ( strcmp( writeArg, "init" ) == 0 ) writeInit = true; else if ( strcmp( writeArg, "exec" ) == 0 ) writeExec = true; else if ( strcmp( writeArg, "finish" ) == 0 ) writeFinish = true; } } goto st7; tr7: #line 290 "klscan.rl" { if ( parser == 0 ) error() << "no section name and no previously named section" << endl; else { int line = TK_Inline ? inline_start_line : curline; int result = parser->token( line, tokid, tokdata ); if ( result < 0 ) error() << "parse error on or near this line" << endl; } } goto st7; st7: if ( ++p == pe ) goto _test_eof7; case 7: #line 325 "klscan.cpp" switch( (*p) ) { case 128: goto st1; case 129: goto st3; case 130: goto st5; } goto tr7; st1: if ( ++p == pe ) goto _test_eof1; case 1: if ( (*p) == 143 ) goto tr0; goto st0; st0: cs = 0; goto _out; tr0: #line 301 "klscan.rl" { captured = tokdata; } goto st2; st2: if ( ++p == pe ) goto _test_eof2; case 2: #line 350 "klscan.cpp" if ( (*p) == 59 ) goto tr2; goto st0; st3: if ( ++p == pe ) goto _test_eof3; case 3: if ( (*p) == 144 ) goto tr3; goto st0; tr3: #line 302 "klscan.rl" { captured = tokdata; } goto st4; st4: if ( ++p == pe ) goto _test_eof4; case 4: #line 369 "klscan.cpp" if ( (*p) == 59 ) goto tr4; goto st0; st5: if ( ++p == pe ) goto _test_eof5; case 5: if ( (*p) == 143 ) goto tr5; goto st0; tr5: #line 301 "klscan.rl" { captured = tokdata; } goto st6; st6: if ( ++p == pe ) goto _test_eof6; case 6: #line 388 "klscan.cpp" if ( (*p) == 59 ) goto tr6; goto st0; } _test_eof7: cs = 7; goto _test_eof; _test_eof1: cs = 1; goto _test_eof; _test_eof2: cs = 2; goto _test_eof; _test_eof3: cs = 3; goto _test_eof; _test_eof4: cs = 4; goto _test_eof; _test_eof5: cs = 5; goto _test_eof; _test_eof6: cs = 6; goto _test_eof; _test_eof: {} _out: {} } #line 318 "klscan.rl" } #line 460 "klscan.rl" #line 414 "klscan.cpp" static const int klscan_start = 21; static const int klscan_first_final = 21; static const int klscan_error = 0; static const int klscan_en_inline_code = 30; static const int klscan_en_access_stmt = 40; static const int klscan_en_parser_def = 42; static const int klscan_en_main = 21; #line 463 "klscan.rl" void Scanner::do_scan() { int bufsize = 8; char *buf = new char[bufsize]; char *ts, *te; int cs, act, have = 0; int curly_count = 0; char *inline_start = 0; char *litstart = 0, *litend = 0; char *identstart = 0, *identend = 0; bool execute = true; #line 440 "klscan.cpp" { cs = klscan_start; ts = 0; te = 0; act = 0; } #line 477 "klscan.rl" while ( execute ) { char *p = buf + have; int space = bufsize - have; if ( space == 0 ) { /* We filled up the buffer trying to scan a token. Grow it. */ bufsize = bufsize * 2; char *newbuf = new char[bufsize]; //cout << "FULL BUFFER, NEW SIZE: " << bufsize << endl; /* Recompute p and space. */ p = newbuf + have; space = bufsize - have; /* Patch up pointers possibly in use. */ if ( ts != 0 ) ts = newbuf + ( ts - buf ); if ( inline_start != 0 ) inline_start = newbuf + ( inline_start - buf ); te = newbuf + ( te - buf ); litstart = newbuf + ( litstart - buf ); litend = newbuf + ( litend - buf ); identstart = newbuf + ( identstart - buf ); identend = newbuf + ( identend - buf ); /* Copy the new buffer in. */ memcpy( newbuf, buf, have ); delete[] buf; buf = newbuf; } input.read( p, space ); int len = input.gcount(); char *pe = p + len; /* Check for EOF. */ char *eof = 0; if ( len == 0 ) { eof = pe; execute = false; } #line 493 "klscan.cpp" { if ( p == pe ) goto _test_eof; switch ( cs ) { tr0: #line 436 "klscan.rl" {{p = ((te))-1;}{ if ( !generateGraphviz && gblErrorCount == 0 && include_depth == 0 ) outStream->write( ts, te-ts ); }} goto st21; tr2: #line 436 "klscan.rl" {te = p+1;{ if ( !generateGraphviz && gblErrorCount == 0 && include_depth == 0 ) outStream->write( ts, te-ts ); }} goto st21; tr9: #line 436 "klscan.rl" {te = p+1;{ if ( !generateGraphviz && gblErrorCount == 0 && include_depth == 0 ) outStream->write( ts, te-ts ); }} goto st21; tr11: #line 328 "klscan.rl" { curline++; } #line 436 "klscan.rl" {te = p+1;{ if ( !generateGraphviz && gblErrorCount == 0 && include_depth == 0 ) outStream->write( ts, te-ts ); }} goto st21; tr33: #line 436 "klscan.rl" {te = p+1;{ if ( !generateGraphviz && gblErrorCount == 0 && include_depth == 0 ) outStream->write( ts, te-ts ); }} goto st21; tr34: #line 456 "klscan.rl" {te = p+1;} goto st21; tr43: #line 436 "klscan.rl" {te = p;p--;{ if ( !generateGraphviz && gblErrorCount == 0 && include_depth == 0 ) outStream->write( ts, te-ts ); }} goto st21; tr44: #line 436 "klscan.rl" {te = p;p--;{ if ( !generateGraphviz && gblErrorCount == 0 && include_depth == 0 ) outStream->write( ts, te-ts ); }} goto st21; tr46: #line 447 "klscan.rl" {te = p;p--;{ startSection( true ); {goto st42;} }} goto st21; tr47: #line 451 "klscan.rl" {te = p+1;{ startSection( false ); {goto st42;} }} goto st21; tr48: #line 436 "klscan.rl" {te = p;p--;{ if ( !generateGraphviz && gblErrorCount == 0 && include_depth == 0 ) outStream->write( ts, te-ts ); }} goto st21; tr49: #line 436 "klscan.rl" {te = p;p--;{ if ( !generateGraphviz && gblErrorCount == 0 && include_depth == 0 ) outStream->write( ts, te-ts ); }} goto st21; st21: #line 1 "NONE" {ts = 0;} if ( ++p == pe ) goto _test_eof21; case 21: #line 1 "NONE" {ts = p;} #line 590 "klscan.cpp" switch( (*p) ) { case 0: goto tr34; case 9: goto st22; case 10: goto tr36; case 13: goto st22; case 32: goto st22; case 34: goto tr37; case 37: goto st24; case 39: goto tr39; case 47: goto tr40; case 95: goto st29; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto st28; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto st29; } else goto st29; goto tr33; tr36: #line 328 "klscan.rl" { curline++; } goto st22; st22: if ( ++p == pe ) goto _test_eof22; case 22: #line 620 "klscan.cpp" switch( (*p) ) { case 9: goto st22; case 10: goto tr36; case 13: goto st22; case 32: goto st22; } goto tr43; tr37: #line 1 "NONE" {te = p+1;} goto st23; st23: if ( ++p == pe ) goto _test_eof23; case 23: #line 636 "klscan.cpp" switch( (*p) ) { case 10: goto tr44; case 13: goto tr44; case 34: goto tr2; case 92: goto st2; } goto st1; st1: if ( ++p == pe ) goto _test_eof1; case 1: switch( (*p) ) { case 10: goto tr0; case 13: goto tr0; case 34: goto tr2; case 92: goto st2; } goto st1; st2: if ( ++p == pe ) goto _test_eof2; case 2: if ( (*p) == 10 ) goto tr0; goto st1; st24: if ( ++p == pe ) goto _test_eof24; case 24: if ( (*p) == 37 ) goto st25; goto tr44; st25: if ( ++p == pe ) goto _test_eof25; case 25: if ( (*p) == 123 ) goto tr47; goto tr46; tr39: #line 1 "NONE" {te = p+1;} goto st26; st26: if ( ++p == pe ) goto _test_eof26; case 26: #line 684 "klscan.cpp" switch( (*p) ) { case 10: goto tr44; case 13: goto tr44; case 39: goto tr2; case 92: goto st4; } goto st3; st3: if ( ++p == pe ) goto _test_eof3; case 3: switch( (*p) ) { case 10: goto tr0; case 13: goto tr0; case 39: goto tr2; case 92: goto st4; } goto st3; st4: if ( ++p == pe ) goto _test_eof4; case 4: if ( (*p) == 10 ) goto tr0; goto st3; tr40: #line 1 "NONE" {te = p+1;} goto st27; st27: if ( ++p == pe ) goto _test_eof27; case 27: #line 718 "klscan.cpp" switch( (*p) ) { case 42: goto st5; case 47: goto st7; } goto tr44; tr7: #line 328 "klscan.rl" { curline++; } goto st5; st5: if ( ++p == pe ) goto _test_eof5; case 5: #line 732 "klscan.cpp" switch( (*p) ) { case 10: goto tr7; case 42: goto st6; } goto st5; st6: if ( ++p == pe ) goto _test_eof6; case 6: switch( (*p) ) { case 10: goto tr7; case 42: goto st6; case 47: goto tr9; } goto st5; st7: if ( ++p == pe ) goto _test_eof7; case 7: if ( (*p) == 10 ) goto tr11; goto st7; st28: if ( ++p == pe ) goto _test_eof28; case 28: if ( 48 <= (*p) && (*p) <= 57 ) goto st28; goto tr48; st29: if ( ++p == pe ) goto _test_eof29; case 29: if ( (*p) == 95 ) goto st29; if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto st29; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto st29; } else goto st29; goto tr49; tr12: #line 368 "klscan.rl" {{p = ((te))-1;}} goto st30; tr14: #line 347 "klscan.rl" {te = p+1;} goto st30; tr21: #line 346 "klscan.rl" {te = p+1;} goto st30; tr23: #line 328 "klscan.rl" { curline++; } #line 346 "klscan.rl" {te = p+1;} goto st30; tr50: #line 368 "klscan.rl" {te = p+1;} goto st30; tr60: #line 350 "klscan.rl" {te = p+1;{ curly_count += 1; }} goto st30; tr61: #line 352 "klscan.rl" {te = p+1;{ if ( --curly_count == 0 ) { /* Send the entire block and free the inline_start pointer. */ try_token( TK_Inline, inline_start, te ); inline_start = 0; {goto st42;} } }} goto st30; tr62: #line 348 "klscan.rl" {te = p;p--;} goto st30; tr63: #line 368 "klscan.rl" {te = p;p--;} goto st30; tr64: #line 361 "klscan.rl" {te = p+1;{ if ( inline_start < ts ) try_token( TK_Inline, inline_start, ts ); try_token( TK_Reference, ts, te ); inline_start = te; }} goto st30; tr66: #line 361 "klscan.rl" {te = p;p--;{ if ( inline_start < ts ) try_token( TK_Inline, inline_start, ts ); try_token( TK_Reference, ts, te ); inline_start = te; }} goto st30; tr67: #line 345 "klscan.rl" {te = p;p--;} goto st30; tr68: #line 344 "klscan.rl" {te = p;p--;} goto st30; st30: #line 1 "NONE" {ts = 0;} if ( ++p == pe ) goto _test_eof30; case 30: #line 1 "NONE" {ts = p;} #line 856 "klscan.cpp" switch( (*p) ) { case 9: goto st31; case 10: goto tr52; case 13: goto st31; case 32: goto st31; case 34: goto tr53; case 36: goto st33; case 39: goto tr55; case 47: goto tr56; case 64: goto st38; case 95: goto st39; case 123: goto tr60; case 125: goto tr61; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto st37; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto st39; } else goto st39; goto tr50; tr52: #line 328 "klscan.rl" { curline++; } goto st31; st31: if ( ++p == pe ) goto _test_eof31; case 31: #line 888 "klscan.cpp" switch( (*p) ) { case 9: goto st31; case 10: goto tr52; case 13: goto st31; case 32: goto st31; } goto tr62; tr53: #line 1 "NONE" {te = p+1;} goto st32; st32: if ( ++p == pe ) goto _test_eof32; case 32: #line 904 "klscan.cpp" switch( (*p) ) { case 10: goto tr63; case 13: goto tr63; case 34: goto tr14; case 92: goto st9; } goto st8; st8: if ( ++p == pe ) goto _test_eof8; case 8: switch( (*p) ) { case 10: goto tr12; case 13: goto tr12; case 34: goto tr14; case 92: goto st9; } goto st8; st9: if ( ++p == pe ) goto _test_eof9; case 9: if ( (*p) == 10 ) goto tr12; goto st8; st33: if ( ++p == pe ) goto _test_eof33; case 33: if ( (*p) == 36 ) goto tr64; if ( 48 <= (*p) && (*p) <= 57 ) goto st34; goto tr63; st34: if ( ++p == pe ) goto _test_eof34; case 34: if ( 48 <= (*p) && (*p) <= 57 ) goto st34; goto tr66; tr55: #line 1 "NONE" {te = p+1;} goto st35; st35: if ( ++p == pe ) goto _test_eof35; case 35: #line 954 "klscan.cpp" switch( (*p) ) { case 10: goto tr63; case 13: goto tr63; case 39: goto tr14; case 92: goto st11; } goto st10; st10: if ( ++p == pe ) goto _test_eof10; case 10: switch( (*p) ) { case 10: goto tr12; case 13: goto tr12; case 39: goto tr14; case 92: goto st11; } goto st10; st11: if ( ++p == pe ) goto _test_eof11; case 11: if ( (*p) == 10 ) goto tr12; goto st10; tr56: #line 1 "NONE" {te = p+1;} goto st36; st36: if ( ++p == pe ) goto _test_eof36; case 36: #line 988 "klscan.cpp" switch( (*p) ) { case 42: goto st12; case 47: goto st14; } goto tr63; tr19: #line 328 "klscan.rl" { curline++; } goto st12; st12: if ( ++p == pe ) goto _test_eof12; case 12: #line 1002 "klscan.cpp" switch( (*p) ) { case 10: goto tr19; case 42: goto st13; } goto st12; st13: if ( ++p == pe ) goto _test_eof13; case 13: switch( (*p) ) { case 10: goto tr19; case 42: goto st13; case 47: goto tr21; } goto st12; st14: if ( ++p == pe ) goto _test_eof14; case 14: if ( (*p) == 10 ) goto tr23; goto st14; st37: if ( ++p == pe ) goto _test_eof37; case 37: if ( 48 <= (*p) && (*p) <= 57 ) goto st37; goto tr67; st38: if ( ++p == pe ) goto _test_eof38; case 38: if ( (*p) == 64 ) goto tr64; if ( 48 <= (*p) && (*p) <= 57 ) goto st34; goto tr63; st39: if ( ++p == pe ) goto _test_eof39; case 39: if ( (*p) == 95 ) goto st39; if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto st39; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto st39; } else goto st39; goto tr68; tr71: #line 373 "klscan.rl" {te = p+1;{ try_token( ';' ); {goto st42;} }} goto st40; tr72: #line 372 "klscan.rl" {te = p;p--;{ try_token( TK_AccessData, ts, te ); }} goto st40; st40: #line 1 "NONE" {ts = 0;} if ( ++p == pe ) goto _test_eof40; case 40: #line 1 "NONE" {ts = p;} #line 1075 "klscan.cpp" switch( (*p) ) { case 0: goto st0; case 59: goto tr71; } goto st41; st41: if ( ++p == pe ) goto _test_eof41; case 41: switch( (*p) ) { case 0: goto tr72; case 59: goto tr72; } goto st41; st0: cs = 0; goto _out; tr24: #line 433 "klscan.rl" {{p = ((te))-1;}{ try_token( *ts, 0, 0 ); }} goto st42; tr26: #line 407 "klscan.rl" {te = p+1;{ try_token( TK_String, ts+1, te-1 ); }} goto st42; tr29: #line 328 "klscan.rl" { curline++; } #line 410 "klscan.rl" {te = p+1;} goto st42; tr30: #line 406 "klscan.rl" {te = p+1;{ try_token( TK_Literal, ts+1, te-1 ); }} goto st42; tr32: #line 412 "klscan.rl" {te = p+1;{ endSection(); {goto st21;} }} goto st42; tr73: #line 433 "klscan.rl" {te = p+1;{ try_token( *ts, 0, 0 ); }} goto st42; tr75: #line 328 "klscan.rl" { curline++; } #line 419 "klscan.rl" {te = p+1;{ if ( singleLineSpec ) { endSection(); {goto st21;} } }} goto st42; tr91: #line 426 "klscan.rl" {te = p+1;{ inline_start_line = curline; inline_start = ts; curly_count = 1; {goto st30;} }} goto st42; tr93: #line 417 "klscan.rl" {te = p;p--;} goto st42; tr94: #line 433 "klscan.rl" {te = p;p--;{ try_token( *ts, 0, 0 ); }} goto st42; tr96: #line 408 "klscan.rl" {te = p;p--;{ try_token( TK_Number, ts, te ); }} goto st42; tr97: #line 1 "NONE" { switch( act ) { case 12: {{p = ((te))-1;} try_token( KW_Commit ); } break; case 13: {{p = ((te))-1;} try_token( KW_Try ); } break; case 14: {{p = ((te))-1;} try_token( KW_Undo ); } break; case 15: {{p = ((te))-1;} try_token( KW_Final ); } break; case 16: {{p = ((te))-1;} try_token( KW_Translate ); } break; case 17: {{p = ((te))-1;} try_token( KW_Token ); } break; case 18: {{p = ((te))-1;} try_token( KW_NonTerm ); } break; case 19: {{p = ((te))-1;} try_token( KW_Uses ); } break; case 20: {{p = ((te))-1;} try_token( KW_Type ); } break; case 21: {{p = ((te))-1;} try_token( KW_Parser ); } break; case 22: {{p = ((te))-1;} try_token( KW_Include ); } break; case 23: {{p = ((te))-1;} try_token( KW_Pri ); } break; case 24: {{p = ((te))-1;} try_token( KW_Write ); } break; case 25: {{p = ((te))-1;} try_token( KW_Class ); } break; case 26: {{p = ((te))-1;} try_token( KW_Shortest ); } break; case 28: {{p = ((te))-1;} try_token( TK_Word, ts, te ); } break; } } goto st42; tr98: #line 405 "klscan.rl" {te = p;p--;{ try_token( TK_Word, ts, te ); }} goto st42; tr104: #line 397 "klscan.rl" {te = p;p--;{ try_token( KW_Access ); {goto st40;} }} goto st42; st42: #line 1 "NONE" {ts = 0;} if ( ++p == pe ) goto _test_eof42; case 42: #line 1 "NONE" {ts = p;} #line 1227 "klscan.cpp" switch( (*p) ) { case 9: goto st43; case 10: goto tr75; case 13: goto st43; case 32: goto st43; case 34: goto tr76; case 35: goto tr77; case 39: goto tr78; case 95: goto tr80; case 97: goto st49; case 99: goto st56; case 102: goto st64; case 105: goto st68; case 110: goto st74; case 112: goto st80; case 115: goto st86; case 116: goto st93; case 117: goto st106; case 119: goto st111; case 123: goto tr91; case 125: goto tr92; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto st47; } else if ( (*p) > 90 ) { if ( 98 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr73; st43: if ( ++p == pe ) goto _test_eof43; case 43: switch( (*p) ) { case 9: goto st43; case 13: goto st43; case 32: goto st43; } goto tr93; tr76: #line 1 "NONE" {te = p+1;} goto st44; st44: if ( ++p == pe ) goto _test_eof44; case 44: #line 1277 "klscan.cpp" switch( (*p) ) { case 10: goto tr94; case 13: goto tr94; case 34: goto tr26; case 92: goto st16; } goto st15; st15: if ( ++p == pe ) goto _test_eof15; case 15: switch( (*p) ) { case 10: goto tr24; case 13: goto tr24; case 34: goto tr26; case 92: goto st16; } goto st15; st16: if ( ++p == pe ) goto _test_eof16; case 16: if ( (*p) == 10 ) goto tr24; goto st15; tr77: #line 1 "NONE" {te = p+1;} goto st45; st45: if ( ++p == pe ) goto _test_eof45; case 45: #line 1311 "klscan.cpp" if ( (*p) == 10 ) goto tr29; goto st17; st17: if ( ++p == pe ) goto _test_eof17; case 17: if ( (*p) == 10 ) goto tr29; goto st17; tr78: #line 1 "NONE" {te = p+1;} goto st46; st46: if ( ++p == pe ) goto _test_eof46; case 46: #line 1330 "klscan.cpp" switch( (*p) ) { case 10: goto tr94; case 13: goto tr94; case 39: goto tr94; case 92: goto st19; } goto st18; st18: if ( ++p == pe ) goto _test_eof18; case 18: if ( (*p) == 39 ) goto tr30; goto tr24; st19: if ( ++p == pe ) goto _test_eof19; case 19: goto st18; st47: if ( ++p == pe ) goto _test_eof47; case 47: if ( 48 <= (*p) && (*p) <= 57 ) goto st47; goto tr96; tr80: #line 1 "NONE" {te = p+1;} #line 405 "klscan.rl" {act = 28;} goto st48; tr111: #line 1 "NONE" {te = p+1;} #line 394 "klscan.rl" {act = 25;} goto st48; tr115: #line 1 "NONE" {te = p+1;} #line 381 "klscan.rl" {act = 12;} goto st48; tr119: #line 1 "NONE" {te = p+1;} #line 384 "klscan.rl" {act = 15;} goto st48; tr125: #line 1 "NONE" {te = p+1;} #line 391 "klscan.rl" {act = 22;} goto st48; tr131: #line 1 "NONE" {te = p+1;} #line 387 "klscan.rl" {act = 18;} goto st48; tr137: #line 1 "NONE" {te = p+1;} #line 390 "klscan.rl" {act = 21;} goto st48; tr138: #line 1 "NONE" {te = p+1;} #line 392 "klscan.rl" {act = 23;} goto st48; tr145: #line 1 "NONE" {te = p+1;} #line 395 "klscan.rl" {act = 26;} goto st48; tr151: #line 1 "NONE" {te = p+1;} #line 386 "klscan.rl" {act = 17;} goto st48; tr153: #line 1 "NONE" {te = p+1;} #line 382 "klscan.rl" {act = 13;} goto st48; tr159: #line 1 "NONE" {te = p+1;} #line 385 "klscan.rl" {act = 16;} goto st48; tr161: #line 1 "NONE" {te = p+1;} #line 389 "klscan.rl" {act = 20;} goto st48; tr165: #line 1 "NONE" {te = p+1;} #line 383 "klscan.rl" {act = 14;} goto st48; tr167: #line 1 "NONE" {te = p+1;} #line 388 "klscan.rl" {act = 19;} goto st48; tr171: #line 1 "NONE" {te = p+1;} #line 393 "klscan.rl" {act = 24;} goto st48; st48: if ( ++p == pe ) goto _test_eof48; case 48: #line 1457 "klscan.cpp" if ( (*p) == 95 ) goto tr80; if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr97; st49: if ( ++p == pe ) goto _test_eof49; case 49: switch( (*p) ) { case 95: goto tr80; case 99: goto st50; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st50: if ( ++p == pe ) goto _test_eof50; case 50: switch( (*p) ) { case 95: goto tr80; case 99: goto st51; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st51: if ( ++p == pe ) goto _test_eof51; case 51: switch( (*p) ) { case 95: goto tr80; case 101: goto st52; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st52: if ( ++p == pe ) goto _test_eof52; case 52: switch( (*p) ) { case 95: goto tr80; case 115: goto st53; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st53: if ( ++p == pe ) goto _test_eof53; case 53: switch( (*p) ) { case 95: goto tr80; case 115: goto st54; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st54: if ( ++p == pe ) goto _test_eof54; case 54: switch( (*p) ) { case 9: goto st55; case 10: goto tr106; case 13: goto st55; case 32: goto st55; case 95: goto tr80; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr104; tr106: #line 328 "klscan.rl" { curline++; } goto st55; st55: if ( ++p == pe ) goto _test_eof55; case 55: #line 1582 "klscan.cpp" switch( (*p) ) { case 9: goto st55; case 10: goto tr106; case 13: goto st55; case 32: goto st55; } goto tr104; st56: if ( ++p == pe ) goto _test_eof56; case 56: switch( (*p) ) { case 95: goto tr80; case 108: goto st57; case 111: goto st60; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st57: if ( ++p == pe ) goto _test_eof57; case 57: switch( (*p) ) { case 95: goto tr80; case 97: goto st58; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 98 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st58: if ( ++p == pe ) goto _test_eof58; case 58: switch( (*p) ) { case 95: goto tr80; case 115: goto st59; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st59: if ( ++p == pe ) goto _test_eof59; case 59: switch( (*p) ) { case 95: goto tr80; case 115: goto tr111; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st60: if ( ++p == pe ) goto _test_eof60; case 60: switch( (*p) ) { case 95: goto tr80; case 109: goto st61; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st61: if ( ++p == pe ) goto _test_eof61; case 61: switch( (*p) ) { case 95: goto tr80; case 109: goto st62; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st62: if ( ++p == pe ) goto _test_eof62; case 62: switch( (*p) ) { case 95: goto tr80; case 105: goto st63; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st63: if ( ++p == pe ) goto _test_eof63; case 63: switch( (*p) ) { case 95: goto tr80; case 116: goto tr115; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st64: if ( ++p == pe ) goto _test_eof64; case 64: switch( (*p) ) { case 95: goto tr80; case 105: goto st65; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st65: if ( ++p == pe ) goto _test_eof65; case 65: switch( (*p) ) { case 95: goto tr80; case 110: goto st66; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st66: if ( ++p == pe ) goto _test_eof66; case 66: switch( (*p) ) { case 95: goto tr80; case 97: goto st67; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 98 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st67: if ( ++p == pe ) goto _test_eof67; case 67: switch( (*p) ) { case 95: goto tr80; case 108: goto tr119; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st68: if ( ++p == pe ) goto _test_eof68; case 68: switch( (*p) ) { case 95: goto tr80; case 110: goto st69; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st69: if ( ++p == pe ) goto _test_eof69; case 69: switch( (*p) ) { case 95: goto tr80; case 99: goto st70; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st70: if ( ++p == pe ) goto _test_eof70; case 70: switch( (*p) ) { case 95: goto tr80; case 108: goto st71; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st71: if ( ++p == pe ) goto _test_eof71; case 71: switch( (*p) ) { case 95: goto tr80; case 117: goto st72; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st72: if ( ++p == pe ) goto _test_eof72; case 72: switch( (*p) ) { case 95: goto tr80; case 100: goto st73; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st73: if ( ++p == pe ) goto _test_eof73; case 73: switch( (*p) ) { case 95: goto tr80; case 101: goto tr125; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st74: if ( ++p == pe ) goto _test_eof74; case 74: switch( (*p) ) { case 95: goto tr80; case 111: goto st75; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st75: if ( ++p == pe ) goto _test_eof75; case 75: switch( (*p) ) { case 95: goto tr80; case 110: goto st76; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st76: if ( ++p == pe ) goto _test_eof76; case 76: switch( (*p) ) { case 95: goto tr80; case 116: goto st77; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st77: if ( ++p == pe ) goto _test_eof77; case 77: switch( (*p) ) { case 95: goto tr80; case 101: goto st78; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st78: if ( ++p == pe ) goto _test_eof78; case 78: switch( (*p) ) { case 95: goto tr80; case 114: goto st79; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st79: if ( ++p == pe ) goto _test_eof79; case 79: switch( (*p) ) { case 95: goto tr80; case 109: goto tr131; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st80: if ( ++p == pe ) goto _test_eof80; case 80: switch( (*p) ) { case 95: goto tr80; case 97: goto st81; case 114: goto st85; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 98 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st81: if ( ++p == pe ) goto _test_eof81; case 81: switch( (*p) ) { case 95: goto tr80; case 114: goto st82; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st82: if ( ++p == pe ) goto _test_eof82; case 82: switch( (*p) ) { case 95: goto tr80; case 115: goto st83; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st83: if ( ++p == pe ) goto _test_eof83; case 83: switch( (*p) ) { case 95: goto tr80; case 101: goto st84; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st84: if ( ++p == pe ) goto _test_eof84; case 84: switch( (*p) ) { case 95: goto tr80; case 114: goto tr137; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st85: if ( ++p == pe ) goto _test_eof85; case 85: switch( (*p) ) { case 95: goto tr80; case 105: goto tr138; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st86: if ( ++p == pe ) goto _test_eof86; case 86: switch( (*p) ) { case 95: goto tr80; case 104: goto st87; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st87: if ( ++p == pe ) goto _test_eof87; case 87: switch( (*p) ) { case 95: goto tr80; case 111: goto st88; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st88: if ( ++p == pe ) goto _test_eof88; case 88: switch( (*p) ) { case 95: goto tr80; case 114: goto st89; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st89: if ( ++p == pe ) goto _test_eof89; case 89: switch( (*p) ) { case 95: goto tr80; case 116: goto st90; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st90: if ( ++p == pe ) goto _test_eof90; case 90: switch( (*p) ) { case 95: goto tr80; case 101: goto st91; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st91: if ( ++p == pe ) goto _test_eof91; case 91: switch( (*p) ) { case 95: goto tr80; case 115: goto st92; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st92: if ( ++p == pe ) goto _test_eof92; case 92: switch( (*p) ) { case 95: goto tr80; case 116: goto tr145; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st93: if ( ++p == pe ) goto _test_eof93; case 93: switch( (*p) ) { case 95: goto tr80; case 111: goto st94; case 114: goto st97; case 121: goto st104; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st94: if ( ++p == pe ) goto _test_eof94; case 94: switch( (*p) ) { case 95: goto tr80; case 107: goto st95; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st95: if ( ++p == pe ) goto _test_eof95; case 95: switch( (*p) ) { case 95: goto tr80; case 101: goto st96; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st96: if ( ++p == pe ) goto _test_eof96; case 96: switch( (*p) ) { case 95: goto tr80; case 110: goto tr151; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st97: if ( ++p == pe ) goto _test_eof97; case 97: switch( (*p) ) { case 95: goto tr80; case 97: goto st98; case 121: goto tr153; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 98 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st98: if ( ++p == pe ) goto _test_eof98; case 98: switch( (*p) ) { case 95: goto tr80; case 110: goto st99; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st99: if ( ++p == pe ) goto _test_eof99; case 99: switch( (*p) ) { case 95: goto tr80; case 115: goto st100; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st100: if ( ++p == pe ) goto _test_eof100; case 100: switch( (*p) ) { case 95: goto tr80; case 108: goto st101; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st101: if ( ++p == pe ) goto _test_eof101; case 101: switch( (*p) ) { case 95: goto tr80; case 97: goto st102; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 98 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st102: if ( ++p == pe ) goto _test_eof102; case 102: switch( (*p) ) { case 95: goto tr80; case 116: goto st103; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st103: if ( ++p == pe ) goto _test_eof103; case 103: switch( (*p) ) { case 95: goto tr80; case 101: goto tr159; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st104: if ( ++p == pe ) goto _test_eof104; case 104: switch( (*p) ) { case 95: goto tr80; case 112: goto st105; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st105: if ( ++p == pe ) goto _test_eof105; case 105: switch( (*p) ) { case 95: goto tr80; case 101: goto tr161; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st106: if ( ++p == pe ) goto _test_eof106; case 106: switch( (*p) ) { case 95: goto tr80; case 110: goto st107; case 115: goto st109; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st107: if ( ++p == pe ) goto _test_eof107; case 107: switch( (*p) ) { case 95: goto tr80; case 100: goto st108; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st108: if ( ++p == pe ) goto _test_eof108; case 108: switch( (*p) ) { case 95: goto tr80; case 111: goto tr165; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st109: if ( ++p == pe ) goto _test_eof109; case 109: switch( (*p) ) { case 95: goto tr80; case 101: goto st110; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st110: if ( ++p == pe ) goto _test_eof110; case 110: switch( (*p) ) { case 95: goto tr80; case 115: goto tr167; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st111: if ( ++p == pe ) goto _test_eof111; case 111: switch( (*p) ) { case 95: goto tr80; case 114: goto st112; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st112: if ( ++p == pe ) goto _test_eof112; case 112: switch( (*p) ) { case 95: goto tr80; case 105: goto st113; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st113: if ( ++p == pe ) goto _test_eof113; case 113: switch( (*p) ) { case 95: goto tr80; case 116: goto st114; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; st114: if ( ++p == pe ) goto _test_eof114; case 114: switch( (*p) ) { case 95: goto tr80; case 101: goto tr171; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) goto tr80; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) goto tr80; } else goto tr80; goto tr98; tr92: #line 1 "NONE" {te = p+1;} goto st115; st115: if ( ++p == pe ) goto _test_eof115; case 115: #line 2607 "klscan.cpp" if ( (*p) == 37 ) goto st20; goto tr94; st20: if ( ++p == pe ) goto _test_eof20; case 20: if ( (*p) == 37 ) goto tr32; goto tr24; } _test_eof21: cs = 21; goto _test_eof; _test_eof22: cs = 22; goto _test_eof; _test_eof23: cs = 23; goto _test_eof; _test_eof1: cs = 1; goto _test_eof; _test_eof2: cs = 2; goto _test_eof; _test_eof24: cs = 24; goto _test_eof; _test_eof25: cs = 25; goto _test_eof; _test_eof26: cs = 26; goto _test_eof; _test_eof3: cs = 3; goto _test_eof; _test_eof4: cs = 4; goto _test_eof; _test_eof27: cs = 27; goto _test_eof; _test_eof5: cs = 5; goto _test_eof; _test_eof6: cs = 6; goto _test_eof; _test_eof7: cs = 7; goto _test_eof; _test_eof28: cs = 28; goto _test_eof; _test_eof29: cs = 29; goto _test_eof; _test_eof30: cs = 30; goto _test_eof; _test_eof31: cs = 31; goto _test_eof; _test_eof32: cs = 32; goto _test_eof; _test_eof8: cs = 8; goto _test_eof; _test_eof9: cs = 9; goto _test_eof; _test_eof33: cs = 33; goto _test_eof; _test_eof34: cs = 34; goto _test_eof; _test_eof35: cs = 35; goto _test_eof; _test_eof10: cs = 10; goto _test_eof; _test_eof11: cs = 11; goto _test_eof; _test_eof36: cs = 36; goto _test_eof; _test_eof12: cs = 12; goto _test_eof; _test_eof13: cs = 13; goto _test_eof; _test_eof14: cs = 14; goto _test_eof; _test_eof37: cs = 37; goto _test_eof; _test_eof38: cs = 38; goto _test_eof; _test_eof39: cs = 39; goto _test_eof; _test_eof40: cs = 40; goto _test_eof; _test_eof41: cs = 41; goto _test_eof; _test_eof42: cs = 42; goto _test_eof; _test_eof43: cs = 43; goto _test_eof; _test_eof44: cs = 44; goto _test_eof; _test_eof15: cs = 15; goto _test_eof; _test_eof16: cs = 16; goto _test_eof; _test_eof45: cs = 45; goto _test_eof; _test_eof17: cs = 17; goto _test_eof; _test_eof46: cs = 46; goto _test_eof; _test_eof18: cs = 18; goto _test_eof; _test_eof19: cs = 19; goto _test_eof; _test_eof47: cs = 47; goto _test_eof; _test_eof48: cs = 48; goto _test_eof; _test_eof49: cs = 49; goto _test_eof; _test_eof50: cs = 50; goto _test_eof; _test_eof51: cs = 51; goto _test_eof; _test_eof52: cs = 52; goto _test_eof; _test_eof53: cs = 53; goto _test_eof; _test_eof54: cs = 54; goto _test_eof; _test_eof55: cs = 55; goto _test_eof; _test_eof56: cs = 56; goto _test_eof; _test_eof57: cs = 57; goto _test_eof; _test_eof58: cs = 58; goto _test_eof; _test_eof59: cs = 59; goto _test_eof; _test_eof60: cs = 60; goto _test_eof; _test_eof61: cs = 61; goto _test_eof; _test_eof62: cs = 62; goto _test_eof; _test_eof63: cs = 63; goto _test_eof; _test_eof64: cs = 64; goto _test_eof; _test_eof65: cs = 65; goto _test_eof; _test_eof66: cs = 66; goto _test_eof; _test_eof67: cs = 67; goto _test_eof; _test_eof68: cs = 68; goto _test_eof; _test_eof69: cs = 69; goto _test_eof; _test_eof70: cs = 70; goto _test_eof; _test_eof71: cs = 71; goto _test_eof; _test_eof72: cs = 72; goto _test_eof; _test_eof73: cs = 73; goto _test_eof; _test_eof74: cs = 74; goto _test_eof; _test_eof75: cs = 75; goto _test_eof; _test_eof76: cs = 76; goto _test_eof; _test_eof77: cs = 77; goto _test_eof; _test_eof78: cs = 78; goto _test_eof; _test_eof79: cs = 79; goto _test_eof; _test_eof80: cs = 80; goto _test_eof; _test_eof81: cs = 81; goto _test_eof; _test_eof82: cs = 82; goto _test_eof; _test_eof83: cs = 83; goto _test_eof; _test_eof84: cs = 84; goto _test_eof; _test_eof85: cs = 85; goto _test_eof; _test_eof86: cs = 86; goto _test_eof; _test_eof87: cs = 87; goto _test_eof; _test_eof88: cs = 88; goto _test_eof; _test_eof89: cs = 89; goto _test_eof; _test_eof90: cs = 90; goto _test_eof; _test_eof91: cs = 91; goto _test_eof; _test_eof92: cs = 92; goto _test_eof; _test_eof93: cs = 93; goto _test_eof; _test_eof94: cs = 94; goto _test_eof; _test_eof95: cs = 95; goto _test_eof; _test_eof96: cs = 96; goto _test_eof; _test_eof97: cs = 97; goto _test_eof; _test_eof98: cs = 98; goto _test_eof; _test_eof99: cs = 99; goto _test_eof; _test_eof100: cs = 100; goto _test_eof; _test_eof101: cs = 101; goto _test_eof; _test_eof102: cs = 102; goto _test_eof; _test_eof103: cs = 103; goto _test_eof; _test_eof104: cs = 104; goto _test_eof; _test_eof105: cs = 105; goto _test_eof; _test_eof106: cs = 106; goto _test_eof; _test_eof107: cs = 107; goto _test_eof; _test_eof108: cs = 108; goto _test_eof; _test_eof109: cs = 109; goto _test_eof; _test_eof110: cs = 110; goto _test_eof; _test_eof111: cs = 111; goto _test_eof; _test_eof112: cs = 112; goto _test_eof; _test_eof113: cs = 113; goto _test_eof; _test_eof114: cs = 114; goto _test_eof; _test_eof115: cs = 115; goto _test_eof; _test_eof20: cs = 20; goto _test_eof; _test_eof: {} if ( p == eof ) { switch ( cs ) { case 22: goto tr43; case 23: goto tr44; case 1: goto tr0; case 2: goto tr0; case 24: goto tr44; case 25: goto tr46; case 26: goto tr44; case 3: goto tr0; case 4: goto tr0; case 27: goto tr44; case 5: goto tr0; case 6: goto tr0; case 7: goto tr0; case 28: goto tr48; case 29: goto tr49; case 31: goto tr62; case 32: goto tr63; case 8: goto tr12; case 9: goto tr12; case 33: goto tr63; case 34: goto tr66; case 35: goto tr63; case 10: goto tr12; case 11: goto tr12; case 36: goto tr63; case 12: goto tr12; case 13: goto tr12; case 14: goto tr12; case 37: goto tr67; case 38: goto tr63; case 39: goto tr68; case 41: goto tr72; case 43: goto tr93; case 44: goto tr94; case 15: goto tr24; case 16: goto tr24; case 45: goto tr94; case 17: goto tr24; case 46: goto tr94; case 18: goto tr24; case 19: goto tr24; case 47: goto tr96; case 48: goto tr97; case 49: goto tr98; case 50: goto tr98; case 51: goto tr98; case 52: goto tr98; case 53: goto tr98; case 54: goto tr104; case 55: goto tr104; case 56: goto tr98; case 57: goto tr98; case 58: goto tr98; case 59: goto tr98; case 60: goto tr98; case 61: goto tr98; case 62: goto tr98; case 63: goto tr98; case 64: goto tr98; case 65: goto tr98; case 66: goto tr98; case 67: goto tr98; case 68: goto tr98; case 69: goto tr98; case 70: goto tr98; case 71: goto tr98; case 72: goto tr98; case 73: goto tr98; case 74: goto tr98; case 75: goto tr98; case 76: goto tr98; case 77: goto tr98; case 78: goto tr98; case 79: goto tr98; case 80: goto tr98; case 81: goto tr98; case 82: goto tr98; case 83: goto tr98; case 84: goto tr98; case 85: goto tr98; case 86: goto tr98; case 87: goto tr98; case 88: goto tr98; case 89: goto tr98; case 90: goto tr98; case 91: goto tr98; case 92: goto tr98; case 93: goto tr98; case 94: goto tr98; case 95: goto tr98; case 96: goto tr98; case 97: goto tr98; case 98: goto tr98; case 99: goto tr98; case 100: goto tr98; case 101: goto tr98; case 102: goto tr98; case 103: goto tr98; case 104: goto tr98; case 105: goto tr98; case 106: goto tr98; case 107: goto tr98; case 108: goto tr98; case 109: goto tr98; case 110: goto tr98; case 111: goto tr98; case 112: goto tr98; case 113: goto tr98; case 114: goto tr98; case 115: goto tr94; case 20: goto tr24; } } _out: {} } #line 521 "klscan.rl" /* Check if we failed. */ if ( cs == klscan_error ) { /* Machine failed before finding a token. */ cout << "PARSE ERROR" << endl; exit(1); } /* Decide if we need to preserve anything. */ char *preserve = ts; if ( inline_start != 0 && ( preserve == 0 || inline_start < preserve ) ) preserve = inline_start; /* Now set up the prefix. */ if ( preserve == 0 ) have = 0; else { /* There is data that needs to be shifted over. */ have = pe - preserve; memmove( buf, preserve, have ); unsigned int shiftback = preserve - buf; if ( ts != 0 ) ts -= shiftback; if ( inline_start != 0 ) inline_start -= shiftback; te -= shiftback; litstart -= shiftback; litend -= shiftback; identstart -= shiftback; identend -= shiftback; preserve = buf; } } delete[] buf; } void scan( const char *fileName, istream &input ) { ParserDict parserDict; Scanner scanner( fileName, input, parserDict, 0 ); scanner.do_scan(); /* This uses the most recent parser definition. */ if ( ::generateGraphviz && ::graphvizGenParser != 0 ) graphvizGenParser->pd.generateGraphviz(); } kelbt-0.15/kelbt/Makefile.in0000664000175000017500000000317211707046235016256 0ustar thurstonthurston# # Copyright 2001-2003, 2005 Adrian Thurston # # This file is part of Kelbt # # Kelbt is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Kelbt is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Kelbt; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA INCS = -I../aapl DEFS = CFLAGS = -g -Wall LDFLAGS = CC_SRCS = \ pcheck.cpp main.cpp parsedata.cpp closure.cpp fsmbase.cpp fsmattach.cpp \ fsmgraph.cpp codegen.cpp gvdotgen.cpp klscan.cpp klparse.cpp LIBS = @LIBS@ prefix = @prefix@ #************************************* # Programs CXX = @CXX@ # Get objects and dependencies from sources. OBJS = $(CC_SRCS:%.cpp=%.o) DEPS = $(CC_SRCS:%.cpp=.%.d) # Get the version info. include ../version.mk # Rules. all: kelbt kelbt: $(GEN_SRC) $(OBJS) $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) %.o: %.cpp @$(CXX) -M $(DEFS) $(INCS) $< > .$*.d $(CXX) -c $(CFLAGS) $(DEFS) $(INCS) -o $@ $< install: all install -d $(prefix)/bin install -s kelbt $(prefix)/bin/kelbt distclean: clean rm -f Makefile clean: rm -Rf kelbt tags .*.d *.o klscan.cpp klparse.h klparse.cpp version.h -include $(DEPS) kelbt-0.15/kelbt/version.h0000664000175000017500000000006211707046235016042 0ustar thurstonthurston#define VERSION "0.15" #define PUBDATE "Jan 2012" kelbt-0.15/kelbt/buffer.h0000664000175000017500000000260211072514631015623 0ustar thurstonthurston/* * Copyright 2003, 2005 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _BUFFER_H #define _BUFFER_H /* An automatically grown buffer for collecting tokens. Always reuses space; * never down resizes. */ struct Buffer { Buffer(); ~Buffer(); void append( char c ) { if ( length+1 > allocated ) upAllocate( (length+1)*2 ); data[length++] = c; } void append( char *p, int l ) { if ( length+l > allocated ) upAllocate( (length+l)*2 ); memcpy( data+length, p, l ); length += l; } void clear() { length = 0; } char *data; int length; private: int allocated; void upAllocate( int len ); void empty(); }; #endif /* _BUFFER_H */ kelbt-0.15/kelbt/gvdotgen.cpp0000664000175000017500000000543211072514631016526 0ustar thurstonthurston/* * Copyright 2001-2005 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "kelbt.h" #include "parsedata.h" using namespace std; void ParseData::writeTransList( StateAp *state ) { for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) { /* Write out the from and to states. */ out << "\t" << state->stateNum << " -> " << trans->value->toState->stateNum; /* Begin the label. */ out << " [ label = \""; long key = trans->key; KlangEl *lel = langElIndex[key]; if ( lel != 0 ) out << lel->data; else out << (char)key; if ( trans->value->actions.length() > 0 ) { out << " / "; for ( ActDataList::Iter act = trans->value->actions; act.lte(); act++ ) { switch ( *act & 0x3 ) { case 1: out << "S(" << trans->value->actOrds[act.pos()] << ")"; break; case 2: { out << "R(" << prodIdIndex[(*act >> 2)]->data << ", " << trans->value->actOrds[act.pos()] << ")"; break; } case 3: { out << "SR(" << prodIdIndex[(*act >> 2)]->data << ", " << trans->value->actOrds[act.pos()] << ")"; break; }} if ( ! act.last() ) out << ", "; } } out << "\" ];\n"; } } void ParseData::writeDotFile( FsmAp *graph ) { out << "digraph " << parserName << " {\n" " rankdir=LR;\n" " ranksep=\"0\"\n" " nodesep=\"0.25\"\n" "\n"; /* Define the psuedo states. Transitions will be done after the states * have been defined as either final or not final. */ out << " node [ shape = point ];\n" " ENTRY [ label = \"\" ];\n" "\n" " node [ shape = circle, fixedsize = true, height = 0.2 ];\n"; /* Walk the states. */ for ( StateList::Iter st = graph->stateList; st.lte(); st++ ) out << " " << st->stateNum << " [ label = \"\" ];\n"; out << "\n"; /* Walk the states. */ for ( StateList::Iter st = graph->stateList; st.lte(); st++ ) writeTransList( st ); /* Transitions into the start state. */ out << " ENTRY -> " << graph->startState->stateNum << " [ label = \"\" ];\n"; out << "}\n"; } void ParseData::writeDotFile( ) { writeDotFile( graph ); } kelbt-0.15/kelbt/fsmbase.cpp0000664000175000017500000001341211072514631016326 0ustar thurstonthurston/* * Copyright 2001, 2005 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "fsmgraph.h" using std::cerr; using std::endl; /* Create a new fsm state. State has not out transitions or in transitions, not * out out transition data and not number. */ StateAp::StateAp() : /* No in transitions. */ inRange(), /* No entry points, or epsilon trans. */ pendingCommits(), stateSet(0), /* Only used during merging. Normally null. */ stateDictEl(0), /* No state identification bits. */ stateBits(0), onClosureQueue(false), inClosedMap(false), followMarked(false) { } /* Copy everything except actual the transitions. That is left up to the * FsmAp copy constructor. */ StateAp::StateAp(const StateAp &other) : inRange(), /* Duplicate the entry id set, epsilon transitions and context sets. These * are sets of integers and as such need no fixing. */ pendingCommits(other.pendingCommits), stateSet(0), /* This is only used during merging. Normally null. */ stateDictEl(0), /* Fsm state data. */ stateBits(other.stateBits), dotSet(other.dotSet), onClosureQueue(false), inClosedMap(false), followMarked(false), transMap() { /* Duplicate all the transitions. */ for ( TransMap::Iter trans = other.transMap; trans.lte(); trans++ ) { /* Dupicate and store the orginal target in the transition. This will * be corrected once all the states have been created. */ TransAp *newTrans = new TransAp(*trans->value); newTrans->toState = trans->value->toState; transMap.append( TransMapEl( newTrans->lowKey, newTrans ) ); } } /* If there is a state dict element, then delete it. Everything else is left * up to the FsmGraph destructor. */ StateAp::~StateAp() { if ( stateDictEl != 0 ) delete stateDictEl; } /* Graph constructor. */ FsmAp::FsmAp() : /* No start state. */ startState(0) { } /* Copy all graph data including transitions. */ FsmAp::FsmAp( const FsmAp &graph ) : /* Lists start empty. Will be filled by copy. */ stateList(), misfitList(), /* Copy in the entry points, * pointers will be resolved later. */ startState(graph.startState), /* Will be filled by copy. */ finStateSet() { /* Create the states and record their map in the original state. */ StateList::Iter origState = graph.stateList; for ( ; origState.lte(); origState++ ) { /* Make the new state. */ StateAp *newState = new StateAp( *origState ); /* Add the state to the list. */ stateList.append( newState ); /* Set the mapsTo item of the old state. */ origState->stateMap = newState; } /* Derefernce all the state maps. */ for ( StateList::Iter state = stateList; state.lte(); state++ ) { for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) { /* The points to the original in the src machine. The taget's duplicate * is in the statemap. */ StateAp *toState = trans->value->toState != 0 ? trans->value->toState->stateMap : 0; /* Attach The transition to the duplicate. */ trans->value->toState = 0; attachTrans( state, toState, trans->value ); } } /* Fix the start state pointer and the new start state's count of in * transiions. */ startState = startState->stateMap; /* Build the final state set. */ StateSet::Iter st = graph.finStateSet; for ( ; st.lte(); st++ ) finStateSet.insert((*st)->stateMap); } /* Deletes all transition data then deletes each state. */ FsmAp::~FsmAp() { /* Delete all the transitions. */ StateList::Iter state = stateList; for ( ; state.lte(); state++ ) { for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) delete trans->value; } /* Delete all the states. */ stateList.empty(); } /* Set a state final. The state has its isFinState set to true and the state * is added to the finStateSet. */ void FsmAp::setFinState( StateAp *state ) { /* Is it already a fin state. */ if ( state->stateBits & SB_ISFINAL ) return; state->stateBits |= SB_ISFINAL; finStateSet.insert( state ); } void FsmAp::unsetAllFinStates( ) { for ( StateSet::Iter st = finStateSet; st.lte(); st++ ) { StateAp *state = *st; state->stateBits &= ~ SB_ISFINAL; } finStateSet.empty(); } /* Set and unset a state as the start state. */ void FsmAp::setStartState( StateAp *state ) { /* Sould change from unset to set. */ assert( startState == 0 ); startState = state; } /* Mark all states reachable from state. Traverses transitions forward. Used * for removing states that have no path into them. */ void FsmAp::markReachableFromHere( StateAp *state ) { /* Base case: return; */ if ( state->stateBits & SB_ISMARKED ) return; /* Set this state as processed. We are going to visit all states that this * state has a transition to. */ state->stateBits |= SB_ISMARKED; /* Recurse on all out transitions. */ for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) { if ( trans->value->toState != 0 ) markReachableFromHere( trans->value->toState ); } } void FsmAp::setStateNumbers() { int curNum = 0; StateList::Iter state = stateList; for ( ; state.lte(); state++ ) state->stateNum = curNum++; } kelbt-0.15/kelbt/parsedata.h0000664000175000017500000003073511604455327016335 0ustar thurstonthurston/* * Copyright 2001-2005 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _PARSEDATA_H #define _PARSEDATA_H #include #include #include #include "avlmap.h" #include "bstmap.h" #include "dlist.h" #include "fsmgraph.h" #include "compare.h" #include "vector.h" #include "dlistmel.h" using std::ostream; using std::string; /* Forwards. */ struct RedFsmAp; struct KlangEl; #define SHIFT_CODE 0x1 #define REDUCE_CODE 0x2 #define SHIFT_REDUCE_CODE 0x3 inline long makeReduceCode( long reduction, bool isShiftReduce ) { return ( isShiftReduce ? SHIFT_REDUCE_CODE : REDUCE_CODE ) | ( reduction << 2 ); } /* Location in an input file. */ struct InputLoc { int line; int col; }; /* * Inline code tree */ struct InlineItem { enum Type { Text, Reference }; InlineItem( const InputLoc &loc, char *data, Type type ) : loc(loc), data(data), type(type) { } InlineItem( const InputLoc &loc, Type type ) : loc(loc), data(0), type(type) { } InputLoc loc; char *data; Type type; InlineItem *prev, *next; }; typedef DList InlineList; /* Element in a list of strings used for storing inline code blocks. */ struct InlineBlock { InlineBlock( const InputLoc &loc, InlineList *inlineList ) : loc(loc), inlineList(inlineList) { inlineList->head->data++; inlineList->tail->data[strlen(inlineList->tail->data)-1] = 0; } InputLoc loc; InlineList *inlineList; InlineBlock *prev, *next; }; /* List of inline code blocks. */ typedef DList InlineBlockList; /* Structure for reverse action mapping. */ struct RevActionMapEl { char *name; InputLoc location; }; struct Factor; struct ProdElList; struct Literal; struct Definition; struct DefListEl { Definition *prev, *next; }; struct LelDefListEl { Definition *prev, *next; }; typedef Vector< KlangEl* > KlangElVect; typedef Vector< Factor* > FactorVect; struct TypeDef { TypeDef( char *data ) : data(data), typeBlock(0), isClass(false) {} TypeDef( char *data, InlineBlock *typeBlock, bool isClass ) : data(data), typeBlock(typeBlock), isClass(isClass) {} char *data; InlineBlock *typeBlock; bool isClass; }; typedef BstMap< char*, TypeDef*, CmpStr > TypeDefMap; typedef BstMapEl< char*, TypeDef* > TypeDefMapEl; /* Graph dictionary. */ struct Definition : public DefListEl, public LelDefListEl { enum Type { Production }; Definition( const InputLoc &loc, KlangEl *prodName, ProdElList *prodElList, bool prodCommit, InlineBlock *redBlock, InlineBlock *undoBlock, InlineBlock *finalBlock, int prodId, Type type ) : loc(loc), prodName(prodName), prodElList(prodElList), prodCommit(prodCommit), redBlock(redBlock), undoBlock(undoBlock), finalBlock(finalBlock), prodId(prodId), type(type), fsm(0), fsmLength(0), data(0), uniqueEmptyLeader(0), isLeftRec(false) {} InputLoc loc; KlangEl *prodName; ProdElList *prodElList; bool prodCommit; InlineBlock *redBlock; InlineBlock *undoBlock; InlineBlock *finalBlock; int prodId; Type type; FsmAp *fsm; int fsmLength; char *data; KlangElVect rhsLelVect; FactorVect rhsFactorVect; LongSet reducesTo; KlangEl *uniqueEmptyLeader; ProdIdSet nonTermFirstSet; AlphSet firstSet; bool isLeftRec; }; struct CmpDefById { static int compare( Definition *d1, Definition *d2 ) { if ( d1->prodId < d2->prodId ) return -1; else if ( d1->prodId > d2->prodId ) return 1; else return 0; } }; /* Map dotItems to productions. */ typedef BstMap< int, Definition*, CmpOrd > DotItemIndex; typedef BstMapEl< int, Definition*> DotItemIndexEl; /* Symbol Map. */ typedef AvlMap< char*, KlangEl*, CmpStr > SymbolMap; typedef AvlMapEl< char*, KlangEl* > SymbolMapEl; /* A vector of production vectors. Each non terminal can have many productions. */ typedef DListMel DefList; typedef DListMel LelDefList; /* A set of machines made during a closure round. */ typedef Vector< FsmAp* > Machines; /* List of language elements. */ typedef DList LelList; /* Class to collect information about the machine during the * parse of input. */ struct ParseData { /* Create a new parse data object. This is done at the beginning of every * fsm specification. */ ParseData( const char *fileName, char *parserName, ostream &out ); void wrapUserStartSymbol(); void makeTokens(); void makeDefinitionNames(); void noUndefinedKlangEls(); void noUndefinedUses(); void makeKlangElIds(); /* Parser generation. */ void advanceReductions( long nextTime ); void sortActions(); void linkExpansions(); void lalr1FollowEpsilonOp(); void transferCommits( TransAp *trans, StateAp *state, long prodId ); void lalr1AddFollow2( TransAp *trans, FollowToAdd &followKeys ); void lalr1AddFollow1( StateAp *state ); void lalr1AddFollow2( TransAp *trans, long followKey, long prior ); void lalr1AddFollow1( TransAp *trans ); void lalr1AddFollowSets(); void lr0BringInItem( StateAp *dest, StateAp *prodState, TransAp *expandFrom, Definition *prod ); void lr0InvokeClosure( StateAp *state ); void lr0CloseAllStates(); void lalr1GenerateParser(); void reduceActions(); bool makeNonTermFirstSetProd( Definition *prod, StateAp *state ); void makeNonTermFirstSets(); bool makeFirstSetProd( Definition *prod, StateAp *state ); void makeFirstSets(); StateAp *followProd( StateAp *tabState, StateAp *prodState ); void findFollow( AlphSet &result, StateAp *overTab, StateAp *overSrc, Definition *parentDef ); long computeActOrds(); void actionOrdsFollow( StateAp *tabState, TransAp *tabTrans, TransAp *srcTrans, Definition *parentDef, Definition *definition, long &time ); void actionOrdsProd( StateAp *tabState, StateAp *srcState, Definition *parentDef, long &time ); void analyzeMachine(); void checkInlineListReferences( Definition *prod, InlineBlock *inlineBlock ); void checkReferences( Definition *prod ); void makeProdFsms(); void uniqueEmptyProductions(); void makeGraph(); /* Generate and write out the fsm. */ void generateInstanceData(); void generateTokenDefs(); void generateTypes(); void generateData(); void generateInit(); void generateExec(); void generateFinish(); void generateGraphviz(); /* * Querying the parse data */ /* * Code Generation. */ void startCodeGen(); void endCodeGen( int endLine ); void writeNonTermDestructors(); void writeFinishBlocks(); void writeFinalBlocks(); void writeReduceBlocks(); void writeUndoBlocks(); void writeTokenIds(); void writeLangEls(); void writeReferencePtr( InputLoc &loc, Definition *prod, char *data, int refNum ); void writeReference( InputLoc &loc, Definition *prod, char *data, int refNum ); void writeUndoReference( Definition *prod, char *data ); void writeFinalReference( Definition *prod, char *data ); void writeInlineBlock( Definition *prod, InlineBlock *inlineBlock ); void writeFirstLocate( Definition *prod ); void writeRhsLocate( Definition *prod ); ostream &UARRAY_TYPE( unsigned long long maxVal ); ostream &SARRAY_TYPE( signed long long maxVal ); ostream &ALLOCATE_EL( const char *name ); void writeInstanceData(); void writeTokenDefs(); void writeTypes(); void writeData(); void writeInit(); void writeExec(); void writeFinish(); string PARSER() { string ret = parserName; ret += "_"; return ret; } string Block() { return PARSER() + "Block"; } string LangEl() { return PARSER() + "LangEl"; } string Token() { string ret; if ( tokenStruct != 0 ) ret = tokenStruct; else ret = "Token"; return ret; } string Lel_() { return PARSER() + "Lel_"; } string UserData() { return PARSER() + "UserData"; } string startState() { return PARSER() + "startState"; } string indicies() { return PARSER() + "indicies"; } string keys() { return PARSER() + "keys"; } string offsets() { return PARSER() + "offsets"; } string targs() { return PARSER() + "targs"; } string actInds() { return PARSER() + "actInds"; } string actions() { return PARSER() + "actions"; } string commitLen() { return PARSER() + "commitLen"; } string prodLengths() { return PARSER() + "prodLengths"; } string prodLhsIds() { return PARSER() + "prodLhsIds"; } string prodNames() { return PARSER() + "prodNames"; } string lelNames() { return PARSER() + "lelNames"; } string ACCESS() { string ret; if ( access != 0 ) ret = access; return ret; } string curs() { return ACCESS() + "curs"; } string pool() { return ACCESS() + "pool"; } string freshEl() { return ACCESS() + "freshEl"; } string block() { return ACCESS() + "block"; } string stackTop() { return ACCESS() + "stackTop"; } string freshPos() { return ACCESS() + "freshPos"; } string lastFinal() { return ACCESS() + "lastFinal"; } string numRetry() { return ACCESS() + "numRetry"; } string numNodes() { return ACCESS() + "numNodes"; } string errCount() { return ACCESS() + "errCount"; } void printDotSet( ostream &out, long dotItem ); /* * Graphviz Generation */ void writeTransList(StateAp *state ); void writeDotFile(FsmAp *graph ); void writeDotFile( ); /* * Data collected during the parse. */ /* Dictionary of graphs. Both instances and non-instances go here. */ SymbolMap symbolMap; LelList langEls; /* The list of instances. */ DefList prodList; /* Dumping. */ DotItemIndex dotItemIndex; /* The name of the file the fsm is from, and the spec name. */ const char *fileName; char *parserName; ostream &out; InputLoc sectionLoc; /* How to access the instance data. */ char *access; /* The name of the token structure. */ char *tokenStruct; KlangEl *startKlangEl; KlangEl *eofKlangEl; KlangEl *errorKlangEl; KlangEl *userStartKlangEl; Definition *startDef; int nextSymbolId; int firstNonTermId; KlangEl **langElIndex; FsmAp *graph; StateAp *actionDestState; DefSetSet prodSetSet; ActionSet actionSet; /* Collected machine information. */ unsigned long long maxState; unsigned long long maxAction; unsigned long long maxLelId; unsigned long long maxOffset; unsigned long long maxIndex; unsigned long long maxProdLen; InlineBlock *elementBlock; InlineBlock *tokenBlock; InlineBlock *preReduceBlock; InlineBlock *postReduceBlock; InlineBlock *translateBlock; InlineBlock *undoTransBlock; InlineBlock *tokenFinalBlock; Definition **prodIdIndex; AlphSet literalSet; TypeDefMap typeDefMap; bool didTokens, didGraph, tokenIsClass; }; /* A language element class. Can be a nonTerm or a term. */ struct KlangEl : public DListEl { enum Type { Unknown, Term, NonTerm }; KlangEl( char *data, Type type ); ~KlangEl(); char *data; Type type; long id; bool isUserTerm; bool isContext; TypeDef *typeDef; char *displayString; int numAppearances; bool isShortest; /* Return a string that describes what the lang el is. * literal-term, term, regular, non-term */ const char *typeString(); /* Productions from the language element if it is a non-terminal. */ LelDefList defList; }; KlangEl *getKlangEl( ParseData *pd, char *data, KlangEl::Type defType ); struct Factor { /* Language elements a factor node can be. */ enum Type { LiteralType, ReferenceType }; /* Construct with a literal fsm. */ Factor( const InputLoc &loc, bool commit, Literal *literal, int priorVal ) : loc(loc), commit(commit), literal(literal), priorVal(priorVal), type(LiteralType) {} /* Construct with a reference to a var def. */ Factor( const InputLoc &loc, bool commit, KlangEl *langEl, int priorVal ) : loc(loc), commit(commit), langEl(langEl), priorVal(priorVal), type(ReferenceType) {} InputLoc loc; bool commit; Literal *literal; KlangEl *langEl; int priorVal; Type type; Factor *prev, *next; }; struct ProdElList : public DList { FsmAp *walk( ParseData *pd ); }; /* Some literal machine. Can be a number or literal string. */ struct Literal { Literal( const InputLoc &loc, long value ) : loc(loc), value(value) { } InputLoc loc; long value; }; #endif /* _PARSEDATA_H */ kelbt-0.15/kelbt/parsedata.cpp0000664000175000017500000010065711072521140016653 0ustar thurstonthurston/* * Copyright 2001-2007 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include /* Parsing. */ #include "kelbt.h" #include "parsedata.h" /* Dumping the fsm. */ #include "mergesort.h" using namespace std; char startDefName[] = "start"; void ParseData::printDotSet( ostream &out, long dotItem ) { long pos = 0, base = dotItem; DotItemIndexEl *iel; for (;;) { iel = dotItemIndex.find( base ); if ( iel != 0 ) break; base -= 1; } out << " " << iel->value->data << ":"; for ( ProdElList::Iter pli = *iel->value->prodElList; pli.lte(); pli++, pos++ ) { if ( pos == dotItem - base ) out << " ."; if ( pli->type == Factor::LiteralType ) out << " '" << (char)pli->literal->value << "'"; else out << " " << pli->langEl->data; } if ( pos == dotItem - base ) out << " ."; out << endl; } /* Count the transitions in the fsm by walking the state list. */ int countTransitions( FsmAp *fsm ) { int numTrans = 0; StateAp *state = fsm->stateList.head; while ( state != 0 ) { numTrans += state->transMap.length(); state = state->next; } return numTrans; } KlangEl::KlangEl( char *data, Type type ) : type(type), id(-1), isUserTerm(false), isContext(false), typeDef(0), displayString(0), numAppearances(0), isShortest(false) { /* If there is a data, take a copy. */ this->data = strdup(data); } /* Return a string that describes what the lang el is. * literal-term, term, regular, non-term */ const char *KlangEl::typeString() { switch ( type ) { case Term: return "term"; case NonTerm: return "non-term"; default: return 0; } } FsmAp *ProdElList::walk( ParseData *pd ) { FsmAp *prodFsm = new FsmAp(); StateAp *last = prodFsm->addState(); prodFsm->setStartState( last ); int prodLength = 0; for ( Iter prodEl = first(); prodEl.lte(); prodEl++, prodLength++ ) { //FsmAp *itemFsm = prodEl->walk( pd ); long value = 0; if ( prodEl->type == Factor::LiteralType ) value = prodEl->literal->value; else if ( Factor::ReferenceType ) value = prodEl->langEl->id; StateAp *newState = prodFsm->addState(); TransAp *newTrans = prodFsm->attachNewTrans( last, newState, value, value ); newTrans->isShift = true; newTrans->shiftPrior = prodEl->priorVal; //cerr << "PRIOR VAL: " << newTrans->shiftPrior << endl; if ( prodEl->commit ) { //cout << "COMMIT: inserting commit of length: " << pd->prodLength << endl; /* Insert the commit into transitions out of last */ for ( TransMap::Iter trans = last->transMap; trans.lte(); trans++ ) trans->value->commits.insert( prodLength ); } last = newState; } /* Make the last state the final state. */ prodFsm->setFinState( last ); return prodFsm; } /* * ParseData */ /* Initialize the structure that will collect info during the parse of a * machine. */ ParseData::ParseData( const char *fileName, char *parserName, ostream &out ) : /* 0 is reserved for global error actions. */ fileName(fileName), parserName(parserName), out(out), access(0), tokenStruct(0), startKlangEl(0), eofKlangEl(0), errorKlangEl(0), userStartKlangEl(0), startDef(0), nextSymbolId(0), firstNonTermId(0), elementBlock(0), tokenBlock(0), preReduceBlock(0), postReduceBlock(0), translateBlock(0), undoTransBlock(0), tokenFinalBlock(0), prodIdIndex(0), didTokens(false), didGraph(false), tokenIsClass(false) {} KlangEl *getKlangEl( ParseData *pd, char *data, KlangEl::Type defType ) { /* If the id is already in the dict, it will be placed in last found. If * it is not there then it will be inserted and last found will be set to it. */ SymbolMapEl *inDict = pd->symbolMap.find( data ); if ( inDict == 0 ) { /* Language element not there. Make the new lang el and insert.. */ KlangEl *langEl = new KlangEl( data, defType ); inDict = pd->symbolMap.insert( langEl->data, langEl ); pd->langEls.append( langEl ); } return inDict->value; } ProdElList *makeProdElList( char *name, KlangEl *langEl ) { ProdElList *prodElList = new ProdElList(); prodElList->append( new Factor( InputLoc(), false, langEl, 0 ) ); return prodElList; } void ParseData::makeDefinitionNames() { for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) { int prodNum = 1; for ( LelDefList::Iter def = lel->defList; def.lte(); def++ ) { def->data = new char[strlen(lel->data) + 30]; sprintf( def->data, "%s-%i", lel->data, prodNum++ ); } } } /* Make sure there there are no language elements whose type is unkonwn. This * can happen when an id is used on the rhs of a definition but is not defined * as anything. */ void ParseData::noUndefinedKlangEls() { for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) { if ( lel->type == KlangEl::Unknown ) error() << "'" << lel->data << "' was not defined as anything" << endl; } } void ParseData::noUndefinedUses() { for ( TypeDefMap::Iter tmel = typeDefMap; tmel.lte(); tmel++ ) { if ( tmel->value->typeBlock == 0 ) error() << "'" << tmel->value->data << "' is an undefined type" << endl; } } void ParseData::makeTokens( ) { if ( didTokens ) return; didTokens = true; /* Make an EOF language element. */ char *eofName = new char[strlen(parserName) + 16]; sprintf( eofName, "%s_tk_eof", parserName ); eofKlangEl = new KlangEl( eofName, KlangEl::Term ); langEls.append( eofKlangEl ); SymbolMapEl *eofMapEl = symbolMap.insert( eofKlangEl->data, eofKlangEl ); assert( eofMapEl != 0 ); nextSymbolId = 128; /* First pass assigns to the user terminals. */ for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) { /* Must be a term, and not any of the special reserved terminals. * Remember if the non terminal is a user non terminal. */ if ( lel->type == KlangEl::Term && lel != eofKlangEl && lel != errorKlangEl ) { lel->isUserTerm = true; lel->id = nextSymbolId++; } } /* Next assign to the eof token, which we always create. */ eofKlangEl->id = nextSymbolId++; } void ParseData::makeKlangElIds() { /* First pass assigns to the user terminals. */ for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) { if ( lel->id < 0 ) { /* Must be a term, and not any of the special reserved terminals. * Remember if the non terminal is a user non terminal. */ if ( lel->type == KlangEl::Term && lel != eofKlangEl && lel != errorKlangEl ) { lel->isUserTerm = true; lel->id = nextSymbolId++; } } } /* Possibly assign to the error language element. */ if ( errorKlangEl != 0 ) errorKlangEl->id = nextSymbolId++; /* Save this for for the code generation. */ firstNonTermId = nextSymbolId; /* A third and final pass assigns to everything else. */ for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) { /* Anything else not yet assigned gets assigned now. */ if ( lel->id < 0 ) lel->id = nextSymbolId++; } } void ParseData::checkInlineListReferences( Definition *prod, InlineBlock *inlineBlock ) { for ( InlineList::Iter ili = *inlineBlock->inlineList; ili.lte(); ili++ ) { if ( ili->type == InlineItem::Reference ) { if ( ili->data[1] != '$' && ili->data[1] != '@' ) { int refPos = atoi( ili->data+1 ) - 1; if ( refPos < 0 || refPos >= prod->rhsFactorVect.length() ) { error( ili->loc ) << "reference " << ili->data << " is out range for production" << endl; } } } } } void ParseData::checkReferences( Definition *prod ) { if ( prod->redBlock != 0 ) checkInlineListReferences( prod, prod->redBlock ); if ( prod->undoBlock != 0 ) checkInlineListReferences( prod, prod->undoBlock ); if ( prod->finalBlock != 0 ) checkInlineListReferences( prod, prod->finalBlock ); } /* Set up dot sets, shift info, and prod sets. */ void ParseData::makeProdFsms() { /* There are two items in the index for each production (high and low). */ int indexLen = prodList.length() * 2; dotItemIndex.setAsNew( indexLen ); int dsiLow = 0, indexPos = 0; /* Build FSMs for all production language elements. */ for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { /* Verify that rhs references are legal. */ checkReferences( prod ); prod->fsm = prod->prodElList->walk( this ); } makeNonTermFirstSets(); makeFirstSets(); /* Build FSMs for all production language elements. */ for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { if ( addUniqueEmptyProductions ) { /* This must be re-implemented. */ assert( false ); //if ( !prod->isLeftRec && prod->uniqueEmptyLeader != 0 ) { // FsmAp *emptyLeader = prod->uniqueEmptyLeader->walk( this ); // emptyLeader->concatOp( prod->fsm ); // prod->fsm = emptyLeader; //} } /* Compute the machine's length. */ prod->fsmLength = prod->fsm->fsmLength( ); /* Productions have a unique production id for each final state. * This lets us use a production length specific to each final state. * Start states are always isolated therefore if the start state is * final then reductions from it will always have a fixed production * length. This is a simple method for determining the length * of zero-length derivations when reducing. */ /* Number of dot items needed for the production is elements + 1 * because the dot can be before the first and after the last element. */ int numForProd = prod->fsm->stateList.length() + 1; /* Set up the low and high values in the index for this production. */ dotItemIndex.data[indexPos].key = dsiLow; dotItemIndex.data[indexPos].value = prod; dotItemIndex.data[indexPos+1].key = dsiLow + numForProd - 1; dotItemIndex.data[indexPos+1].value = prod; int dsi = dsiLow; for ( StateList::Iter state = prod->fsm->stateList; state.lte(); state++, dsi++ ) { /* All transitions are shifts. */ for ( TransMap::Iter out = state->transMap; out.lte(); out++ ) assert( out->value->isShift ); state->dotSet.insert( dsi ); } /* Move over the production. */ dsiLow += numForProd; indexPos += 2; if ( prod->prodCommit ) { for ( StateSet::Iter fin = prod->fsm->finStateSet; fin.lte(); fin++ ) { int length = prod->fsmLength; //cerr << "PENDING COMMIT IN FINAL STATE of " << prod->prodId << // " with len: " << length << endl; (*fin)->pendingCommits.insert( ProdIdPair( prod->prodId, length ) ); } } } /* Make the final state specific prod id to prod id mapping. */ prodIdIndex = new Definition*[prodList.length()]; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) prodIdIndex[prod->prodId] = prod; } /* Want the first set of over src. If the first set contains epsilon, go over * it and over tab. If overSrc is the end of the production, find the follow * from the table, taking only the characters on which the parent is reduced. * */ void ParseData::findFollow( AlphSet &result, StateAp *overTab, StateAp *overSrc, Definition *parentDef ) { if ( overSrc->isFinState() ) { assert( overSrc->transMap.length() == 0 ); /* At the end of the production. Turn to the table. */ long redCode = makeReduceCode( parentDef->prodId, false ); for ( TransMap::Iter tabTrans = overTab->transMap; tabTrans.lte(); tabTrans++ ) { for ( ActDataList::Iter adl = tabTrans->value->actions; adl.lte(); adl++ ) { if ( *adl == redCode ) { result.insert( tabTrans->key ); } } } } else { /* Get the first set of the item. If the first set contains epsilon * then move over overSrc and overTab and recurse. */ assert( overSrc->transMap.length() == 1 ); TransMap::Iter pastTrans = overSrc->transMap; KlangEl *langEl = langElIndex[pastTrans->key]; if ( langEl != 0 && langEl->type == KlangEl::NonTerm ) { bool hasEpsilon = false; for ( LelDefList::Iter def = langEl->defList; def.lte(); def++ ) { result.insert( def->firstSet ); if ( def->firstSet.find( -1 ) ) hasEpsilon = true; } /* Find the equivalent state in the parser. */ if ( hasEpsilon ) { TransAp *tabTrans = overTab->findTrans( pastTrans->key ); findFollow( result, tabTrans->toState, pastTrans->value->toState, parentDef ); } } else { result.insert( pastTrans->key ); } } } StateAp *ParseData::followProd( StateAp *tabState, StateAp *prodState ) { while ( prodState->transMap.length() == 1 ) { TransMap::Iter prodTrans = prodState->transMap; TransAp *tabTrans = tabState->findTrans( prodTrans->key ); prodState = prodTrans->value->toState; tabState = tabTrans->toState; } return tabState; } /* Go down a defintiion and then handle the follow actions. */ void ParseData::actionOrdsFollow( StateAp *tabState, TransAp *tabTrans, TransAp *srcTrans, Definition *parentDef, Definition *definition, long &time ) { /* We need the follow from tabState/srcState over the defintion we are * currently processing. */ StateAp *overTab = tabTrans->toState; StateAp *overSrc = srcTrans->toState; AlphSet alphSet; if ( parentDef == startDef ) alphSet.insert( eofKlangEl->id ); else findFollow( alphSet, overTab, overSrc, parentDef ); /* Now follow the production to find out where it expands to. */ StateAp *expandToState = followProd( tabState, definition->fsm->startState ); /* Find the reduce item. */ long redCode = makeReduceCode( definition->prodId, false ); for ( TransMap::Iter tt = expandToState->transMap; tt.lte(); tt++ ) { if ( alphSet.find( tt->key ) ) { for ( ActDataList::Iter adl = tt->value->actions; adl.lte(); adl++ ) { if ( *adl == redCode ) { if ( tt->value->actOrds[adl.pos()] == 0 ) { // cerr << "setting reduction(" << redCode << "): state = " // << expandToState->stateNum // << ", trans = " << tt->key // << ", time = " << time << endl; tt->value->actOrds[adl.pos()] = time++; } } } } } } void ParseData::actionOrdsProd( StateAp *tabState, StateAp *srcState, Definition *parentDef, long &time ) { assert( srcState->dotSet.length() == 1 ); if ( tabState->dotSet2.find( srcState->dotSet[0] ) ) return; tabState->dotSet2.insert( srcState->dotSet[0] ); assert( srcState->transMap.length() == 0 || srcState->transMap.length() == 1 ); if ( srcState->transMap.length() == 1 ) { TransMap::Iter srcTrans = srcState->transMap; /* Find the equivalent state in the parser. */ TransAp *tabTrans = tabState->findTrans( srcTrans->key ); /* Recurse into the transition if it is a non-terminal. */ KlangEl *langEl = langElIndex[srcTrans->key]; if ( langEl != 0 ) { if ( langEl->isShortest ) { /* Use a shortest match ordering for the contents of this * nonterminal. Does follows for all productions first, then * goes down the productions. */ for ( LelDefList::Iter expDef = langEl->defList; expDef.lte(); expDef++ ) { actionOrdsFollow( tabState, tabTrans, srcTrans->value, parentDef, expDef, time ); } for ( LelDefList::Iter expDef = langEl->defList; expDef.lte(); expDef++ ) actionOrdsProd( tabState, expDef->fsm->startState, expDef, time ); } else { /* The default action ordering. For each prod, goes down the * prod then sets the follow before going to the next prod. */ for ( LelDefList::Iter expDef = langEl->defList; expDef.lte(); expDef++ ) { actionOrdsProd( tabState, expDef->fsm->startState, expDef, time ); actionOrdsFollow( tabState, tabTrans, srcTrans->value, parentDef, expDef, time ); } } } /* Find the shift item. */ ActDataList::Iter adl = tabTrans->actions; for ( ; adl.lte(); adl++ ) { if ( *adl == SHIFT_CODE ) break; } /* If the time of the shift is not already set, set it. */ if ( tabTrans->actOrds[adl.pos()] == 0 ) { //cerr << "setting shift: state = " << tabState->stateNum // << ", trans = " << tabTrans->lowKey // << ", time = " << time << endl; tabTrans->actOrds[adl.pos()] = time++; } /* Go over one in the production. */ actionOrdsProd( tabTrans->toState, srcTrans->value->toState, parentDef, time ); } } long ParseData::computeActOrds() { for ( StateList::Iter state = graph->stateList; state.lte(); state++ ) { assert( (state->stateBits & SB_ISMARKED) == 0 ); /* Traverse the src state's transitions. */ long last = 0; for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) { if ( ! trans.first() ) assert( last < trans->key ); last = trans->key; } } /* Compute the action orderings, record the max value. */ long time = 1; StateAp *startState = startDef->fsm->startState; actionOrdsProd( graph->startState, startState, startDef, time ); /* Walk over the start lang el and set the time for shift of * the eof action that completes the parse. This could use some cleanup, * in particular a find routine. */ TransAp *overStart = graph->startState->findTrans( userStartKlangEl->id ); TransAp *eofTrans = overStart->toState->findTrans( eofKlangEl->id ); eofTrans->actOrds[0] = time++; for ( StateList::Iter state = graph->stateList; state.lte(); state++ ) { assert( CmpDotSet::compare( state->dotSet, state->dotSet2 ) == 0 ); for ( TransMap::Iter tel = state->transMap; tel.lte(); tel++ ) { TransAp *trans = tel->value; /* Check every action has an ordering. */ for ( ActDataList::Iter adl = trans->actOrds; adl.lte(); adl++ ) { if ( *adl == 0 ) { warning() << "action ordering for " << trans->actions[adl.pos()] << " is unset, state: " << state->stateNum << ", trans: "; KlangEl *lel = langElIndex[trans->lowKey]; if ( lel == 0 ) cerr << (char)trans->lowKey << endl; else cerr << lel->data << endl; *adl = time++; } } } } return time; } long min( Vector &v ) { Vector::Iter i = v; long m = *i; i++; for ( ; i.lte(); i++ ) { if ( *i < m ) m = *i; } return m; } void ParseData::advanceReductions( long nextTime ) { /* Loop all states. */ for ( StateList::Iter state = graph->stateList; state.lte(); state++ ) { bool outHasShift = false; long minTime = nextTime; ReductionMap outReds; LongSet outCommits; for ( TransMap::Iter out = state->transMap; out.lte(); out++ ) { /* Get the transition from the trans el. */ if ( out->value->isShift ) outHasShift = true; outReds.insert( out->value->reductions ); outCommits.insert( out->value->commits ); long nmt = min( out->value->actOrds ); if ( nmt < minTime ) minTime = nmt; } bool inHasShift = false; ReductionMap inReds; for ( TransInList::Iter in = state->inRange; in.lte(); in++ ) { /* Get the transition from the trans el. */ if ( in->isShift ) inHasShift = true; inReds.insert( in->reductions ); } if ( !outHasShift && outReds.length() == 1 && inHasShift && inReds.length() == 0 ) { //cerr << "moving reduction to shift" << endl; /* Move the reduction to all in transitions. */ for ( TransInList::Iter in = state->inRange; in.lte(); in++ ) { assert( in->actions.length() == 1 ); assert( in->actions[0] == SHIFT_CODE ); in->actions[0] = makeReduceCode( outReds[0].key, true ); in->actOrds[0] = minTime; in->afterShiftCommits.insert( outCommits ); } /* * Remove all transitions out of the state. */ /* Detach out range transitions. */ for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) { graph->detachTrans( state, trans->value->toState, trans->value ); delete trans->value; } state->transMap.empty(); /* Redirect all the in transitions to the actionDestState. */ graph->inTransMove( actionDestState, state ); } } graph->removeUnreachableStates(); long *map = new long[nextTime]; memset( map, 0, sizeof(long)*nextTime ); for ( StateList::Iter state = graph->stateList; state.lte(); state++ ) { for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) { for ( ActDataList::Iter t = trans->value->actOrds; t.lte(); t++ ) map[*t] = 1; } } for ( int i = 0, j = 1; i < nextTime; i++ ) { if ( map[i] ) map[i] = j++; } for ( StateList::Iter state = graph->stateList; state.lte(); state++ ) { for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) { for ( ActDataList::Iter t = trans->value->actOrds; t.lte(); t++ ) *t = map[*t]; } } delete[] map; } void ParseData::sortActions() { /* Sort the actions. */ for ( StateList::Iter state = graph->stateList; state.lte(); state++ ) { assert( CmpDotSet::compare( state->dotSet, state->dotSet2 ) == 0 ); for ( TransMap::Iter tel = state->transMap; tel.lte(); tel++ ) { TransAp *trans = tel->value; /* Sort by the action ords. */ ActDataList actions( trans->actions ); ActDataList actOrds( trans->actOrds ); ActDataList actPriors( trans->actPriors ); trans->actions.empty(); trans->actOrds.empty(); trans->actPriors.empty(); while ( actOrds.length() > 0 ) { int min = 0; for ( int i = 1; i < actOrds.length(); i++ ) { if ( actPriors[i] > actPriors[min] || (actPriors[i] == actPriors[min] && actOrds[i] < actOrds[min] ) ) { min = i; } } trans->actions.append( actions[min] ); trans->actOrds.append( actOrds[min] ); trans->actPriors.append( actPriors[min] ); actions.remove(min); actOrds.remove(min); actPriors.remove(min); } if ( branchPointInfo && trans->actions.length() > 1 ) { cout << "info: branch point" << " state: " << state->stateNum << " trans: "; KlangEl *lel = langElIndex[trans->lowKey]; if ( lel == 0 ) cout << (char)trans->lowKey << endl; else cout << lel->data << endl; cout << " actions:" << endl; for ( ActDataList::Iter act = trans->actions; act.lte(); act++ ) { switch ( *act & 0x3 ) { case 1: cout << " shift" << endl; break; case 2: cout << " reduce " << prodIdIndex[(*act >> 2)]->data << endl; break; case 3: cout << " shift-reduce" << endl; break; } } cout << " dot set of state:" << endl; for ( DotSet::Iter dsi = state->dotSet; dsi.lte(); dsi++ ) printDotSet( cout, *dsi ); } /* Verify that shifts of nonterminals don't have any branch * points or commits. */ if ( trans->lowKey >= firstNonTermId ) { if ( trans->actions.length() != 1 || (trans->actions[0] & 0x3) != 1 ) { error() << "TRANS ON NONTERMINAL is something " "other than a shift" << endl; } if ( trans->commits.length() > 0 ) error() << "TRANS ON NONTERMINAL has a commit" << endl; } /* TODO: Shift-reduces are optimizations. Verify that * shift-reduces exist only if they don't entail a conflict. */ } } } void ParseData::reduceActions() { /* Reduce the actions. */ for ( StateList::Iter state = graph->stateList; state.lte(); state++ ) { for ( TransMap::Iter tel = state->transMap; tel.lte(); tel++ ) { TransAp *trans = tel->value; ActionSetEl *inSet; int commitLen = trans->commits.length() > 0 ? trans->commits[trans->commits.length()-1] : 0; if ( trans->afterShiftCommits.length() > 0 ) { int afterShiftCommit = trans->afterShiftCommits[ trans->afterShiftCommits.length()-1]; if ( commitLen > 0 && commitLen+1 > afterShiftCommit ) commitLen = ( commitLen + 1 ); else commitLen = afterShiftCommit; } else { commitLen = commitLen * -1; } // if ( commitLen != 0 ) { // cerr << "FINAL ACTION COMMIT LEN: " << commitLen << endl; // } actionSet.insert( ActionData( trans->toState->stateNum, trans->actions, commitLen ), &inSet ); trans->actionSetEl = inSet; } } } void ParseData::analyzeMachine() { maxState = graph->stateList.length() - 1; maxLelId = nextSymbolId - 1; maxOffset = graph->stateList.length() * maxLelId; for ( StateList::Iter state = graph->stateList; state.lte(); state++ ) { for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) { if ( trans->value->isShift ) { trans->value->actions.append( SHIFT_CODE ); trans->value->actPriors.append( trans->value->shiftPrior ); } for ( ReductionMap::Iter red = trans->value->reductions; red.lte(); red++ ) { trans->value->actions.append( makeReduceCode( red->key, false ) ); trans->value->actPriors.append( red->value ); } trans->value->actOrds.appendDup( 0, trans->value->actions.length() ); } } long nextTime = computeActOrds(); sortActions(); advanceReductions( nextTime ); graph->setStateNumbers(); reduceActions(); /* Set the action ids. */ int actionSetId = 0; for ( ActionSet::Iter asi = actionSet; asi.lte(); asi++ ) asi->key.id = actionSetId++; /* Get the max index. */ maxIndex = actionSetId - 1; /* Compute the max prod length. */ maxProdLen = 0; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { if ( (unsigned)prod->fsmLength > maxProdLen ) maxProdLen = prod->fsmLength; } } void ParseData::wrapUserStartSymbol() { SymbolMapEl *startMapEl = symbolMap.find( startDefName ); if ( startMapEl == 0 ) { /* No recovery action, fsm is skipped. */ error(sectionLoc) << "start non-terminal not defined in \"" << parserName << "\"" << endl; return; } userStartKlangEl = startMapEl->value; /* Make a language element that will go to the start symbol only. This will * guarantee a start symbol with only one production. A name with an underscore * at the beginning will never clash with any user name. */ startKlangEl = new KlangEl( strdup("_start"), KlangEl::NonTerm ); langEls.append( startKlangEl ); startMapEl = symbolMap.insert( startKlangEl->data, startKlangEl ); assert( startMapEl != 0 ); /* Make a single production for the start element. */ ProdElList *startProdElList = makeProdElList( startKlangEl->data, userStartKlangEl ); startDef = new Definition( InputLoc(), startKlangEl, startProdElList, false, 0, 0, 0, prodList.length(), Definition::Production ); prodList.append( startDef ); startKlangEl->defList.append( startDef ); } bool ParseData::makeNonTermFirstSetProd( Definition *prod, StateAp *state ) { bool modified = false; for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) { if ( trans->key >= firstNonTermId ) { long *inserted = prod->nonTermFirstSet.insert( trans->key ); if ( inserted != 0 ) modified = true; bool hasEpsilon = false; KlangEl *lel = langElIndex[trans->key]; for ( LelDefList::Iter ldef = lel->defList; ldef.lte(); ldef++ ) { for ( ProdIdSet::Iter pid = ldef->nonTermFirstSet; pid.lte(); pid++ ) { if ( *pid == -1 ) hasEpsilon = true; else { long *inserted = prod->nonTermFirstSet.insert( *pid ); if ( inserted != 0 ) modified = true; } } } if ( hasEpsilon ) { if ( trans->value->toState->isFinState() ) { long *inserted = prod->nonTermFirstSet.insert( -1 ); if ( inserted != 0 ) modified = true; } bool lmod = makeNonTermFirstSetProd( prod, trans->value->toState ); if ( lmod ) modified = true; } } } return modified; } void ParseData::makeNonTermFirstSets() { // cerr << "MAKING NONTERM FIRST SETS" << endl; bool modified = true; while ( modified ) { modified = false; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { if ( prod->fsm->startState->isFinState() ) { long *inserted = prod->nonTermFirstSet.insert( -1 ); if ( inserted != 0 ) modified = true; } bool lmod = makeNonTermFirstSetProd( prod, prod->fsm->startState ); if ( lmod ) modified = true; } } for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { // cerr << prod->data << ": "; // for ( ProdIdSet::Iter pid = prod->nonTermFirstSet; pid.lte(); pid++ ) // { // if ( *pid < 0 ) // cerr << " "; // else { // KlangEl *lel = langElIndex[*pid]; // cerr << " " << lel->data; // } // } // cerr << endl; if ( prod->nonTermFirstSet.find( prod->prodName->id ) ) { // cerr << "PROD IS LEFT REC: " << prod->data << endl; prod->isLeftRec = true; } } } bool ParseData::makeFirstSetProd( Definition *prod, StateAp *state ) { bool modified = false; for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) { if ( trans->key < firstNonTermId ) { long *inserted = prod->firstSet.insert( trans->key ); if ( inserted != 0 ) modified = true; } else { long *inserted = prod->firstSet.insert( trans->key ); if ( inserted != 0 ) modified = true; bool hasEpsilon = false; KlangEl *lel = langElIndex[trans->key]; for ( LelDefList::Iter ldef = lel->defList; ldef.lte(); ldef++ ) { for ( ProdIdSet::Iter pid = ldef->firstSet; pid.lte(); pid++ ) { if ( *pid == -1 ) hasEpsilon = true; else { long *inserted = prod->firstSet.insert( *pid ); if ( inserted != 0 ) modified = true; } } } if ( hasEpsilon ) { if ( trans->value->toState->isFinState() ) { long *inserted = prod->firstSet.insert( -1 ); if ( inserted != 0 ) modified = true; } bool lmod = makeFirstSetProd( prod, trans->value->toState ); if ( lmod ) modified = true; } } } return modified; } void ParseData::makeFirstSets() { // cerr << "MAKING TERM FIRST SETS" << endl; bool modified = true; while ( modified ) { modified = false; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { if ( prod->fsm->startState->isFinState() ) { long *inserted = prod->firstSet.insert( -1 ); if ( inserted != 0 ) modified = true; } bool lmod = makeFirstSetProd( prod, prod->fsm->startState ); if ( lmod ) modified = true; } } // for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { // cerr << prod->data << ": "; // for ( ProdIdSet::Iter pid = prod->firstSet; pid.lte(); pid++ ) // { // if ( *pid < 0 ) // cerr << " "; // else { // KlangEl *lel = langElIndex[*pid]; // if ( lel != 0 ) // cerr << endl << " " << lel->data; // else // cerr << endl << " " << *pid; // } // } // cerr << endl; // } } void ParseData::uniqueEmptyProductions() { if ( addUniqueEmptyProductions ) { int limit = prodList.length(); for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { if ( prod->prodId == limit ) break; /* Get a language element. */ char name[20]; sprintf(name, "U%li", prodList.length()); KlangEl *prodName = getKlangEl( this, name, KlangEl::NonTerm ); Definition *newDef = new Definition( InputLoc(), prodName, 0 /* FIXME new VarDef( name, 0 )*/, false, 0, 0, 0, prodList.length(), Definition::Production ); prodName->defList.append( newDef ); prodList.append( newDef ); prod->uniqueEmptyLeader = prodName; } } } void ParseData::makeGraph() { if ( didGraph ) return; didGraph = true; makeTokens(); uniqueEmptyProductions(); wrapUserStartSymbol(); if ( gblErrorCount > 0 ) return; makeKlangElIds(); makeDefinitionNames(); noUndefinedKlangEls(); noUndefinedUses(); /* Put the language elements in an index by language element id. */ langElIndex = new KlangEl*[nextSymbolId+1]; memset( langElIndex, 0, sizeof(KlangEl*)*(nextSymbolId+1) ); for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) langElIndex[lel->id] = lel; //for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) // cerr << prod->prodId << " " << prod->data << endl; makeProdFsms(); lalr1GenerateParser(); graph->setStateNumbers(); analyzeMachine(); //cerr << "NUMBER OF STATES: " << graph->stateList.length() << endl; } void ParseData::generateInstanceData() { makeTokens( ); startCodeGen(); writeInstanceData(); } void ParseData::generateTokenDefs() { makeTokens( ); startCodeGen(); writeTokenDefs(); } void ParseData::generateTypes() { makeGraph(); if ( gblErrorCount > 0 ) return; startCodeGen(); writeTypes(); } void ParseData::generateData() { makeGraph(); if ( gblErrorCount > 0 ) return; startCodeGen(); writeData(); } void ParseData::generateInit() { makeGraph(); if ( gblErrorCount > 0 ) return; startCodeGen(); writeInit(); } void ParseData::generateExec() { makeGraph(); if ( gblErrorCount > 0 ) return; startCodeGen(); writeExec(); } void ParseData::generateFinish() { makeGraph(); if ( gblErrorCount > 0 ) return; startCodeGen(); writeFinish(); } void ParseData::generateGraphviz( ) { makeGraph(); if ( gblErrorCount > 0 ) return; writeDotFile(); } kelbt-0.15/kelbt/pcheck.h0000664000175000017500000000303511072521140015601 0ustar thurstonthurston/* * Copyright 2001, 2002, 2005, 2008 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _PCHECK_H #define _PCHECK_H class ParamCheck { public: ParamCheck( const char *paramSpec, int argc, const char **argv); bool check(); const char *paramArg; /* The argument to the parameter. */ char parameter; /* The parameter matched. */ enum { match, invalid, noparam } state; const char *argOffset; /* If we are reading params inside an * arg this points to the offset. */ const char *curArg; /* Pointer to the current arg. */ int iCurArg; /* Index to the current arg. */ private: const char *paramSpec; /* Parameter spec supplied by the coder. */ int argc; /* Arguement data from the command line. */ const char **argv; }; #endif /* _PCHECK_H */ kelbt-0.15/kelbt/fsmgraph.cpp0000664000175000017500000001153011072514631016514 0ustar thurstonthurston/* * Copyright 2001, 2002, 2005 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include using std::cerr; using std::endl; #include "fsmgraph.h" #include "mergesort.h" void FsmAp::addInReduction( TransAp *dest, long prodId, long prior ) { /* Look for the reduction. If not there insert it, otherwise take * the max of the priorities. */ ReductionMapEl *redMapEl = dest->reductions.find( prodId ); if ( redMapEl == 0 ) dest->reductions.insert( prodId, prior ); else if ( prior > redMapEl->value ) redMapEl->value = prior; } /* Callback invoked when another trans (or possibly this) is added into this * transition during the merging process. Draw in any properties of srcTrans * into this transition. AddInTrans is called when a new transitions is made * that will be a duplicate of another transition or a combination of several * other transitions. AddInTrans will be called for each transition that the * new transition is to represent. */ void FsmAp::addInTrans( TransAp *destTrans, TransAp *srcTrans ) { /* Protect against adding in from ourselves. */ if ( srcTrans != destTrans ) { /* Add in the shift priority. */ if ( destTrans->isShift && srcTrans->isShift ) { /* Both shifts are set. We want the max of the two. */ if ( srcTrans->shiftPrior > destTrans->shiftPrior ) destTrans->shiftPrior = srcTrans->shiftPrior; } else if ( srcTrans->isShift ) { /* Just the source is set, copy the source prior over. */ destTrans->shiftPrior = srcTrans->shiftPrior; } /* If either is a shift, dest is a shift. */ destTrans->isShift = destTrans->isShift || srcTrans->isShift; /* Add in the reductions. */ for ( ReductionMap::Iter red = srcTrans->reductions; red.lte(); red++ ) addInReduction( destTrans, red->key, red->value ); /* Add in the commit points. */ destTrans->commits.insert( srcTrans->commits ); } } void FsmAp::addInState( StateAp *destState, StateAp *srcState ) { /* Draw in any properties of srcState into destState. */ if ( srcState != destState ) { /* Get the epsilons, context, out priorities. */ destState->pendingCommits.insert( srcState->pendingCommits ); if ( srcState->pendingCommits.length() > 0 ) cerr << "THERE ARE PENDING COMMITS DRAWN IN" << endl; /* Parser generation data. */ destState->dotSet.insert( srcState->dotSet ); if ( srcState->onClosureQueue && !destState->onClosureQueue ) { stateClosureQueue.append( destState ); destState->onClosureQueue = true; } } } /* Make a new state. The new state will be put on the graph's * list of state. The new state can be created final or non final. */ StateAp *FsmAp::addState() { /* Make the new state to return. */ StateAp *state = new StateAp(); /* Create the new state. */ stateList.append( state ); return state; } /* Follow from to the final state of srcFsm. */ StateAp *FsmAp::followFsm( StateAp *from, FsmAp *srcFsm ) { StateAp *followSrc = srcFsm->startState; while ( ! followSrc->isFinState() ) { assert( followSrc->transMap.length() == 1 ); TransAp *followTrans = followSrc->transMap[0].value; TransAp *inTrans = from->findTrans( followTrans->lowKey ); assert( inTrans != 0 ); from = inTrans->toState; followSrc = followTrans->toState; } return from; } int FsmAp::fsmLength( ) { int length = 0; StateAp *state = startState; while ( ! state->isFinState() ) { length += 1; state = state->transMap[0].value->toState; } return length; } /* Remove states that have no path to them from the start state. Recursively * traverses the graph marking states that have paths into them. Then removes * all states that did not get marked. */ void FsmAp::removeUnreachableStates() { /* Mark all the states that can be reached * through the existing set of entry points. */ markReachableFromHere( startState ); /* Delete all states that are not marked * and unmark the ones that are marked. */ StateAp *state = stateList.head; while ( state ) { StateAp *next = state->next; if ( state->stateBits & SB_ISMARKED ) state->stateBits &= ~ SB_ISMARKED; else { detachState( state ); stateList.detach( state ); delete state; } state = next; } } kelbt-0.15/kelbt/klparse.h0000664000175000017500000000536511707046235016031 0ustar thurstonthurston/* Automatically generated by Kelbt from "klparse.kh". * * Parts of this file are copied from Kelbt source covered by the GNU * GPL. As a special exception, you may use the parts of this file copied * from Kelbt source without restriction. The remainder is derived from * "klparse.kh" and inherits the copyright status of that file. */ #line 1 "klparse.kh" /* * Copyright 2006 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef KLPARSE_H #define KLPARSE_H #include #include "avltree.h" #include "parsedata.h" struct LangEl; struct Token { char *data; InputLoc loc; }; struct Parser { #line 48 "klparse.h" struct Parser_Block *block; struct Parser_LangEl *freshEl; int freshPos; struct Parser_LangEl *pool; int numRetry; int numNodes; struct Parser_LangEl *stackTop; struct Parser_LangEl *lastFinal; int errCount; int curs; #line 49 "klparse.kh" Parser( const char *fileName, char *parserName, std::ostream &out ) : pd( fileName, parserName, out ), sawStart(false), sawInterface(false) {} void init(); int parseLangEl( int type, const Token *token ); int token( int line, int tokid, char *data ); TypeDef *getTypeDef( char *data ); ParseData pd; bool sawStart; bool sawInterface; KlangElVect langElVect; FactorVect factorVect; }; #line 79 "klparse.h" #define KW_Parser 128 #define KW_Include 129 #define KW_Write 130 #define KW_Class 131 #define KW_Commit 132 #define KW_Try 133 #define KW_Undo 134 #define KW_Final 135 #define KW_Translate 136 #define KW_Token 137 #define KW_NonTerm 138 #define KW_Uses 139 #define KW_Type 140 #define KW_Pri 141 #define KW_Shortest 142 #define TK_Word 143 #define TK_String 144 #define TK_Number 145 #define TK_Inline 146 #define TK_Reference 147 #define TK_Literal 148 #define KW_Access 149 #define TK_AccessData 150 #define Parser_tk_eof 151 #line 69 "klparse.kh" struct ParserDictEl : public AvlTreeEl { char *name; Parser *parser; char *getKey() const { return name; }; }; typedef AvlTree ParserDict; #endif kelbt-0.15/kelbt/klparse.cpp0000664000175000017500000011700211707046235016354 0ustar thurstonthurston/* Automatically generated by Kelbt from "klparse.kl". * * Parts of this file are copied from Kelbt source covered by the GNU * GPL. As a special exception, you may use the parts of this file copied * from Kelbt source without restriction. The remainder is derived from * "klparse.kl" and inherits the copyright status of that file. */ #line 1 "klparse.kl" /* * Copyright 2006 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "klparse.h" #include "kelbt.h" #include using std::cout; using std::cerr; using std::endl; #line 49 "klparse.kh" #line 69 "klparse.kh" #line 318 "klparse.kl" #line 45 "klparse.cpp" struct Parser_Lel_inline_block_item { #line 193 "klparse.kl" InlineItem *inlineItem; InputLoc loc; #line 52 "klparse.cpp" }; struct Parser_Lel_inline_list { #line 171 "klparse.kl" InlineList *inlineList; InputLoc loc; #line 63 "klparse.cpp" }; struct Parser_Lel_opt_class { #line 140 "klparse.kl" bool isClass; #line 73 "klparse.cpp" }; struct Parser_Lel_opt_commit { #line 250 "klparse.kl" bool commit; #line 83 "klparse.cpp" }; struct Parser_Lel_opt_inline_block { #line 280 "klparse.kl" InlineBlock *inlineBlock; #line 93 "klparse.cpp" }; struct Parser_Lel_opt_prior { #line 265 "klparse.kl" int priorVal; #line 103 "klparse.cpp" }; struct Parser_Lel_prod_el { #line 232 "klparse.kl" Factor *factor; #line 113 "klparse.cpp" }; struct Parser_Lel_prod_el_list { #line 214 "klparse.kl" ProdElList *prodElList; #line 123 "klparse.cpp" }; union Parser_UserData { struct Parser_Lel_inline_block_item inline_block_item; struct Parser_Lel_inline_list inline_list; struct Parser_Lel_opt_class opt_class; struct Parser_Lel_opt_commit opt_commit; struct Parser_Lel_opt_inline_block opt_inline_block; struct Parser_Lel_opt_prior opt_prior; struct Parser_Lel_prod_el prod_el; struct Parser_Lel_prod_el_list prod_el_list; struct Token token; }; struct Parser_LangEl { char *file; int line; int type; int reduction; int state; int causeReduce; union Parser_UserData user; unsigned int retry; struct Parser_LangEl *next, *child, *prev; }; struct Parser_Block { struct Parser_LangEl data[8128]; struct Parser_Block *next; }; #line 160 "klparse.cpp" unsigned int Parser_startState = 0; char Parser_indicies[] = { 50, 50, -1, 50, -1, 50, 50, -1, -1, -1, -1, -1, 50, -1, 50, 1, 0, 93, 3, 4, -1, 5, -1, 7, 2, -1, -1, -1, -1, -1, 6, -1, 48, -1, -1, 49, 85, 86, 87, 88, 89, 90, 91, 92, 16, 83, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 83, 83, 11, -1, -1, 9, -1, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 55, -1, 10, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 14, 17, 15, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, 67, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 18, 66, 24, 23, 25, 64, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, 70, 70, 70, -1, -1, -1, -1, -1, 70, -1, 70, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 26, 51, 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 27, 56, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, 67, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 66, 31, 67, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, 66, 67, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, 66, 73, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, 73, 73, 73, -1, -1, -1, -1, -1, 38, -1, 76, -1, -1, -1, -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, 37, 57, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 58, 67, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, 66, 60, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 77, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, 77, 77, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 41, 74, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 74, 74, 74, -1, -1, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, 74, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, 73, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, 40, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 44, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, 67, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 45, 66, 71, -1, -1, -1, -1, 72, 75, 78, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, 78, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, 52, }; unsigned char Parser_keys[] = { 137, 153, 151, 151, 137, 162, 58, 58, 59, 171, 131, 170, 131, 170, 150, 150, 143, 143, 44, 59, 131, 170, 59, 166, 146, 173, 143, 143, 139, 139, 143, 143, 59, 59, 59, 163, 59, 59, 59, 173, 143, 143, 143, 169, 59, 167, 146, 173, 143, 143, 146, 173, 146, 173, 59, 175, 59, 59, 59, 173, 59, 59, 146, 173, 59, 59, 59, 173, 59, 173, 59, 165, 59, 148, 132, 164, 40, 40, 59, 173, 145, 145, 59, 166, 146, 173, 143, 148, 41, 41, 59, 173, 59, 167, 59, 59, 0, 0 }; unsigned short Parser_offsets[] = { 0, 17, 18, 44, 45, 158, 198, 238, 239, 240, 256, 296, 404, 432, 433, 434, 435, 436, 541, 542, 657, 658, 685, 794, 822, 823, 851, 879, 996, 997, 1112, 1113, 1141, 1142, 1257, 1372, 1479, 1569, 1602, 1603, 1718, 1719, 1827, 1855, 1861, 1862, 1977, 2086, 2087 }; unsigned char Parser_targs[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48 }; unsigned int Parser_actInds[] = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188 }; unsigned int Parser_actions[] = { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 90, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 146, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 0, 7, 0, 10, 0, 47, 0, 51, 0, 55, 0, 59, 0, 63, 0, 67, 0, 71, 0, 75, 0, 79, 0, 83, 0, 87, 0, 90, 0, 95, 0, 99, 0, 103, 0, 107, 0, 111, 0, 115, 0, 119, 0, 122, 0, 127, 0, 131, 0, 134, 0, 138, 0, 143, 0, 146, 0, 150, 0, 154, 0, 158, 0, 162, 0, 166, 0, 170, 0, 174, 0, 178, 0, 15, 0, 19, 0, 23, 0, 27, 0, 31, 0, 35, 0, 39, 0, 43, 0, 1, 0 }; int Parser_commitLen[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2 }; char Parser_prodLengths[] = { 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 8, 3, 3, 1, 1, 5, 5, 5, 5, 1, 0, 5, 3, 2, 1, 1, 1, 2, 0, 3, 3, 0, 1, 4, 0, 0, 2, 0, 2, 0, 2, 0, 2, 1 }; unsigned char Parser_prodLhsIds[] = { 153, 152, 152, 154, 154, 154, 154, 154, 154, 154, 154, 161, 155, 156, 168, 168, 169, 157, 158, 159, 159, 170, 170, 160, 162, 172, 172, 173, 173, 163, 163, 174, 174, 164, 164, 175, 175, 165, 165, 166, 166, 167, 167, 171, 171, 176 }; const char *Parser_prodNames[] = { "start-1", "statement_list-1", "statement_list-2", "statement-1", "statement-2", "statement-3", "statement-4", "statement-5", "statement-6", "statement-7", "statement-8", "access_stmt-1", "production_stmt-1", "token_stmt-1", "token_list-1", "token_list-2", "token_list_word-1", "token_uses_stmt-1", "translate_stmt-1", "nonterm_stmt-1", "nonterm_stmt-2", "opt_class-1", "opt_class-2", "type_stmt-1", "shortest_stmt-1", "inline_list-1", "inline_list-2", "inline_block_item-1", "inline_block_item-2", "prod_el_list-1", "prod_el_list-2", "prod_el-1", "prod_el-2", "opt_commit-1", "opt_commit-2", "opt_prior-1", "opt_prior-2", "opt_reduction-1", "opt_reduction-2", "opt_undo-1", "opt_undo-2", "opt_final-1", "opt_final-2", "opt_translate-1", "opt_translate-2", "_start-1" }; const char *Parser_lelNames[] = { "D-0", "D-1", "D-2", "D-3", "D-4", "D-5", "D-6", "D-7", "D-8", "D-9", "D-10", "D-11", "D-12", "D-13", "D-14", "D-15", "D-16", "D-17", "D-18", "D-19", "D-20", "D-21", "D-22", "D-23", "D-24", "D-25", "D-26", "D-27", "D-28", "D-29", "D-30", "D-31", "D-32", "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "[", "\\", "]", "^", "_", "`", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "~", "D-127", "KW_Parser", "KW_Include", "KW_Write", "KW_Class", "KW_Commit", "KW_Try", "KW_Undo", "KW_Final", "KW_Translate", "KW_Token", "KW_NonTerm", "KW_Uses", "KW_Type", "KW_Pri", "KW_Shortest", "TK_Word", "TK_String", "TK_Number", "TK_Inline", "TK_Reference", "TK_Literal", "KW_Access", "TK_AccessData", "Parser_tk_eof", "statement_list", "start", "statement", "production_stmt", "token_stmt", "token_uses_stmt", "translate_stmt", "nonterm_stmt", "type_stmt", "access_stmt", "shortest_stmt", "prod_el_list", "opt_commit", "opt_reduction", "opt_undo", "opt_final", "token_list", "token_list_word", "opt_class", "opt_translate", "inline_list", "inline_block_item", "prod_el", "opt_prior", "_start" }; #line 323 "klparse.kl" void Parser::init() { #line 777 "klparse.cpp" curs = Parser_startState; pool = 0; block = (struct Parser_Block*) malloc( sizeof(struct Parser_Block) ); block->next = 0; freshEl = block->data; #ifdef KELBT_LOG_ACTIONS cerr << "allocating 8128 LangEls" << endl; #endif stackTop = freshEl; stackTop->type = 0; stackTop->state = -1; stackTop->next = 0; stackTop->child = 0; stackTop->causeReduce = 0; freshPos = 1; lastFinal = stackTop; numRetry = 0; numNodes = 0; errCount = 0; #line 328 "klparse.kl" } TypeDef *Parser::getTypeDef( char *data ) { TypeDefMapEl *inMap = 0, *inserted; inserted = pd.typeDefMap.insert( data, &inMap ); if ( inserted != 0 ) inserted->value = new TypeDef( data ); return inMap->value; } int Parser::parseLangEl( int type, const Token *token ) { #line 811 "klparse.cpp" #define reject() induceReject = 1 int pos, targState; unsigned int *action; int rhsLen; struct Parser_LangEl *rhs[32]; struct Parser_LangEl *lel = 0; struct Parser_LangEl *input = 0; struct Parser_LangEl *queue = 0; char induceReject; if ( curs < 0 ) return 0; if ( pool == 0 ) { if ( freshPos == 8128 ) { struct Parser_Block* newBlock = (struct Parser_Block*) malloc( sizeof(struct Parser_Block) ); newBlock->next = block; block = newBlock; freshEl = newBlock->data; #ifdef KELBT_LOG_ACTIONS cerr << "allocating 8128 LangEls" << endl; #endif freshPos = 0; } queue = freshEl + freshPos++; } else { queue = pool; pool = pool->next; } numNodes += 1; queue->type = type; queue->user.token = *token; queue->next = 0; queue->retry = 0; queue->child = 0; queue->causeReduce = 0; again: if ( input == 0 ) { if ( queue == 0 ) goto _out; input = queue; queue = queue->next; input->next = 0; } lel = input; if ( lel->type < Parser_keys[curs<<1] || lel->type > Parser_keys[(curs<<1)+1] ) goto parseError; pos = Parser_indicies[Parser_offsets[curs] + (lel->type - Parser_keys[curs<<1])]; if ( pos < 0 ) goto parseError; induceReject = 0; targState = Parser_targs[pos]; action = Parser_actions + Parser_actInds[pos]; if ( lel->retry & 0x0000ffff ) action += (lel->retry & 0x0000ffff); if ( *action & 0x1 ) { #ifdef KELBT_LOG_ACTIONS cerr << "shifted: " << Parser_lelNames[lel->type]; #endif input = input->next; lel->state = curs; lel->next = stackTop; stackTop = lel; if ( action[1] == 0 ) lel->retry &= 0xffff0000; else { lel->retry += 1; numRetry += 1; #ifdef KELBT_LOG_ACTIONS cerr << " retry: " << stackTop; #endif } #ifdef KELBT_LOG_ACTIONS cerr << endl; #endif } if ( Parser_commitLen[pos] != 0 ) { struct Parser_LangEl *commitHead = stackTop, *lel; int sp = 0, doExec = 0; #ifdef KELBT_LOG_ACTIONS cerr << "commit encountered, executing final actions" << endl; #endif if ( Parser_commitLen[pos] < 0 ) commitHead = commitHead->next; lel = commitHead; commit_head: if ( lel == lastFinal ) { doExec = 1; goto commit_base; } if ( lel->next != 0 ) { sp += 1; lel->next->prev = lel; lel = lel->next; lel->retry = 0; goto commit_head; } commit_reverse: if ( lel->child != 0 ) { sp += 1; lel->child->prev = lel; lel = lel->child; lel->retry = 1; goto commit_head; } commit_upwards: if ( doExec ) { if ( lel->type < 152 ) { } else { struct Parser_LangEl *redLel = lel; if ( redLel->child != 0 ) { int r = Parser_prodLengths[redLel->reduction] - 1; struct Parser_LangEl *rhsEl = redLel->child; while ( rhsEl != 0 ) { rhs[r--] = rhsEl; rhsEl = rhsEl->next; } } switch ( lel->reduction ) { case 11: { Token *__ref0 = (Token*)&rhs[1]->user.token; #line 52 "klparse.kl" pd.access = (__ref0)->data; #line 955 "klparse.cpp" } break; case 12: { Token *__ref0 = (Token*)&rhs[0]->user.token; Token *__ref1 = (Token*)&rhs[0]->user.token; Token *__ref2 = (Token*)&rhs[0]->user.token; Token *__ref3 = (Token*)&rhs[0]->user.token; Parser_Lel_prod_el_list *__ref4 = (Parser_Lel_prod_el_list*)&rhs[2]->user.prod_el_list; Parser_Lel_opt_commit *__ref5 = (Parser_Lel_opt_commit*)&rhs[3]->user.opt_commit; Parser_Lel_opt_inline_block *__ref6 = (Parser_Lel_opt_inline_block*)&rhs[4]->user.opt_inline_block; Parser_Lel_opt_inline_block *__ref7 = (Parser_Lel_opt_inline_block*)&rhs[5]->user.opt_inline_block; Parser_Lel_opt_inline_block *__ref8 = (Parser_Lel_opt_inline_block*)&rhs[6]->user.opt_inline_block; Token *__ref9 = (Token*)&rhs[0]->user.token; #line 59 "klparse.kl" /* Get the language element. */ KlangEl *prodName = getKlangEl( &pd, (__ref0)->data, KlangEl::NonTerm ); /* Check that the element wasn't previously defined as something else. */ if ( prodName->type != KlangEl::Unknown && prodName->type != KlangEl::NonTerm ) { error((__ref1)->loc) << "'" << (__ref2)->data << "' already defined as something else" << endl; } else { prodName->type = KlangEl::NonTerm; Definition *newDef = new Definition( (__ref3)->loc, prodName, (__ref4)->prodElList, (__ref5)->commit, (__ref6)->inlineBlock, (__ref7)->inlineBlock, (__ref8)->inlineBlock, pd.prodList.length(), Definition::Production ); prodName->defList.append( newDef ); pd.prodList.append( newDef ); /* Start machine will trigger code generation. */ if ( strcmp((__ref9)->data, startDefName) == 0 ) sawStart = true; newDef->rhsLelVect = langElVect; newDef->rhsFactorVect = factorVect; langElVect.empty(); factorVect.empty(); } #line 998 "klparse.cpp" } break; case 16: { Token *__ref0 = (Token*)&rhs[0]->user.token; Token *__ref1 = (Token*)&rhs[0]->user.token; Token *__ref2 = (Token*)&rhs[0]->user.token; #line 94 "klparse.kl" /* Token name must be unique. */ KlangEl *tokName = getKlangEl( &pd, (__ref0)->data, KlangEl::Term ); if ( tokName->type != KlangEl::Unknown && tokName->type != KlangEl::Term ) error((__ref1)->loc) << "'" << (__ref2) << "' already defined as something else" << endl; tokName->type = KlangEl::Term; #line 1013 "klparse.cpp" } break; case 17: { Token *__ref0 = (Token*)&rhs[3]->user.token; Parser_Lel_opt_class *__ref1 = (Parser_Lel_opt_class*)&rhs[2]->user.opt_class; #line 103 "klparse.kl" pd.tokenStruct = (__ref0)->data; pd.tokenIsClass = (__ref1)->isClass; #line 1024 "klparse.cpp" } break; case 18: { Parser_Lel_opt_inline_block *__ref0 = (Parser_Lel_opt_inline_block*)&rhs[1]->user.opt_inline_block; Parser_Lel_opt_inline_block *__ref1 = (Parser_Lel_opt_inline_block*)&rhs[2]->user.opt_inline_block; Parser_Lel_opt_inline_block *__ref2 = (Parser_Lel_opt_inline_block*)&rhs[3]->user.opt_inline_block; #line 110 "klparse.kl" pd.translateBlock = (__ref0)->inlineBlock; pd.undoTransBlock = (__ref1)->inlineBlock; pd.tokenFinalBlock = (__ref2)->inlineBlock; #line 1037 "klparse.cpp" } break; case 19: { Token *__ref0 = (Token*)&rhs[2]->user.token; Token *__ref1 = (Token*)&rhs[2]->user.token; Parser_Lel_inline_list *__ref2 = (Parser_Lel_inline_list*)&rhs[3]->user.inline_list; Token *__ref3 = (Token*)&rhs[2]->user.token; Token *__ref4 = (Token*)&rhs[2]->user.token; Token *__ref5 = (Token*)&rhs[2]->user.token; Parser_Lel_opt_class *__ref6 = (Parser_Lel_opt_class*)&rhs[1]->user.opt_class; #line 118 "klparse.kl" /* Create/get the nonterminal. */ KlangEl *nonTerm = getKlangEl( &pd, (__ref0)->data, KlangEl::NonTerm ); /* Make a new inline block. */ InlineBlock *typeBlock = new InlineBlock( (__ref1)->loc, (__ref2)->inlineList ); /* Create/get the typedef. */ TypeDef *typeDef = getTypeDef( (__ref3)->data ); nonTerm->typeDef = typeDef; /* The typeDef should not already exist. */ if ( typeDef->typeBlock != 0 ) error((__ref4)->loc) << "redefintion of nonterminal type " << (__ref5)->data << endl; else { typeDef->typeBlock = typeBlock; typeDef->isClass = (__ref6)->isClass; } #line 1068 "klparse.cpp" } break; case 20: { Token *__ref0 = (Token*)&rhs[1]->user.token; Token *__ref1 = (Token*)&rhs[3]->user.token; #line 140 "klparse.kl" KlangEl *nonTerm = getKlangEl( &pd, (__ref0)->data, KlangEl::NonTerm ); nonTerm->typeDef = getTypeDef( (__ref1)->data ); #line 1079 "klparse.cpp" } break; case 21: { Parser_Lel_opt_class *__ref0 = (Parser_Lel_opt_class*)&redLel->user.opt_class; #line 150 "klparse.kl" (__ref0)->isClass = true; #line 1086 "klparse.cpp" } break; case 22: { Parser_Lel_opt_class *__ref0 = (Parser_Lel_opt_class*)&redLel->user.opt_class; #line 151 "klparse.kl" (__ref0)->isClass = false; #line 1093 "klparse.cpp" } break; case 23: { Parser_Lel_inline_list *__ref0 = (Parser_Lel_inline_list*)&rhs[3]->user.inline_list; Parser_Lel_inline_list *__ref1 = (Parser_Lel_inline_list*)&rhs[3]->user.inline_list; Token *__ref2 = (Token*)&rhs[2]->user.token; Token *__ref3 = (Token*)&rhs[2]->user.token; Token *__ref4 = (Token*)&rhs[2]->user.token; Parser_Lel_opt_class *__ref5 = (Parser_Lel_opt_class*)&rhs[1]->user.opt_class; #line 155 "klparse.kl" /* Create the inline block and create/get the typedef. */ InlineBlock *typeBlock = new InlineBlock( InputLoc((__ref0)->loc), (__ref1)->inlineList ); TypeDef *typeDef = getTypeDef( (__ref2)->data ); /* The typeDef should not already exist. */ if ( typeDef->typeBlock != 0 ) error((__ref3)->loc) << "redefintion of nonterminal type " << (__ref4)->data << endl; else { typeDef->typeBlock = typeBlock; typeDef->isClass = (__ref5)->isClass; } #line 1117 "klparse.cpp" } break; case 24: { Token *__ref0 = (Token*)&rhs[1]->user.token; #line 171 "klparse.kl" KlangEl *nonTerm = getKlangEl( &pd, (__ref0)->data, KlangEl::NonTerm ); nonTerm->isShortest = true; #line 1127 "klparse.cpp" } break; case 25: { Parser_Lel_inline_list *__ref0 = (Parser_Lel_inline_list*)&rhs[0]->user.inline_list; Parser_Lel_inline_block_item *__ref1 = (Parser_Lel_inline_block_item*)&rhs[1]->user.inline_block_item; Parser_Lel_inline_list *__ref2 = (Parser_Lel_inline_list*)&redLel->user.inline_list; Parser_Lel_inline_list *__ref3 = (Parser_Lel_inline_list*)&rhs[0]->user.inline_list; Parser_Lel_inline_list *__ref4 = (Parser_Lel_inline_list*)&redLel->user.inline_list; Parser_Lel_inline_list *__ref5 = (Parser_Lel_inline_list*)&rhs[0]->user.inline_list; #line 185 "klparse.kl" (__ref0)->inlineList->append( (__ref1)->inlineItem ); (__ref2)->inlineList = (__ref3)->inlineList; (__ref4)->loc = (__ref5)->loc; #line 1143 "klparse.cpp" } break; case 26: { Parser_Lel_inline_list *__ref0 = (Parser_Lel_inline_list*)&redLel->user.inline_list; Parser_Lel_inline_list *__ref1 = (Parser_Lel_inline_list*)&redLel->user.inline_list; Parser_Lel_inline_block_item *__ref2 = (Parser_Lel_inline_block_item*)&rhs[0]->user.inline_block_item; Parser_Lel_inline_list *__ref3 = (Parser_Lel_inline_list*)&redLel->user.inline_list; Parser_Lel_inline_block_item *__ref4 = (Parser_Lel_inline_block_item*)&rhs[0]->user.inline_block_item; #line 193 "klparse.kl" (__ref0)->inlineList = new InlineList; (__ref1)->inlineList->append( (__ref2)->inlineItem ); (__ref3)->loc = (__ref4)->loc; #line 1158 "klparse.cpp" } break; case 27: { Parser_Lel_inline_block_item *__ref0 = (Parser_Lel_inline_block_item*)&redLel->user.inline_block_item; Token *__ref1 = (Token*)&rhs[0]->user.token; Token *__ref2 = (Token*)&rhs[0]->user.token; Parser_Lel_inline_block_item *__ref3 = (Parser_Lel_inline_block_item*)&redLel->user.inline_block_item; Token *__ref4 = (Token*)&rhs[0]->user.token; #line 207 "klparse.kl" (__ref0)->inlineItem = new InlineItem( (__ref1)->loc, (__ref2)->data, InlineItem::Text ); (__ref3)->loc = (__ref4)->loc; #line 1172 "klparse.cpp" } break; case 28: { Parser_Lel_inline_block_item *__ref0 = (Parser_Lel_inline_block_item*)&redLel->user.inline_block_item; Token *__ref1 = (Token*)&rhs[0]->user.token; Token *__ref2 = (Token*)&rhs[0]->user.token; Parser_Lel_inline_block_item *__ref3 = (Parser_Lel_inline_block_item*)&redLel->user.inline_block_item; Token *__ref4 = (Token*)&rhs[0]->user.token; #line 214 "klparse.kl" (__ref0)->inlineItem = new InlineItem( (__ref1)->loc, (__ref2)->data, InlineItem::Reference ); (__ref3)->loc = (__ref4)->loc; #line 1186 "klparse.cpp" } break; case 29: { Parser_Lel_prod_el_list *__ref0 = (Parser_Lel_prod_el_list*)&rhs[0]->user.prod_el_list; Parser_Lel_prod_el *__ref1 = (Parser_Lel_prod_el*)&rhs[1]->user.prod_el; Parser_Lel_prod_el_list *__ref2 = (Parser_Lel_prod_el_list*)&redLel->user.prod_el_list; Parser_Lel_prod_el_list *__ref3 = (Parser_Lel_prod_el_list*)&rhs[0]->user.prod_el_list; #line 226 "klparse.kl" (__ref0)->prodElList->append( (__ref1)->factor ); (__ref2)->prodElList = (__ref3)->prodElList; #line 1199 "klparse.cpp" } break; case 30: { Parser_Lel_prod_el_list *__ref0 = (Parser_Lel_prod_el_list*)&redLel->user.prod_el_list; #line 232 "klparse.kl" (__ref0)->prodElList = new ProdElList; #line 1206 "klparse.cpp" } break; case 31: { Token *__ref0 = (Token*)&rhs[2]->user.token; Parser_Lel_prod_el *__ref1 = (Parser_Lel_prod_el*)&redLel->user.prod_el; Token *__ref2 = (Token*)&rhs[2]->user.token; Parser_Lel_opt_commit *__ref3 = (Parser_Lel_opt_commit*)&rhs[1]->user.opt_commit; Parser_Lel_opt_prior *__ref4 = (Parser_Lel_opt_prior*)&rhs[0]->user.opt_prior; Parser_Lel_prod_el *__ref5 = (Parser_Lel_prod_el*)&redLel->user.prod_el; #line 241 "klparse.kl" KlangEl *langEl = getKlangEl( &pd, (__ref0)->data, KlangEl::Unknown ); (__ref1)->factor = new Factor( (__ref2)->loc, (__ref3)->commit, langEl, (__ref4)->priorVal ); langElVect.append( langEl ); factorVect.append( (__ref5)->factor ); #line 1223 "klparse.cpp" } break; case 32: { Token *__ref0 = (Token*)&rhs[2]->user.token; Token *__ref1 = (Token*)&rhs[2]->user.token; Parser_Lel_prod_el *__ref2 = (Parser_Lel_prod_el*)&redLel->user.prod_el; Token *__ref3 = (Token*)&rhs[2]->user.token; Parser_Lel_opt_commit *__ref4 = (Parser_Lel_opt_commit*)&rhs[1]->user.opt_commit; Parser_Lel_opt_prior *__ref5 = (Parser_Lel_opt_prior*)&rhs[0]->user.opt_prior; Parser_Lel_prod_el *__ref6 = (Parser_Lel_prod_el*)&redLel->user.prod_el; #line 250 "klparse.kl" /* Create a new factor node going to a concat literal. */ Literal *literal = new Literal( (__ref0)->loc, (__ref1)->data[0] ); (__ref2)->factor = new Factor( (__ref3)->loc, (__ref4)->commit, literal, (__ref5)->priorVal ); langElVect.append( 0 ); factorVect.append( (__ref6)->factor ); #line 1242 "klparse.cpp" } break; case 33: { Parser_Lel_opt_commit *__ref0 = (Parser_Lel_opt_commit*)&redLel->user.opt_commit; #line 264 "klparse.kl" (__ref0)->commit = false; #line 1249 "klparse.cpp" } break; case 34: { Parser_Lel_opt_commit *__ref0 = (Parser_Lel_opt_commit*)&redLel->user.opt_commit; #line 265 "klparse.kl" (__ref0)->commit = true; #line 1256 "klparse.cpp" } break; case 35: { Parser_Lel_opt_prior *__ref0 = (Parser_Lel_opt_prior*)&redLel->user.opt_prior; Token *__ref1 = (Token*)&rhs[2]->user.token; #line 273 "klparse.kl" (__ref0)->priorVal = atoi( (__ref1)->data ); #line 1266 "klparse.cpp" } break; case 36: { Parser_Lel_opt_prior *__ref0 = (Parser_Lel_opt_prior*)&redLel->user.opt_prior; #line 277 "klparse.kl" (__ref0)->priorVal = 0; #line 1273 "klparse.cpp" } break; case 37: { Parser_Lel_opt_inline_block *__ref0 = (Parser_Lel_opt_inline_block*)&redLel->user.opt_inline_block; #line 290 "klparse.kl" (__ref0)->inlineBlock = 0; #line 1280 "klparse.cpp" } break; case 38: { Parser_Lel_opt_inline_block *__ref0 = (Parser_Lel_opt_inline_block*)&redLel->user.opt_inline_block; Parser_Lel_inline_list *__ref1 = (Parser_Lel_inline_list*)&rhs[1]->user.inline_list; Parser_Lel_inline_list *__ref2 = (Parser_Lel_inline_list*)&rhs[1]->user.inline_list; #line 293 "klparse.kl" (__ref0)->inlineBlock = new InlineBlock( (__ref1)->loc, (__ref2)->inlineList ); #line 1291 "klparse.cpp" } break; case 39: { Parser_Lel_opt_inline_block *__ref0 = (Parser_Lel_opt_inline_block*)&redLel->user.opt_inline_block; #line 297 "klparse.kl" (__ref0)->inlineBlock = 0; #line 1298 "klparse.cpp" } break; case 40: { Parser_Lel_opt_inline_block *__ref0 = (Parser_Lel_opt_inline_block*)&redLel->user.opt_inline_block; Parser_Lel_inline_list *__ref1 = (Parser_Lel_inline_list*)&rhs[1]->user.inline_list; Parser_Lel_inline_list *__ref2 = (Parser_Lel_inline_list*)&rhs[1]->user.inline_list; #line 300 "klparse.kl" (__ref0)->inlineBlock = new InlineBlock( (__ref1)->loc, (__ref2)->inlineList ); #line 1309 "klparse.cpp" } break; case 41: { Parser_Lel_opt_inline_block *__ref0 = (Parser_Lel_opt_inline_block*)&redLel->user.opt_inline_block; #line 304 "klparse.kl" (__ref0)->inlineBlock = 0; #line 1316 "klparse.cpp" } break; case 42: { Parser_Lel_opt_inline_block *__ref0 = (Parser_Lel_opt_inline_block*)&redLel->user.opt_inline_block; Parser_Lel_inline_list *__ref1 = (Parser_Lel_inline_list*)&rhs[1]->user.inline_list; Parser_Lel_inline_list *__ref2 = (Parser_Lel_inline_list*)&rhs[1]->user.inline_list; #line 307 "klparse.kl" (__ref0)->inlineBlock = new InlineBlock( (__ref1)->loc, (__ref2)->inlineList ); #line 1327 "klparse.cpp" } break; case 43: { Parser_Lel_opt_inline_block *__ref0 = (Parser_Lel_opt_inline_block*)&redLel->user.opt_inline_block; #line 311 "klparse.kl" (__ref0)->inlineBlock = 0; #line 1334 "klparse.cpp" } break; case 44: { Parser_Lel_opt_inline_block *__ref0 = (Parser_Lel_opt_inline_block*)&redLel->user.opt_inline_block; Parser_Lel_inline_list *__ref1 = (Parser_Lel_inline_list*)&rhs[1]->user.inline_list; Parser_Lel_inline_list *__ref2 = (Parser_Lel_inline_list*)&rhs[1]->user.inline_list; #line 314 "klparse.kl" (__ref0)->inlineBlock = new InlineBlock( (__ref1)->loc, (__ref2)->inlineList ); #line 1345 "klparse.cpp" } break; } } if ( lel->child != 0 ) { struct Parser_LangEl *first = lel->child; struct Parser_LangEl *child = lel->child; lel->child = 0; while ( 1 ) { if ( child->type < 152 ) { } else { } numNodes -= 1; if ( child->next == 0 ) break; child = child->next; } child->next = pool; pool = first; } } commit_base: if ( sp > 0 ) { sp -= 1; if ( lel->retry == 0 ) { lel = lel->prev; goto commit_reverse; } else { lel->retry = 0; lel = lel->prev; goto commit_upwards; } } lel->retry = 0; lastFinal = lel; numRetry = 0; } if ( *action & 0x2 ) { int reduction = *action >> 2; struct Parser_LangEl *redLel; if ( input != 0 ) input->causeReduce += 1; if ( pool == 0 ) { if ( freshPos == 8128 ) { struct Parser_Block* newBlock = (struct Parser_Block*) malloc( sizeof(struct Parser_Block) ); newBlock->next = block; block = newBlock; freshEl = newBlock->data; #ifdef KELBT_LOG_ACTIONS cerr << "allocating 8128 LangEls" << endl; #endif freshPos = 0; } redLel = freshEl + freshPos++; } else { redLel = pool; pool = pool->next; } numNodes += 1; redLel->type = Parser_prodLhsIds[reduction]; redLel->reduction = reduction; redLel->child = 0; redLel->next = 0; redLel->retry = (lel->retry << 16); redLel->causeReduce = 0; lel->retry &= 0xffff0000; rhsLen = Parser_prodLengths[reduction]; if ( rhsLen > 0 ) { int r; for ( r = rhsLen-1; r > 0; r-- ) { rhs[r] = stackTop; stackTop = stackTop->next; } rhs[0] = stackTop; stackTop = stackTop->next; rhs[0]->next = 0; } #ifdef KELBT_LOG_ACTIONS cerr << "reduced: " << Parser_prodNames[reduction] << " rhsLen: " << rhsLen; #endif if ( action[1] == 0 ) redLel->retry = 0; else { redLel->retry += 0x10000; numRetry += 1; #ifdef KELBT_LOG_ACTIONS cerr << " retry: " << redLel; #endif } #ifdef KELBT_LOG_ACTIONS cerr << endl; #endif if ( rhsLen == 0 ) { redLel->file = lel->file; redLel->line = lel->line; targState = curs; } else { redLel->child = rhs[rhsLen-1]; redLel->file = rhs[0]->file; redLel->line = rhs[0]->line; targState = rhs[0]->state; } if ( induceReject ) { #ifdef KELBT_LOG_ACTIONS cerr << "error induced during reduction of " << Parser_lelNames[redLel->type] << endl; #endif redLel->state = curs; redLel->next = stackTop; stackTop = redLel; curs = targState; goto parseError; } else { redLel->next = input; input = redLel; } } curs = targState; goto again; parseError: #ifdef KELBT_LOG_BACKTRACK cerr << "hit error" << endl; #endif if ( numRetry > 0 ) { struct Parser_LangEl *redLel; if ( input != 0 ) { redLel = input; goto have_undo_element; } while ( 1 ) { redLel = stackTop; if ( stackTop->type < 152 ) { #ifdef KELBT_LOG_BACKTRACK cerr << "backing up over terminal: " << Parser_lelNames[stackTop->type] << endl; #endif stackTop = stackTop->next; redLel->next = input; input = redLel; } else { #ifdef KELBT_LOG_BACKTRACK cerr << "backing up over non-terminal: " << Parser_lelNames[stackTop->type] << endl; #endif stackTop = stackTop->next; struct Parser_LangEl *first = redLel->child; if ( first == 0 ) rhsLen = 0; else { rhsLen = 1; while ( first->next != 0 ) { first = first->next; rhsLen += 1; } first->next = stackTop; stackTop = redLel->child; struct Parser_LangEl *rhsEl = stackTop; int p = rhsLen; while ( p > 0 ) { rhs[--p] = rhsEl; rhsEl = rhsEl->next; } } redLel->next = pool; pool = redLel; numNodes -= 1; if ( input != 0 ) input->causeReduce -= 1; } have_undo_element: if ( redLel->retry == 0 ) { if ( input != 0 && input->causeReduce == 0 ) { #ifdef KELBT_LOG_BACKTRACK cerr << "pushing back: " << Parser_lelNames[input->type] << endl; #endif input->next = queue; queue = input; input = 0; } } else { #ifdef KELBT_LOG_BACKTRACK cerr << "found retry targ: " << redLel << endl; #endif numRetry -= 1; #ifdef KELBT_LOG_BACKTRACK cerr << "found retry: " << redLel << endl; #endif if ( redLel->retry & 0x0000ffff ) curs = input->state; else { input->retry = redLel->retry >> 16; if ( stackTop->state < 0 ) curs = Parser_startState; else { curs = Parser_targs[(int)Parser_indicies[Parser_offsets[stackTop->state] + (stackTop->type - Parser_keys[stackTop->state<<1])]]; } } goto again; } } } curs = -1; errCount += 1; _out: {} #line 342 "klparse.kl" return errCount == 0 ? 0 : -1; } int Parser::token( int line, int tokid, char *data ) { Token token; token.data = data; token.loc.line = line; token.loc.col = 1; //cout << "SENDING TOKEN: " << lelNames[tokid]; //if ( token.data != 0 ) // cout << " data: " << token.data; //cout << endl; return parseLangEl( tokid, &token ); } kelbt-0.15/kelbt/klparse.kh0000664000175000017500000000363311072521140016164 0ustar thurstonthurston/* * Copyright 2006 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef KLPARSE_H #define KLPARSE_H #include #include "avltree.h" #include "parsedata.h" struct LangEl; struct Token { char *data; InputLoc loc; }; struct Parser { %%{ parser Parser; token KW_Parser, KW_Include, KW_Write, KW_Class, KW_Commit, KW_Try, KW_Undo, KW_Final, KW_Translate, KW_Token, KW_NonTerm, KW_Uses, KW_Type, KW_Pri, KW_Shortest; token TK_Word, TK_String, TK_Number, TK_Inline, TK_Reference, TK_Literal, KW_Access, TK_AccessData; write instance_data; }%% Parser( const char *fileName, char *parserName, std::ostream &out ) : pd( fileName, parserName, out ), sawStart(false), sawInterface(false) {} void init(); int parseLangEl( int type, const Token *token ); int token( int line, int tokid, char *data ); TypeDef *getTypeDef( char *data ); ParseData pd; bool sawStart; bool sawInterface; KlangElVect langElVect; FactorVect factorVect; }; %% write token_defs; struct ParserDictEl : public AvlTreeEl { char *name; Parser *parser; char *getKey() const { return name; }; }; typedef AvlTree ParserDict; #endif kelbt-0.15/kelbt/Makefile0000664000175000017500000000316411707046235015652 0ustar thurstonthurston# # Copyright 2001-2003, 2005 Adrian Thurston # # This file is part of Kelbt # # Kelbt is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Kelbt is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Kelbt; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA INCS = -I../aapl DEFS = CFLAGS = -g -Wall LDFLAGS = CC_SRCS = \ pcheck.cpp main.cpp parsedata.cpp closure.cpp fsmbase.cpp fsmattach.cpp \ fsmgraph.cpp codegen.cpp gvdotgen.cpp klscan.cpp klparse.cpp LIBS = prefix = /usr/local #************************************* # Programs CXX = g++ # Get objects and dependencies from sources. OBJS = $(CC_SRCS:%.cpp=%.o) DEPS = $(CC_SRCS:%.cpp=.%.d) # Get the version info. include ../version.mk # Rules. all: kelbt kelbt: $(GEN_SRC) $(OBJS) $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) %.o: %.cpp @$(CXX) -M $(DEFS) $(INCS) $< > .$*.d $(CXX) -c $(CFLAGS) $(DEFS) $(INCS) -o $@ $< install: all install -d $(prefix)/bin install -s kelbt $(prefix)/bin/kelbt distclean: clean rm -f Makefile clean: rm -Rf kelbt tags .*.d *.o klscan.cpp klparse.h klparse.cpp version.h -include $(DEPS) kelbt-0.15/kelbt/kelbt.h0000664000175000017500000000407111261000315015442 0ustar thurstonthurston/* * Copyright 2001-2003,2005 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _KELBT_H #define _KELBT_H #include #include #include #include "avltree.h" #include "vector.h" #include "../config.h" #define PROGNAME "kelbt" struct Parser; /* Filter on the output stream that keeps track of the number of lines * output. */ class output_filter : public std::filebuf { public: output_filter() : line(1) { } virtual int sync(); virtual std::streamsize xsputn(const char* s, std::streamsize n); int line; }; /* IO filenames and stream. */ extern const char *outputFile; extern std::ostream *outStream; extern output_filter *outFilter; extern bool generateGraphviz; extern Parser *graphvizGenParser; extern bool branchPointInfo; extern bool addUniqueEmptyProductions; extern bool inhibitLineDirectives; extern int gblErrorCount; extern char startDefName[]; typedef Vector ArgsVector; extern ArgsVector includePaths; /* Error reporting. */ struct InputLoc; std::ostream &error(); std::ostream &error( const InputLoc &loc ); std::ostream &error( int first_line, int first_column ); std::ostream &warning( ); std::ostream &warning( const InputLoc &loc ); std::ostream &warning( int first_line, int first_column ); /* Size of the include stack. */ #define INCLUDE_STACK_SIZE 32 #endif /* _KELBT_H */ kelbt-0.15/kelbt/klscan.rl0000664000175000017500000003207211261000315016004 0ustar thurstonthurston/* * Copyright 2006-2009 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "kelbt.h" #include "klparse.h" using std::ifstream; using std::istream; using std::ostream; using std::cout; using std::cerr; using std::endl; %%{ machine section_parser; write data; }%% struct Scanner { Scanner( const char *fileName, istream &input, ParserDict &parserDict, int include_depth ) : fileName(fileName), input(input), parserDict(parserDict), include_depth(include_depth), parser(0), curline(1) { %% write init; } void startSection( bool singleLineSpec ); void endSection(); void do_scan(); void try_token( int tokid ); void try_token( int tokid, char *start, char *end ); ifstream *tryOpenInclude( char **pathChecks, long &found ); char **makeIncludePathChecks( const char *thisFileName, const char *fileName ); /* Open an error message with the file name and line. */ ostream &error() { /* Keep the error count. */ gblErrorCount += 1; cerr << fileName << ":" << curline << ": "; return cerr; } const char *fileName; istream &input; ParserDict &parserDict; int include_depth; Parser *parser; int curline, inline_start_line; bool singleLineSpec; /* Write statements seen. */ bool writeInstanceData; bool writeTokenDefs; bool writeTypes; bool writeData; bool writeInit; bool writeExec; bool writeFinish; /* For section parser. */ int cs; char *captured; }; void Scanner::startSection( bool singleLineSpec ) { this->singleLineSpec = singleLineSpec; writeInstanceData = false; writeTokenDefs = false; writeTypes = false; writeData = false; writeInit = false; writeExec = false; writeFinish = false; } void Scanner::endSection() { if ( !::generateGraphviz ) { if ( writeInstanceData ) parser->pd.generateInstanceData(); if ( writeTokenDefs ) parser->pd.generateTokenDefs(); if ( writeTypes ) parser->pd.generateTypes(); if ( writeInit ) parser->pd.generateInit(); if ( writeData ) parser->pd.generateData(); if ( writeExec ) parser->pd.generateExec(); if ( writeFinish ) parser->pd.generateFinish(); if ( ! inhibitLineDirectives ) *outStream << "#line " << curline << " \"" << fileName << "\"\n"; } /* This causes us to use the parser with the last parser definition when * generating graphviz code. */ graphvizGenParser = parser; } void Scanner::try_token( int tokid ) { try_token( tokid, 0, 0 ); } bool isAbsolutePath( const char *path ) { return path[0] == '/'; } ifstream *Scanner::tryOpenInclude( char **pathChecks, long &found ) { char **check = pathChecks; ifstream *inFile = new ifstream; while ( *check != 0 ) { inFile->open( *check ); if ( inFile->is_open() ) { found = check - pathChecks; return inFile; } check += 1; } found = -1; delete inFile; return 0; } char **Scanner::makeIncludePathChecks( const char *thisFileName, const char *fileName ) { char **checks = 0; long nextCheck = 0; char *data = strdup(fileName); long length = strlen(fileName); /* Absolute path? */ if ( isAbsolutePath( data ) ) { checks = new char*[2]; checks[nextCheck++] = data; } else { /* Search from the the location of the current file. */ checks = new char *[2 + includePaths.length()]; const char *lastSlash = strrchr( thisFileName, '/' ); if ( lastSlash == 0 ) checks[nextCheck++] = data; else { long givenPathLen = (lastSlash - thisFileName) + 1; long checklen = givenPathLen + length; char *check = new char[checklen+1]; memcpy( check, thisFileName, givenPathLen ); memcpy( check+givenPathLen, data, length ); check[checklen] = 0; checks[nextCheck++] = check; } /* Search from the include paths given on the command line. */ for ( ArgsVector::Iter incp = includePaths; incp.lte(); incp++ ) { long pathLen = strlen( *incp ); long checkLen = pathLen + 1 + length; char *check = new char[checkLen+1]; memcpy( check, *incp, pathLen ); check[pathLen] = '/'; memcpy( check+pathLen+1, data, length ); check[checkLen] = 0; checks[nextCheck++] = check; } } checks[nextCheck] = 0; return checks; } void Scanner::try_token( int tokid, char *start, char *end ) { char *tokdata = 0; int *p = &tokid, *pe = &tokid + 1; if ( start != 0 ) { int len = end-start; tokdata = new char[len+1]; memcpy( tokdata, start, len ); tokdata[len] = 0; } %%{ machine section_parser; alphtype int; # Bring in tokens from the parser. import "klparse.h"; action handle_parser { //cout << "PARSER STATEMENT" << endl; char *parserName = captured; ParserDictEl *pdEl = parserDict.find( parserName ); if ( pdEl != 0 ) { //cout << "USING EXISTING PARSER" << endl; delete[] parserName; } else { //cout << "CREATING NEW PARSER" << endl; pdEl = new ParserDictEl; pdEl->name = parserName; pdEl->parser = new Parser( fileName, parserName, *outStream ); pdEl->parser->init(); parserDict.insert( pdEl ); } parser = pdEl->parser; } action handle_include { /* Make the list of files to try. */ char **checks = makeIncludePathChecks( this->fileName, captured ); /* Open the input file for reading. */ long found = 0; ifstream *inFile = tryOpenInclude( checks, found ); /* Open the input file for reading. */ if ( inFile == 0 ) error() << "include: could not open " << captured << " for reading" << endl; else { Scanner subScanner( checks[found], *inFile, parserDict, include_depth+1 ); subScanner.do_scan(); delete inFile; } } action handle_write { if ( include_depth == 0 ) { char *writeArg = captured; if ( strcmp( writeArg, "instance_data" ) == 0 ) writeInstanceData = true; else if ( strcmp( writeArg, "token_defs" ) == 0 ) writeTokenDefs = true; else if ( strcmp( writeArg, "types" ) == 0 ) writeTypes = true; else if ( strcmp( writeArg, "data" ) == 0 ) writeData = true; else if ( strcmp( writeArg, "init" ) == 0 ) writeInit = true; else if ( strcmp( writeArg, "exec" ) == 0 ) writeExec = true; else if ( strcmp( writeArg, "finish" ) == 0 ) writeFinish = true; } } action handle_else { if ( parser == 0 ) error() << "no section name and no previously named section" << endl; else { int line = TK_Inline ? inline_start_line : curline; int result = parser->token( line, tokid, tokdata ); if ( result < 0 ) error() << "parse error on or near this line" << endl; } } captured_word = TK_Word @{ captured = tokdata; }; captured_string = TK_String @{ captured = tokdata; }; main := ( # Parser statements KW_Parser captured_word ';' @handle_parser | # Include statements. KW_Include captured_string ';' @handle_include | KW_Write captured_word ';' @handle_write | # Everything else. ^(KW_Parser | KW_Include | KW_Write) @handle_else )*; write exec; }%% } %%{ machine klscan; # This is sent by the driver code. EOF = 0; # Machine which tracks newlines NL = '\n' @{ curline++; }; # Identifiers, numbers, commetns, and other common things. ident = ( alpha | '_' ) ( alpha |digit |'_' )*; number = digit+; c_comment = '/*' ( any | NL )* :>> '*/' | '//' [^\n]* NL; single_literal = "'" ([^'\\\r\n] | '\\' [^\n])* "'"; double_literal = '"' ([^"\\\r\n] | '\\' [^\n])* '"'; literal = single_literal | double_literal; whitespace = [ \t\r] | NL; pound_comment = '#' [^\n]* NL; # An inline block of code. This is specified as a scanned, but is sent to # the parser as one long block. The inline_block pointer is used to handle # the preservation of the data. inline_code := |* ident; number; c_comment; literal; whitespace+; '{' => { curly_count += 1; }; '}' => { if ( --curly_count == 0 ) { /* Send the entire block and free the inline_start pointer. */ try_token( TK_Inline, inline_start, te ); inline_start = 0; fgoto parser_def; } }; ( '$' | '@' ) number | '$$' | '@@' => { if ( inline_start < ts ) try_token( TK_Inline, inline_start, ts ); try_token( TK_Reference, ts, te ); inline_start = te; }; any; *|; access_stmt := |* [^;\0]+ => { try_token( TK_AccessData, ts, te ); }; ';' => { try_token( ';' ); fgoto parser_def; }; *|; # Parser definitions. parser_def := |* 'commit' => { try_token( KW_Commit ); }; 'try' => { try_token( KW_Try ); }; 'undo' => { try_token( KW_Undo ); }; 'final' => { try_token( KW_Final ); }; 'translate' => { try_token( KW_Translate ); }; 'token' => { try_token( KW_Token ); }; 'nonterm' => { try_token( KW_NonTerm ); }; 'uses' => { try_token( KW_Uses ); }; 'type' => { try_token( KW_Type ); }; 'parser' => { try_token( KW_Parser ); }; 'include' => { try_token( KW_Include ); }; 'pri' => { try_token( KW_Pri ); }; 'write' => { try_token( KW_Write ); }; 'class' => { try_token( KW_Class ); }; 'shortest' => { try_token( KW_Shortest ); }; 'access' whitespace* => { try_token( KW_Access ); fgoto access_stmt; }; # Parser literals are single characters with single quotes. parser_literal = "'" ([^'\\\r\n] | '\\' any) "'"; ident => { try_token( TK_Word, ts, te ); } ; parser_literal => { try_token( TK_Literal, ts+1, te-1 ); } ; double_literal => { try_token( TK_String, ts+1, te-1 ); } ; number => { try_token( TK_Number, ts, te ); }; pound_comment; '}%%' => { endSection(); fgoto main; }; [ \t\r]+; NL => { if ( singleLineSpec ) { endSection(); fgoto main; } }; '{' => { inline_start_line = curline; inline_start = ts; curly_count = 1; fgoto inline_code; }; any => { try_token( *ts, 0, 0 ); } ; *|; action pass { if ( !generateGraphviz && gblErrorCount == 0 && include_depth == 0 ) outStream->write( ts, te-ts ); } # Outside code scanner. These tokens get passed through. main := |* ident => pass; number => pass; c_comment => pass; literal => pass; '%%' => { startSection( true ); fgoto parser_def; }; '%%{' => { startSection( false ); fgoto parser_def; }; whitespace+ => pass; EOF; any => pass; *|; }%% %% write data; void Scanner::do_scan() { int bufsize = 8; char *buf = new char[bufsize]; char *ts, *te; int cs, act, have = 0; int curly_count = 0; char *inline_start = 0; char *litstart = 0, *litend = 0; char *identstart = 0, *identend = 0; bool execute = true; %% write init; while ( execute ) { char *p = buf + have; int space = bufsize - have; if ( space == 0 ) { /* We filled up the buffer trying to scan a token. Grow it. */ bufsize = bufsize * 2; char *newbuf = new char[bufsize]; //cout << "FULL BUFFER, NEW SIZE: " << bufsize << endl; /* Recompute p and space. */ p = newbuf + have; space = bufsize - have; /* Patch up pointers possibly in use. */ if ( ts != 0 ) ts = newbuf + ( ts - buf ); if ( inline_start != 0 ) inline_start = newbuf + ( inline_start - buf ); te = newbuf + ( te - buf ); litstart = newbuf + ( litstart - buf ); litend = newbuf + ( litend - buf ); identstart = newbuf + ( identstart - buf ); identend = newbuf + ( identend - buf ); /* Copy the new buffer in. */ memcpy( newbuf, buf, have ); delete[] buf; buf = newbuf; } input.read( p, space ); int len = input.gcount(); char *pe = p + len; /* Check for EOF. */ char *eof = 0; if ( len == 0 ) { eof = pe; execute = false; } %% write exec; /* Check if we failed. */ if ( cs == klscan_error ) { /* Machine failed before finding a token. */ cout << "PARSE ERROR" << endl; exit(1); } /* Decide if we need to preserve anything. */ char *preserve = ts; if ( inline_start != 0 && ( preserve == 0 || inline_start < preserve ) ) preserve = inline_start; /* Now set up the prefix. */ if ( preserve == 0 ) have = 0; else { /* There is data that needs to be shifted over. */ have = pe - preserve; memmove( buf, preserve, have ); unsigned int shiftback = preserve - buf; if ( ts != 0 ) ts -= shiftback; if ( inline_start != 0 ) inline_start -= shiftback; te -= shiftback; litstart -= shiftback; litend -= shiftback; identstart -= shiftback; identend -= shiftback; preserve = buf; } } delete[] buf; } void scan( const char *fileName, istream &input ) { ParserDict parserDict; Scanner scanner( fileName, input, parserDict, 0 ); scanner.do_scan(); /* This uses the most recent parser definition. */ if ( ::generateGraphviz && ::graphvizGenParser != 0 ) graphvizGenParser->pd.generateGraphviz(); } kelbt-0.15/kelbt/closure.cpp0000664000175000017500000003251211072514631016364 0ustar thurstonthurston/* * Copyright 2005 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "kelbt.h" #include "parsedata.h" #include "vector.h" #include #include #include using std::endl; using std::cerr; void ParseData::lr0BringInItem( StateAp *dest, StateAp *prodState, TransAp *expandFrom, Definition *prod ) { /* We use dot sets for finding unique states. In the future, should merge * dots sets with the stateSet pointer (only need one of these). */ assert( dest != prodState ); dest->dotSet.insert( prodState->dotSet ); /* Get the epsilons, context, out priorities. */ dest->pendingCommits.insert( prodState->pendingCommits ); //if ( prodState->pendingCommits.length() > 0 ) // cerr << "THERE ARE PENDING COMMITS DRAWN IN" << endl; if ( prodState->transMap.length() > 0 ) { assert( prodState->transMap.length() == 1 ); TransAp *srcTrans = prodState->transMap[0].value; /* Look for the source in the destination. */ TransMapEl *destTel = dest->transMap.find( srcTrans->lowKey ); if ( destTel == 0 ) { /* Make a new state and transition to it. */ StateAp *newState = graph->addState(); TransAp *newTrans = new TransAp(); /* Attach the new transition to the new state. */ newTrans->lowKey = srcTrans->lowKey; graph->attachTrans( dest, newState, newTrans ); graph->addInTrans( newTrans, srcTrans ); /* The transitions we make during lr0 closure are all shifts. */ assert( newTrans->isShift ); assert( srcTrans->isShift ); /* The new state must have its state set setup. */ newState->stateSet = new StateSet; newState->stateSet->insert( srcTrans->toState ); /* Insert the transition into the map. Be sure to set destTel, it * is needed below. */ dest->transMap.insert( srcTrans->lowKey, newTrans, &destTel ); /* If the item is a non-term, queue it for closure. */ KlangEl *langEl = langElIndex[srcTrans->lowKey]; if ( langEl != 0 && langEl->type == KlangEl::NonTerm ) { graph->transClosureQueue.append( newTrans ); //cerr << "put to trans closure queue" << endl; } } else { //cerr << "merging transitions" << endl; destTel->value->toState->stateSet->insert( srcTrans->toState ); graph->addInTrans( destTel->value, srcTrans ); } /* If this is an expansion then we may need to bring in commits. */ if ( expandFrom != 0 && expandFrom->commits.length() > 0 ) { //cerr << "SETTING COMMIT ON CLOSURE ROUND" << endl; destTel->value->commits.insert( expandFrom->commits ); expandFrom->commits.empty(); } } else { /* ProdState does not have any transitions out. It is at the end of a * production. */ if ( expandFrom != 0 && expandFrom->commits.length() > 0 ) { //cerr << "SETTING COMMIT IN PENDING LOOKAHEAD" << endl; for ( LongSet::Iter len = expandFrom->commits; len.lte(); len++ ) dest->pendingCommits.insert( ProdIdPair( prod->prodId, *len ) ); expandFrom->commits.empty(); } } } void ParseData::lr0InvokeClosure( StateAp *state ) { /* State should not already be closed. */ assert( !state->inClosedMap ); /* This is used each time we invoke closure, it must be cleared. */ graph->transClosureQueue.abandon(); /* Drag in the core items. */ for ( StateSet::Iter ssi = *state->stateSet; ssi.lte(); ssi++ ) lr0BringInItem( state, *ssi, 0, 0 ); /* Now bring in the derived items. */ while ( graph->transClosureQueue.length() > 0 ) { TransAp *toClose = graph->transClosureQueue.detachFirst(); //cerr << "have a transition to derive" << endl; /* Get the langEl. */ KlangEl *langEl = langElIndex[toClose->lowKey]; /* Make graphs for all of the productions that the non * terminal goes to that are not already in the state's dotSet. */ for ( LelDefList::Iter prod = langEl->defList; prod.lte(); prod++ ) { /* Bring in the start state of the production. */ lr0BringInItem( state, prod->fsm->startState, toClose, prod ); } } /* Try and insert into the closed dict. */ DotSetMapEl *lastFound; if ( graph->closedMap.insert( state, &lastFound ) ) { /* Insertion into closed dict succeeded. There is no state with the * same dot set. The state is now closed. It is guaranteed a spot in * the closed dict and it will never go away (states never deleted * during closure). */ graph->stateClosedList.append( state ); state->inClosedMap = true; /* Add all of the states in the out transitions to the closure queue. * This will give us a depth first search of the graph. */ for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) { /* Get the state the transEl goes to. */ StateAp *targ = trans->value->toState; /* If the state on this tranisition has not already been slated * for closure, then add it to the queue. */ if ( !targ->onClosureQueue && !targ->inClosedMap ) { graph->stateClosureQueue.append( targ ); targ->onClosureQueue = true; } } } else { /* Insertion into closed dict failed. There is an existing state * with the same dot set. Get the existing state. */ graph->inTransMove( lastFound, state ); for ( TransMap::Iter tel = state->transMap; tel.lte(); tel++ ) { graph->stateList.detach( tel->value->toState ); delete tel->value->toState; delete tel->value; } graph->stateList.detach( state ); delete state; } } /* Invoke cloure on the graph. We use a queue here to achieve a breadth * first search of the tree we build. Note, there are back edges in this * tree. They are the edges made when upon closure, a dot set exists * already. */ void ParseData::lr0CloseAllStates() { /* While there are items on the closure queue. */ while ( graph->stateClosureQueue.length() > 0 ) { /* Pop the first item off. */ StateAp *state = graph->stateClosureQueue.detachFirst(); state->onClosureQueue = false; /* Invoke closure upon the state. */ lr0InvokeClosure( state ); } } void ParseData::transferCommits( TransAp *trans, StateAp *state, long prodId ) { ProdIdPairSet &pendingCommits = state->pendingCommits; for ( ProdIdPairSet::Iter pi = pendingCommits; pi.lte(); pi++ ) { if ( pi->onReduce == prodId ) trans->commits.insert( pi->length ); } } void ParseData::lalr1AddFollow2( TransAp *trans, FollowToAdd &followKeys ) { for ( ExpandToSet::Iter ets = trans->expandTo; ets.lte(); ets++ ) { int prodId = ets->prodId; StateAp *expandTo = ets->state; for ( FollowToAdd::Iter fkey = followKeys; fkey.lte(); fkey++ ) { TransMapEl *transEl = expandTo->transMap.find( fkey->key ); if ( transEl != 0 ) { /* Set up the follow transition. */ TransAp *destTrans = transEl->value; transferCommits( destTrans, expandTo, prodId ); graph->addInReduction( destTrans, prodId, fkey->value ); } else { /* Set up the follow transition. */ TransAp *followTrans = new TransAp; followTrans->lowKey = fkey->key; followTrans->isShift = false; followTrans->reductions.insert( prodId, fkey->value ); transferCommits( followTrans, expandTo, prodId ); graph->attachTrans( expandTo, actionDestState, followTrans ); expandTo->transMap.insert( followTrans->lowKey, followTrans ); graph->transClosureQueue.append( followTrans ); } } } } long TransAp::maxPrior() { long prior = LONG_MIN; if ( isShift && shiftPrior > prior ) prior = shiftPrior; for ( ReductionMap::Iter red = reductions; red.lte(); red++ ) { if ( red->value > prior ) prior = red->value; } return prior; } void ParseData::lalr1AddFollow1( StateAp *state ) { /* Finding non-terminals into the state. */ for ( TransInList::Iter in = state->inRange; in.lte(); in++ ) { long key = in->lowKey; KlangEl *langEl = langElIndex[key]; if ( langEl != 0 && langEl->type == KlangEl::NonTerm ) { /* Finding the following transitions. */ FollowToAdd followKeys; for ( TransMap::Iter fout = state->transMap; fout.lte(); fout++ ) { int fkey = fout->key; KlangEl *flel = langElIndex[fkey]; if ( flel == 0 || flel->type == KlangEl::Term ) { long prior = fout->value->maxPrior(); followKeys.insert( fkey, prior ); } } if ( followKeys.length() > 0 ) lalr1AddFollow2( in, followKeys ); } } } void ParseData::lalr1AddFollow2( TransAp *trans, long followKey, long prior ) { for ( ExpandToSet::Iter ets = trans->expandTo; ets.lte(); ets++ ) { int prodId = ets->prodId; StateAp *expandTo = ets->state; TransMapEl *transEl = expandTo->transMap.find( followKey ); if ( transEl != 0 ) { /* Add in the reductions, or in the shift. */ TransAp *destTrans = transEl->value; transferCommits( destTrans, expandTo, prodId ); graph->addInReduction( destTrans, prodId, prior ); } else { /* Set up the follow transition. */ TransAp *followTrans = new TransAp; followTrans->lowKey = followKey; followTrans->isShift = false; followTrans->reductions.insert( prodId, prior ); transferCommits( followTrans, expandTo, prodId ); graph->attachTrans( expandTo, actionDestState, followTrans ); expandTo->transMap.insert( followTrans->lowKey, followTrans ); graph->transClosureQueue.append( followTrans ); } } } void ParseData::lalr1AddFollow1( TransAp *trans ) { StateAp *state = trans->fromState; int fkey = trans->lowKey; KlangEl *flel = langElIndex[fkey]; if ( flel == 0 || flel->type == KlangEl::Term ) { /* Finding non-terminals into the state. */ for ( TransInList::Iter in = state->inRange; in.lte(); in++ ) { long key = in->lowKey; KlangEl *langEl = langElIndex[key]; if ( langEl != 0 && langEl->type == KlangEl::NonTerm ) { //cerr << "FOLLOW PRIOR TRANSFER 2: " << prior << endl; long prior = trans->maxPrior(); lalr1AddFollow2( in, fkey, prior ); } } } } /* Add follow sets to an LR(0) graph to make it LALR(1). */ void ParseData::lalr1AddFollowSets( ) { /* Make the state that all reduction actions go to. Since a reduction pops * states of the stack and sets the new target state, this state is * actually never reached. Just here to link the trans to. */ actionDestState = graph->addState(); graph->setFinState( actionDestState ); /* Get the entry into the graph and traverse over start. */ StateAp *overStart = graph->followFsm( graph->startState, startDef->fsm ); /* Add _eof after the initial _start. */ TransAp *eofTrans = graph->attachNewTrans( overStart, actionDestState, eofKlangEl->id, eofKlangEl->id ); eofTrans->isShift = true; /* This was used during lr0 table construction. */ graph->transClosureQueue.abandon(); /* Need to pass over every state initially. */ for ( StateList::Iter state = graph->stateList; state.lte(); state++ ) lalr1AddFollow1( state ); /* While the closure queue has items, pop them off and add follow * characters. */ while ( graph->transClosureQueue.length() > 0 ) { /* Pop the first item off and add Follow for it . */ TransAp *trans = graph->transClosureQueue.detachFirst(); lalr1AddFollow1( trans ); } } void ParseData::linkExpansions() { graph->setStateNumbers(); for ( StateList::Iter state = graph->stateList; state.lte(); state++ ) { /* Find transitions out on non terminals. */ for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) { long key = trans->key; KlangEl *langEl = langElIndex[key]; if ( langEl != 0 && langEl->type == KlangEl::NonTerm ) { /* For each production that the non terminal expand to ... */ for ( LelDefList::Iter prod = langEl->defList; prod.lte(); prod++ ) { /* Follow the production and add to the trans's expand to set. */ StateAp *followRes = graph->followFsm( state, prod->fsm ); //KlangEl *lel = langElIndex[key]; //cerr << state->stateNum << ", "; //if ( lel != 0 ) // cerr << lel->data; //else // cerr << (char)key; //cerr << " -> " << (*fto)->stateNum << " on " << // prod->data << " (fss = " << fin.pos() << ")" << endl; trans->value->expandTo.insert( ExpandToEl( followRes, prod->prodId ) ); } } } } } /* Generate a LALR(1) graph. */ void ParseData::lalr1GenerateParser() { /* Make the intial graph. */ graph = new FsmAp(); graph->langElIndex = langElIndex; StateAp *start = graph->addState(); graph->setStartState( start ); start->stateSet = new StateSet; start->stateSet->insert( startDef->fsm->startState ); /* Queue the start state for closure. */ start->onClosureQueue = true; graph->stateClosureQueue.append( start ); /* Run the lr0 closure. */ lr0CloseAllStates(); /* Link production expansions to the place they expand to. */ linkExpansions(); /* Walk the graph adding follow sets to the LR(0) graph. */ lalr1AddFollowSets(); /* Set the commit on the final eof shift. */ TransAp *overStart = graph->startState->findTrans( userStartKlangEl->id ); TransAp *eofTrans = overStart->toState->findTrans( eofKlangEl->id ); eofTrans->afterShiftCommits.insert( 2 ); } kelbt-0.15/kelbt/codegen.cpp0000664000175000017500000007311311707046220016315 0ustar thurstonthurston/* * Copyright 2003-2012 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "kelbt.h" #include "parsedata.h" #include "avlmap.h" #include "avlbasic.h" #include "avlset.h" #include "mergesort.h" using std::cerr; using std::endl; #define FRESH_BLOCK 8128 #define act_sb "0x1" #define act_rb "0x2" #define lower "0x0000ffff" #define upper "0xffff0000" void ParseData::startCodeGen() { if ( ! inhibitLineDirectives ) { /* Write the preprocessor line info for going to the output file. */ *outStream << "#line " << outFilter->line + 1 << " \"" << outputFile << "\"\n"; } } void ParseData::endCodeGen( int endLine ) { if ( ! inhibitLineDirectives ) { /* Write the preprocessor line info for to the input file. */ *outStream << "#line " << endLine << " \"" << fileName << "\"\n"; } } void ParseData::writeReferencePtr( InputLoc &loc, Definition *prod, char *data, int refNum ) { bool user = false, refThis = false; int rhsPos = -1; if ( data[0] == '$' ) user = true; if ( data[1] == '$' || data[1] == '@' ) refThis = true; else rhsPos = atoi(data+1); /* Get the language element. */ KlangEl *lel = refThis ? prod->prodName : prod->rhsLelVect[rhsPos-1]; if ( user ) { if ( lel == 0 || lel->type == KlangEl::Term ) { if ( tokenIsClass ) out << Token() << " *__ref" << refNum << " = (" << Token() << "*)"; else out << Token() << " *__ref" << refNum << " = (" << Token() << "*)&"; } else if ( lel != 0 && lel->type == KlangEl::NonTerm ) { if ( lel->typeDef != 0 && lel->typeDef->isClass ) out << Lel_() << lel->typeDef->data << " *__ref" << refNum << " = (" << Lel_() << lel->typeDef->data << "*)"; else out << Lel_() << lel->typeDef->data << " *__ref" << refNum << " = (" << Lel_() << lel->typeDef->data << "*)&"; } else { assert( false ); } } else { out << LangEl() << " *__ref" << refNum << " = (" << LangEl() << "*)"; } /* Write the access to the language element. */ if ( refThis ) out << "redLel"; else out << "rhs[" << (rhsPos-1) << "]"; if ( user ) { if ( lel == 0 || lel->type == KlangEl::Term ) { /* Terminal (maybe a lit). */ out << "->user.token"; } else if ( lel->type == KlangEl::NonTerm && lel->typeDef != 0 ) out << "->user." << lel->typeDef->data; else { error(loc) << "reference to " << data << " in code block " "does not have a user type" << endl; exit(1); } } out << ";\n"; } void ParseData::writeReference( InputLoc &loc, Definition *prod, char *data, int refNum ) { out << "(__ref" << refNum << ")"; } void ParseData::writeInlineBlock( Definition *prod, InlineBlock *block ) { int refNum = 0; for ( InlineList::Iter item = *block->inlineList; item.lte(); item++ ) { if ( item->type == InlineItem::Reference ) writeReferencePtr( item->loc, prod, item->data, refNum++ ); } if ( ! inhibitLineDirectives ) out << "#line " << block->loc.line << " \"" << fileName << "\"\n"; refNum = 0; for ( InlineList::Iter item = *block->inlineList; item.lte(); item++ ) { switch ( item->type ) { case InlineItem::Text: out << item->data; break; case InlineItem::Reference: writeReference( item->loc, prod, item->data, refNum++ ); break; } } if ( ! inhibitLineDirectives ) out << "\n\n#line " << outFilter->line + 1 << " \"" << outputFile << "\"\n"; } void ParseData::writeTokenIds() { out << "/*\n"; for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) { if ( lel->data != 0 ) out << " " << lel->data << " " << lel->id << endl; else out << " " << lel->id << endl; } out << "*/\n\n"; } /* Write the classes representing the non-terminal language elements. */ void ParseData::writeTypes() { for ( TypeDefMap::Iter td = typeDefMap; td.lte(); td++ ) { /* Start the class representing the non-terminal. */ out << "struct " << Lel_() << td->key << "\n" "{\n"; writeInlineBlock( 0, td->value->typeBlock ); /* Close the struct off. */ out << "};\n" "\n"; } out << "union " << UserData() << "\n" "{\n"; for ( TypeDefMap::Iter td = typeDefMap; td.lte(); td++ ) { if ( td->value->isClass ) out << " char " << td->key << "[sizeof(" << Lel_() << td->key << ")];\n"; else out << " struct " << Lel_() << td->key << " " << td->key << ";\n"; } if ( tokenIsClass ) out << " char token[sizeof(" << Token() << ")];\n"; else out << " struct " << Token() << " token;\n"; out << "};\n" "\n"; out << "struct " << LangEl() << "\n" "{\n" " char *file;\n" " int line;\n" " int type;\n" " int reduction;\n" /* Should be able to extract this from the FSM. */ " int state;\n" " int causeReduce;\n" " union " << UserData() << " user;\n"; if ( elementBlock != 0 ) writeInlineBlock( 0, elementBlock ); out << " unsigned int retry;\n" " struct " << LangEl() << " *next, *child, *prev;\n" "};\n" "\n"; out << "struct " << Block() << "\n" "{\n" " struct " << LangEl() << " data[" << FRESH_BLOCK << "];\n" " struct " << Block() << " *next;\n" "};\n" "\n"; } void ParseData::writeInstanceData() { out << " struct " << Block() << " *block;\n" " struct " << LangEl() << " *freshEl;\n" " int freshPos;\n" " struct " << LangEl() << " *pool;\n" " int numRetry;\n" " int numNodes;\n" " struct " << LangEl() << " *stackTop;\n" " struct " << LangEl() << " *lastFinal;\n" " int errCount;\n" " int curs;\n"; } void ParseData::writeTokenDefs() { for ( LelList::Iter lel = langEls; lel.lte(); lel++ ) { if ( lel->isUserTerm || lel == eofKlangEl ) { /* Write out the token that will be generated by the scanner. */ out << "#define " << lel->data << " " << lel->id << "\n"; } } out << "\n"; } void ParseData::writeInit() { out << " " << curs() << " = " << startState() << ";\n" " " << pool() << " = 0;\n" " " << block() << " = (struct " << Block() << "*) " "malloc( sizeof(struct " << Block() << ") );\n" " " << block() << "->next = 0;\n" " " << freshEl() << " = " << block() << "->data;\n" " #ifdef KELBT_LOG_ACTIONS\n" " cerr << \"allocating " << FRESH_BLOCK << " LangEls\" << endl;\n" " #endif\n" " " << stackTop() << " = " << freshEl() << ";\n" " " << stackTop() << "->type = 0;\n" " " << stackTop() << "->state = -1;\n" " " << stackTop() << "->next = 0;\n" " " << stackTop() << "->child = 0;\n" " " << stackTop() << "->causeReduce = 0;\n" " " << freshPos() << " = 1;\n" " " << lastFinal() << " = " << stackTop() << ";\n" " " << numRetry() << " = 0;\n" " " << numNodes() << " = 0;\n" " " << errCount() << " = 0;\n"; } std::ostream &ParseData::UARRAY_TYPE( unsigned long long maxVal ) { ostream &out = *outStream; if ( maxVal <= UCHAR_MAX ) out << "unsigned char"; else if ( maxVal <= USHRT_MAX ) out << "unsigned short"; else if ( maxVal <= UINT_MAX ) out << "unsigned int"; else if ( maxVal <= ULONG_MAX ) out << "unsigned long"; else out << "unsigned long long"; return out; } std::ostream &ParseData::SARRAY_TYPE( signed long long maxVal ) { ostream &out = *outStream; if ( maxVal <= CHAR_MAX ) out << "char"; else if ( maxVal <= SHRT_MAX ) out << "short"; else if ( maxVal <= INT_MAX ) out << "int"; else if ( maxVal <= LONG_MAX ) out << "long"; else out << "long long"; return out; } void ParseData::writeData() { out << "unsigned int " << startState() << " = " << graph->startState->stateNum << ";\n\n"; SARRAY_TYPE(maxIndex) << " " << indicies() << "[] = {\n\t"; int totalItems = 0; for ( StateList::Iter state = graph->stateList; state.lte(); state++ ) { for ( TransMap::Iter trans = state->transMap; trans.lte(); trans++ ) { out << trans->value->actionSetEl->key.id; if ( !state.last() || !trans.last() ) { out << ", "; if ( ++totalItems % 8 == 0 ) out << "\n\t"; } if ( ! trans.last() ) { TransMap::Iter next = trans.next(); for ( long key = trans->key+1; key < next->key; key++ ) { out << "-1, "; if ( ++totalItems % 8 == 0 ) out << "\n\t"; } } } } out << "\n};\n\n"; UARRAY_TYPE(maxLelId) << " " << keys() << "[] = {\n\t"; totalItems = 0; for ( StateList::Iter state = graph->stateList; state.lte(); state++ ) { if ( state->transMap.length() == 0 ) { out << "0, 0"; if ( !state.last() ) { out << ", "; totalItems += 2; if ( totalItems % 8 == 0 ) out << "\n\t"; } } else { TransMap::Iter first = state->transMap.first(); TransMap::Iter last = state->transMap.last(); out << first->key << ", " << last->key; if ( !state.last() ) { out << ", "; totalItems += 2; if ( totalItems % 8 == 0 ) out << "\n\t"; } } } out << "\n};\n\n"; UARRAY_TYPE(maxOffset) << " " << offsets() << "[] = {\n\t"; totalItems = 0; int curOffset = 0; for ( StateList::Iter state = graph->stateList; state.lte(); state++ ) { out << curOffset; if ( !state.last() ) { out << ", "; if ( ++totalItems % 8 == 0 ) out << "\n\t"; } /* Increment the offset. */ if ( state->transMap.length() > 0 ) { TransMap::Iter first = state->transMap.first(); TransMap::Iter last = state->transMap.last(); curOffset += last->key - first->key + 1; } } out << "\n};\n\n"; UARRAY_TYPE(maxState) << " " << targs() << "[] = {\n\t"; totalItems = 0; for ( ActionSet::Iter asi = actionSet; asi.lte(); asi++ ) { out << asi->key.targ; if ( ! asi.last() ) { out << ", "; if ( ++totalItems % 8 == 0 ) out << "\n\t"; } } out << "\n};\n\n"; out << "unsigned int " << actInds() << "[] = {\n\t"; totalItems = 0; int pos = 0; for ( ActionSet::Iter asi = actionSet; asi.lte(); asi++ ) { out << pos; if ( ! asi.last() ) { out << ", "; if ( ++totalItems % 8 == 0 ) out << "\n\t"; } pos += asi->key.actions.length() + 1; } out << "\n};\n\n"; out << "unsigned int " << actions() << "[] = {\n\t"; totalItems = 0; for ( ActionSet::Iter asi = actionSet; asi.lte(); asi++ ) { for ( ActDataList::Iter ali = asi->key.actions; ali.lte(); ali++ ) { out << *ali << ", "; if ( ++totalItems % 8 == 0 ) out << "\n\t"; } out << "0"; if ( ! asi.last() ) { out << ", "; if ( ++totalItems % 8 == 0 ) out << "\n\t"; } } out << "\n};\n\n"; out << "int " << commitLen() << "[] = {\n\t"; totalItems = 0; for ( ActionSet::Iter asi = actionSet; asi.lte(); asi++ ) { out << asi->key.commitLen; if ( ! asi.last() ) { out << ", "; if ( ++totalItems % 8 == 0 ) out << "\n\t"; } } out << "\n};\n\n"; SARRAY_TYPE(maxProdLen) << " " << prodLengths() << "[] = {\n\t"; totalItems = 0; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { int numFin = prod->fsm->finStateSet.length(); assert( numFin == 1 ); for ( int i = 0; i < numFin; i++ ) { out << prod->fsmLength; if ( !prod.last() || i < (numFin-1) ) { out << ", "; if ( ++totalItems % 8 == 0 ) out << "\n\t"; } } } out << "\n};\n\n"; UARRAY_TYPE(maxLelId) << " " << prodLhsIds() << "[] = {\n\t"; totalItems = 0; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { out << prod->prodName->id; if ( ! prod.last() ) { out << ", "; if ( ++totalItems % 8 == 0 ) out << "\n\t"; } } out << "\n};\n\n"; out << "const char *" << prodNames() << "[] = {\n"; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { out << "\t\"" << prod->data << "\""; if ( ! prod.last() ) out << ","; out << "\n"; } out << "};\n\n"; out << "const char *" << lelNames() << "[] = {\n"; for ( int i = 0; i < nextSymbolId; i++ ) { KlangEl *lel = langElIndex[i]; if ( lel != 0 ) out << "\t\"" << lel->data << "\""; else { out << "\t\""; if ( 33 <= i && i <= 126 ) { if ( i == '"' || i == '\\' ) out << "\\"; out << (char)i; } else out << "D-" << i; out << "\""; } if ( i < nextSymbolId-1 ) out << ","; out << "\n"; } out << "};\n\n"; #if 0 out << "char prodCommit[] = {\n\t"; totalItems = 0; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { out << ( prod->prodCommit ? '1' : '0' ); if ( ! prod.last() ) { out << ", "; if ( ++totalItems % 8 == 0 ) out << "\n\t"; } } out << "\n};\n\n"; #endif } void ParseData::writeReduceBlocks() { bool generate = false; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { TypeDef *typeDef = prod->prodName->typeDef; bool doConstruct = typeDef != 0 && typeDef->isClass; if ( doConstruct || prod->redBlock != 0 ) { generate = true; break; } } if ( generate ) { out << "switch ( reduction ) {\n"; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { TypeDef *typeDef = prod->prodName->typeDef; bool doConstruct = typeDef != 0 && typeDef->isClass; /* If there is reduction code, embed it here. */ if ( doConstruct || prod->redBlock != 0 ) { out << "case " << prod->prodId << ": {\n"; if ( doConstruct ) { out << " new(redLel->user." << typeDef->data << ") " << Lel_() << typeDef->data << "();\n"; } if ( prod->redBlock != 0 ) writeInlineBlock( prod, prod->redBlock ); out << "} break;\n"; } } out << "}\n"; } } void ParseData::writeUndoBlocks() { bool generate = false; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { TypeDef *typeDef = prod->prodName->typeDef; bool doDestruct = typeDef != 0 && typeDef->isClass; if ( doDestruct || prod->undoBlock != 0 ) { generate = true; break; } } if ( generate ) { out << "switch ( redLel->reduction ) {\n"; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { TypeDef *typeDef = prod->prodName->typeDef; bool doDestruct = typeDef != 0 && typeDef->isClass; /* If there is reduction code, embed it here. */ if ( doDestruct || prod->undoBlock != 0 ) { out << "case " << prod->prodId << ": {\n"; if ( prod->undoBlock != 0 ) writeInlineBlock( prod, prod->undoBlock ); if ( doDestruct ) { out << Lel_() << typeDef->data << " *dlel = " "((" << Lel_() << typeDef->data << "*)" "redLel->user." << typeDef->data << ");\n"; out << "dlel->~" << Lel_() << typeDef->data << "();\n"; } out << "} break;\n"; } } out << "}\n"; } } void ParseData::writeFinalBlocks() { bool generate = false; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { if ( prod->finalBlock != 0 ) { generate = true; break; } } if ( generate ) { out << "switch ( lel->reduction ) {\n"; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { /* If there is reduction code, embed it here. */ if ( prod->finalBlock != 0 ) { out << "case " << prod->prodId << ": {\n"; if ( prod->finalBlock != 0 ) writeInlineBlock( prod, prod->finalBlock ); out << "} break;\n"; } } out << "}\n"; } } void ParseData::writeNonTermDestructors() { bool generate = false; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { TypeDef *typeDef = prod->prodName->typeDef; bool doDestruct = typeDef != 0 && typeDef->isClass; if ( doDestruct ) { generate = true; break; } } if ( generate ) { out << "switch ( child->reduction ) {\n"; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { TypeDef *typeDef = prod->prodName->typeDef; bool doDestruct = typeDef != 0 && typeDef->isClass; /* If there is reduction code, embed it here. */ if ( doDestruct ) { out << "case " << prod->prodId << ": {\n"; out << Lel_() << typeDef->data << " *dlel = ((" << Lel_() << typeDef->data << "*)" "child->user." << typeDef->data << ");\n"; out << "dlel->~" << Lel_() << typeDef->data << "();\n"; out << "} break;\n"; } } out << "}\n"; } } void ParseData::writeFinishBlocks() { bool generate = false; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { TypeDef *typeDef = prod->prodName->typeDef; bool doDestruct = typeDef != 0 && typeDef->isClass; if ( doDestruct ) { generate = true; break; } } if ( generate ) { out << "switch ( lel->reduction ) {\n"; for ( DefList::Iter prod = prodList; prod.lte(); prod++ ) { TypeDef *typeDef = prod->prodName->typeDef; bool doDestruct = typeDef != 0 && typeDef->isClass; /* If there is reduction code, embed it here. */ if ( doDestruct ) { out << "case " << prod->prodId << ": {\n"; out << Lel_() << typeDef->data << " *dlel =" "((" << Lel_() << typeDef->data << "*)\n"; out << "dlel->~" << Lel_() << typeDef->data << "();\n"; out << "} break;\n"; } } out << "}\n"; } } ostream &ParseData::ALLOCATE_EL( const char *name ) { out << " if ( " << pool() << " == 0 ) {\n" " if ( " << freshPos() << " == " << FRESH_BLOCK << " ) {\n" " struct " << Block() << "* newBlock = (struct " << Block() << "*) " "malloc( sizeof(struct " << Block() << ") );\n" " newBlock->next = " << block() << ";\n" " " << block() << " = newBlock;\n" " " << freshEl() << " = newBlock->data;\n" " #ifdef KELBT_LOG_ACTIONS\n" " cerr << \"allocating " << FRESH_BLOCK << " LangEls\" << endl;\n" " #endif\n" " " << freshPos() << " = 0;\n" " }\n" " " << name << " = " << freshEl() << " + " << freshPos() << "++;\n" " }\n" " else {\n" " " << name << " = " << pool() << ";\n" " " << pool() << " = " << pool() << "->next;\n" " }\n" " " << numNodes() << " += 1;\n"; return out; } void ParseData::writeExec() { out << "#define reject() induceReject = 1\n" "\n" " int pos, targState;\n" " unsigned int *action;\n" " int rhsLen;\n" " struct " << LangEl() << " *rhs[32];\n" " struct " << LangEl() << " *lel = 0;\n" " struct " << LangEl() << " *input = 0;\n" " struct " << LangEl() << " *queue = 0;\n" " char induceReject;\n" "\n" " if ( " << curs() << " < 0 )\n" " return 0;\n" "\n"; ALLOCATE_EL( "queue" ) << "\n" " queue->type = type;\n"; if ( tokenIsClass ) out << " new(queue->user.token) " << Token() << "(*token);\n"; else out << " queue->user.token = *token;\n"; out << " queue->next = 0;\n" " queue->retry = 0;\n" " queue->child = 0;\n" " queue->causeReduce = 0;\n" "\n" "again:\n" " if ( input == 0 ) {\n" " if ( queue == 0 )\n" " goto _out;\n" "\n" " input = queue;\n" " queue = queue->next;\n" " input->next = 0;\n"; if ( translateBlock != 0 ) writeInlineBlock( 0, translateBlock ); out << " }\n" "\n"; out << " lel = input;\n" " if ( lel->type < " << keys() << "[" << curs() << "<<1] || lel->type > " << keys() << "[(" << curs() << "<<1)+1] )\n" " goto parseError;\n" "\n" " pos = " << indicies() << "[" << offsets() << "[" << curs() << "] + (lel->type - " << keys() << "[" << curs() << "<<1])];\n" " if ( pos < 0 )\n" " goto parseError;\n" "\n" " induceReject = 0;\n" " targState = " << targs() << "[pos];\n" " action = " << actions() << " + " << actInds() << "[pos];\n" " if ( lel->retry & " << lower << " )\n" " action += (lel->retry & " << lower << ");\n" "\n" " if ( *action & " << act_sb << " ) {\n" " #ifdef KELBT_LOG_ACTIONS\n" " cerr << \"shifted: \" << " << lelNames() << "[lel->type];\n" " #endif\n" " input = input->next;\n" " lel->state = " << curs() << ";\n" " lel->next = " << stackTop() << ";\n" " " << stackTop() << " = lel;\n" "\n" " if ( action[1] == 0 )\n" " lel->retry &= " << upper << ";\n" " else {\n" " lel->retry += 1;\n" " " << numRetry() << " += 1;\n" " #ifdef KELBT_LOG_ACTIONS\n" " cerr << \" retry: \" << " << stackTop() << ";\n" " #endif\n" " }\n" " #ifdef KELBT_LOG_ACTIONS\n" " cerr << endl;\n" " #endif\n" " }\n" "\n" " if ( " << commitLen() << "[pos] != 0 ) {\n" " struct " << LangEl() << " *commitHead = " << stackTop() << ", *lel;\n" " int sp = 0, doExec = 0;\n" " #ifdef KELBT_LOG_ACTIONS\n" " cerr << \"commit encountered, executing final actions\" << endl;\n" " #endif\n" " if ( " << commitLen() << "[pos] < 0 )\n" " commitHead = commitHead->next;\n" "\n" " lel = commitHead;\n" "\n" "commit_head:\n" " if ( lel == " << lastFinal() << " ) {\n" " doExec = 1;\n" " goto commit_base;\n" " }\n" "\n" " if ( lel->next != 0 ) {\n" " sp += 1;\n" " lel->next->prev = lel;\n" " lel = lel->next;\n" " lel->retry = 0;\n" " goto commit_head;\n" " }\n" "\n" "commit_reverse:\n" "\n" " if ( lel->child != 0 ) {\n" " sp += 1;\n" " lel->child->prev = lel;\n" " lel = lel->child;\n" " lel->retry = 1;\n" " goto commit_head;\n" " }\n" "\n" "commit_upwards:\n" "\n" " if ( doExec ) {\n" " if ( lel->type < " << firstNonTermId << " ) {\n"; if ( tokenFinalBlock != 0 ) writeInlineBlock( 0, tokenFinalBlock ); out << " }\n" " else {\n" " struct " << LangEl() << " *redLel = lel;\n" " if ( redLel->child != 0 ) {\n" " int r = " << prodLengths() << "[redLel->reduction] - 1;\n" " struct " << LangEl() << " *rhsEl = redLel->child;\n" " while ( rhsEl != 0 ) {\n" " rhs[r--] = rhsEl;\n" " rhsEl = rhsEl->next;\n" " }\n" " }\n"; writeFinalBlocks(); out << " }\n" "\n" " if ( lel->child != 0 ) {\n" " struct " << LangEl() << " *first = lel->child;\n" " struct " << LangEl() << " *child = lel->child;\n" " lel->child = 0;\n" " while ( 1 ) {\n" " if ( child->type < " << firstNonTermId << " ) {\n"; if ( tokenIsClass ) { out << Token() << " *dlel = ((" << Token() << "*)child->user.token);\n"; out << "dlel->~" << Token() << "();\n"; } out << " }\n" " else {\n"; writeNonTermDestructors(); out << " }\n" " " << numNodes() << " -= 1;\n" " if ( child->next == 0 )\n" " break;\n" " child = child->next;\n" " }\n" " child->next = " << pool() << ";\n" " " << pool() << " = first;\n" " }\n" " }\n" "\n" "commit_base:\n" " if ( sp > 0 ) {\n" " sp -= 1;\n" " if ( lel->retry == 0 ) {\n" " lel = lel->prev;\n" " goto commit_reverse;\n" " }\n" " else {\n" " lel->retry = 0;\n" " lel = lel->prev;\n" " goto commit_upwards;\n" " }\n" " }\n" " lel->retry = 0;\n" "\n" " " << lastFinal() << " = lel;\n" " " << numRetry() << " = 0;\n" " }\n" "\n" " if ( *action & " << act_rb << " ) {\n" " int reduction = *action >> 2;\n" " struct " << LangEl() << " *redLel;\n" "\n" " if ( input != 0 )\n" " input->causeReduce += 1;\n" "\n"; ALLOCATE_EL("redLel") << "\n" " redLel->type = " << prodLhsIds() << "[reduction];\n" " redLel->reduction = reduction;\n" " redLel->child = 0;\n" " redLel->next = 0;\n" " redLel->retry = (lel->retry << 16);\n" " redLel->causeReduce = 0;\n" " lel->retry &= " << upper << ";\n" "\n" " rhsLen = " << prodLengths() << "[reduction];\n" " if ( rhsLen > 0 ) {\n" " int r;\n" " for ( r = rhsLen-1; r > 0; r-- ) {\n" " rhs[r] = " << stackTop() << ";\n" " " << stackTop() << " = " << stackTop() << "->next;\n" " }\n" " rhs[0] = " << stackTop() << ";\n" " " << stackTop() << " = " << stackTop() << "->next;\n" " rhs[0]->next = 0;\n" " }\n"; writeReduceBlocks(); out << " #ifdef KELBT_LOG_ACTIONS\n" " cerr << \"reduced: \"\n" " << " << prodNames() << "[reduction]\n" " << \" rhsLen: \" << rhsLen;\n" " #endif\n" " if ( action[1] == 0 )\n" " redLel->retry = 0;\n" " else {\n" " redLel->retry += 0x10000;\n" " " << numRetry() << " += 1;\n" " #ifdef KELBT_LOG_ACTIONS\n" " cerr << \" retry: \" << redLel;\n" " #endif\n" " }\n" "\n" " #ifdef KELBT_LOG_ACTIONS\n" " cerr << endl;\n" " #endif\n" "\n" " if ( rhsLen == 0 ) {\n" " redLel->file = lel->file;\n" " redLel->line = lel->line;\n" " targState = " << curs() << ";\n" " }\n" " else {\n" " redLel->child = rhs[rhsLen-1];\n" " redLel->file = rhs[0]->file;\n" " redLel->line = rhs[0]->line;\n" " targState = rhs[0]->state;\n" " }\n" "\n" " if ( induceReject ) {\n" " #ifdef KELBT_LOG_ACTIONS\n" " cerr << \"error induced during reduction of \" <<\n" " " << lelNames() << "[redLel->type] << endl;\n" " #endif\n" " redLel->state = " << curs() << ";\n" " redLel->next = " << stackTop() << ";\n" " " << stackTop() << " = redLel;\n" " " << curs() << " = targState;\n" " goto parseError;\n" " }\n" " else {\n" " redLel->next = input;\n" " input = redLel;\n" " }\n" " }\n" "\n" "\n" " " << curs() << " = targState;\n" " goto again;\n" "\n" "parseError:\n" " #ifdef KELBT_LOG_BACKTRACK\n" " cerr << \"hit error\" << endl;\n" " #endif\n"; out << " if ( " << numRetry() << " > 0 ) {\n" " struct " << LangEl() << " *redLel;\n" "\n" " if ( input != 0 ) {\n" " redLel = input;\n" " goto have_undo_element;\n" " }\n" "\n" " while ( 1 ) {\n" " redLel = " << stackTop() << ";\n" " if ( " << stackTop() << "->type < " << firstNonTermId << " ) {\n" " #ifdef KELBT_LOG_BACKTRACK\n" " cerr << \"backing up over terminal: \" <<\n" " " << lelNames() << "[" << stackTop() << "->type] << endl;\n" " #endif\n" " " << stackTop() << " = " << stackTop() << "->next;\n" " redLel->next = input;\n" " input = redLel;\n" " }\n" " else {\n" " #ifdef KELBT_LOG_BACKTRACK\n" " cerr << \"backing up over non-terminal: \" <<\n" " " << lelNames() << "[" << stackTop() << "->type] << endl;\n" " #endif\n" " " << stackTop() << " = " << stackTop() << "->next;\n" " struct " << LangEl() << " *first = redLel->child;\n" " if ( first == 0 )\n" " rhsLen = 0;\n" " else {\n" " rhsLen = 1;\n" " while ( first->next != 0 ) {\n" " first = first->next;\n" " rhsLen += 1;\n" " }\n" " first->next = " << stackTop() << ";\n" " " << stackTop() << " = redLel->child;\n" "\n" " struct " << LangEl() << " *rhsEl = " << stackTop() << ";\n" " int p = rhsLen;\n" " while ( p > 0 ) {\n" " rhs[--p] = rhsEl;\n" " rhsEl = rhsEl->next;\n" " }\n" " }\n"; writeUndoBlocks(); out << " redLel->next = " << pool() << ";\n" " " << pool() << " = redLel;\n" " " << numNodes() << " -= 1;\n" "\n" " if ( input != 0 )\n" " input->causeReduce -= 1;\n" " }\n" "\n" "have_undo_element:\n" " if ( redLel->retry == 0 ) {\n" " if ( input != 0 && input->causeReduce == 0 ) {\n" " #ifdef KELBT_LOG_BACKTRACK\n" " cerr << \"pushing back: \" << " << lelNames() << "[input->type] << endl;\n" " #endif\n"; if ( undoTransBlock != 0 ) writeInlineBlock( 0, undoTransBlock ); out << " input->next = queue;\n" " queue = input;\n" " input = 0;\n" " }\n" " }\n" " else {\n" " #ifdef KELBT_LOG_BACKTRACK\n" " cerr << \"found retry targ: \" << redLel << endl;\n" " #endif\n" " " << numRetry() << " -= 1;\n" " #ifdef KELBT_LOG_BACKTRACK\n" " cerr << \"found retry: \" << redLel << endl;\n" " #endif\n" " if ( redLel->retry & " << lower << " )\n" " " << curs() << " = input->state;\n" " else {\n" " input->retry = redLel->retry >> 16;\n" " if ( " << stackTop() << "->state < 0 )\n" " " << curs() << " = " << startState() << ";\n" " else {\n" " " << curs() << " = " << targs() << "[(int)" << indicies() << "[" << offsets() << "[" << stackTop() << "->state] + (" << stackTop() << "->type - " << keys() << "[" << stackTop() << "->state<<1])]];\n" " }\n" " }\n" " goto again;\n" " }\n" " }\n" " }\n" " " << curs() << " = -1;\n" " " << errCount() << " += 1;\n" "_out: {}\n"; } void ParseData::writeFinish() { /* Clean up the stack and free memory. */ out << " struct " << Block() << " *todel = 0;\n" " struct " << LangEl() << " *lel = " << stackTop() << ";\n" " int sp = 0;\n" " #ifdef KELBT_LOG_ACTIONS\n" " cerr << \"cleaning up stack\" << endl;\n" " #endif\n" "\n" "clean_head:\n" " if ( lel->next != 0 ) {\n" " sp += 1;\n" " lel->next->prev = lel;\n" " lel = lel->next;\n" " lel->retry = 0;\n" " goto clean_head;\n" " }\n" "\n" "clean_reverse:\n" " if ( lel->child != 0 ) {\n" " sp += 1;\n" " lel->child->prev = lel;\n" " lel = lel->child;\n" " lel->retry = 1;\n" " goto clean_head;\n" " }\n" "\n" "clean_upwards:\n" " if ( lel->state != -1 ) {\n" " if ( lel->type < " << firstNonTermId << " ) {\n"; if ( tokenIsClass ) { out << Token() << " *dlel = ((" << Token() << "*)lel->user.token);\n"; out << "dlel->~" << Token() << "();\n"; } out << " }\n" " else {\n"; writeFinishBlocks(); out << " }\n" " #ifdef KELBT_LOG_ACTIONS\n" " cerr << \"deleted: \" << " << lelNames() << "[lel->type] << endl;\n" " #endif\n" " }\n" " if ( sp > 0 ) {\n" " sp -= 1;\n" " if ( lel->retry == 0 ) {\n" " lel = lel->prev;\n" " goto clean_reverse;\n" " }\n" " else {\n" " lel = lel->prev;\n" " goto clean_upwards;\n" " }\n" " }\n" "\n"; /* Now clean up the allocated blocks. */ out << " while ( " << block() << " != 0 ) {\n" " todel = " << block() << ";\n" " " << block() << " = " << block() << "->next;\n" " free( todel );\n" " }\n"; } kelbt-0.15/kelbt/main.cpp0000664000175000017500000002276011707046220015637 0ustar thurstonthurston/* * Copyright 2001-2005, 2009-2012 Adrian Thurston */ /* This file is part of Kelbt. * * Kelbt is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Kelbt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kelbt; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include /* Parsing. */ #include "kelbt.h" #include "parsedata.h" /* Parameters and output. */ #include "pcheck.h" #include "vector.h" #include "version.h" using std::ostream; using std::istream; using std::ifstream; using std::ios; using std::cout; using std::cerr; using std::cin; using std::endl; /* Target language and output style. */ const char *defExtension = ".cpp"; /* Io globals. */ ostream *outStream = 0; output_filter *outFilter = 0; const char *inputFile = 0; const char *outputFile = 0; bool generateGraphviz = false; Parser *graphvizGenParser = 0; bool branchPointInfo = false; bool addUniqueEmptyProductions = false; bool inhibitLineDirectives = false; istream *inStream = 0; ArgsVector includePaths; /* Print a summary of the options. */ void usage() { cout << "usage: kelbt [options] file\n" "general:\n" " -h, -H, -?, --help Print this usage and exit\n" " -v, --version Print version information and exit\n" " -o Write output to \n" " -V Generate a Graphviz dotfile\n" " -i Show branch point info\n" " -t Force top-down with unique empty productions\n" " -l Inhibit writing of #line directives\n" ; } /* Print version information. */ void version() { cout << "Kelbt version " VERSION << " " PUBDATE << endl << "Copyright (c) 2005-2012 by Adrian Thurston" << endl; } /* Scans a string looking for the file extension. If there is a file * extension then pointer returned points to inside the string * passed in. Otherwise returns null. */ const char *findFileExtension( const char *stemFile ) { const char *ppos = stemFile + strlen(stemFile) - 1; /* Scan backwards from the end looking for the first dot. * If we encounter a '/' before the first dot, then stop the scan. */ while ( 1 ) { /* If we found a dot or got to the beginning of the string then * we are done. */ if ( ppos == stemFile || *ppos == '.' ) break; /* If we hit a / then there is no extension. Done. */ if ( *ppos == '/' ) { ppos = stemFile; break; } ppos--; } /* If we got to the front of the string then bail we * did not find an extension */ if ( ppos == stemFile ) ppos = 0; return ppos; } /* Make a file name from a stem. Removes the old filename suffix and * replaces it with a new one. Returns a newed up string. */ const char *fileNameFromStem( const char *stemFile, const char *suffix ) { int len = strlen( stemFile ); assert( len > 0 ); /* Get the extension. */ const char *ppos = findFileExtension( stemFile ); /* If an extension was found, then shorten what we think the len is. */ if ( ppos != 0 ) len = ppos - stemFile; /* Make the return string from the stem and the suffix. */ char *retVal = new char[ len + strlen( suffix ) + 1 ]; strncpy( retVal, stemFile, len ); strcpy( retVal + len, suffix ); return retVal; } /* Total error count. */ int gblErrorCount = 0; /* Print the opening to a program error, then return the error stream. */ ostream &error() { /* Keep the error count. */ // if ( id != 0 && id->pd != 0 ) // id->pd->errorCount += 1; gblErrorCount += 1; cerr << PROGNAME ": "; return cerr; } /* Print the opening to an error in the input, then return the error ostream. */ ostream &error( const InputLoc &loc ) { assert( inputFile != 0 ); /* Keep the error count. */ gblErrorCount += 1; cerr << inputFile << ":" << loc.line << ":" << loc.col << ": "; return cerr; } /* Print the opening to a warning, then return the error ostream. */ ostream &warning( ) { assert( inputFile != 0 ); cerr << inputFile << ": warning: "; return cerr; } /* Print the opening to a warning in the input, then return the error ostream. */ ostream &warning( const InputLoc &loc ) { assert( inputFile != 0 ); cerr << inputFile << ":" << loc.line << ":" << loc.col << ": warning: "; return cerr; } int output_filter::sync( ) { line += 1; return std::filebuf::sync(); } /* Counts newlines before sending data out to file. */ std::streamsize output_filter::xsputn( const char *s, std::streamsize n ) { for ( int i = 0; i < n; i++ ) { if ( s[i] == '\n' ) line += 1; } return std::filebuf::xsputn( s, n ); } void escapeLineDirectivePath( std::ostream &out, const char *path ) { for ( const char *pc = path; *pc != 0; pc++ ) { if ( *pc == '\\' ) out << "\\\\"; else out << *pc; } } void scan( const char *fileName, istream &input ); /* Main, process args and call yyparse to start scanning input. */ int main(int argc, const char **argv) { ParamCheck pc("I:io:VdvHh?-:tl", argc, argv); while ( pc.check() ) { switch ( pc.state ) { case ParamCheck::match: switch ( pc.parameter ) { /* Output. */ case 'o': if ( *pc.paramArg == 0 ) { /* Complain, someone used -o "" */ error() << "zero length output file name" << endl; exit(1); } else if ( outputFile != 0 ) { /* Complain, two output files given. */ error() << "more than one output file" << endl; exit(1); } else { /* Ok, remember the output file name. */ outputFile = pc.paramArg; } break; /* Version and help. */ case 'v': version(); exit(0); case 'H': case 'h': case '?': usage(); exit(0); case 'V': generateGraphviz = true; break; case 'i': branchPointInfo = true; break; case '-': if ( strcasecmp(pc.paramArg, "help") == 0 ) { usage(); exit(0); } else if ( strcasecmp(pc.paramArg, "version") == 0 ) { version(); exit(0); } else { error() << "invalid parameter" << endl; exit(1); } break; case 't': addUniqueEmptyProductions = true; break; case 'l': inhibitLineDirectives = true; break; case 'I': includePaths.append( pc.paramArg ); break; } break; case ParamCheck::invalid: error() << "invalid parameter" << endl; exit(1); case ParamCheck::noparam: /* It is interpreted as an input file. */ if ( *pc.curArg == 0 ) { error() << "zero length input file name" << endl; exit(1); } if ( inputFile != 0 ) { error() << "more than one input file" << endl; exit(1); } /* Remember the filename. */ inputFile = pc.curArg; break; } } /* Look for no input file specified. */ if ( inputFile == 0 ) error() << "no input file" << endl; /* Bail on above errors. */ if ( gblErrorCount > 0 ) exit(1); if ( ! generateGraphviz ) { if ( outputFile == 0 ) outputFile = fileNameFromStem( inputFile, defExtension ); /* Make sure we are not writing to the same file as the input file. */ if ( outputFile != 0 && strcmp( inputFile, outputFile ) == 0 ) { error() << "output file \"" << outputFile << "\" is the same as the input file" << endl; } } /* Open the input file for reading. */ ifstream *inFile = new ifstream( inputFile ); inStream = inFile; if ( ! inFile->is_open() ) error() << "could not open " << inputFile << " for reading" << endl; /* Bail on above errors. */ if ( gblErrorCount > 0 ) exit(1); if ( outputFile != 0 ) { /* Create the filter on the output and open it. */ outFilter = new output_filter; outFilter->open( outputFile, ios::out|ios::trunc ); if ( !outFilter->is_open() ) { error() << "error opening " << outputFile << " for writing" << endl; exit(1); } /* Open the output stream, attaching it to the filter. */ outStream = new ostream( outFilter ); } else { /* Writing to std out. */ outStream = &cout; } if ( ! generateGraphviz ) { /* Put a header on the output to indicate that the file was machine generated. */ *outStream << "/* Automatically generated by Kelbt from \"" << inputFile << "\".\n" " *\n" " * Parts of this file are copied from Kelbt source covered by the GNU\n" " * GPL. As a special exception, you may use the parts of this file copied\n" " * from Kelbt source without restriction. The remainder is derived from\n" " * \"" << inputFile << "\" and inherits the copyright status of that file.\n" " */\n\n"; /* Initial line directive. */ if ( ! inhibitLineDirectives ) { *outStream << "#line 1 \""; escapeLineDirectivePath( *outStream, inputFile ); *outStream << "\"\n"; } } /* Parse the input! */ scan( inputFile, *inStream ); /* If writing to a file, delete the ostream, causing it to flush. * Standard out is flushed automatically. */ if ( outputFile != 0 ) { delete outStream; delete outFilter; } delete inStream; /* Finished, final check for errors.. */ if ( gblErrorCount > 0 ) { /* If we opened and output file, remove it. */ if ( outputFile != 0 ) unlink( outputFile ); exit(1); } return 0; } kelbt-0.15/COPYING0000664000175000017500000004326010572350155014143 0ustar thurstonthurston GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. kelbt-0.15/kelbt.vim0000664000175000017500000001104410614433252014716 0ustar thurstonthurston" Vim syntax file " " Language: Kelbt " Author: Adrian Thurston syntax clear " " Outside code " " Comments syntax region ocComment start="\/\*" end="\*\/" syntax match ocComment "\/\/.*$" " Anything preprocessor syntax match ocPreproc "#.*$" " Strings syntax match ocLiteral "'\(\\.\|[^'\\]\)*'" syntax match ocLiteral "\"\(\\.\|[^\"\\]\)*\"" " Keywords syntax keyword ocType unsigned signed void char short int long float double bool syntax keyword ocType inline static extern register const volatile auto syntax keyword ocType union enum struct class typedef syntax keyword ocType namespace template typename mutable syntax keyword ocKeyword break continue default do else for syntax keyword ocKeyword goto if return switch while syntax keyword ocKeyword new delete this using friend public private protected sizeof syntax keyword ocKeyword throw try catch operator typeid syntax keyword ocKeyword and bitor xor compl bitand and_eq or_eq xor_eq not not_eq syntax keyword ocKeyword static_cast dynamic_cast syntax match ocObjCDirective "@public\|@private\|@protected" syntax match ocObjCDirective "@interface\|@implementation" syntax match ocObjCDirective "@class\|@end\|@defs" syntax match ocObjCDirective "@encode\|@protocol\|@selector" " Numbers syntax match ocNumber "[0-9][0-9]*" syntax match ocNumber "0x[0-9a-fA-F][0-9a-fA-F]*" " Booleans syntax keyword ocBoolean true false " Identifiers syntax match anyId "[a-zA-Z_][a-zA-Z_0-9]*" " Labels syntax match ocLabelColon "^[\t ]*[a-zA-Z_][a-zA-Z_0-9]*[ \t]*:$" contains=ocLabel syntax match ocLabelColon "^[\t ]*[a-zA-Z_][a-zA-Z_0-9]*[ \t]*:[^=:]"me=e-1 contains=ocLabel syntax match ocLabel "[a-zA-Z_][a-zA-Z_0-9]*" contained " Case Labels syntax keyword ocCaseLabelKeyword case contained syntax cluster ocCaseLabelItems contains=ocComment,ocPreproc,ocLiteral,ocType,ocKeyword,ocCaseLabelKeyword,ocNumber,ocBoolean,anyId syntax match ocCaseLabelColon "case" contains=@ocCaseLabelItems syntax match ocCaseLabelColon "case[\t ]\+.*:$" contains=@ocCaseLabelItems syntax match ocCaseLabelColon "case[\t ]\+.*:[^=:]"me=e-1 contains=@ocCaseLabelItems " " Kelbt sections " " Parser Specification syntax region parserSpec1 matchgroup=beginParser start="%%{" end="}%%" contains=@klItems syntax region parserSpec2 matchgroup=beginParser start="%%[^{]"rs=e-1 end="$" keepend contains=@klItems syntax region parserSpec3 matchgroup=beginParser start="%%$" end="$" keepend contains=@klItems " Items in kelbt sections syntax cluster klItems contains=klComment,klLiteral,klKeywords,klCodeCurly,klCodeSemi,klNumber,anyId,klNonTerm,klWrite " Non-terminal syntax match klNonTerm "[a-zA-Z_][a-zA-Z_0-9]*[ \t]*:" contained " Comments syntax match klComment "#.*$" contained " Literals syntax match klLiteral "'\(\\.\|[^'\\]\)*'" contained syntax match klLiteral "\"\(\\.\|[^\"\\]\)*\"" contained syntax match klLiteral /\/\(\\.\|[^\/\\]\)*\// contained syntax match klLiteral "\[\(\\.\|[^\]\\]\)*\]" contained " Numbers syntax match klNumber "[0-9][0-9]*" contained syntax match klNumber "0x[0-9a-fA-F][0-9a-fA-F]*" contained " Keywords syntax keyword klKeywords parser include token nonterm uses type translate try undo final commit pri class shortest contained " Write statements syntax region klWrite matchgroup=Type start="\" matchgroup=NONE end=";" contained contains=klWriteWhat syntax keyword klWriteWhat instance_data token_defs types data init exec finish contained " Inline items syntax cluster inlineItems contains=klCodeCurly,ocComment,ocPreproc,ocLiteral,ocType,ocKeyword,ocNumber,ocBoolean,ocLabelColon,anyId,ocCaseLabelColon,ilAccess " RHS Accessors in inline code syntax match ilAccess "[\$@]\([\$@]\|[0-9]\+\)" contained " Blocks of code. klCodeCurly is recursive. syntax region klCodeCurly matchgroup=NONE start="{" end="}" contained contains=@inlineItems syntax region klCodeSemi matchgroup=Type start="\" matchgroup=NONE end=";" contained contains=@inlineItems " " Sync at the start and end of parser specifications. " syntax sync match kelbtSyncPat grouphere NONE "%%{&" syntax sync match kelbtSyncPat grouphere NONE "}%%" " " Specifying Groups " hi link ocComment Comment hi link ocPreproc Macro hi link ocLiteral String hi link ocType Type hi link ocKeyword Keyword hi link ocObjCDirective Keyword hi link ocNumber Number hi link ocBoolean Boolean hi link ocCaseLabelKeyword Keyword hi link ocLabel Label hi link klComment Comment hi link klNumber Number hi link klLiteral String hi link klKeywords Type hi link klNonTerm Function hi link klWriteWhat Keyword hi link ilAccess Keyword hi link beginParser Type let b:current_syntax = "kelbt"