[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: push parser
From: |
Joel E. Denny |
Subject: |
Re: push parser |
Date: |
Mon, 1 Jan 2007 21:12:08 -0500 (EST) |
On Sun, 31 Dec 2006, Bob Rossi wrote:
> > As far as I can tell, it's time to mv push.c yacc.c. However, that's a
> > major change that I should not make without some consensus.
> >
> > Once we do that, I think we should add a new maintainer-check pass that
> > forces yacc.c to run in that special push mode that emulates pull mode.
> > (That pass should probably use Valgrind also.) Otherwise, we'll have to
> > keep setting up that mode manually in the way I've previously described:
>
> Yeah, automating it sounds right to me too. If it's going to be a long
> time before push.c replaces yacc.c, I would think we should automate it
> right away.
Might as well, so I committed the following. Notice that
maintainer-push-check is not invoked by maintainer-check. Instead, it's a
separate version of maintainer-check.
Index: ChangeLog
===================================================================
RCS file: /sources/bison/bison/ChangeLog,v
retrieving revision 1.1641
diff -p -u -r1.1641 ChangeLog
--- ChangeLog 1 Jan 2007 00:42:21 -0000 1.1641
+++ ChangeLog 2 Jan 2007 02:03:55 -0000
@@ -1,3 +1,19 @@
+2007-01-01 Joel E. Denny <address@hidden>
+
+ Add maintainer-push-check to run maintainer-check using push parsing in
+ place of pull parsing where available.
+ * Makefile.am (maintainer-push-check): New.
+ * data/bison.m4 (b4_use_push_for_pull_if): New.
+ * data/push.c: Redefine b4_push_if and b4_use_push_for_pull_if
+ appropriately based on their existing values.
+ (yypush_parse): Don't print push-parser-specific diagnostics if push
+ parsing is being used in place of pull parsing.
+ * data/yacc.c: If push parsing should replace pull parsing, redirect to
+ push.c.
+ * src/output.c (prepare): Check BISON_USE_PUSH_FOR_PULL environment
+ variable, and insert b4_use_push_for_pull_flag into muscles.
+ * tests/Makefile.am (maintainer-push-check): New.
+
2006-12-31 Joel E. Denny <address@hidden>
* data/push.c (yypush_parse): Set yynew = 1 at the end of a parse
Index: Makefile.am
===================================================================
RCS file: /sources/bison/bison/Makefile.am,v
retrieving revision 1.45
diff -p -u -r1.45 Makefile.am
--- Makefile.am 26 Dec 2006 18:09:53 -0000 1.45
+++ Makefile.am 2 Jan 2007 02:03:55 -0000
@@ -1,5 +1,6 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
-## Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 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
@@ -35,3 +36,7 @@ EXTRA_DIST = GNUmakefile Makefile.cfg Ma
.PHONY: maintainer-check
maintainer-check:
cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
+
+.PHONY: maintainer-push-check
+maintainer-push-check:
+ cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
Index: data/bison.m4
===================================================================
RCS file: /sources/bison/bison/data/bison.m4,v
retrieving revision 1.3
diff -p -u -r1.3 bison.m4
--- data/bison.m4 31 Dec 2006 20:29:48 -0000 1.3
+++ data/bison.m4 2 Jan 2007 02:03:55 -0000
@@ -1,7 +1,7 @@
m4_divert(-1) -*- Autoconf -*-
# Language-independent M4 Macros for Bison.
-# Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2005, 2006, 2007 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
@@ -130,6 +130,10 @@ b4_define_flag_if([nondeterministic]) #
b4_define_flag_if([pull]) # Whether pull parsing is requested.
b4_define_flag_if([pure]) # Whether the interface is pure.
b4_define_flag_if([push]) # Whether push parsing is requested.
+b4_define_flag_if([use_push_for_pull]) # Whether push parsing should be used
+ # in place of pull parsing (where
+ # available) for the sake of the test
+ # suite.
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
Index: data/push.c
===================================================================
RCS file: /sources/bison/bison/data/push.c,v
retrieving revision 1.28
diff -p -u -r1.28 push.c
--- data/push.c 1 Jan 2007 00:42:21 -0000 1.28
+++ data/push.c 2 Jan 2007 02:03:55 -0000
@@ -2,8 +2,8 @@ m4_divert(-1)
# Yacc compatible skeleton for Bison
-# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-# Free Software Foundation, Inc.
+# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+# 2007 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
@@ -20,6 +20,18 @@ m4_divert(-1)
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
+# Handle BISON_USE_PUSH_FOR_PULL for the test suite. So that push parsing
+# tests function as written, don't let BISON_USE_PUSH_FOR_PULL modify Bison's
+# behavior at all when push parsing is already requested.
+b4_use_push_for_pull_if([
+ b4_push_if([
+ m4_define([b4_use_push_for_pull_flag], [[0]])
+ b4_define_flag_if([use_push_for_pull])
+ ], [
+ m4_define([b4_push_flag], [[1]])
+ b4_define_flag_if([push])
+ ])])
+
m4_include(b4_pkgdatadir/[c.m4])
## ---------------- ##
@@ -1317,8 +1329,9 @@ yybackup:
{
]b4_push_if([[ if (!yyps->yynew)
{
- YYDPRINTF ((stderr, "Return for a new token:\n"));
- yyresult = YYPUSH_MORE;
+]b4_use_push_for_pull_if([],
+[[ YYDPRINTF ((stderr, "Return for a new token:\n"));
+]])[ yyresult = YYPUSH_MORE;
goto yypushreturn;
}
yyps->yynew = 0;
Index: data/yacc.c
===================================================================
RCS file: /sources/bison/bison/data/yacc.c,v
retrieving revision 1.156
diff -p -u -r1.156 yacc.c
--- data/yacc.c 12 Dec 2006 06:47:39 -0000 1.156
+++ data/yacc.c 2 Jan 2007 02:03:55 -0000
@@ -2,8 +2,8 @@ m4_divert(-1)
# Yacc compatible skeleton for Bison
-# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-# Free Software Foundation, Inc.
+# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+# 2007 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
@@ -20,6 +20,9 @@ m4_divert(-1)
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
+# Handle BISON_USE_PUSH_FOR_PULL for the test suite.
+b4_use_push_for_pull_if([m4_include(b4_pkgdatadir/[push.c])m4_exit])
+
m4_include(b4_pkgdatadir/[c.m4])
## ---------------- ##
Index: src/output.c
===================================================================
RCS file: /sources/bison/bison/src/output.c,v
retrieving revision 1.262
diff -p -u -r1.262 output.c
--- src/output.c 31 Dec 2006 20:29:48 -0000 1.262
+++ src/output.c 2 Jan 2007 02:03:55 -0000
@@ -1,7 +1,7 @@
/* Output the generated parsing program for Bison.
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006 Free Software Foundation, Inc.
+ 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -586,6 +586,15 @@ output_skeleton (void)
static void
prepare (void)
{
+ /* BISON_USE_PUSH_FOR_PULL is for the test suite and should not be documented
+ for the user. */
+ char const *use_push_for_pull_env = getenv ("BISON_USE_PUSH_FOR_PULL");
+ bool use_push_for_pull_flag = false;
+ if (use_push_for_pull_env != NULL
+ && use_push_for_pull_env[0] != '\0'
+ && 0 != strcmp (use_push_for_pull_env, "0"))
+ use_push_for_pull_flag = true;
+
/* Flags. */
MUSCLE_INSERT_BOOL ("debug_flag", debug_flag);
MUSCLE_INSERT_BOOL ("defines_flag", defines_flag);
@@ -595,6 +604,7 @@ prepare (void)
MUSCLE_INSERT_BOOL ("nondeterministic_flag", nondeterministic_parser);
MUSCLE_INSERT_BOOL ("pull_flag", pull_parser);
MUSCLE_INSERT_BOOL ("pure_flag", pure_parser);
+ MUSCLE_INSERT_BOOL ("use_push_for_pull_flag", use_push_for_pull_flag);
MUSCLE_INSERT_BOOL ("push_flag", push_parser);
MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag);
MUSCLE_INSERT_BOOL ("tag_seen_flag", tag_seen);
Index: tests/Makefile.am
===================================================================
RCS file: /sources/bison/bison/tests/Makefile.am,v
retrieving revision 1.43
diff -p -u -r1.43 Makefile.am
--- tests/Makefile.am 8 Nov 2006 20:28:57 -0000 1.43
+++ tests/Makefile.am 2 Jan 2007 02:03:55 -0000
@@ -2,7 +2,7 @@
## Makefile for Bison testsuite.
-## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
+## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
## Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
@@ -93,3 +93,7 @@ maintainer-check-valgrind: $(TESTSUITE)
.PHONY: maintainer-check
maintainer-check: maintainer-check-posix maintainer-check-valgrind
maintainer-check-g++
+
+.PHONY: maintainer-push-check
+maintainer-push-check:
+ BISON_USE_PUSH_FOR_PULL=1 $(MAKE) $(AM_MAKEFLAGS) maintainer-check
- Re: push parser,
Joel E. Denny <=