bison-patches
[Top][All Lists]
Advanced

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

[PATCH 03/13] traces: don't print the stack before the gotos


From: Akim Demaille
Subject: [PATCH 03/13] traces: don't print the stack before the gotos
Date: Wed, 5 Feb 2020 18:04:55 +0100

The C, C++ and D skeletons used to show the stack right after popping
the stack during the reduction.  Now that the stack is printed after
reaching a new state, that has become useless:

    Entering state 1
    Stack now 0 1
    Reducing stack by rule 5 (line 83):
       $1 = token "number" (1)
    -> $$ = nterm exp (1)
    Stack now 0
    Entering state 8
    Stack now 0 8

Remove the "Stack now 0" line.

* data/skeletons/lalr1.cc, data/skeletons/lalr1.d,
* data/skeletons/lalr1.java, data/skeletons/yacc.c:
Here.
---
 data/skeletons/lalr1.cc   | 1 -
 data/skeletons/lalr1.d    | 3 ---
 data/skeletons/lalr1.java | 1 -
 data/skeletons/yacc.c     | 1 -
 tests/actions.at          | 5 -----
 tests/c++.at              | 3 ---
 tests/calc.at             | 2 +-
 tests/regression.at       | 1 -
 8 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc
index 7e080ec0..35dedce9 100644
--- a/data/skeletons/lalr1.cc
+++ b/data/skeletons/lalr1.cc
@@ -993,7 +993,6 @@ b4_dollar_popdef])[]dnl
       YY_SYMBOL_PRINT ("-> $$ =", yylhs);
       yypop_ (yylen);
       yylen = 0;
-      YY_STACK_PRINT ();
 
       // Shift the result of the reduction.
       yypush_ (YY_NULLPTR, YY_MOVE (yylhs));
diff --git a/data/skeletons/lalr1.d b/data/skeletons/lalr1.d
index 1b4fda0e..cb1dc4ca 100644
--- a/data/skeletons/lalr1.d
+++ b/data/skeletons/lalr1.d
@@ -344,9 +344,6 @@ b4_user_union_members
 
     yystack.pop (yylen);
     yylen = 0;
-]b4_parse_trace_if([[
-    if (0 < yydebug)
-      yystack.print (yyDebugStream);]])[
 
     /* Shift the result of the reduction.  */
     yyn = yyr1_[yyn];
diff --git a/data/skeletons/lalr1.java b/data/skeletons/lalr1.java
index b28e7bbd..7f5e4a1a 100644
--- a/data/skeletons/lalr1.java
+++ b/data/skeletons/lalr1.java
@@ -482,7 +482,6 @@ m4_define([b4_define_state],[[
 
     yystack.pop (yylen);
     yylen = 0;
-
     /* Shift the result of the reduction.  */
     int yystate = yyLRGotoState (yystack.stateAt (0), yyr1_[yyn]);
     yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index 72e6cd47..8883a987 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -1823,7 +1823,6 @@ yyreduce:
 
   YYPOPSTACK (yylen);
   yylen = 0;
-  YY_STACK_PRINT (yyss, yyssp);
 
   *++yyvsp = yyval;]b4_locations_if([
   *++yylsp = yyloc;])[
diff --git a/tests/actions.at b/tests/actions.at
index a5796e5d..b7ad64ca 100644
--- a/tests/actions.at
+++ b/tests/actions.at
@@ -1385,7 +1385,6 @@ Entering state 0
 Stack now 0
 Reducing stack by rule 1 (line 49):
 -> $$ = nterm start (1.1: <]]kind[[> for 'S' @ 1)
-Stack now 0
 Entering state 1
 Stack now 0 1
 Reading a token
@@ -1649,22 +1648,18 @@ Entering state 0
 Stack now 0
 Reducing stack by rule 1 (line 30):
 -> $$ = nterm $@1 (: )
-Stack now 0
 Entering state 2
 Stack now 0 2
 Reducing stack by rule 2 (line 31):
 -> $$ = nterm @2 (: 2)
-Stack now 0 2
 Entering state 4
 Stack now 0 2 4
 Reducing stack by rule 3 (line 32):
 -> $$ = nterm @3 (: 3)
-Stack now 0 2 4
 Entering state 5
 Stack now 0 2 4 5
 Reducing stack by rule 4 (line 33):
 -> $$ = nterm @4 (: 4)
-Stack now 0 2 4 5
 Entering state 6
 Stack now 0 2 4 5 6
 Reading a token
diff --git a/tests/c++.at b/tests/c++.at
index c87adc1e..848a977d 100644
--- a/tests/c++.at
+++ b/tests/c++.at
@@ -658,14 +658,12 @@ Reducing stack by rule 1 (line 34):
    $1 = token NUMBER (1)
 -> $$ = nterm expr (10)
 destroy: 1
-Stack now 0
 Entering state 2
 Stack now 0 2
 Reading a token
 Next token is token NUMBER (30)
 Reducing stack by rule 2 (line 35):
 -> $$ = nterm @1 (20)
-Stack now 0 2
 Entering state 4
 Stack now 0 2 4
 Next token is token NUMBER (30)
@@ -681,7 +679,6 @@ expr: 10 20 30
 destroy: 30
 destroy: 20
 destroy: 10
-Stack now 0
 Entering state 2
 Stack now 0 2
 Reading a token
diff --git a/tests/calc.at b/tests/calc.at
index c46cccdc..78a701e2 100644
--- a/tests/calc.at
+++ b/tests/calc.at
@@ -922,7 +922,7 @@ _AT_CHECK_CALC([$1],
 2^2^3 = 256
 (2^2)^3 = 64],
 [[final: 64 12 0]],
-               [1111])
+               [1017])
 
 # Some syntax errors.
 _AT_CHECK_CALC_ERROR([$1], [1], [1 2],
diff --git a/tests/regression.at b/tests/regression.at
index 240f33ae..d7d3e0de 100644
--- a/tests/regression.at
+++ b/tests/regression.at
@@ -963,7 +963,6 @@ Entering state 0
 Stack now 0
 Reducing stack by rule 1 (line 20):
 -> $$ = nterm start ()
-Stack now 0
 Entering state 1
 Stack now 0 1
 Reading a token
-- 
2.25.0




reply via email to

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