bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Latest set of patches to the java-push branch


From: Dennis Heimbigner
Subject: Latest set of patches to the java-push branch
Date: Mon, 03 Jun 2013 10:33:17 -0600
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

>From 3674d03633b41b87e56d64c2d597eceeaf1a4751 Mon Sep 17 00:00:00 2001
From: Dennis Heimbigner <address@hidden>
Date: Tue, 21 May 2013 12:24:06 -0600
Subject: [PATCH] next set of updates to java-push branch

squashme: In response to this set of comments
 http://lists.gnu.org/archive/html/bison-patches/2013-02/msg00027.html
I have made the following changes to Java push-parsing support.

* data/lalr1.java
  1. Ensured that all lines were shorter than 76 columns.
  2. Added [...] as requested.
  3. Moved to a consistent comment style. Note that
     this extended to changing existing comments.
  4. As noted, the %initial-action code was in the wrong place.
     It was moved and the corresponding test in tests/javapush.at
     was modified to verify that it is being called exactly once.

* doc/bison.texi
  1. Ensured that all lines were shorter than 76 columns.
  2. Made a number of small formatting changes such
     as using @samp{...}.
  3. Added a discussion about the problem with yyerror()
     (see below).

* tests/javapush.at
  1. Ensured that all lines were shorter than 76 columns.
  2. Modified some code to move from a set of if...else
     to a switch, as suggested.
  3. The %initial-action test was modified so that the code
     sent a comment to stderr.  It was then possible to
     verify that the action was invoked exactly once by
     testing how may instances of that comment occurred in
     the error output.
  4. I deem it necessary to have one test that verifies
     that the sequence of state transitions are the same
     for push parsing and for pull parsing. As noted,
     the existing test was longer than strictly necessary.
     So, a subset of the parse trace output was extracted
     (the "Stack now..." lines) for testing state transitions.
     This is still long (~180 lines) but only a fraction
     of the existing test.
  5. I limited the set of other calculator tests to one
     that tested %locations support and tested the calculator
     operation. I tested %locations by having the scanner print out
     a location value.

* tests/testsuite.at

  1. For some reason, this is still only one line long, so I
     copied it from the master branch, add the javapush.at
     test and removed one test (types.at) that was added,
     apparently, after the java-push branch was
     created. This will probably cause a conflict when the
     java-push branch is merged back to the master branch.

I deliberately did not do the following suggested changes.

* data/lalr1.java

  1. >It looks like this is a single b4_push_if, but with two branches
     >(if you fuse it with the previous b4_push_if).
    Rationale: I have chosen not to do this because the code
    with its escapes is confusing enough. My principle is that
    using a parenthese matching editor(e.g. emacs) it should
    be possible to have a closing macro ')' show a
    corresponding b4_...  This deliberately entails not using
    both arms of a two arm conditional macro (such as
    b4_push_if).

* doc/bison.texi

  1. >I'm not sure this use of @pxref{} is really conform to the
     >Texinfo specification.  Have you checked what it looks like
     >in PDF and HTML?
     Rationale: code like this was already in bison.texit. I verified
     that it looks ok in html.

* tests/javapush.at
  1. >If this piece of code is alike something that is already available
     > in C, consider factoring all this in the c-like.m4 file, which is
     > common to C, C++ and Java.
     Rationale: I tried this but it caused another test (push.at) to fail.

  2. >You don't need to do that: if java.at is loaded before, the
     >definition is still available.  It was probably needed because
     >you had removed all the other files from testsuite.at.
     Rationale: I assume this is with respect to the AT_CHECK_JAVA_GREP
     macro.  The reason I included it is because I needed to change it to
     support matching zero lines.

  3. >Is there a means to factor this calculator from another test?
     Rationale: I was not able to find any way to do this. Autotest
     (deliberately, I think) makes each test completely independent,
     so code sharing appears to be difficult.

There were a couple of queries for which answers are provided  here.

* doc/bison.texi
  > I don't get it here.  Are you saying that yyerror is provided
  > by the scanner?
  Answer: Yes, the lex interface defines yyerror(), so in order
  to use yyerror(), an implementation of the scanner interface is required.
  Fixing this seems like a good idea, but have no idea what
  the appropriate change should be. In any case, I added some
  discussion about this to the bison.texi file.

* tests/javapush.at
  3. > +AT_CHECK([[sed -e 's/(line[ ][0-9][0-9]*)[,]/,/' 
stderr]],[ignore],[expout])
     > You don't seem to be checking anything at all here.
     Answer: AT_CHECK has a feature that if you insert expout or experr
     in the stdout or stderr arguments, then it compares the output
     of the command to the file named "expout" or "experr". So this
     line actually both computes and compares.

--------------------------------------------------

Finally, the proposed modified commit message for the whole
set of java-push branch changes is as follows with changes
as suggested.

--------------------------------------------------
Added java push parsing support.  This entailed making
changes to the following files.

* data/lalr1.java

  1. Capture the declarations as m4 macros.  This was done to
  avoid duplication.  When push parsing, the declarations
  occur at the class instance level rather than within the
  parse() function.

  2. Change the way that the parser state is initialized.
  For push-parsing, the parse state declarations are moved to
  a function called push_parse_initialize(), which is called
  on the first invocation of push_parse(). THe %initial-action
  code is also inserted after the invocation of
  push_parse_initialize()

  3. The body of the parse loop is modified to return values
  at appropriate points when doing push parsing.  In order to
  make push parsing work, it is necessary to divide
  YYNEWSTATE into two states: YYNEWSTATE and YYGETTOKEN. On
  the first call to push_parse(), the state is YYNEWSTATE. On
  all later entries, the state is set to YYGETTOKEN. The
  YYNEWSTATE switch arm falls through into
  YYGETTOKEN. YYGETTOKEN indicates that a new token is
  potentially needed. Normally, with a pull parser, this new
  token would be obtained by calling yylex(). In the push
  parser, the value YYMORE is returned to the caller. On the
  next call to push_parse(), the parser will return to the
  YYGETTOKEN state and continue operation.

* tests/javapush.at

  1. This is a new test file for java push parsing.

* tests/testsuite.at

  1. Add a line to invoke the javapush.at tests.

* tests/local.mk

  1. Ensure that javapush.at is included in the distribution.

* NEWS

  1. Add a note about Java push parsing support.

* doc/bison.texi

  1. Add a description of how to use Java push parsing.
---
 data/lalr1.java    |  153 ++-
 doc/bison.texi     |    8 +-
 tests/javapush.at  | 4003 ++++------------------------------------------------
 tests/testsuite.at |   78 +
 4 files changed, 465 insertions(+), 3777 deletions(-)

diff --git a/data/lalr1.java b/data/lalr1.java
index 3ac85b7..f2d6532 100644
--- a/data/lalr1.java
+++ b/data/lalr1.java
@@ -29,31 +29,36 @@ m4_define([b4_symbol_no_destructor_assert],
                         [b4_skeleton],
                         [b4_symbol_action_location([$1], [destructor])])])])
 b4_symbol_foreach([b4_symbol_no_destructor_assert])
-b4_percent_define_default([[api.push-pull]], [[pull]])dnl
+
+# Setup some macros for api.push-pull.
+b4_percent_define_default([[api.push-pull]], [[pull]])
 b4_percent_define_check_values([[[[api.push-pull]],
-                                 [[pull]], [[push]], [[both]]]])dnl
-b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])dnl
-b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])dnl
+                                 [[pull]], [[push]], [[both]]]])
+
+# Define m4 conditional macros that encode the value
+# of the api.push-pull flag.
+b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
+b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
 m4_case(b4_percent_define_get([[api.push-pull]]),
         [pull], [m4_define([b4_push_flag], [[0]])],
-        [push], [m4_define([b4_pull_flag], [[0]])])dnl
+        [push], [m4_define([b4_pull_flag], [[0]])])
+
+# Define a macro to be true when api.push-pull has the value "both".
+m4_define([b4_both_if],[b4_push_if([b4_pull_if([$1],[$2])],[$2])])

 # Handle BISON_USE_PUSH_FOR_PULL for the test suite.  So that push parsing
 # tests function as written, do not let BISON_USE_PUSH_FOR_PULL modify the
 # behavior of Bison at all when push parsing is already requested.
-b4_define_flag_if([use_push_for_pull])dnl
+b4_define_flag_if([use_push_for_pull])
 b4_use_push_for_pull_if([
   b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])],
              [m4_define([b4_push_flag], [[1]])])])

-# Define a macro to be true when api.push-pull has the value "both"
-m4_define([b4_both_if],[b4_push_if([b4_pull_if([$1],[$2])],[$2])])dnl
-
 # Define a macro to encapsulate the parse state variables.
 # This allows them to be defined either in parse() when doing
 # pull parsing, or as class instance variable when doing push parsing.
 m4_define([b4_define_state],[[
-    /// Lookahead and lookahead in internal form.
+    /* Lookahead and lookahead in internal form.  */
     int yychar = yyempty_;
     int yytoken = 0;

@@ -66,13 +71,13 @@ m4_define([b4_define_state],[[

     /* Error handling.  */
     int yynerrs_ = 0;
-    ]b4_locations_if([/// The location where the error started.
+    ]b4_locations_if([/* The location where the error started.  */
     b4_location_type yyerrloc = null;

-    /// b4_location_type of the lookahead.
+    /* Location. */
     b4_location_type yylloc = new b4_location_type (null, null);])[

-    /// Semantic value of the lookahead.
+    /* Semantic value of the lookahead.  */
     ]b4_yystype[ yylval = null;
 ]])

@@ -101,7 +106,9 @@ b4_percent_define_get3([implements], [ implements ])[
 {
   ]b4_identification[
 ]b4_error_verbose_if([[
-  /** True if verbose error messages are enabled.  */
+  /**
+   * True if verbose error messages are enabled.
+   */
   private boolean yyErrorVerbose = true;

   /**
@@ -122,18 +129,24 @@ b4_locations_if([[
    * A class defining a pair of positions.  Positions, defined by the
    * <code>]b4_position_type[</code> class, denote a point in the input.
    * Locations represent a part of the input through the beginning
-   * and ending positions.  */
+   * and ending positions.
+   */
   public class ]b4_location_type[ {
-    /** The first, inclusive, position in the range.  */
+    /**
+     * The first, inclusive, position in the range.
+     */
     public ]b4_position_type[ begin;

-    /** The first position beyond the range.  */
+    /**
+     * The first position beyond the range.
+     */
     public ]b4_position_type[ end;

     /**
      * Create a <code>]b4_location_type[</code> denoting an empty range 
located at
      * a given point.
-     * @@param loc The position at which the range is anchored.  */
+     * @@param loc The position at which the range is anchored.
+     */
     public ]b4_location_type[ (]b4_position_type[ loc) {
       this.begin = this.end = loc;
     }
@@ -141,7 +154,8 @@ b4_locations_if([[
     /**
      * Create a <code>]b4_location_type[</code> from the endpoints of the 
range.
      * @@param begin The first position included in the range.
-     * @@param end   The first position beyond the range.  */
+     * @@param end   The first position beyond the range.
+     */
     public ]b4_location_type[ (]b4_position_type[ begin, ]b4_position_type[ 
end) {
       this.begin = begin;
       this.end = end;
@@ -150,7 +164,8 @@ b4_locations_if([[
     /**
      * Print a representation of the location.  For this to be correct,
      * <code>]b4_position_type[</code> should override the <code>equals</code>
-     * method.  */
+     * method.
+     */
     public String toString () {
       if (begin.equals (end))
         return begin.toString ();
@@ -182,24 +197,28 @@ b4_locations_if([[

     ]b4_locations_if([[/**
      * Method to retrieve the beginning position of the last scanned token.
-     * @@return the position at which the last scanned token starts.  */
+     * @@return the position at which the last scanned token starts.
+     */
     ]b4_position_type[ getStartPos ();

     /**
      * Method to retrieve the ending position of the last scanned token.
-     * @@return the first position beyond the last scanned token.  */
+     * @@return the first position beyond the last scanned token.
+     */
     ]b4_position_type[ getEndPos ();]])[

     /**
      * Method to retrieve the semantic value of the last scanned token.
-     * @@return the semantic value of the last scanned token.  */
+     * @@return the semantic value of the last scanned token.
+     */
     ]b4_yystype[ getLVal ();

     /**
      * Entry point for the scanner.  Returns the token identifier corresponding
      * to the next token and prepares to return the semantic value
      * ]b4_locations_if([and beginning/ending positions ])[of the token.
-     * @@return the token identifier corresponding to the next token. */
+     * @@return the token identifier corresponding to the next token.
+     */
     int yylex () ]b4_maybe_throws([b4_lex_throws])[;

     /**
@@ -208,7 +227,8 @@ b4_locations_if([[
      *
      * ]b4_locations_if([[@@param loc The location of the element to which the
      *                error message is related]])[
-     * @@param msg The string for the error message.  */
+     * @@param msg The string for the error message.
+     */
      void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String msg);]
   }

@@ -216,7 +236,9 @@ b4_locations_if([[
 ]b4_percent_code_get([[lexer]])[
   }

-  ]])[/** The object doing lexical analysis for us.  */
+  ]])[/**
+   * The object doing lexical analysis for us.
+   */
   private Lexer yylexer;
   ]
   b4_parse_param_vars
@@ -382,12 +404,14 @@ b4_lexer_if([[

   /**
    * Returned by a Bison action in order to stop the parsing process and
-   * return success (<tt>true</tt>).  */
+   * return success (<tt>true</tt>).
+   */
   public static final int YYACCEPT = 0;

   /**
    * Returned by a Bison action in order to stop the parsing process and
-   * return failure (<tt>false</tt>).  */
+   * return failure (<tt>false</tt>).
+   */
   public static final int YYABORT = 1;

 ]b4_push_if([
@@ -398,18 +422,21 @@ b4_lexer_if([[

   /**
    * Returned by a Bison action in order to start error recovery without
-   * printing an error message.  */
+   * printing an error message.
+   */
   public static final int YYERROR = 2;

-  // Internal return codes that are not supported for user semantic
-  // actions.
+  /**
+   * Internal return codes that are not supported for user semantic
+   * actions.
+   */
   private static final int YYERRLAB = 3;
   private static final int YYNEWSTATE = 4;
   private static final int YYDEFAULT = 5;
   private static final int YYREDUCE = 6;
   private static final int YYERRLAB1 = 7;
   private static final int YYRETURN = 8;
-]b4_push_if([  private static final int YYGETTOKEN = 9;])[
+]b4_push_if([[  private static final int YYGETTOKEN = 9; /* Signify that a new 
token is expected when doing push-parsing.  */]])[

   private int yyerrstatus_ = 0;

@@ -418,7 +445,8 @@ b4_define_state])[
   /**
    * Return whether error recovery is being done.  In this state, the parser
    * reads token until it reaches a known state, and then restarts normal
-   * operation.  */
+   * operation.
+   */
   public final boolean recovering ()
   {
     return yyerrstatus_ == 0;
@@ -431,7 +459,6 @@ b4_define_state])[

     /* If YYLEN is nonzero, implement the default value of the action:
        `$$ = $1'.  Otherwise, use the top of the stack.
-
        Otherwise, the following line sets YYVAL to garbage.
        This behavior is undocumented and Bison
        users should not rely upon it.  */
@@ -518,7 +545,7 @@ b4_define_state])[
               + (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
   }

-]b4_push_if([],[
+]b4_push_if([],[[
   /**
    * Parse input from the scanner that was specified at object construction
    * time.  Return whether the end of the input was reached successfully.
@@ -526,21 +553,21 @@ b4_define_state])[
    * @@return <tt>true</tt> if the parsing succeeds.  Note that this does not
    *          imply that there were no syntax errors.
    */
-   public boolean parse () b4_maybe_throws([b4_list2([b4_lex_throws], 
[b4_throws])])])[
+   public boolean parse () ]b4_maybe_throws([b4_list2([b4_lex_throws], 
[b4_throws])])[]])[
 ]b4_push_if([
   /**
    * Push Parse input from external lexer
    *
    * @@param yylextoken current token
    * @@param yylexval current lval
-b4_locations_if([   * @@param yylexloc current position])
+]b4_locations_if([   * @@param yylexloc current position])[
    *
    * @@return <tt>YYACCEPT, YYABORT, YYMORE</tt>
    */
   public int push_parse (int yylextoken, b4_yystype 
yylexval[]b4_locations_if([, b4_location_type yylexloc]))
       b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])])[
   {
-    ]b4_locations_if([/// @@$.
+    ]b4_locations_if([/* @@$.  */
     b4_location_type yyloc;])[
 ]b4_push_if([],[[
 ]b4_define_state[
@@ -557,21 +584,21 @@ b4_dollar_popdef[]dnl
 ])[
 ]])[
 ]b4_push_if([[
-    boolean push_token_consumed = true;
-
-    if (!push_parse_initialized)
+    if (!this.push_parse_initialized)
       {
         push_parse_initialize ();
-        yycdebug ("Starting parse\n");
-        yyerrstatus_ = 0;
-      } else
-        label = YYGETTOKEN;
 ]m4_ifdef([b4_initial_action], [
 b4_dollar_pushdef([yylval], [], [yylloc])dnl
     /* User initialization code.  */
     b4_user_initial_action
 b4_dollar_popdef[]dnl
 ])[
+        yycdebug ("Starting parse\n");
+        yyerrstatus_ = 0;
+      } else
+        label = YYGETTOKEN;
+
+    boolean push_token_consumed = true;
 ]])[
     for (;;)
       switch (label)
@@ -585,7 +612,8 @@ b4_dollar_popdef[]dnl

         /* Accept?  */
         if (yystate == yyfinal_)
-         ]b4_push_if([{label = YYACCEPT; break;}],[return true;])[
+]b4_push_if([{label = YYACCEPT; break;}],dnl
+            [return true;])[

         /* Take a decision.  First try without lookahead.  */
         yyn = yypact_[yystate];
@@ -769,7 +797,7 @@ b4_dollar_popdef[]dnl
           }

         if (label == YYABORT)
-            /* leave the switch */
+            /* Leave the switch.  */
             break;

         ]b4_locations_if([
@@ -790,22 +818,24 @@ b4_dollar_popdef[]dnl

         /* Accept.  */
       case YYACCEPT:
-        ]b4_push_if([push_parse_initialized = false; return YYACCEPT;],
+        ]b4_push_if([this.push_parse_initialized = false; return YYACCEPT;],
                     [return true;])[

         /* Abort.  */
       case YYABORT:
-        ]b4_push_if([push_parse_initialized = false; return YYABORT;],
+        ]b4_push_if([this.push_parse_initialized = false; return YYABORT;],
                     [return false;])[
       }
 }
 ]b4_push_if([[
   boolean push_parse_initialized = false;

+    /**
+     * (Re-)Initialize the state of the push parser.
+     */
   public void push_parse_initialize()
   {
-    // (Re-)Initialize the state
-    /// Lookahead and lookahead in internal form.
+    /* Lookahead and lookahead in internal form.  */
     this.yychar = yyempty_;
     this.yytoken = 0;

@@ -818,19 +848,21 @@ b4_dollar_popdef[]dnl

     /* Error handling.  */
     this.yynerrs_ = 0;
-    ]b4_locations_if([/// The location where the error started.
+    ]b4_locations_if([/* The location where the error started.  */
     this.yyerrloc = null;
     this.yylloc = new b4_location_type (null, null);])[

-    /// Semantic value of the lookahead.
+    /* Semantic value of the lookahead.  */
     this.yylval = null;

     yystack.push (this.yystate, this.yylval]b4_locations_if([, this.yylloc])[);
-    push_parse_initialized = true;
+
+    this.push_parse_initialized = true;
+
   }
 ]b4_locations_if([
   /**
-   * Push Parse input from external lexer
+   * Push parse given input from an external lexer.
    *
    * @@param yylextoken current token
    * @@param yylexval current lval
@@ -849,7 +881,7 @@ b4_both_if([[
   /**
    * Parse input from the scanner that was specified at object construction
    * time.  Return whether the end of the input was reached successfully.
-   * This version of parse () is defined only when api.push-push=both
+   * This version of parse () is defined only when api.push-push=both.
    *
    * @@return <tt>true</tt> if the parsing succeeds.  Note that this does not
    *          imply that there were no syntax errors.
@@ -906,8 +938,8 @@ b4_both_if([[
         */
         if (tok != yyempty_)
           {
-            // FIXME: This method of building the message is not compatible
-            // with internationalization.
+            /* FIXME: This method of building the message is not compatible
+               with internationalization.  */
             StringBuffer res =
               new StringBuffer ("syntax error, unexpected ");
             res.append (yytnamerr_ (yytname_[tok]));
@@ -956,8 +988,9 @@ b4_both_if([[
   }

   /**
-   * Whether the given <code>yytable_</code> value indicates a syntax error.
-   * @@param yyvalue   the value to check
+   * Whether the given <code>yytable_</code>
+   * value indicates a syntax error.
+   * @@param yyvalue the value to check
    */
   private static boolean yy_table_value_is_error_ (int yyvalue)
   {
diff --git a/doc/bison.texi b/doc/bison.texi
index 4795a87..a030a98 100644
--- a/doc/bison.texi
+++ b/doc/bison.texi
@@ -11692,13 +11692,17 @@ There is one additional complication.
 Technically, the push parser does not need to know about the scanner
 (i.e. an object implementing the @code{YYParser.Lexer} interface),
 but it does need access to the @code{yyerror} method.
+Currently, the @code{yyerror} method is defined in the @code{YYParser.Lexer}
+interface. Hence, an implementation of that interface is still required
+in order to provide an implementation of @code{yyerror}.
 The current approach (and subject to change) is to require
 the @code{YYParser} constructor to be given an object implementing
 the @code{YYParser.Lexer} interface. This object need only
 implement the @code{yyerror} method; the other methods can be stubbed
 since they will never be invoked.
-The simplest way to do this is to add code like this to your
-.y file.
+The simplest way to do this is to add a trivial scanner implementation
+to your grammar file using whatever implementation of @code{yyerror} is
+desired. The following code sample shows a simple way to accomplish this.

 @example
 %code lexer @{
diff --git a/tests/javapush.at b/tests/javapush.at
index 4b0b125..4e8ee6b 100755
--- a/tests/javapush.at
+++ b/tests/javapush.at
@@ -1,6 +1,6 @@
 # Checking Java Push Parsing.                            -*- Autotest -*-

-# Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2013 Free Software Foundation, Inc.

 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,19 +21,15 @@

 ##################################################
 # Provide a way to generate data with and without push parsing
-# so we can capture the output for comparison (except test 1).
-# Use both rather than push so we can also set it to pull to
-# get the experr data.
+# so  it is possible to capture the output for comparison
+# (except the "trivial" tests).
+# Use "both" rather than "push" so we can also set it to "pull" to
+# get the "experr" data.

-m4_define([PUSHPULLFLAGS],[-Dapi.push-pull=both])
+m4_define([PUSHPULLFLAG],[-Dapi.push-pull=both])

-# Bring in the grep tester from java.at
-# AT_CHECK_JAVA_GREP([PARSERFILE], [LINE], [COUNT=1])
-# -------------------------------------
-# Check that PARSERFILEcontains exactly COUNT lines matching ^LINE$
-# with grep.
-
-# Modify to ignore status so we can test for zero matching lines
+# Modify the grep tester from java.at
+# to ignore status so we can test for zero matching lines
 m4_define([AT_CHECK_JAVA_GREP],
         [AT_CHECK([grep -c '^$2$' $1], [ignore], [m4_default([$3], [1])
 ])
@@ -43,8 +39,10 @@ m4_define([AT_CHECK_JAVA_GREP],

 AT_BANNER([[Java Push Parsing Tests]])

-# Define a single copy of the trivial parser
-m4_define([AT_TRIVIAL_PARSER],[
+# Define a single copy of the trivial parser grammar.
+# This is missing main(), so two versions
+# are instantiated with different main() procedures.
+m4_define([AT_TRIVIAL_GRAMMAR],[
 %define parser_class_name "YYParser"
 %error-verbose

@@ -58,59 +56,105 @@ import java.util.*;
 start: 'a' 'b' 'c' ;

 %%
+])

-public class Main
-{
-
+# Define comon code across to be includede in
+# class Main for the trivial parser tests.
+m4_define([AT_TRIVIAL_COMMON],[
   static class YYerror implements YYParser.Lexer
   {
     public Object getLVal() {return null;}
-    public int yylex () throws java.io.IOException {return 0;}
-    public void yyerror (String msg)
-    {
-        System.err.println(msg);
-    }
+    public int yylex () throws java.io.IOException { return 0; }
+    public void yyerror (String msg) { System.err.println(msg); }
   }

+  static YYParser parser = null;
+  static YYerror yyerror = null;
+  static int teststate = -1;

-  static public void main (String[[]] argv) throws IOException
+  static void setup()
+    throws IOException
   {
-      YYerror yyerror = new YYerror();
-      YYParser parser;
-      int state = -1;
-
+      yyerror = new YYerror();
       parser = new YYParser(yyerror);
       parser.setDebugLevel(1);
+      teststate = -1;
+  }

-      state = parser.push_parse('a', null);
-      check(state,YYParser.YYMORE,"push_parse('a', null)");
+  static String[[]] teststatename
+    = new String[[]]{"YYACCEPT","YYABORT","YYERROR","UNKNOWN","YYMORE"};

-      parser = new YYParser(yyerror);
+  static void check(int teststate, int expected, String msg)
+  {
+    System.err.println("teststate="+teststatename[[teststate]]
+                       +"; expected="+teststatename[[expected]]);
+    if (teststate == expected)
+       return;
+    System.err.println("unexpected state: "+msg);
+    System.exit(1);
+  }
+])

-      state = parser.push_parse('a', null);
-      check(state,YYParser.YYMORE,"push_parse('a', null)");
-      state = parser.push_parse('b', null);
-      check(state,YYParser.YYMORE,"push_parse('b', null)");
-      state = parser.push_parse('c', null);
-      check(state,YYParser.YYMORE,"push_parse('c', null)");
-      state = parser.push_parse('\0', null);
-      check(state,YYParser.YYACCEPT,"push_parse('\\0', null)");
+m4_define([AT_TRIVIAL_PARSER],[
+  AT_TRIVIAL_GRAMMAR
+
+  public class Main
+  {
+
+  AT_TRIVIAL_COMMON
+
+  static public void main (String[[]] argv)
+    throws IOException
+  {
+      setup();
+
+      teststate = parser.push_parse('a', null);
+      check(teststate,YYParser.YYMORE,"push_parse('a', null)");
+
+      setup();
+
+      teststate = parser.push_parse('a', null);
+      check(teststate,YYParser.YYMORE,"push_parse('a', null)");
+      teststate = parser.push_parse('b', null);
+      check(teststate,YYParser.YYMORE,"push_parse('b', null)");
+      teststate = parser.push_parse('c', null);
+      check(teststate,YYParser.YYMORE,"push_parse('c', null)");
+      teststate = parser.push_parse('\0', null);
+      check(teststate,YYParser.YYACCEPT,"push_parse('\\0', null)");

       /* Reuse the parser instance and cause a failure */
-      state = parser.push_parse('b', null);
-      check(state,YYParser.YYABORT,"push_parse('b', null)");
+      teststate = parser.push_parse('b', null);
+      check(teststate,YYParser.YYABORT,"push_parse('b', null)");
+
       System.exit(0);
   }

-  static String[[]] statename = new 
String[[]]{"YYACCEPT","YYABORT","YYERROR","UNKNOWN","YYMORE"};
+}
+])
+
+m4_define([AT_TRIVIAL_PARSER_INITIAL_ACTION],[
+  AT_TRIVIAL_GRAMMAR

-  static void check(int state, int expected, String msg)
+  public class Main
   {
-    System.err.println("state="+statename[[state]]+"; 
expected="+statename[[expected]]);
-    if (state == expected)
-       return;
-    System.err.println("unexpected state: "+msg);
-    System.exit(1);
+
+  AT_TRIVIAL_COMMON
+
+  static public void main (String[[]] argv)
+    throws IOException
+  {
+      setup();
+
+      teststate = parser.push_parse('a', null);
+      check(teststate,YYParser.YYMORE,"push_parse('a', null)");
+      teststate = parser.push_parse('b', null);
+      check(teststate,YYParser.YYMORE,"push_parse('b', null)");
+      teststate = parser.push_parse('c', null);
+      check(teststate,YYParser.YYMORE,"push_parse('c', null)");
+      teststate = parser.push_parse('\0', null);
+      check(teststate,YYParser.YYACCEPT,"push_parse('\\0', null)");
+
+      System.exit(0);
   }

 }
@@ -123,16 +167,31 @@ AT_DATA([[input.y]],[[%language "Java"
 ]])
 AT_BISON_OPTION_POPDEFS

-# Verify that the proper procedure(s) are generated for each case
+# Verify that the proper procedure(s) are generated for each case.
 AT_BISON_CHECK([[-Dapi.push-pull=pull -o Main.java input.y]])
-AT_CHECK_JAVA_GREP([[Main.java]],[[.*public boolean parse ().*]],[1])
-AT_CHECK_JAVA_GREP([[Main.java]],[[.*public int push_parse (int yylextoken, 
Object yylexval).*]],[0])
+AT_CHECK_JAVA_GREP([[Main.java]],
+                   [[.*public boolean parse ().*]],
+                   [1])
+AT_CHECK_JAVA_GREP(
+        [[Main.java]],
+        [[.*public int push_parse (int yylextoken, Object yylexval).*]],
+        [0])
 AT_BISON_CHECK([[-Dapi.push-pull=both -o Main.java input.y]])
-AT_CHECK_JAVA_GREP([[Main.java]],[[.*public boolean parse ().*]],[1])
-AT_CHECK_JAVA_GREP([[Main.java]],[[.*public int push_parse (int yylextoken, 
Object yylexval).*]],[1])
+AT_CHECK_JAVA_GREP([[Main.java]],
+                   [[.*public boolean parse ().*]],
+                   [1])
+AT_CHECK_JAVA_GREP(
+        [[Main.java]],
+        [[.*public int push_parse (int yylextoken, Object yylexval).*]],
+        [1])
 AT_BISON_CHECK([[-Dapi.push-pull=push -o Main.java input.y]])
-AT_CHECK_JAVA_GREP([[Main.java]],[[.*public boolean parse ().*]],[0])
-AT_CHECK_JAVA_GREP([[Main.java]],[[.*public int push_parse (int yylextoken, 
Object yylexval).*]],[1])
+AT_CHECK_JAVA_GREP([[Main.java]],
+                   [[.*public boolean parse ().*]],
+                   [0])
+AT_CHECK_JAVA_GREP(
+        [[Main.java]],
+        [[.*public int push_parse (int yylextoken, Object yylexval).*]],
+        [1])

 AT_JAVA_COMPILE([[Main.java]])
 AT_JAVA_PARSER_CHECK([Main], 0, [], [stderr-nolog])
@@ -142,19 +201,43 @@ AT_SETUP([Trivial Push Parser with %initial-action])
 AT_BISON_OPTION_PUSHDEFS
 AT_DATA([[input.y]],[[%language "Java"
 %initial-action {
-final int INITIAL_ACTION_DECLARED = 1;
+System.err.println("Initial action invoked");
 }
-]AT_TRIVIAL_PARSER[
+]AT_TRIVIAL_PARSER_INITIAL_ACTION[
 ]])
 AT_BISON_OPTION_POPDEFS
 AT_BISON_CHECK([[-Dapi.push-pull=push -o Main.java input.y]])
-AT_CHECK_JAVA_GREP([[Main.java]],[[final int INITIAL_ACTION_DECLARED = 1;]])
+AT_CHECK_JAVA_GREP([[Main.java]],
+  [[System.err.println("Initial action invoked");]])
 AT_JAVA_COMPILE([[Main.java]])
 AT_JAVA_PARSER_CHECK([Main], 0, [], [stderr-nolog])
+# Verify that initial action is called exactly once.
+AT_CHECK_JAVA_GREP(
+        [[stderr]],
+        [[Initial action invoked]],
+        [1])
 AT_CLEANUP

-# Define a single copy of the Calculator
-m4_define([AT_CALC_BODY1],[
+# Define a single copy of the Calculator grammar.
+m4_define([AT_CALC_BODY],[
+%code imports {
+  import java.io.*;
+}
+
+%code {
+  static StringReader
+  getinput(String filename) throws IOException
+  {
+    StringBuilder buf = new StringBuilder();
+    FileReader file = new FileReader(filename);
+    int c;
+    while ((c=file.read()) > 0)
+      buf.append((char)c);
+    file.close();
+    return new StringReader(buf.toString());
+  }
+}
+
 /* Bison Declarations */
 %token <Integer> NUM "number"
 %type  <Integer> exp
@@ -175,6 +258,7 @@ input:
 line:
   '\n'
 | exp '\n'
+       {System.out.println("total = "+$[]1);}
 | error '\n'
 ;

@@ -185,58 +269,63 @@ exp:
     if ($[]1.intValue() != $[]3.intValue())
       yyerror (]AT_LOCATION_IF(address@hidden,]])[ "calc: error: " + $[]1 + " 
!= " + $[]3);
   }
-| exp '+' exp        { $[]$ = new Integer ($[]1.intValue () + $[]3.intValue 
());  }
-| exp '-' exp        { $[]$ = new Integer ($[]1.intValue () - $[]3.intValue 
());  }
-| exp '*' exp        { $[]$ = new Integer ($[]1.intValue () * $[]3.intValue 
());  }
-| exp '/' exp        { $[]$ = new Integer ($[]1.intValue () / $[]3.intValue 
());  }
-| '-' exp  %prec NEG { $[]$ = new Integer (-$[]2.intValue ());                 
 }
-| exp '^' exp        { $[]$ = new Integer ((int)
-                                         Math.pow ($[]1.intValue (),
-                                                   $[]3.intValue ()));        }
-| '(' exp ')'        { $[]$ = $[]2;                                            
 }
+| exp '+' exp
+    { $[]$ = new Integer ($[]1.intValue () + $[]3.intValue ());  }
+| exp '-' exp
+    { $[]$ = new Integer ($[]1.intValue () - $[]3.intValue ());  }
+| exp '*' exp
+    { $[]$ = new Integer ($[]1.intValue () * $[]3.intValue ());  }
+| exp '/' exp
+    { $[]$ = new Integer ($[]1.intValue () / $[]3.intValue ());  }
+| '-' exp  %prec NEG
+    { $[]$ = new Integer (-$[]2.intValue ());                    }
+| exp '^' exp
+    { $[]$ = new Integer ((int)Math.pow ($[]1.intValue (),
+                                         $[]3.intValue ()));     }
+| '(' exp ')'        { $[]$ = $[]2;}
 | '(' error ')'      { $[]$ = new Integer (1111);}
 | '!'                { $[]$ = new Integer (0); return YYERROR;}
 | '-' error          { $[]$ = new Integer (0); return YYERROR;}
 ;
 ])

+# Test that the states transitioned by the push parser are the
+# same as for the pull parser.  This test is assumed to work
+# if it produces the same partial trace of stack states as is
+# produced when using pull parsing.  The output is verbose,
+# but seems essential for verifying push parsing.
+
 AT_SETUP([Calc parser with api.push-pull both])
 AT_BISON_OPTION_PUSHDEFS
-AT_DATA([Calc.y],[[/* Infix notation calculator--calc */
-%language "Java"
-%name-prefix "Calc"
-%define parser_class_name "Calc"

-%code imports {
-  import java.io.*;
-}
+# Define the calculator input.
+# Warning: if you changes the input file
+# then the locations test file position numbers
+# may be incorrect and you will have
+# to modify that file as well.

-%code {
+AT_DATA([input],[[1 + 2 * 3 = 7
+1 + 2 * -3 = -5

-  public static void main (String[] argv)
-        throws IOException
-  {
-    StringReader reader = getinput(argv[0]);
-    UserLexer lexer = new UserLexer(reader);
-    Calc calc = new Calc(lexer);
-    calc.setDebugLevel(1);
-    calc.parse();
-  }
+-1^2 = -1
+(-1)^2 = 1

+---1 = -1

-  static StringReader
-  getinput(String filename) throws IOException
-  {
-    StringBuilder buf = new StringBuilder();
-    FileReader file = new FileReader(filename);
-    int c;
-    while((c=file.read()) > 0) {
-      buf.append((char)c);
-    }
-    file.close();
-    return new StringReader(buf.toString());
-  }
+1 - 2 - 3 = -4
+1 - (2 - 3) = 2
+
+2^2^3 = 256
+(2^2)^3 = 64
+]])

+# Compose pieces to build the actual .y file.
+AT_DATA([Calc.y],[[/* Infix notation calculator--calc */
+%language "Java"
+%name-prefix "Calc"
+%define parser_class_name "Calc"
+
+%code {
 static class UserLexer implements Calc.Lexer
 {
   StreamTokenizer st;
@@ -255,1274 +344,252 @@ static class UserLexer implements Calc.Lexer

   Integer yylval;

-  public Object getLVal() {
-    return yylval;
-  }
-
-  public void yyerror(String msg)
-  {
-    System.err.println(msg);
-  }
+  public Object getLVal() { return yylval; }

-  public int yylex () throws IOException {
-    int ttype = st.nextToken ();
-    if (ttype == st.TT_EOF)
-      return EOF;
-
-    else if (ttype == st.TT_EOL)
-      {
-        return (int) '\n';
-      }
+  public void yyerror(String msg) { System.err.println(msg); }

-    else if (ttype == st.TT_WORD)
-      {
+  public int yylex () throws IOException
+  {
+    switch (st.nextToken()) {
+    case StreamTokenizer.TT_EOF: return EOF;
+    case StreamTokenizer.TT_EOL: return (int) '\n';
+    case StreamTokenizer.TT_WORD:
         yylval = new Integer (st.sval);
         return NUM;
-      }
-
-    else
-      return st.ttype;
+    default: return st.ttype;
+    }
   }
 }

 }

-]AT_CALC_BODY1[
-
-]])
-
-AT_DATA([[input]],[[1 + 2 * 3 = 7
-1 + 2 * -3 = -5
-
--1^2 = -1
-(-1)^2 = 1
+%code {
+public static void main (String[] argv)
+      throws IOException
+{
+    StringReader reader = getinput(argv[0]);
+    UserLexer lexer = new UserLexer(reader);
+    Calc calc = new Calc(lexer);
+    calc.setDebugLevel(1);
+    calc.parse();
+}//main

----1 = -1
+}

-1 - 2 - 3 = -4
-1 - (2 - 3) = 2
+]AT_CALC_BODY[

-2^2^3 = 256
-(2^2)^3 = 64
 ]])

-AT_DATA([[expout]],[[Starting parse
-
-Entering state 0
-
-Stack now 0
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
+# This data was captured from running a pull parser.
+AT_DATA([[expout]],[[Stack now 0
 Stack now 0 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 9
-
 Stack now 0 9
-Reading a token: @&t@
-Next token is token '+' (1)
-Shifting token '+' (1)
-Entering state 19
-
 Stack now 0 9 19
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
 Stack now 0 9 19 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 28
-
 Stack now 0 9 19 28
-Reading a token: @&t@
-Next token is token '*' (2)
-Shifting token '*' (2)
-Entering state 20
-
 Stack now 0 9 19 28 20
-Reading a token: @&t@
-Next token is token "number" (3)
-Shifting token "number" (3)
-Entering state 2
-
 Stack now 0 9 19 28 20 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (3)
--> $$ = nterm exp (3)
-Entering state 29
-
 Stack now 0 9 19 28 20 29
-Reading a token: @&t@
-Next token is token '=' (3)
-Reducing stack by rule 10 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '*' (2)
-   $3 = nterm exp (3)
--> $$ = nterm exp (6)
-Entering state 28
-
 Stack now 0 9 19 28
-Next token is token '=' (3)
-Reducing stack by rule 8 , @&t@
-   $1 = nterm exp (1)
-   $2 = token '+' (1)
-   $3 = nterm exp (6)
--> $$ = nterm exp (7)
-Entering state 9
-
 Stack now 0 9
-Next token is token '=' (3)
-Shifting token '=' (3)
-Entering state 17
-
 Stack now 0 9 17
-Reading a token: @&t@
-Next token is token "number" (7)
-Shifting token "number" (7)
-Entering state 2
-
 Stack now 0 9 17 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (7)
--> $$ = nterm exp (7)
-Entering state 26
-
 Stack now 0 9 17 26
-Reading a token: @&t@
-Next token is token '\n' (7)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (7)
-   $2 = token '=' (3)
-   $3 = nterm exp (7)
--> $$ = nterm exp (7)
-Entering state 9
-
 Stack now 0 9
-Next token is token '\n' (7)
-Shifting token '\n' (7)
-Entering state 23
-
 Stack now 0 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (7)
-   $2 = token '\n' (7)
--> $$ = nterm line (7)
-Entering state 8
-
 Stack now 0 8
-Reducing stack by rule 1 , @&t@
-   $1 = nterm line (7)
--> $$ = nterm input (7)
-Entering state 7
-
 Stack now 0 7
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
 Stack now 0 7 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 9
-
 Stack now 0 7 9
-Reading a token: @&t@
-Next token is token '+' (1)
-Shifting token '+' (1)
-Entering state 19
-
 Stack now 0 7 9 19
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
 Stack now 0 7 9 19 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 28
-
 Stack now 0 7 9 19 28
-Reading a token: @&t@
-Next token is token '*' (2)
-Shifting token '*' (2)
-Entering state 20
-
 Stack now 0 7 9 19 28 20
-Reading a token: @&t@
-Next token is token '-' (2)
-Shifting token '-' (2)
-Entering state 3
-
 Stack now 0 7 9 19 28 20 3
-Reading a token: @&t@
-Next token is token "number" (3)
-Shifting token "number" (3)
-Entering state 2
-
 Stack now 0 7 9 19 28 20 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (3)
--> $$ = nterm exp (3)
-Entering state 12
-
 Stack now 0 7 9 19 28 20 3 12
-Reading a token: @&t@
-Next token is token '=' (3)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (2)
-   $2 = nterm exp (3)
--> $$ = nterm exp (-3)
-Entering state 29
-
 Stack now 0 7 9 19 28 20 29
-Next token is token '=' (3)
-Reducing stack by rule 10 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '*' (2)
-   $3 = nterm exp (-3)
--> $$ = nterm exp (-6)
-Entering state 28
-
 Stack now 0 7 9 19 28
-Next token is token '=' (3)
-Reducing stack by rule 8 , @&t@
-   $1 = nterm exp (1)
-   $2 = token '+' (1)
-   $3 = nterm exp (-6)
--> $$ = nterm exp (-5)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '=' (3)
-Shifting token '=' (3)
-Entering state 17
-
 Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token '-' (3)
-Shifting token '-' (3)
-Entering state 3
-
 Stack now 0 7 9 17 3
-Reading a token: @&t@
-Next token is token "number" (5)
-Shifting token "number" (5)
-Entering state 2
-
 Stack now 0 7 9 17 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (5)
--> $$ = nterm exp (5)
-Entering state 12
-
 Stack now 0 7 9 17 3 12
-Reading a token: @&t@
-Next token is token '\n' (5)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (3)
-   $2 = nterm exp (5)
--> $$ = nterm exp (-5)
-Entering state 26
-
 Stack now 0 7 9 17 26
-Next token is token '\n' (5)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (-5)
-   $2 = token '=' (3)
-   $3 = nterm exp (-5)
--> $$ = nterm exp (-5)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '\n' (5)
-Shifting token '\n' (5)
-Entering state 23
-
 Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (-5)
-   $2 = token '\n' (5)
--> $$ = nterm line (-5)
-Entering state 16
-
 Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (-5)
--> $$ = nterm input (7)
-Entering state 7
-
 Stack now 0 7
-Reading a token: @&t@
-Next token is token '\n' (5)
-Shifting token '\n' (5)
-Entering state 4
-
 Stack now 0 7 4
-Reducing stack by rule 3 , @&t@
-   $1 = token '\n' (5)
--> $$ = nterm line (5)
-Entering state 16
-
 Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (5)
--> $$ = nterm input (7)
-Entering state 7
-
 Stack now 0 7
-Reading a token: @&t@
-Next token is token '-' (5)
-Shifting token '-' (5)
-Entering state 3
-
 Stack now 0 7 3
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
 Stack now 0 7 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 12
-
 Stack now 0 7 3 12
-Reading a token: @&t@
-Next token is token '^' (1)
-Shifting token '^' (1)
-Entering state 22
-
 Stack now 0 7 3 12 22
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
 Stack now 0 7 3 12 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 31
-
 Stack now 0 7 3 12 22 31
-Reading a token: @&t@
-Next token is token '=' (2)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (1)
-   $2 = token '^' (1)
-   $3 = nterm exp (2)
--> $$ = nterm exp (1)
-Entering state 12
-
 Stack now 0 7 3 12
-Next token is token '=' (2)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (5)
-   $2 = nterm exp (1)
--> $$ = nterm exp (-1)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '=' (2)
-Shifting token '=' (2)
-Entering state 17
-
 Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token '-' (2)
-Shifting token '-' (2)
-Entering state 3
-
 Stack now 0 7 9 17 3
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
 Stack now 0 7 9 17 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 12
-
 Stack now 0 7 9 17 3 12
-Reading a token: @&t@
-Next token is token '\n' (1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (2)
-   $2 = nterm exp (1)
--> $$ = nterm exp (-1)
-Entering state 26
-
 Stack now 0 7 9 17 26
-Next token is token '\n' (1)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (-1)
-   $2 = token '=' (2)
-   $3 = nterm exp (-1)
--> $$ = nterm exp (-1)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '\n' (1)
-Shifting token '\n' (1)
-Entering state 23
-
 Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (-1)
-   $2 = token '\n' (1)
--> $$ = nterm line (-1)
-Entering state 16
-
 Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (-1)
--> $$ = nterm input (7)
-Entering state 7
-
 Stack now 0 7
-Reading a token: @&t@
-Next token is token '(' (1)
-Shifting token '(' (1)
-Entering state 5
-
 Stack now 0 7 5
-Reading a token: @&t@
-Next token is token '-' (1)
-Shifting token '-' (1)
-Entering state 3
-
 Stack now 0 7 5 3
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
 Stack now 0 7 5 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 12
-
 Stack now 0 7 5 3 12
-Reading a token: @&t@
-Next token is token ')' (1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (1)
-   $2 = nterm exp (1)
--> $$ = nterm exp (-1)
-Entering state 14
-
 Stack now 0 7 5 14
-Next token is token ')' (1)
-Shifting token ')' (1)
-Entering state 25
-
 Stack now 0 7 5 14 25
-Reducing stack by rule 14 , @&t@
-   $1 = token '(' (1)
-   $2 = nterm exp (-1)
-   $3 = token ')' (1)
--> $$ = nterm exp (-1)
-Entering state 9
-
 Stack now 0 7 9
-Reading a token: @&t@
-Next token is token '^' (1)
-Shifting token '^' (1)
-Entering state 22
-
 Stack now 0 7 9 22
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
 Stack now 0 7 9 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 31
-
 Stack now 0 7 9 22 31
-Reading a token: @&t@
-Next token is token '=' (2)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (-1)
-   $2 = token '^' (1)
-   $3 = nterm exp (2)
--> $$ = nterm exp (1)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '=' (2)
-Shifting token '=' (2)
-Entering state 17
-
 Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
 Stack now 0 7 9 17 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 26
-
 Stack now 0 7 9 17 26
-Reading a token: @&t@
-Next token is token '\n' (1)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (1)
-   $2 = token '=' (2)
-   $3 = nterm exp (1)
--> $$ = nterm exp (1)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '\n' (1)
-Shifting token '\n' (1)
-Entering state 23
-
 Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (1)
-   $2 = token '\n' (1)
--> $$ = nterm line (1)
-Entering state 16
-
 Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (1)
--> $$ = nterm input (7)
-Entering state 7
-
 Stack now 0 7
-Reading a token: @&t@
-Next token is token '\n' (1)
-Shifting token '\n' (1)
-Entering state 4
-
 Stack now 0 7 4
-Reducing stack by rule 3 , @&t@
-   $1 = token '\n' (1)
--> $$ = nterm line (1)
-Entering state 16
-
 Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (1)
--> $$ = nterm input (7)
-Entering state 7
-
 Stack now 0 7
-Reading a token: @&t@
-Next token is token '-' (1)
-Shifting token '-' (1)
-Entering state 3
-
 Stack now 0 7 3
-Reading a token: @&t@
-Next token is token '-' (1)
-Shifting token '-' (1)
-Entering state 3
-
 Stack now 0 7 3 3
-Reading a token: @&t@
-Next token is token '-' (1)
-Shifting token '-' (1)
-Entering state 3
-
 Stack now 0 7 3 3 3
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
 Stack now 0 7 3 3 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 12
-
 Stack now 0 7 3 3 3 12
-Reading a token: @&t@
-Next token is token '=' (1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (1)
-   $2 = nterm exp (1)
--> $$ = nterm exp (-1)
-Entering state 12
-
 Stack now 0 7 3 3 12
-Next token is token '=' (1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (1)
-   $2 = nterm exp (-1)
--> $$ = nterm exp (1)
-Entering state 12
-
 Stack now 0 7 3 12
-Next token is token '=' (1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (1)
-   $2 = nterm exp (1)
--> $$ = nterm exp (-1)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '=' (1)
-Shifting token '=' (1)
-Entering state 17
-
 Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token '-' (1)
-Shifting token '-' (1)
-Entering state 3
-
 Stack now 0 7 9 17 3
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
 Stack now 0 7 9 17 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 12
-
 Stack now 0 7 9 17 3 12
-Reading a token: @&t@
-Next token is token '\n' (1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (1)
-   $2 = nterm exp (1)
--> $$ = nterm exp (-1)
-Entering state 26
-
 Stack now 0 7 9 17 26
-Next token is token '\n' (1)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (-1)
-   $2 = token '=' (1)
-   $3 = nterm exp (-1)
--> $$ = nterm exp (-1)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '\n' (1)
-Shifting token '\n' (1)
-Entering state 23
-
 Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (-1)
-   $2 = token '\n' (1)
--> $$ = nterm line (-1)
-Entering state 16
-
 Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (-1)
--> $$ = nterm input (7)
-Entering state 7
-
 Stack now 0 7
-Reading a token: @&t@
-Next token is token '\n' (1)
-Shifting token '\n' (1)
-Entering state 4
-
 Stack now 0 7 4
-Reducing stack by rule 3 , @&t@
-   $1 = token '\n' (1)
--> $$ = nterm line (1)
-Entering state 16
-
 Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (1)
--> $$ = nterm input (7)
-Entering state 7
-
 Stack now 0 7
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
 Stack now 0 7 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 9
-
 Stack now 0 7 9
-Reading a token: @&t@
-Next token is token '-' (1)
-Shifting token '-' (1)
-Entering state 18
-
 Stack now 0 7 9 18
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
 Stack now 0 7 9 18 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 27
-
 Stack now 0 7 9 18 27
-Reading a token: @&t@
-Next token is token '-' (2)
-Reducing stack by rule 9 , @&t@
-   $1 = nterm exp (1)
-   $2 = token '-' (1)
-   $3 = nterm exp (2)
--> $$ = nterm exp (-1)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '-' (2)
-Shifting token '-' (2)
-Entering state 18
-
 Stack now 0 7 9 18
-Reading a token: @&t@
-Next token is token "number" (3)
-Shifting token "number" (3)
-Entering state 2
-
 Stack now 0 7 9 18 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (3)
--> $$ = nterm exp (3)
-Entering state 27
-
 Stack now 0 7 9 18 27
-Reading a token: @&t@
-Next token is token '=' (3)
-Reducing stack by rule 9 , @&t@
-   $1 = nterm exp (-1)
-   $2 = token '-' (2)
-   $3 = nterm exp (3)
--> $$ = nterm exp (-4)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '=' (3)
-Shifting token '=' (3)
-Entering state 17
-
 Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token '-' (3)
-Shifting token '-' (3)
-Entering state 3
-
 Stack now 0 7 9 17 3
-Reading a token: @&t@
-Next token is token "number" (4)
-Shifting token "number" (4)
-Entering state 2
-
 Stack now 0 7 9 17 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (4)
--> $$ = nterm exp (4)
-Entering state 12
-
 Stack now 0 7 9 17 3 12
-Reading a token: @&t@
-Next token is token '\n' (4)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (3)
-   $2 = nterm exp (4)
--> $$ = nterm exp (-4)
-Entering state 26
-
 Stack now 0 7 9 17 26
-Next token is token '\n' (4)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (-4)
-   $2 = token '=' (3)
-   $3 = nterm exp (-4)
--> $$ = nterm exp (-4)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '\n' (4)
-Shifting token '\n' (4)
-Entering state 23
-
 Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (-4)
-   $2 = token '\n' (4)
--> $$ = nterm line (-4)
-Entering state 16
-
 Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (-4)
--> $$ = nterm input (7)
-Entering state 7
-
 Stack now 0 7
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
 Stack now 0 7 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 9
-
 Stack now 0 7 9
-Reading a token: @&t@
-Next token is token '-' (1)
-Shifting token '-' (1)
-Entering state 18
-
 Stack now 0 7 9 18
-Reading a token: @&t@
-Next token is token '(' (1)
-Shifting token '(' (1)
-Entering state 5
-
 Stack now 0 7 9 18 5
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
 Stack now 0 7 9 18 5 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 14
-
 Stack now 0 7 9 18 5 14
-Reading a token: @&t@
-Next token is token '-' (2)
-Shifting token '-' (2)
-Entering state 18
-
 Stack now 0 7 9 18 5 14 18
-Reading a token: @&t@
-Next token is token "number" (3)
-Shifting token "number" (3)
-Entering state 2
-
 Stack now 0 7 9 18 5 14 18 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (3)
--> $$ = nterm exp (3)
-Entering state 27
-
 Stack now 0 7 9 18 5 14 18 27
-Reading a token: @&t@
-Next token is token ')' (3)
-Reducing stack by rule 9 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '-' (2)
-   $3 = nterm exp (3)
--> $$ = nterm exp (-1)
-Entering state 14
-
 Stack now 0 7 9 18 5 14
-Next token is token ')' (3)
-Shifting token ')' (3)
-Entering state 25
-
 Stack now 0 7 9 18 5 14 25
-Reducing stack by rule 14 , @&t@
-   $1 = token '(' (1)
-   $2 = nterm exp (-1)
-   $3 = token ')' (3)
--> $$ = nterm exp (-1)
-Entering state 27
-
 Stack now 0 7 9 18 27
-Reading a token: @&t@
-Next token is token '=' (3)
-Reducing stack by rule 9 , @&t@
-   $1 = nterm exp (1)
-   $2 = token '-' (1)
-   $3 = nterm exp (-1)
--> $$ = nterm exp (2)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '=' (3)
-Shifting token '=' (3)
-Entering state 17
-
 Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
 Stack now 0 7 9 17 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 26
-
 Stack now 0 7 9 17 26
-Reading a token: @&t@
-Next token is token '\n' (2)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '=' (3)
-   $3 = nterm exp (2)
--> $$ = nterm exp (2)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '\n' (2)
-Shifting token '\n' (2)
-Entering state 23
-
 Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '\n' (2)
--> $$ = nterm line (2)
-Entering state 16
-
 Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (2)
--> $$ = nterm input (7)
-Entering state 7
-
 Stack now 0 7
-Reading a token: @&t@
-Next token is token '\n' (2)
-Shifting token '\n' (2)
-Entering state 4
-
 Stack now 0 7 4
-Reducing stack by rule 3 , @&t@
-   $1 = token '\n' (2)
--> $$ = nterm line (2)
-Entering state 16
-
 Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (2)
--> $$ = nterm input (7)
-Entering state 7
-
 Stack now 0 7
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
 Stack now 0 7 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 9
-
 Stack now 0 7 9
-Reading a token: @&t@
-Next token is token '^' (2)
-Shifting token '^' (2)
-Entering state 22
-
 Stack now 0 7 9 22
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
 Stack now 0 7 9 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 31
-
 Stack now 0 7 9 22 31
-Reading a token: @&t@
-Next token is token '^' (2)
-Shifting token '^' (2)
-Entering state 22
-
 Stack now 0 7 9 22 31 22
-Reading a token: @&t@
-Next token is token "number" (3)
-Shifting token "number" (3)
-Entering state 2
-
 Stack now 0 7 9 22 31 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (3)
--> $$ = nterm exp (3)
-Entering state 31
-
 Stack now 0 7 9 22 31 22 31
-Reading a token: @&t@
-Next token is token '=' (3)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '^' (2)
-   $3 = nterm exp (3)
--> $$ = nterm exp (8)
-Entering state 31
-
 Stack now 0 7 9 22 31
-Next token is token '=' (3)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '^' (2)
-   $3 = nterm exp (8)
--> $$ = nterm exp (256)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '=' (3)
-Shifting token '=' (3)
-Entering state 17
-
 Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token "number" (256)
-Shifting token "number" (256)
-Entering state 2
-
 Stack now 0 7 9 17 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (256)
--> $$ = nterm exp (256)
-Entering state 26
-
 Stack now 0 7 9 17 26
-Reading a token: @&t@
-Next token is token '\n' (256)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (256)
-   $2 = token '=' (3)
-   $3 = nterm exp (256)
--> $$ = nterm exp (256)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '\n' (256)
-Shifting token '\n' (256)
-Entering state 23
-
 Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (256)
-   $2 = token '\n' (256)
--> $$ = nterm line (256)
-Entering state 16
-
 Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (256)
--> $$ = nterm input (7)
-Entering state 7
-
 Stack now 0 7
-Reading a token: @&t@
-Next token is token '(' (256)
-Shifting token '(' (256)
-Entering state 5
-
 Stack now 0 7 5
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
 Stack now 0 7 5 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 14
-
 Stack now 0 7 5 14
-Reading a token: @&t@
-Next token is token '^' (2)
-Shifting token '^' (2)
-Entering state 22
-
 Stack now 0 7 5 14 22
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
 Stack now 0 7 5 14 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 31
-
 Stack now 0 7 5 14 22 31
-Reading a token: @&t@
-Next token is token ')' (2)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '^' (2)
-   $3 = nterm exp (2)
--> $$ = nterm exp (4)
-Entering state 14
-
 Stack now 0 7 5 14
-Next token is token ')' (2)
-Shifting token ')' (2)
-Entering state 25
-
 Stack now 0 7 5 14 25
-Reducing stack by rule 14 , @&t@
-   $1 = token '(' (256)
-   $2 = nterm exp (4)
-   $3 = token ')' (2)
--> $$ = nterm exp (4)
-Entering state 9
-
 Stack now 0 7 9
-Reading a token: @&t@
-Next token is token '^' (2)
-Shifting token '^' (2)
-Entering state 22
-
 Stack now 0 7 9 22
-Reading a token: @&t@
-Next token is token "number" (3)
-Shifting token "number" (3)
-Entering state 2
-
 Stack now 0 7 9 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (3)
--> $$ = nterm exp (3)
-Entering state 31
-
 Stack now 0 7 9 22 31
-Reading a token: @&t@
-Next token is token '=' (3)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (4)
-   $2 = token '^' (2)
-   $3 = nterm exp (3)
--> $$ = nterm exp (64)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '=' (3)
-Shifting token '=' (3)
-Entering state 17
-
 Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token "number" (64)
-Shifting token "number" (64)
-Entering state 2
-
 Stack now 0 7 9 17 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (64)
--> $$ = nterm exp (64)
-Entering state 26
-
 Stack now 0 7 9 17 26
-Reading a token: @&t@
-Next token is token '\n' (64)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (64)
-   $2 = token '=' (3)
-   $3 = nterm exp (64)
--> $$ = nterm exp (64)
-Entering state 9
-
 Stack now 0 7 9
-Next token is token '\n' (64)
-Shifting token '\n' (64)
-Entering state 23
-
 Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (64)
-   $2 = token '\n' (64)
--> $$ = nterm line (64)
-Entering state 16
-
 Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (64)
--> $$ = nterm input (7)
-Entering state 7
-
 Stack now 0 7
-Reading a token: @&t@
-Now at end of input.
-
-Shifting token $end (64)
-Entering state 15
-
 Stack now 0 7 15
 ]])

-AT_BISON_OPTION_POPDEFS
-
-AT_BISON_CHECK([PUSHPULLFLAGS [-o Calc.java Calc.y]])
+AT_BISON_CHECK([PUSHPULLFLAG [-o Calc.java Calc.y]])
 AT_JAVA_COMPILE([[Calc.java]])
-# Verify that this is a push parser
-AT_CHECK_JAVA_GREP([[Calc.java]],[[.*public void push_parse_initialize().*]])
-# Capture the output so we can edit out the (line nnnn) occurrences
-AT_JAVA_PARSER_CHECK([Calc input], 0, [], [stderr-nolog])
-AT_CHECK([[sed -e 's/(line[ ][0-9][0-9]*)[,]/,/' stderr]],[ignore],[expout])
-
+#Verify that this is a push parser.
+AT_CHECK_JAVA_GREP([[Calc.java]],
+                   [[.*public void push_parse_initialize().*]])
+# Capture stderr output for comparison purposes.
+AT_JAVA_PARSER_CHECK([Calc input], 0, [ignore-nolog], [stderr-nolog])
+# Extract the "Stack Now" lines from the error output,
+# send them to stdout (via the sed command) and compare to expout.
+# NOTE: because the target is "expout", this macro automatically
+# compares the output of the sed command with the contents of
+# the file "expout" (defined above).
+AT_CHECK([[sed -e '/^Stack now.*$/p' -e d ./stderr|tee 
jj]],[ignore],[expout],[ignore-nolog])
+AT_BISON_OPTION_POPDEFS
 AT_CLEANUP

+# This test looks for location reporting by looking
+# at the lexer output with locations enabled.
+# It defines a lexer that reports location info.
 AT_SETUP([Calc parser with %locations %code lexer and api.push-pull both])
 AT_BISON_OPTION_PUSHDEFS
-AT_DATA([[Calc.y]],[[/* Infix notation calculator--calc */
+
+AT_DATA([Calc.y],[[/* Infix notation calculator--calc.  */
 %language "Java"
 %name-prefix "Calc"
 %define parser_class_name "Calc"
-%lex-param { Reader rdr}
+%lex-param { Reader rdr }
 %locations

 %code imports {
@@ -1531,6 +598,7 @@ AT_DATA([[Calc.y]],[[/* Infix notation calculator--calc */

 %code lexer {
   StreamTokenizer st;
+  Integer yylval;

   public YYLexer(Reader rdr)
   {
@@ -1544,45 +612,32 @@ AT_DATA([[Calc.y]],[[/* Infix notation calculator--calc 
*/

   Position yypos = new Position (1, 0);

-  public Position getStartPos() {
-    return yypos;
-  }
-
-  public Position getEndPos() {
-    return yypos;
-  }
+  public Position getStartPos() { return yypos; }

-  Integer yylval;
+  public Position getEndPos() { return yypos; }

-  public Object getLVal() {
-    return yylval;
-  }
+  public Object getLVal() { return yylval; }

   public void yyerror(Location loc, String msg)
   {
     System.err.println(loc+":"+msg);
   }

-  public int yylex () throws IOException {
-    int ttype = st.nextToken ();
+  public int yylex () throws IOException
+  {
     yypos = new Position (yypos.lineno (),yypos.token () + 1);
-    if (ttype == st.TT_EOF)
-      return EOF;
-
-    else if (ttype == st.TT_EOL)
-      {
+    switch (st.nextToken()) {
+    case StreamTokenizer.TT_EOF:
+        return EOF;
+    case StreamTokenizer.TT_EOL:
         yypos = new Position (yypos.lineno () + 1, 0);
         return (int) '\n';
-      }
-
-    else if (ttype == st.TT_WORD)
-      {
+    case StreamTokenizer.TT_WORD:
         yylval = new Integer (st.sval);
         return NUM;
-      }
-
-    else
+    default:
       return st.ttype;
+    }
   }
 }

@@ -1591,17 +646,9 @@ class Position {
   public int line;
   public int token;

-  public Position ()
-  {
-    line = 0;
-    token = 0;
-  }
+  public Position () { line = 0; token = 0; }

-  public Position (int l, int t)
-  {
-    line = l;
-    token = t;
-  }
+  public Position (int l, int t) { line = l; token = t; }

   public boolean equals (Position l)
   {
@@ -1613,17 +660,13 @@ class Position {
     return Integer.toString(line)  + "." + Integer.toString(token);
   }

-  public int lineno ()
-  {
-    return line;
-  }
+  public int lineno () { return line; }

-  public int token ()
-  {
-    return token;
-  }
+  public int token () { return token; }
+}//Class Position
 }

+%code {
 public static void main (String[] argv)
         throws IOException
 {
@@ -1632,2647 +675,177 @@ public static void main (String[] argv)
   calc.setDebugLevel(1);
   calc.parse();
 }
-
-static StringReader
-getinput(String filename)
-    throws IOException
-{
-  StringBuilder buf = new StringBuilder();
-  FileReader file = new FileReader(filename);
-  int c;
-  while((c=file.read()) > 0) {
-    buf.append((char)c);
-  }
-  file.close();
-  return new StringReader(buf.toString());
-}
 }

-]AT_CALC_BODY1[
+]AT_CALC_BODY[

 ]])
-AT_BISON_OPTION_POPDEFS
-
-AT_DATA([[input]],[[1 + 2 * 3 = 7
-1 + 2 * -3 = -5
-
--1^2 = -1
-(-1)^2 = 1
-
----1 = -1

-1 - 2 - 3 = -4
-1 - (2 - 3) = 2
-
-2^2^3 = 256
-(2^2)^3 = 64
+# Define the expected calculator output.
+# This should match the output from a pull parser.
+AT_DATA([output],[[total = 7
+total = -5
+total = -1
+total = 1
+total = -1
+total = -4
+total = 2
+total = 256
+total = 64
 ]])

-AT_DATA([[expout]],[[Starting parse
-
-Entering state 0
-
-Stack now 0
-Reading a token: @&t@
-Next token is token "number" (1.1: 1)
-Shifting token "number" (1.1: 1)
-Entering state 2
-
-Stack now 0 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1.1: 1)
--> $$ = nterm exp (1.1: 1)
-Entering state 9
-
-Stack now 0 9
-Reading a token: @&t@
+AT_DATA([locations],[[Next token is token "number" (1.1: 1)
 Next token is token '+' (1.2: 1)
-Shifting token '+' (1.2: 1)
-Entering state 19
-
-Stack now 0 9 19
-Reading a token: @&t@
 Next token is token "number" (1.3: 2)
-Shifting token "number" (1.3: 2)
-Entering state 2
-
-Stack now 0 9 19 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1.3: 2)
--> $$ = nterm exp (1.3: 2)
-Entering state 28
-
-Stack now 0 9 19 28
-Reading a token: @&t@
 Next token is token '*' (1.4: 2)
-Shifting token '*' (1.4: 2)
-Entering state 20
-
-Stack now 0 9 19 28 20
-Reading a token: @&t@
 Next token is token "number" (1.5: 3)
-Shifting token "number" (1.5: 3)
-Entering state 2
-
-Stack now 0 9 19 28 20 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1.5: 3)
--> $$ = nterm exp (1.5: 3)
-Entering state 29
-
-Stack now 0 9 19 28 20 29
-Reading a token: @&t@
 Next token is token '=' (1.6: 3)
-Reducing stack by rule 10 , @&t@
-   $1 = nterm exp (1.3: 2)
-   $2 = token '*' (1.4: 2)
-   $3 = nterm exp (1.5: 3)
--> $$ = nterm exp (1.3-1.5: 6)
-Entering state 28
-
-Stack now 0 9 19 28
 Next token is token '=' (1.6: 3)
-Reducing stack by rule 8 , @&t@
-   $1 = nterm exp (1.1: 1)
-   $2 = token '+' (1.2: 1)
-   $3 = nterm exp (1.3-1.5: 6)
--> $$ = nterm exp (1.1-1.5: 7)
-Entering state 9
-
-Stack now 0 9
 Next token is token '=' (1.6: 3)
-Shifting token '=' (1.6: 3)
-Entering state 17
-
-Stack now 0 9 17
-Reading a token: @&t@
 Next token is token "number" (1.7: 7)
-Shifting token "number" (1.7: 7)
-Entering state 2
-
-Stack now 0 9 17 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1.7: 7)
--> $$ = nterm exp (1.7: 7)
-Entering state 26
-
-Stack now 0 9 17 26
-Reading a token: @&t@
 Next token is token '\n' (2.0: 7)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (1.1-1.5: 7)
-   $2 = token '=' (1.6: 3)
-   $3 = nterm exp (1.7: 7)
--> $$ = nterm exp (1.1-1.7: 7)
-Entering state 9
-
-Stack now 0 9
 Next token is token '\n' (2.0: 7)
-Shifting token '\n' (2.0: 7)
-Entering state 23
-
-Stack now 0 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (1.1-1.7: 7)
-   $2 = token '\n' (2.0: 7)
--> $$ = nterm line (1.1-2.0: 7)
-Entering state 8
-
-Stack now 0 8
-Reducing stack by rule 1 , @&t@
-   $1 = nterm line (1.1-2.0: 7)
--> $$ = nterm input (1.1-2.0: 7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
 Next token is token "number" (2.1: 1)
-Shifting token "number" (2.1: 1)
-Entering state 2
-
-Stack now 0 7 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2.1: 1)
--> $$ = nterm exp (2.1: 1)
-Entering state 9
-
-Stack now 0 7 9
-Reading a token: @&t@
 Next token is token '+' (2.2: 1)
-Shifting token '+' (2.2: 1)
-Entering state 19
-
-Stack now 0 7 9 19
-Reading a token: @&t@
 Next token is token "number" (2.3: 2)
-Shifting token "number" (2.3: 2)
-Entering state 2
-
-Stack now 0 7 9 19 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2.3: 2)
--> $$ = nterm exp (2.3: 2)
-Entering state 28
-
-Stack now 0 7 9 19 28
-Reading a token: @&t@
 Next token is token '*' (2.4: 2)
-Shifting token '*' (2.4: 2)
-Entering state 20
-
-Stack now 0 7 9 19 28 20
-Reading a token: @&t@
 Next token is token '-' (2.5: 2)
-Shifting token '-' (2.5: 2)
-Entering state 3
-
-Stack now 0 7 9 19 28 20 3
-Reading a token: @&t@
 Next token is token "number" (2.6: 3)
-Shifting token "number" (2.6: 3)
-Entering state 2
-
-Stack now 0 7 9 19 28 20 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2.6: 3)
--> $$ = nterm exp (2.6: 3)
-Entering state 12
-
-Stack now 0 7 9 19 28 20 3 12
-Reading a token: @&t@
 Next token is token '=' (2.7: 3)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (2.5: 2)
-   $2 = nterm exp (2.6: 3)
--> $$ = nterm exp (2.5-2.6: -3)
-Entering state 29
-
-Stack now 0 7 9 19 28 20 29
 Next token is token '=' (2.7: 3)
-Reducing stack by rule 10 , @&t@
-   $1 = nterm exp (2.3: 2)
-   $2 = token '*' (2.4: 2)
-   $3 = nterm exp (2.5-2.6: -3)
--> $$ = nterm exp (2.3-2.6: -6)
-Entering state 28
-
-Stack now 0 7 9 19 28
 Next token is token '=' (2.7: 3)
-Reducing stack by rule 8 , @&t@
-   $1 = nterm exp (2.1: 1)
-   $2 = token '+' (2.2: 1)
-   $3 = nterm exp (2.3-2.6: -6)
--> $$ = nterm exp (2.1-2.6: -5)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '=' (2.7: 3)
-Shifting token '=' (2.7: 3)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
 Next token is token '-' (2.8: 3)
-Shifting token '-' (2.8: 3)
-Entering state 3
-
-Stack now 0 7 9 17 3
-Reading a token: @&t@
 Next token is token "number" (2.9: 5)
-Shifting token "number" (2.9: 5)
-Entering state 2
-
-Stack now 0 7 9 17 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2.9: 5)
--> $$ = nterm exp (2.9: 5)
-Entering state 12
-
-Stack now 0 7 9 17 3 12
-Reading a token: @&t@
 Next token is token '\n' (3.0: 5)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (2.8: 3)
-   $2 = nterm exp (2.9: 5)
--> $$ = nterm exp (2.8-2.9: -5)
-Entering state 26
-
-Stack now 0 7 9 17 26
 Next token is token '\n' (3.0: 5)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (2.1-2.6: -5)
-   $2 = token '=' (2.7: 3)
-   $3 = nterm exp (2.8-2.9: -5)
--> $$ = nterm exp (2.1-2.9: -5)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '\n' (3.0: 5)
-Shifting token '\n' (3.0: 5)
-Entering state 23
-
-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (2.1-2.9: -5)
-   $2 = token '\n' (3.0: 5)
--> $$ = nterm line (2.1-3.0: -5)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (1.1-2.0: 7)
-   $2 = nterm line (2.1-3.0: -5)
--> $$ = nterm input (1.1-3.0: 7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
 Next token is token '\n' (4.0: 5)
-Shifting token '\n' (4.0: 5)
-Entering state 4
-
-Stack now 0 7 4
-Reducing stack by rule 3 , @&t@
-   $1 = token '\n' (4.0: 5)
--> $$ = nterm line (4.0: 5)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (1.1-3.0: 7)
-   $2 = nterm line (4.0: 5)
--> $$ = nterm input (1.1-4.0: 7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
 Next token is token '-' (4.1: 5)
-Shifting token '-' (4.1: 5)
-Entering state 3
-
-Stack now 0 7 3
-Reading a token: @&t@
 Next token is token "number" (4.2: 1)
-Shifting token "number" (4.2: 1)
-Entering state 2
-
-Stack now 0 7 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (4.2: 1)
--> $$ = nterm exp (4.2: 1)
-Entering state 12
-
-Stack now 0 7 3 12
-Reading a token: @&t@
 Next token is token '^' (4.3: 1)
-Shifting token '^' (4.3: 1)
-Entering state 22
-
-Stack now 0 7 3 12 22
-Reading a token: @&t@
 Next token is token "number" (4.4: 2)
-Shifting token "number" (4.4: 2)
-Entering state 2
-
-Stack now 0 7 3 12 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (4.4: 2)
--> $$ = nterm exp (4.4: 2)
-Entering state 31
-
-Stack now 0 7 3 12 22 31
-Reading a token: @&t@
 Next token is token '=' (4.5: 2)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (4.2: 1)
-   $2 = token '^' (4.3: 1)
-   $3 = nterm exp (4.4: 2)
--> $$ = nterm exp (4.2-4.4: 1)
-Entering state 12
-
-Stack now 0 7 3 12
 Next token is token '=' (4.5: 2)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (4.1: 5)
-   $2 = nterm exp (4.2-4.4: 1)
--> $$ = nterm exp (4.1-4.4: -1)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '=' (4.5: 2)
-Shifting token '=' (4.5: 2)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
 Next token is token '-' (4.6: 2)
-Shifting token '-' (4.6: 2)
-Entering state 3
-
-Stack now 0 7 9 17 3
-Reading a token: @&t@
 Next token is token "number" (4.7: 1)
-Shifting token "number" (4.7: 1)
-Entering state 2
-
-Stack now 0 7 9 17 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (4.7: 1)
--> $$ = nterm exp (4.7: 1)
-Entering state 12
-
-Stack now 0 7 9 17 3 12
-Reading a token: @&t@
 Next token is token '\n' (5.0: 1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (4.6: 2)
-   $2 = nterm exp (4.7: 1)
--> $$ = nterm exp (4.6-4.7: -1)
-Entering state 26
-
-Stack now 0 7 9 17 26
 Next token is token '\n' (5.0: 1)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (4.1-4.4: -1)
-   $2 = token '=' (4.5: 2)
-   $3 = nterm exp (4.6-4.7: -1)
--> $$ = nterm exp (4.1-4.7: -1)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '\n' (5.0: 1)
-Shifting token '\n' (5.0: 1)
-Entering state 23
-
-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (4.1-4.7: -1)
-   $2 = token '\n' (5.0: 1)
--> $$ = nterm line (4.1-5.0: -1)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (1.1-4.0: 7)
-   $2 = nterm line (4.1-5.0: -1)
--> $$ = nterm input (1.1-5.0: 7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
 Next token is token '(' (5.1: 1)
-Shifting token '(' (5.1: 1)
-Entering state 5
-
-Stack now 0 7 5
-Reading a token: @&t@
 Next token is token '-' (5.2: 1)
-Shifting token '-' (5.2: 1)
-Entering state 3
-
-Stack now 0 7 5 3
-Reading a token: @&t@
 Next token is token "number" (5.3: 1)
-Shifting token "number" (5.3: 1)
-Entering state 2
-
-Stack now 0 7 5 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (5.3: 1)
--> $$ = nterm exp (5.3: 1)
-Entering state 12
-
-Stack now 0 7 5 3 12
-Reading a token: @&t@
 Next token is token ')' (5.4: 1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (5.2: 1)
-   $2 = nterm exp (5.3: 1)
--> $$ = nterm exp (5.2-5.3: -1)
-Entering state 14
-
-Stack now 0 7 5 14
 Next token is token ')' (5.4: 1)
-Shifting token ')' (5.4: 1)
-Entering state 25
-
-Stack now 0 7 5 14 25
-Reducing stack by rule 14 , @&t@
-   $1 = token '(' (5.1: 1)
-   $2 = nterm exp (5.2-5.3: -1)
-   $3 = token ')' (5.4: 1)
--> $$ = nterm exp (5.1-5.4: -1)
-Entering state 9
-
-Stack now 0 7 9
-Reading a token: @&t@
 Next token is token '^' (5.5: 1)
-Shifting token '^' (5.5: 1)
-Entering state 22
-
-Stack now 0 7 9 22
-Reading a token: @&t@
 Next token is token "number" (5.6: 2)
-Shifting token "number" (5.6: 2)
-Entering state 2
-
-Stack now 0 7 9 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (5.6: 2)
--> $$ = nterm exp (5.6: 2)
-Entering state 31
-
-Stack now 0 7 9 22 31
-Reading a token: @&t@
 Next token is token '=' (5.7: 2)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (5.1-5.4: -1)
-   $2 = token '^' (5.5: 1)
-   $3 = nterm exp (5.6: 2)
--> $$ = nterm exp (5.1-5.6: 1)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '=' (5.7: 2)
-Shifting token '=' (5.7: 2)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
 Next token is token "number" (5.8: 1)
-Shifting token "number" (5.8: 1)
-Entering state 2
-
-Stack now 0 7 9 17 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (5.8: 1)
--> $$ = nterm exp (5.8: 1)
-Entering state 26
-
-Stack now 0 7 9 17 26
-Reading a token: @&t@
 Next token is token '\n' (6.0: 1)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (5.1-5.6: 1)
-   $2 = token '=' (5.7: 2)
-   $3 = nterm exp (5.8: 1)
--> $$ = nterm exp (5.1-5.8: 1)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '\n' (6.0: 1)
-Shifting token '\n' (6.0: 1)
-Entering state 23
-
-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (5.1-5.8: 1)
-   $2 = token '\n' (6.0: 1)
--> $$ = nterm line (5.1-6.0: 1)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (1.1-5.0: 7)
-   $2 = nterm line (5.1-6.0: 1)
--> $$ = nterm input (1.1-6.0: 7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
 Next token is token '\n' (7.0: 1)
-Shifting token '\n' (7.0: 1)
-Entering state 4
-
-Stack now 0 7 4
-Reducing stack by rule 3 , @&t@
-   $1 = token '\n' (7.0: 1)
--> $$ = nterm line (7.0: 1)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (1.1-6.0: 7)
-   $2 = nterm line (7.0: 1)
--> $$ = nterm input (1.1-7.0: 7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
 Next token is token '-' (7.1: 1)
-Shifting token '-' (7.1: 1)
-Entering state 3
-
-Stack now 0 7 3
-Reading a token: @&t@
 Next token is token '-' (7.2: 1)
-Shifting token '-' (7.2: 1)
-Entering state 3
-
-Stack now 0 7 3 3
-Reading a token: @&t@
 Next token is token '-' (7.3: 1)
-Shifting token '-' (7.3: 1)
-Entering state 3
-
-Stack now 0 7 3 3 3
-Reading a token: @&t@
 Next token is token "number" (7.4: 1)
-Shifting token "number" (7.4: 1)
-Entering state 2
-
-Stack now 0 7 3 3 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (7.4: 1)
--> $$ = nterm exp (7.4: 1)
-Entering state 12
-
-Stack now 0 7 3 3 3 12
-Reading a token: @&t@
 Next token is token '=' (7.5: 1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (7.3: 1)
-   $2 = nterm exp (7.4: 1)
--> $$ = nterm exp (7.3-7.4: -1)
-Entering state 12
-
-Stack now 0 7 3 3 12
 Next token is token '=' (7.5: 1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (7.2: 1)
-   $2 = nterm exp (7.3-7.4: -1)
--> $$ = nterm exp (7.2-7.4: 1)
-Entering state 12
-
-Stack now 0 7 3 12
 Next token is token '=' (7.5: 1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (7.1: 1)
-   $2 = nterm exp (7.2-7.4: 1)
--> $$ = nterm exp (7.1-7.4: -1)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '=' (7.5: 1)
-Shifting token '=' (7.5: 1)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
 Next token is token '-' (7.6: 1)
-Shifting token '-' (7.6: 1)
-Entering state 3
-
-Stack now 0 7 9 17 3
-Reading a token: @&t@
 Next token is token "number" (7.7: 1)
-Shifting token "number" (7.7: 1)
-Entering state 2
-
-Stack now 0 7 9 17 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (7.7: 1)
--> $$ = nterm exp (7.7: 1)
-Entering state 12
-
-Stack now 0 7 9 17 3 12
-Reading a token: @&t@
 Next token is token '\n' (8.0: 1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (7.6: 1)
-   $2 = nterm exp (7.7: 1)
--> $$ = nterm exp (7.6-7.7: -1)
-Entering state 26
-
-Stack now 0 7 9 17 26
 Next token is token '\n' (8.0: 1)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (7.1-7.4: -1)
-   $2 = token '=' (7.5: 1)
-   $3 = nterm exp (7.6-7.7: -1)
--> $$ = nterm exp (7.1-7.7: -1)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '\n' (8.0: 1)
-Shifting token '\n' (8.0: 1)
-Entering state 23
-
-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (7.1-7.7: -1)
-   $2 = token '\n' (8.0: 1)
--> $$ = nterm line (7.1-8.0: -1)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (1.1-7.0: 7)
-   $2 = nterm line (7.1-8.0: -1)
--> $$ = nterm input (1.1-8.0: 7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
 Next token is token '\n' (9.0: 1)
-Shifting token '\n' (9.0: 1)
-Entering state 4
-
-Stack now 0 7 4
-Reducing stack by rule 3 , @&t@
-   $1 = token '\n' (9.0: 1)
--> $$ = nterm line (9.0: 1)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (1.1-8.0: 7)
-   $2 = nterm line (9.0: 1)
--> $$ = nterm input (1.1-9.0: 7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
 Next token is token "number" (9.1: 1)
-Shifting token "number" (9.1: 1)
-Entering state 2
-
-Stack now 0 7 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (9.1: 1)
--> $$ = nterm exp (9.1: 1)
-Entering state 9
-
-Stack now 0 7 9
-Reading a token: @&t@
 Next token is token '-' (9.2: 1)
-Shifting token '-' (9.2: 1)
-Entering state 18
-
-Stack now 0 7 9 18
-Reading a token: @&t@
 Next token is token "number" (9.3: 2)
-Shifting token "number" (9.3: 2)
-Entering state 2
-
-Stack now 0 7 9 18 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (9.3: 2)
--> $$ = nterm exp (9.3: 2)
-Entering state 27
-
-Stack now 0 7 9 18 27
-Reading a token: @&t@
 Next token is token '-' (9.4: 2)
-Reducing stack by rule 9 , @&t@
-   $1 = nterm exp (9.1: 1)
-   $2 = token '-' (9.2: 1)
-   $3 = nterm exp (9.3: 2)
--> $$ = nterm exp (9.1-9.3: -1)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '-' (9.4: 2)
-Shifting token '-' (9.4: 2)
-Entering state 18
-
-Stack now 0 7 9 18
-Reading a token: @&t@
 Next token is token "number" (9.5: 3)
-Shifting token "number" (9.5: 3)
-Entering state 2
-
-Stack now 0 7 9 18 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (9.5: 3)
--> $$ = nterm exp (9.5: 3)
-Entering state 27
-
-Stack now 0 7 9 18 27
-Reading a token: @&t@
 Next token is token '=' (9.6: 3)
-Reducing stack by rule 9 , @&t@
-   $1 = nterm exp (9.1-9.3: -1)
-   $2 = token '-' (9.4: 2)
-   $3 = nterm exp (9.5: 3)
--> $$ = nterm exp (9.1-9.5: -4)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '=' (9.6: 3)
-Shifting token '=' (9.6: 3)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
 Next token is token '-' (9.7: 3)
-Shifting token '-' (9.7: 3)
-Entering state 3
-
-Stack now 0 7 9 17 3
-Reading a token: @&t@
 Next token is token "number" (9.8: 4)
-Shifting token "number" (9.8: 4)
-Entering state 2
-
-Stack now 0 7 9 17 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (9.8: 4)
--> $$ = nterm exp (9.8: 4)
-Entering state 12
-
-Stack now 0 7 9 17 3 12
-Reading a token: @&t@
 Next token is token '\n' (10.0: 4)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (9.7: 3)
-   $2 = nterm exp (9.8: 4)
--> $$ = nterm exp (9.7-9.8: -4)
-Entering state 26
-
-Stack now 0 7 9 17 26
 Next token is token '\n' (10.0: 4)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (9.1-9.5: -4)
-   $2 = token '=' (9.6: 3)
-   $3 = nterm exp (9.7-9.8: -4)
--> $$ = nterm exp (9.1-9.8: -4)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '\n' (10.0: 4)
-Shifting token '\n' (10.0: 4)
-Entering state 23
-
-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (9.1-9.8: -4)
-   $2 = token '\n' (10.0: 4)
--> $$ = nterm line (9.1-10.0: -4)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (1.1-9.0: 7)
-   $2 = nterm line (9.1-10.0: -4)
--> $$ = nterm input (1.1-10.0: 7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
 Next token is token "number" (10.1: 1)
-Shifting token "number" (10.1: 1)
-Entering state 2
-
-Stack now 0 7 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (10.1: 1)
--> $$ = nterm exp (10.1: 1)
-Entering state 9
-
-Stack now 0 7 9
-Reading a token: @&t@
 Next token is token '-' (10.2: 1)
-Shifting token '-' (10.2: 1)
-Entering state 18
-
-Stack now 0 7 9 18
-Reading a token: @&t@
 Next token is token '(' (10.3: 1)
-Shifting token '(' (10.3: 1)
-Entering state 5
-
-Stack now 0 7 9 18 5
-Reading a token: @&t@
 Next token is token "number" (10.4: 2)
-Shifting token "number" (10.4: 2)
-Entering state 2
-
-Stack now 0 7 9 18 5 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (10.4: 2)
--> $$ = nterm exp (10.4: 2)
-Entering state 14
-
-Stack now 0 7 9 18 5 14
-Reading a token: @&t@
 Next token is token '-' (10.5: 2)
-Shifting token '-' (10.5: 2)
-Entering state 18
-
-Stack now 0 7 9 18 5 14 18
-Reading a token: @&t@
 Next token is token "number" (10.6: 3)
-Shifting token "number" (10.6: 3)
-Entering state 2
-
-Stack now 0 7 9 18 5 14 18 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (10.6: 3)
--> $$ = nterm exp (10.6: 3)
-Entering state 27
-
-Stack now 0 7 9 18 5 14 18 27
-Reading a token: @&t@
 Next token is token ')' (10.7: 3)
-Reducing stack by rule 9 , @&t@
-   $1 = nterm exp (10.4: 2)
-   $2 = token '-' (10.5: 2)
-   $3 = nterm exp (10.6: 3)
--> $$ = nterm exp (10.4-10.6: -1)
-Entering state 14
-
-Stack now 0 7 9 18 5 14
 Next token is token ')' (10.7: 3)
-Shifting token ')' (10.7: 3)
-Entering state 25
-
-Stack now 0 7 9 18 5 14 25
-Reducing stack by rule 14 , @&t@
-   $1 = token '(' (10.3: 1)
-   $2 = nterm exp (10.4-10.6: -1)
-   $3 = token ')' (10.7: 3)
--> $$ = nterm exp (10.3-10.7: -1)
-Entering state 27
-
-Stack now 0 7 9 18 27
-Reading a token: @&t@
 Next token is token '=' (10.8: 3)
-Reducing stack by rule 9 , @&t@
-   $1 = nterm exp (10.1: 1)
-   $2 = token '-' (10.2: 1)
-   $3 = nterm exp (10.3-10.7: -1)
--> $$ = nterm exp (10.1-10.7: 2)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '=' (10.8: 3)
-Shifting token '=' (10.8: 3)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
 Next token is token "number" (10.9: 2)
-Shifting token "number" (10.9: 2)
-Entering state 2
-
-Stack now 0 7 9 17 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (10.9: 2)
--> $$ = nterm exp (10.9: 2)
-Entering state 26
-
-Stack now 0 7 9 17 26
-Reading a token: @&t@
 Next token is token '\n' (11.0: 2)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (10.1-10.7: 2)
-   $2 = token '=' (10.8: 3)
-   $3 = nterm exp (10.9: 2)
--> $$ = nterm exp (10.1-10.9: 2)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '\n' (11.0: 2)
-Shifting token '\n' (11.0: 2)
-Entering state 23
-
-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (10.1-10.9: 2)
-   $2 = token '\n' (11.0: 2)
--> $$ = nterm line (10.1-11.0: 2)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (1.1-10.0: 7)
-   $2 = nterm line (10.1-11.0: 2)
--> $$ = nterm input (1.1-11.0: 7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
 Next token is token '\n' (12.0: 2)
-Shifting token '\n' (12.0: 2)
-Entering state 4
-
-Stack now 0 7 4
-Reducing stack by rule 3 , @&t@
-   $1 = token '\n' (12.0: 2)
--> $$ = nterm line (12.0: 2)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (1.1-11.0: 7)
-   $2 = nterm line (12.0: 2)
--> $$ = nterm input (1.1-12.0: 7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
 Next token is token "number" (12.1: 2)
-Shifting token "number" (12.1: 2)
-Entering state 2
-
-Stack now 0 7 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (12.1: 2)
--> $$ = nterm exp (12.1: 2)
-Entering state 9
-
-Stack now 0 7 9
-Reading a token: @&t@
 Next token is token '^' (12.2: 2)
-Shifting token '^' (12.2: 2)
-Entering state 22
-
-Stack now 0 7 9 22
-Reading a token: @&t@
 Next token is token "number" (12.3: 2)
-Shifting token "number" (12.3: 2)
-Entering state 2
-
-Stack now 0 7 9 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (12.3: 2)
--> $$ = nterm exp (12.3: 2)
-Entering state 31
-
-Stack now 0 7 9 22 31
-Reading a token: @&t@
 Next token is token '^' (12.4: 2)
-Shifting token '^' (12.4: 2)
-Entering state 22
-
-Stack now 0 7 9 22 31 22
-Reading a token: @&t@
 Next token is token "number" (12.5: 3)
-Shifting token "number" (12.5: 3)
-Entering state 2
-
-Stack now 0 7 9 22 31 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (12.5: 3)
--> $$ = nterm exp (12.5: 3)
-Entering state 31
-
-Stack now 0 7 9 22 31 22 31
-Reading a token: @&t@
 Next token is token '=' (12.6: 3)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (12.3: 2)
-   $2 = token '^' (12.4: 2)
-   $3 = nterm exp (12.5: 3)
--> $$ = nterm exp (12.3-12.5: 8)
-Entering state 31
-
-Stack now 0 7 9 22 31
 Next token is token '=' (12.6: 3)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (12.1: 2)
-   $2 = token '^' (12.2: 2)
-   $3 = nterm exp (12.3-12.5: 8)
--> $$ = nterm exp (12.1-12.5: 256)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '=' (12.6: 3)
-Shifting token '=' (12.6: 3)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
 Next token is token "number" (12.7: 256)
-Shifting token "number" (12.7: 256)
-Entering state 2
-
-Stack now 0 7 9 17 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (12.7: 256)
--> $$ = nterm exp (12.7: 256)
-Entering state 26
-
-Stack now 0 7 9 17 26
-Reading a token: @&t@
 Next token is token '\n' (13.0: 256)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (12.1-12.5: 256)
-   $2 = token '=' (12.6: 3)
-   $3 = nterm exp (12.7: 256)
--> $$ = nterm exp (12.1-12.7: 256)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '\n' (13.0: 256)
-Shifting token '\n' (13.0: 256)
-Entering state 23
-
-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (12.1-12.7: 256)
-   $2 = token '\n' (13.0: 256)
--> $$ = nterm line (12.1-13.0: 256)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (1.1-12.0: 7)
-   $2 = nterm line (12.1-13.0: 256)
--> $$ = nterm input (1.1-13.0: 7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
 Next token is token '(' (13.1: 256)
-Shifting token '(' (13.1: 256)
-Entering state 5
-
-Stack now 0 7 5
-Reading a token: @&t@
 Next token is token "number" (13.2: 2)
-Shifting token "number" (13.2: 2)
-Entering state 2
-
-Stack now 0 7 5 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (13.2: 2)
--> $$ = nterm exp (13.2: 2)
-Entering state 14
-
-Stack now 0 7 5 14
-Reading a token: @&t@
 Next token is token '^' (13.3: 2)
-Shifting token '^' (13.3: 2)
-Entering state 22
-
-Stack now 0 7 5 14 22
-Reading a token: @&t@
 Next token is token "number" (13.4: 2)
-Shifting token "number" (13.4: 2)
-Entering state 2
-
-Stack now 0 7 5 14 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (13.4: 2)
--> $$ = nterm exp (13.4: 2)
-Entering state 31
-
-Stack now 0 7 5 14 22 31
-Reading a token: @&t@
 Next token is token ')' (13.5: 2)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (13.2: 2)
-   $2 = token '^' (13.3: 2)
-   $3 = nterm exp (13.4: 2)
--> $$ = nterm exp (13.2-13.4: 4)
-Entering state 14
-
-Stack now 0 7 5 14
 Next token is token ')' (13.5: 2)
-Shifting token ')' (13.5: 2)
-Entering state 25
-
-Stack now 0 7 5 14 25
-Reducing stack by rule 14 , @&t@
-   $1 = token '(' (13.1: 256)
-   $2 = nterm exp (13.2-13.4: 4)
-   $3 = token ')' (13.5: 2)
--> $$ = nterm exp (13.1-13.5: 4)
-Entering state 9
-
-Stack now 0 7 9
-Reading a token: @&t@
 Next token is token '^' (13.6: 2)
-Shifting token '^' (13.6: 2)
-Entering state 22
-
-Stack now 0 7 9 22
-Reading a token: @&t@
 Next token is token "number" (13.7: 3)
-Shifting token "number" (13.7: 3)
-Entering state 2
-
-Stack now 0 7 9 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (13.7: 3)
--> $$ = nterm exp (13.7: 3)
-Entering state 31
-
-Stack now 0 7 9 22 31
-Reading a token: @&t@
 Next token is token '=' (13.8: 3)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (13.1-13.5: 4)
-   $2 = token '^' (13.6: 2)
-   $3 = nterm exp (13.7: 3)
--> $$ = nterm exp (13.1-13.7: 64)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '=' (13.8: 3)
-Shifting token '=' (13.8: 3)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
 Next token is token "number" (13.9: 64)
-Shifting token "number" (13.9: 64)
-Entering state 2
-
-Stack now 0 7 9 17 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (13.9: 64)
--> $$ = nterm exp (13.9: 64)
-Entering state 26
-
-Stack now 0 7 9 17 26
-Reading a token: @&t@
 Next token is token '\n' (14.0: 64)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (13.1-13.7: 64)
-   $2 = token '=' (13.8: 3)
-   $3 = nterm exp (13.9: 64)
--> $$ = nterm exp (13.1-13.9: 64)
-Entering state 9
-
-Stack now 0 7 9
 Next token is token '\n' (14.0: 64)
-Shifting token '\n' (14.0: 64)
-Entering state 23
+]])

-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (13.1-13.9: 64)
-   $2 = token '\n' (14.0: 64)
--> $$ = nterm line (13.1-14.0: 64)
-Entering state 16
+# Define the calculator input.
+# Warning: if you changes the input file
+# then the locations test file position numbers
+# may be incorrect and you will have
+# to modify that file as well.

-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (1.1-13.0: 7)
-   $2 = nterm line (13.1-14.0: 64)
--> $$ = nterm input (1.1-14.0: 7)
-Entering state 7
+AT_DATA([input],[[1 + 2 * 3 = 7
+1 + 2 * -3 = -5

-Stack now 0 7
-Reading a token: @&t@
-Now at end of input.
+-1^2 = -1
+(-1)^2 = 1

-Shifting token $end (14.1: 64)
-Entering state 15
+---1 = -1

-Stack now 0 7 15
+1 - 2 - 3 = -4
+1 - (2 - 3) = 2
+
+2^2^3 = 256
+(2^2)^3 = 64
 ]])

-AT_BISON_CHECK([PUSHPULLFLAGS [-o Calc.java Calc.y]])
+AT_BISON_CHECK([PUSHPULLFLAG [-o Calc.java Calc.y]])
 AT_JAVA_COMPILE([[Calc.java]])
 # Verify that this is a push parser
-AT_CHECK_JAVA_GREP([[Calc.java]],[[.*public void push_parse_initialize().*]])
-# Capture the output so we can edit out the (line nnnn) occurrences
-AT_JAVA_PARSER_CHECK([Calc input], 0, [], [stderr-nolog])
-AT_CHECK([[sed -e 's/(line[ ][0-9][0-9]*)[,]/,/' stderr]],[ignore],[expout])
+AT_CHECK_JAVA_GREP([[Calc.java]],
+                   [[.*public void push_parse_initialize().*]])
+# Capture the  stdout and stderr output for comparison purposes.
+AT_JAVA_PARSER_CHECK([Calc input], 0, [stdout-nolog], [stderr-nolog])
+# 1. Check that the token locations are correct
+AT_CHECK([[cp -f ./locations ./expout]],[ignore],[ignore-nolog],[ignore-nolog])
+AT_CHECK([[sed -e '/^Next token.*$/p' -e d 
./stderr]],[ignore],[expout],[ignore-nolog])
+# 2. Check that the calculator output matches that of a pull parser
+AT_CHECK([[rm -f ./expout; cp -f ./output 
./expout]],[ignore],[ignore-nolog],[ignore-nolog])
+AT_CHECK([[cat ./stdout]],[ignore],[expout],[ignore-nolog])
 AT_CLEANUP

-AT_SETUP([Calc parser with api.push-pull both and %define extends])
-AT_BISON_OPTION_PUSHDEFS
-AT_DATA([[Calc.y]],[[/* Infix notation calculator--calc */
-%language "Java"
-%name-prefix "Calc"
-%define parser_class_name "Calc"
-%define extends "CalcActions"
-
-%code init {
-    super();
-}
-
-%code imports {
-  import java.io.*;
-}
-
-%code {
-
-  /* Make yylexer visible */
-  Lexer getLexer() {return yylexer;}
-
-  public static void main (String[] argv)
-        throws IOException
-  {
-    StringReader reader = getinput(argv[0]);
-    UserLexer lexer = new UserLexer(reader);
-    Calc calc = new Calc(lexer);
-    calc.setDebugLevel(1);
-    calc.parse();
-  }
-
-
-  static StringReader
-  getinput(String filename) throws IOException
-  {
-    StringBuilder buf = new StringBuilder();
-    FileReader file = new FileReader(filename);
-    int c;
-    while((c=file.read()) > 0) {
-      buf.append((char)c);
-    }
-    file.close();
-    return new StringReader(buf.toString());
-  }
-}
-
-/* Bison Declarations */
-%token <Integer> NUM "number"
-%type  <Integer> exp
-
-%nonassoc '=' /* comparison            */
-%left '-' '+'
-%left '*' '/'
-%left NEG     /* negation--unary minus */
-%right '^'    /* exponentiation        */
-
-/* Grammar follows */
-%%
-input:
-  line
-| input line
-;
-
-line:
-  '\n'
-| exp '\n'
-| error '\n'
-;
-
-exp:
-  NUM                { $$ = $1;}
-| exp '=' exp {$$ = action_eq($1,$3);}
-| exp '+' exp {$$ = action_add($1,$3);}
-| exp '-' exp {$$ = action_sub($1,$3);}
-| exp '*' exp {$$ = action_mult($1,$3);}
-| exp '/' exp {$$ = action_div($1,$3);}
-| '-' exp  %prec NEG {$$ = action_minus($2);}
-| exp '^' exp {$$ = action_exp($1,$3);}
-| '(' exp ')'   {$$ = action_ident($2);}
-| '(' error ')' {$$ = action_error1();}
-| '!'            {$$ = action_fail(); return YYERROR;}
-| '-' error     {$$ = action_error2(); return YYERROR;}
-;
-
-%%
-
-class UserLexer implements Calc.Lexer
-{
-  StreamTokenizer st;
-  StringReader rdr;
-
-  public UserLexer(StringReader reader)
-  {
-    rdr = reader;
-    st = new StreamTokenizer(rdr);
-    st.resetSyntax();
-    st.eolIsSignificant(true);
-    st.whitespaceChars(9, 9);
-    st.whitespaceChars(32, 32);
-    st.wordChars(48, 57);
-  }
-
-  Integer yylval;
-
-  public Object getLVal() {return yylval;}
-
-  public void yyerror(String msg) {System.err.println(msg);}
-
-  public int yylex () throws IOException
-  {
-    int ttype = st.nextToken ();
-    if (ttype == st.TT_EOF) {return EOF;}
-    else if (ttype == st.TT_EOL) {
-        return (int) '\n';
-    } else if (ttype == st.TT_WORD) {
-        yylval = new Integer (st.sval);
-        return NUM;
-    } else
-      return st.ttype;
-  }
-}
-
-abstract class CalcActions
-{
-  CalcActions() {};
-
-  abstract Calc.Lexer getLexer();
-
-  Integer
-  action_eq(Integer i1, Integer i2)
-  {
-    if (i1.intValue() != i2.intValue())
-      getLexer().yyerror (]AT_LOCATION_IF(address@hidden,])[ "calc: error: " + 
i1 + " != " + i2);
-    return i1; /* default */
-  }
-
-  Integer
-  action_sub(Integer i1, Integer i2)
-      {return new Integer (i1.intValue () - i2.intValue ());}
-
-  Integer
-  action_add(Integer i1, Integer i2)
-      {return new Integer (i1.intValue () + i2.intValue ());}
-
-  Integer
-  action_mult(Integer i1, Integer i2)
-      {return new Integer (i1.intValue () * i2.intValue ());}
-
-  Integer
-  action_div(Integer i1, Integer i2)
-      {return new Integer (i1.intValue () / i2.intValue ());}
-
-  Integer
-  action_minus(Integer i1)
-      {return new Integer (- i1.intValue ());}
-
-  Integer
-  action_exp(Integer i1, Integer i2)
-      {return new Integer ((int)Math.pow(i1.intValue(),i2.intValue ()));}
-
-  Integer
-  action_ident(Integer i1)
-      {return i1;}
-
-  Integer
-  action_error1()
-      {return new Integer(1111);}
-
-  Integer
-  action_fail()
-      {return new Integer(0);}
-
-  Integer
-  action_error2()
-      {return new Integer(0);}
-}
-]])
-
-AT_BISON_OPTION_POPDEFS
-
-AT_DATA([[input]],[[1 + 2 * 3 = 7
-1 + 2 * -3 = -5
-
--1^2 = -1
-(-1)^2 = 1
-
----1 = -1
-
-1 - 2 - 3 = -4
-1 - (2 - 3) = 2
-
-2^2^3 = 256
-(2^2)^3 = 64
-]])
-
-AT_DATA([[expout]],[[Starting parse
-
-Entering state 0
-
-Stack now 0
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
-Stack now 0 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 9
-
-Stack now 0 9
-Reading a token: @&t@
-Next token is token '+' (1)
-Shifting token '+' (1)
-Entering state 19
-
-Stack now 0 9 19
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
-Stack now 0 9 19 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 28
-
-Stack now 0 9 19 28
-Reading a token: @&t@
-Next token is token '*' (2)
-Shifting token '*' (2)
-Entering state 20
-
-Stack now 0 9 19 28 20
-Reading a token: @&t@
-Next token is token "number" (3)
-Shifting token "number" (3)
-Entering state 2
-
-Stack now 0 9 19 28 20 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (3)
--> $$ = nterm exp (3)
-Entering state 29
-
-Stack now 0 9 19 28 20 29
-Reading a token: @&t@
-Next token is token '=' (3)
-Reducing stack by rule 10 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '*' (2)
-   $3 = nterm exp (3)
--> $$ = nterm exp (6)
-Entering state 28
-
-Stack now 0 9 19 28
-Next token is token '=' (3)
-Reducing stack by rule 8 , @&t@
-   $1 = nterm exp (1)
-   $2 = token '+' (1)
-   $3 = nterm exp (6)
--> $$ = nterm exp (7)
-Entering state 9
-
-Stack now 0 9
-Next token is token '=' (3)
-Shifting token '=' (3)
-Entering state 17
-
-Stack now 0 9 17
-Reading a token: @&t@
-Next token is token "number" (7)
-Shifting token "number" (7)
-Entering state 2
-
-Stack now 0 9 17 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (7)
--> $$ = nterm exp (7)
-Entering state 26
-
-Stack now 0 9 17 26
-Reading a token: @&t@
-Next token is token '\n' (7)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (7)
-   $2 = token '=' (3)
-   $3 = nterm exp (7)
--> $$ = nterm exp (7)
-Entering state 9
-
-Stack now 0 9
-Next token is token '\n' (7)
-Shifting token '\n' (7)
-Entering state 23
-
-Stack now 0 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (7)
-   $2 = token '\n' (7)
--> $$ = nterm line (7)
-Entering state 8
-
-Stack now 0 8
-Reducing stack by rule 1 , @&t@
-   $1 = nterm line (7)
--> $$ = nterm input (7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
-Stack now 0 7 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 9
-
-Stack now 0 7 9
-Reading a token: @&t@
-Next token is token '+' (1)
-Shifting token '+' (1)
-Entering state 19
-
-Stack now 0 7 9 19
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
-Stack now 0 7 9 19 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 28
-
-Stack now 0 7 9 19 28
-Reading a token: @&t@
-Next token is token '*' (2)
-Shifting token '*' (2)
-Entering state 20
-
-Stack now 0 7 9 19 28 20
-Reading a token: @&t@
-Next token is token '-' (2)
-Shifting token '-' (2)
-Entering state 3
-
-Stack now 0 7 9 19 28 20 3
-Reading a token: @&t@
-Next token is token "number" (3)
-Shifting token "number" (3)
-Entering state 2
-
-Stack now 0 7 9 19 28 20 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (3)
--> $$ = nterm exp (3)
-Entering state 12
-
-Stack now 0 7 9 19 28 20 3 12
-Reading a token: @&t@
-Next token is token '=' (3)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (2)
-   $2 = nterm exp (3)
--> $$ = nterm exp (-3)
-Entering state 29
-
-Stack now 0 7 9 19 28 20 29
-Next token is token '=' (3)
-Reducing stack by rule 10 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '*' (2)
-   $3 = nterm exp (-3)
--> $$ = nterm exp (-6)
-Entering state 28
-
-Stack now 0 7 9 19 28
-Next token is token '=' (3)
-Reducing stack by rule 8 , @&t@
-   $1 = nterm exp (1)
-   $2 = token '+' (1)
-   $3 = nterm exp (-6)
--> $$ = nterm exp (-5)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '=' (3)
-Shifting token '=' (3)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token '-' (3)
-Shifting token '-' (3)
-Entering state 3
-
-Stack now 0 7 9 17 3
-Reading a token: @&t@
-Next token is token "number" (5)
-Shifting token "number" (5)
-Entering state 2
-
-Stack now 0 7 9 17 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (5)
--> $$ = nterm exp (5)
-Entering state 12
-
-Stack now 0 7 9 17 3 12
-Reading a token: @&t@
-Next token is token '\n' (5)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (3)
-   $2 = nterm exp (5)
--> $$ = nterm exp (-5)
-Entering state 26
-
-Stack now 0 7 9 17 26
-Next token is token '\n' (5)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (-5)
-   $2 = token '=' (3)
-   $3 = nterm exp (-5)
--> $$ = nterm exp (-5)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '\n' (5)
-Shifting token '\n' (5)
-Entering state 23
-
-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (-5)
-   $2 = token '\n' (5)
--> $$ = nterm line (-5)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (-5)
--> $$ = nterm input (7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
-Next token is token '\n' (5)
-Shifting token '\n' (5)
-Entering state 4
-
-Stack now 0 7 4
-Reducing stack by rule 3 , @&t@
-   $1 = token '\n' (5)
--> $$ = nterm line (5)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (5)
--> $$ = nterm input (7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
-Next token is token '-' (5)
-Shifting token '-' (5)
-Entering state 3
-
-Stack now 0 7 3
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
-Stack now 0 7 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 12
-
-Stack now 0 7 3 12
-Reading a token: @&t@
-Next token is token '^' (1)
-Shifting token '^' (1)
-Entering state 22
-
-Stack now 0 7 3 12 22
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
-Stack now 0 7 3 12 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 31
-
-Stack now 0 7 3 12 22 31
-Reading a token: @&t@
-Next token is token '=' (2)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (1)
-   $2 = token '^' (1)
-   $3 = nterm exp (2)
--> $$ = nterm exp (1)
-Entering state 12
-
-Stack now 0 7 3 12
-Next token is token '=' (2)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (5)
-   $2 = nterm exp (1)
--> $$ = nterm exp (-1)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '=' (2)
-Shifting token '=' (2)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token '-' (2)
-Shifting token '-' (2)
-Entering state 3
-
-Stack now 0 7 9 17 3
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
-Stack now 0 7 9 17 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 12
-
-Stack now 0 7 9 17 3 12
-Reading a token: @&t@
-Next token is token '\n' (1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (2)
-   $2 = nterm exp (1)
--> $$ = nterm exp (-1)
-Entering state 26
-
-Stack now 0 7 9 17 26
-Next token is token '\n' (1)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (-1)
-   $2 = token '=' (2)
-   $3 = nterm exp (-1)
--> $$ = nterm exp (-1)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '\n' (1)
-Shifting token '\n' (1)
-Entering state 23
-
-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (-1)
-   $2 = token '\n' (1)
--> $$ = nterm line (-1)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (-1)
--> $$ = nterm input (7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
-Next token is token '(' (1)
-Shifting token '(' (1)
-Entering state 5
-
-Stack now 0 7 5
-Reading a token: @&t@
-Next token is token '-' (1)
-Shifting token '-' (1)
-Entering state 3
-
-Stack now 0 7 5 3
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
-Stack now 0 7 5 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 12
-
-Stack now 0 7 5 3 12
-Reading a token: @&t@
-Next token is token ')' (1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (1)
-   $2 = nterm exp (1)
--> $$ = nterm exp (-1)
-Entering state 14
-
-Stack now 0 7 5 14
-Next token is token ')' (1)
-Shifting token ')' (1)
-Entering state 25
-
-Stack now 0 7 5 14 25
-Reducing stack by rule 14 , @&t@
-   $1 = token '(' (1)
-   $2 = nterm exp (-1)
-   $3 = token ')' (1)
--> $$ = nterm exp (-1)
-Entering state 9
-
-Stack now 0 7 9
-Reading a token: @&t@
-Next token is token '^' (1)
-Shifting token '^' (1)
-Entering state 22
-
-Stack now 0 7 9 22
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
-Stack now 0 7 9 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 31
-
-Stack now 0 7 9 22 31
-Reading a token: @&t@
-Next token is token '=' (2)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (-1)
-   $2 = token '^' (1)
-   $3 = nterm exp (2)
--> $$ = nterm exp (1)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '=' (2)
-Shifting token '=' (2)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
-Stack now 0 7 9 17 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 26
-
-Stack now 0 7 9 17 26
-Reading a token: @&t@
-Next token is token '\n' (1)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (1)
-   $2 = token '=' (2)
-   $3 = nterm exp (1)
--> $$ = nterm exp (1)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '\n' (1)
-Shifting token '\n' (1)
-Entering state 23
-
-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (1)
-   $2 = token '\n' (1)
--> $$ = nterm line (1)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (1)
--> $$ = nterm input (7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
-Next token is token '\n' (1)
-Shifting token '\n' (1)
-Entering state 4
-
-Stack now 0 7 4
-Reducing stack by rule 3 , @&t@
-   $1 = token '\n' (1)
--> $$ = nterm line (1)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (1)
--> $$ = nterm input (7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
-Next token is token '-' (1)
-Shifting token '-' (1)
-Entering state 3
-
-Stack now 0 7 3
-Reading a token: @&t@
-Next token is token '-' (1)
-Shifting token '-' (1)
-Entering state 3
-
-Stack now 0 7 3 3
-Reading a token: @&t@
-Next token is token '-' (1)
-Shifting token '-' (1)
-Entering state 3
-
-Stack now 0 7 3 3 3
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
-Stack now 0 7 3 3 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 12
-
-Stack now 0 7 3 3 3 12
-Reading a token: @&t@
-Next token is token '=' (1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (1)
-   $2 = nterm exp (1)
--> $$ = nterm exp (-1)
-Entering state 12
-
-Stack now 0 7 3 3 12
-Next token is token '=' (1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (1)
-   $2 = nterm exp (-1)
--> $$ = nterm exp (1)
-Entering state 12
-
-Stack now 0 7 3 12
-Next token is token '=' (1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (1)
-   $2 = nterm exp (1)
--> $$ = nterm exp (-1)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '=' (1)
-Shifting token '=' (1)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token '-' (1)
-Shifting token '-' (1)
-Entering state 3
-
-Stack now 0 7 9 17 3
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
-Stack now 0 7 9 17 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 12
-
-Stack now 0 7 9 17 3 12
-Reading a token: @&t@
-Next token is token '\n' (1)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (1)
-   $2 = nterm exp (1)
--> $$ = nterm exp (-1)
-Entering state 26
-
-Stack now 0 7 9 17 26
-Next token is token '\n' (1)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (-1)
-   $2 = token '=' (1)
-   $3 = nterm exp (-1)
--> $$ = nterm exp (-1)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '\n' (1)
-Shifting token '\n' (1)
-Entering state 23
-
-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (-1)
-   $2 = token '\n' (1)
--> $$ = nterm line (-1)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (-1)
--> $$ = nterm input (7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
-Next token is token '\n' (1)
-Shifting token '\n' (1)
-Entering state 4
-
-Stack now 0 7 4
-Reducing stack by rule 3 , @&t@
-   $1 = token '\n' (1)
--> $$ = nterm line (1)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (1)
--> $$ = nterm input (7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
-Stack now 0 7 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 9
-
-Stack now 0 7 9
-Reading a token: @&t@
-Next token is token '-' (1)
-Shifting token '-' (1)
-Entering state 18
-
-Stack now 0 7 9 18
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
-Stack now 0 7 9 18 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 27
-
-Stack now 0 7 9 18 27
-Reading a token: @&t@
-Next token is token '-' (2)
-Reducing stack by rule 9 , @&t@
-   $1 = nterm exp (1)
-   $2 = token '-' (1)
-   $3 = nterm exp (2)
--> $$ = nterm exp (-1)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '-' (2)
-Shifting token '-' (2)
-Entering state 18
-
-Stack now 0 7 9 18
-Reading a token: @&t@
-Next token is token "number" (3)
-Shifting token "number" (3)
-Entering state 2
-
-Stack now 0 7 9 18 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (3)
--> $$ = nterm exp (3)
-Entering state 27
-
-Stack now 0 7 9 18 27
-Reading a token: @&t@
-Next token is token '=' (3)
-Reducing stack by rule 9 , @&t@
-   $1 = nterm exp (-1)
-   $2 = token '-' (2)
-   $3 = nterm exp (3)
--> $$ = nterm exp (-4)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '=' (3)
-Shifting token '=' (3)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token '-' (3)
-Shifting token '-' (3)
-Entering state 3
-
-Stack now 0 7 9 17 3
-Reading a token: @&t@
-Next token is token "number" (4)
-Shifting token "number" (4)
-Entering state 2
-
-Stack now 0 7 9 17 3 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (4)
--> $$ = nterm exp (4)
-Entering state 12
-
-Stack now 0 7 9 17 3 12
-Reading a token: @&t@
-Next token is token '\n' (4)
-Reducing stack by rule 12 , @&t@
-   $1 = token '-' (3)
-   $2 = nterm exp (4)
--> $$ = nterm exp (-4)
-Entering state 26
-
-Stack now 0 7 9 17 26
-Next token is token '\n' (4)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (-4)
-   $2 = token '=' (3)
-   $3 = nterm exp (-4)
--> $$ = nterm exp (-4)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '\n' (4)
-Shifting token '\n' (4)
-Entering state 23
-
-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (-4)
-   $2 = token '\n' (4)
--> $$ = nterm line (-4)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (-4)
--> $$ = nterm input (7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
-Next token is token "number" (1)
-Shifting token "number" (1)
-Entering state 2
-
-Stack now 0 7 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (1)
--> $$ = nterm exp (1)
-Entering state 9
-
-Stack now 0 7 9
-Reading a token: @&t@
-Next token is token '-' (1)
-Shifting token '-' (1)
-Entering state 18
-
-Stack now 0 7 9 18
-Reading a token: @&t@
-Next token is token '(' (1)
-Shifting token '(' (1)
-Entering state 5
-
-Stack now 0 7 9 18 5
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
-Stack now 0 7 9 18 5 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 14
-
-Stack now 0 7 9 18 5 14
-Reading a token: @&t@
-Next token is token '-' (2)
-Shifting token '-' (2)
-Entering state 18
-
-Stack now 0 7 9 18 5 14 18
-Reading a token: @&t@
-Next token is token "number" (3)
-Shifting token "number" (3)
-Entering state 2
-
-Stack now 0 7 9 18 5 14 18 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (3)
--> $$ = nterm exp (3)
-Entering state 27
-
-Stack now 0 7 9 18 5 14 18 27
-Reading a token: @&t@
-Next token is token ')' (3)
-Reducing stack by rule 9 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '-' (2)
-   $3 = nterm exp (3)
--> $$ = nterm exp (-1)
-Entering state 14
-
-Stack now 0 7 9 18 5 14
-Next token is token ')' (3)
-Shifting token ')' (3)
-Entering state 25
-
-Stack now 0 7 9 18 5 14 25
-Reducing stack by rule 14 , @&t@
-   $1 = token '(' (1)
-   $2 = nterm exp (-1)
-   $3 = token ')' (3)
--> $$ = nterm exp (-1)
-Entering state 27
-
-Stack now 0 7 9 18 27
-Reading a token: @&t@
-Next token is token '=' (3)
-Reducing stack by rule 9 , @&t@
-   $1 = nterm exp (1)
-   $2 = token '-' (1)
-   $3 = nterm exp (-1)
--> $$ = nterm exp (2)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '=' (3)
-Shifting token '=' (3)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
-Stack now 0 7 9 17 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 26
-
-Stack now 0 7 9 17 26
-Reading a token: @&t@
-Next token is token '\n' (2)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '=' (3)
-   $3 = nterm exp (2)
--> $$ = nterm exp (2)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '\n' (2)
-Shifting token '\n' (2)
-Entering state 23
-
-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '\n' (2)
--> $$ = nterm line (2)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (2)
--> $$ = nterm input (7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
-Next token is token '\n' (2)
-Shifting token '\n' (2)
-Entering state 4
-
-Stack now 0 7 4
-Reducing stack by rule 3 , @&t@
-   $1 = token '\n' (2)
--> $$ = nterm line (2)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (2)
--> $$ = nterm input (7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
-Stack now 0 7 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 9
-
-Stack now 0 7 9
-Reading a token: @&t@
-Next token is token '^' (2)
-Shifting token '^' (2)
-Entering state 22
-
-Stack now 0 7 9 22
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
-Stack now 0 7 9 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 31
-
-Stack now 0 7 9 22 31
-Reading a token: @&t@
-Next token is token '^' (2)
-Shifting token '^' (2)
-Entering state 22
-
-Stack now 0 7 9 22 31 22
-Reading a token: @&t@
-Next token is token "number" (3)
-Shifting token "number" (3)
-Entering state 2
-
-Stack now 0 7 9 22 31 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (3)
--> $$ = nterm exp (3)
-Entering state 31
-
-Stack now 0 7 9 22 31 22 31
-Reading a token: @&t@
-Next token is token '=' (3)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '^' (2)
-   $3 = nterm exp (3)
--> $$ = nterm exp (8)
-Entering state 31
-
-Stack now 0 7 9 22 31
-Next token is token '=' (3)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '^' (2)
-   $3 = nterm exp (8)
--> $$ = nterm exp (256)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '=' (3)
-Shifting token '=' (3)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token "number" (256)
-Shifting token "number" (256)
-Entering state 2
-
-Stack now 0 7 9 17 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (256)
--> $$ = nterm exp (256)
-Entering state 26
-
-Stack now 0 7 9 17 26
-Reading a token: @&t@
-Next token is token '\n' (256)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (256)
-   $2 = token '=' (3)
-   $3 = nterm exp (256)
--> $$ = nterm exp (256)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '\n' (256)
-Shifting token '\n' (256)
-Entering state 23
-
-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (256)
-   $2 = token '\n' (256)
--> $$ = nterm line (256)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (256)
--> $$ = nterm input (7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
-Next token is token '(' (256)
-Shifting token '(' (256)
-Entering state 5
-
-Stack now 0 7 5
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
-Stack now 0 7 5 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 14
-
-Stack now 0 7 5 14
-Reading a token: @&t@
-Next token is token '^' (2)
-Shifting token '^' (2)
-Entering state 22
-
-Stack now 0 7 5 14 22
-Reading a token: @&t@
-Next token is token "number" (2)
-Shifting token "number" (2)
-Entering state 2
-
-Stack now 0 7 5 14 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (2)
--> $$ = nterm exp (2)
-Entering state 31
-
-Stack now 0 7 5 14 22 31
-Reading a token: @&t@
-Next token is token ')' (2)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (2)
-   $2 = token '^' (2)
-   $3 = nterm exp (2)
--> $$ = nterm exp (4)
-Entering state 14
-
-Stack now 0 7 5 14
-Next token is token ')' (2)
-Shifting token ')' (2)
-Entering state 25
-
-Stack now 0 7 5 14 25
-Reducing stack by rule 14 , @&t@
-   $1 = token '(' (256)
-   $2 = nterm exp (4)
-   $3 = token ')' (2)
--> $$ = nterm exp (4)
-Entering state 9
-
-Stack now 0 7 9
-Reading a token: @&t@
-Next token is token '^' (2)
-Shifting token '^' (2)
-Entering state 22
-
-Stack now 0 7 9 22
-Reading a token: @&t@
-Next token is token "number" (3)
-Shifting token "number" (3)
-Entering state 2
-
-Stack now 0 7 9 22 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (3)
--> $$ = nterm exp (3)
-Entering state 31
-
-Stack now 0 7 9 22 31
-Reading a token: @&t@
-Next token is token '=' (3)
-Reducing stack by rule 13 , @&t@
-   $1 = nterm exp (4)
-   $2 = token '^' (2)
-   $3 = nterm exp (3)
--> $$ = nterm exp (64)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '=' (3)
-Shifting token '=' (3)
-Entering state 17
-
-Stack now 0 7 9 17
-Reading a token: @&t@
-Next token is token "number" (64)
-Shifting token "number" (64)
-Entering state 2
-
-Stack now 0 7 9 17 2
-Reducing stack by rule 6 , @&t@
-   $1 = token "number" (64)
--> $$ = nterm exp (64)
-Entering state 26
-
-Stack now 0 7 9 17 26
-Reading a token: @&t@
-Next token is token '\n' (64)
-Reducing stack by rule 7 , @&t@
-   $1 = nterm exp (64)
-   $2 = token '=' (3)
-   $3 = nterm exp (64)
--> $$ = nterm exp (64)
-Entering state 9
-
-Stack now 0 7 9
-Next token is token '\n' (64)
-Shifting token '\n' (64)
-Entering state 23
-
-Stack now 0 7 9 23
-Reducing stack by rule 4 , @&t@
-   $1 = nterm exp (64)
-   $2 = token '\n' (64)
--> $$ = nterm line (64)
-Entering state 16
-
-Stack now 0 7 16
-Reducing stack by rule 2 , @&t@
-   $1 = nterm input (7)
-   $2 = nterm line (64)
--> $$ = nterm input (7)
-Entering state 7
-
-Stack now 0 7
-Reading a token: @&t@
-Now at end of input.
-
-Shifting token $end (64)
-Entering state 15
-
-Stack now 0 7 15
-]])
-
-AT_BISON_CHECK([PUSHPULLFLAGS [-o Calc.java Calc.y]])
-AT_JAVA_COMPILE([[Calc.java]])
-# Verify that this is a push parser
-AT_CHECK_JAVA_GREP([[Calc.java]],[[.*public void push_parse_initialize().*]])
-# Capture the output so we can edit out the (line nnnn) occurrences
-AT_JAVA_PARSER_CHECK([Calc input], 0, [], [stderr-nolog])
-AT_CHECK([[sed -e 's/(line[ ][0-9][0-9]*)[,]/,/' stderr]],[ignore],[expout])
-AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 7f56578..71aa02a 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -1 +1,79 @@
+# Test suite for GNU Bison.                             -*- Autotest -*-
+
+# Copyright (C) 2000-2004, 2006-2007, 2009-2013 Free Software
+# Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+# Testing resistance to user bugs.
+m4_include([input.at])
+
+# Testing named references.
+m4_include([named-refs.at])
+
+# Testing output file names.
+m4_include([output.at])
+
+# Testing skeleton support.
+m4_include([skeletons.at])
+
+# Testing the part of the engine that computes FOLLOW etc.
+m4_include([sets.at])
+
+# Testing grammar reduction.
+m4_include([reduce.at])
+
+# Testing conflicts detection and resolution.
+m4_include([conflicts.at])
+
+# Testing that #lines are correct.
+m4_include([synclines.at])
+
+# Testing that headers are sane.
+m4_include([headers.at])
+
+# Testing that user actions are properly performed.
+m4_include([actions.at])
+
+# Fulling testing (compilation and execution of the parser) on calc.
+m4_include([calc.at])
+
+# Huge artificial grammars.
+# Torturing the stack expansion at runtime.
+m4_include([torture.at])
+
+# Checking big, real world grammars.
+m4_include([existing.at])
+
+# Some old bugs.
+m4_include([regression.at])
+
+# Some C++ specific tests.
+m4_include([c++.at])
+
+# And some Java specific tests.
+m4_include([java.at])
+
+# GLR tests:
+# C++ types, simplified
+m4_include([cxx-type.at])
+# Regression tests
+m4_include([glr-regression.at])
+
+# Push parsing specific tests.
+m4_include([push.at])
+
+# Java push parsing specific tests.
 m4_include([javapush.at])
--
1.7.4.4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]