From MAILER-DAEMON Sat Apr 01 14:43:24 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FPm0K-0004XI-0n for mharc-bison-patches@gnu.org; Sat, 01 Apr 2006 14:43:24 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FPm0I-0004X5-J8 for bison-patches@gnu.org; Sat, 01 Apr 2006 14:43:22 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FPm0G-0004Wt-Lo for bison-patches@gnu.org; Sat, 01 Apr 2006 14:43:22 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FPm0G-0004Wq-G7 for bison-patches@gnu.org; Sat, 01 Apr 2006 14:43:20 -0500 Received: from [68.230.240.34] (helo=eastrmmtao05.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FPm2w-0007vu-Ix for bison-patches@gnu.org; Sat, 01 Apr 2006 14:46:06 -0500 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao05.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060401194314.DRPB3108.eastrmmtao05.cox.net@localhost.localdomain>; Sat, 1 Apr 2006 14:43:14 -0500 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FPm0L-0006vG-JD; Sat, 01 Apr 2006 14:43:25 -0500 Date: Sat, 1 Apr 2006 14:43:25 -0500 From: Bob Rossi To: Paul Eggert , "Joel E. Denny" , Bison Patches Message-ID: <20060401194325.GQ25300@brasko.net> Mail-Followup-To: Paul Eggert , "Joel E. Denny" , Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060324162737.GA28001@brasko.net> <874q1n3eoj.fsf@penguin.cs.ucla.edu> <20060326140133.GA9044@brasko.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060326140133.GA9044@brasko.net> User-Agent: Mutt/1.5.9i Cc: Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Apr 2006 19:43:22 -0000 On Sun, Mar 26, 2006 at 09:01:33AM -0500, Bob Rossi wrote: > On Fri, Mar 24, 2006 at 10:01:16AM -0800, Paul Eggert wrote: > > "Joel E. Denny" writes: > > > > > Sorry for the silence on our part. I think everyone must be very busy. > > > > Yup. I'll have some more time next week, I think. > > > > > On top of that, there seems to be some delay on completing 2.2, > > > > This is more a licensing issue. I guess we'll have to ship 2.2 with > > the old license. > > > > (Personally I'd trust your or Akim's review over mine. :-) > > Thanks for the responds everyone. I know these things take time, I just > wanted to make sure I wasn't being swept under the rug. > > I do see one problem while testing the parser after the patch. Some of > my actions are not being reached, which makes me think I've corrupted > the parser. Basically, this is the first action that is hit, > opt_oob_record_list: { > $$ = NULL; > }; > Any idea what could cause this? I'll do some more digging. OK, I've fixed the problem, and it had nothing to do with the patch. I simply didn't call yyparse () one last time when the input was done. Along with this Email is the Two week ping. :) Again, this doesn't have to be a final patch review, I'd like suggestions on how to finish my work. The main things are this, 1. Adding the %push-parser option 2. struct yypvars and yypvarsinit Adding the struct yypvars that contains all the data needed to do the parse. yypvarsinit is a user visible function that inits the struct. Is another interface preferable to do this? Does the struct field members slow the parser down? Should I add a yypvarsdestroy? or just let the user do a free () 3. yychar, yylval, yynerrs, and yylloc (external parser variables) These variables remain external in the default parser. However, in the pure and push parser they go in the struct yypvars. 4. User visibility into the struct yypvars. There are 4 variables that users traditionally use. Should we have set/get functions to access them? Any other suggestions? Odd's implementation had a unique integer in the struct representing what parser struct this is. Should we also add that functionality or leave it to the client to do? Again, Odd's parser has a second struct with the user visible fields. I thought that approach was a little more confusing to the user, so combined the data into 1 structure. 5. Test suite. What should I do to modify the test suite? 6. Documentation New chapter? Here is what the interface looks like from the user's perspective int main (void) { void *ctx = yypvarsinit (); FILE *fp; int val = 1; fp= fopen("1.dat", "r"); yyparse (ctx); do { if(val != 0) set_yychar (ctx, yylex(fp)); yyparse(ctx); val = get_yyresult (ctx); if(val == 1) fprintf(stderr,"\nSyntax error"); } while (val!=0); fclose(fp); fprintf(stderr, "\n"); return 0; } It's important to realize that yyparse needs to be called once to init the parser. It also needs to be called once after calling set_yychar (ctx, 0). Any suggestions? ideas? Thanks, Bob Rossi From MAILER-DAEMON Sun Apr 02 09:11:06 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FQ2ME-0000rA-4L for mharc-bison-patches@gnu.org; Sun, 02 Apr 2006 09:11:06 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FQ2MD-0000pr-54 for bison-patches@gnu.org; Sun, 02 Apr 2006 09:11:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FQ2MA-0000lg-L2 for bison-patches@gnu.org; Sun, 02 Apr 2006 09:11:04 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FQ2MA-0000lW-HV for bison-patches@gnu.org; Sun, 02 Apr 2006 09:11:02 -0400 Received: from [68.230.240.37] (helo=eastrmmtao02.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FQ2P0-0003zP-Qv for bison-patches@gnu.org; Sun, 02 Apr 2006 09:13:59 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao02.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060402131059.XYFW14821.eastrmmtao02.cox.net@localhost.localdomain>; Sun, 2 Apr 2006 09:10:59 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FQ2M9-0005mk-Iv; Sun, 02 Apr 2006 09:11:01 -0400 Date: Sun, 2 Apr 2006 09:11:01 -0400 From: Bob Rossi To: Paul Eggert , "Joel E. Denny" , Bison Patches Message-ID: <20060402131101.GA10068@brasko.net> Mail-Followup-To: Paul Eggert , "Joel E. Denny" , Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060324162737.GA28001@brasko.net> <874q1n3eoj.fsf@penguin.cs.ucla.edu> <20060326140133.GA9044@brasko.net> <20060401194325.GQ25300@brasko.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060401194325.GQ25300@brasko.net> User-Agent: Mutt/1.5.9i Cc: Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Apr 2006 13:11:05 -0000 > Here is what the interface looks like from the user's perspective > > int > main (void) > { > void *ctx = yypvarsinit (); > FILE *fp; > int val = 1; > fp= fopen("1.dat", "r"); > yyparse (ctx); > do { > if(val != 0) > set_yychar (ctx, yylex(fp)); > yyparse(ctx); > val = get_yyresult (ctx); > if(val == 1) > fprintf(stderr,"\nSyntax error"); > } while (val!=0); > fclose(fp); > > fprintf(stderr, "\n"); > return 0; > } > > It's important to realize that yyparse needs to be called once to init > the parser. Hmm, I think this isn't necessary. I just thought it was. The yyparse (ctx) call is not necessary before the 'do {' line. Bob Rossi From MAILER-DAEMON Sun Apr 02 23:48:52 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FQG3f-0004ki-Td for mharc-bison-patches@gnu.org; Sun, 02 Apr 2006 23:48:51 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FQG3d-0004kU-D5 for bison-patches@gnu.org; Sun, 02 Apr 2006 23:48:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FQG3b-0004kI-H2 for bison-patches@gnu.org; Sun, 02 Apr 2006 23:48:48 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FQG3b-0004kF-C6 for bison-patches@gnu.org; Sun, 02 Apr 2006 23:48:47 -0400 Received: from [68.230.240.34] (helo=eastrmmtao05.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FQFgi-0004Hr-DU for bison-patches@gnu.org; Sun, 02 Apr 2006 23:25:08 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao05.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060403032147.YVTG3108.eastrmmtao05.cox.net@localhost.localdomain>; Sun, 2 Apr 2006 23:21:47 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FQFdW-0000Jr-7q; Sun, 02 Apr 2006 23:21:50 -0400 Date: Sun, 2 Apr 2006 23:21:50 -0400 From: Bob Rossi To: Paul Eggert Message-ID: <20060403032150.GB10068@brasko.net> Mail-Followup-To: Paul Eggert , Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060320232837.GA27369@brasko.net> <878xr4qp0q.fsf@penguin.cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <878xr4qp0q.fsf@penguin.cs.ucla.edu> User-Agent: Mutt/1.5.9i Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Apr 2006 03:48:50 -0000 On Mon, Mar 20, 2006 at 10:40:21PM -0800, Paul Eggert wrote: > Bob Rossi writes: > > > Hmmm, is everyone busy? > > I am; dunno about the other maintainers. Big patches take time to > digest, and personally I probably won't have time to look at it for a > while. > > Have you had anyone else besides you look at it? What was their > reaction? I suppose I should have answered this sooner. However, no, no one else has looked at it, and I don't think anyone will. Bob Rossi From MAILER-DAEMON Mon Apr 03 09:54:39 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FQPVu-0003EK-RJ for mharc-bison-patches@gnu.org; Mon, 03 Apr 2006 09:54:38 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FQPVt-0003De-4o for bison-patches@gnu.org; Mon, 03 Apr 2006 09:54:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FQPVr-0003Cm-FS for bison-patches@gnu.org; Mon, 03 Apr 2006 09:54:36 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FQPVr-0003Cg-Ai for bison-patches@gnu.org; Mon, 03 Apr 2006 09:54:35 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FQPYv-0004qz-LY for bison-patches@gnu.org; Mon, 03 Apr 2006 09:57:45 -0400 Received: from nostromo.lrde.epita.fr ([192.168.101.52]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FQPVp-0001Eo-Mj for bison-patches@gnu.org; Mon, 03 Apr 2006 15:54:33 +0200 From: Akim Demaille Newsgroups: epita.cours.compile Cc: Bison Patches References: Date: Mon, 03 Apr 2006 15:54:32 +0200 Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:cg88XuTIlxPyqMjeu+gIJnVR6kA= In-Reply-To: (Akim Demaille's message of "Mon, 03 Apr 2006 15:51:49 +0200") MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Posted-To: epita.cours.compile Subject: Re: FYI: {...} without actions X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Apr 2006 13:54:37 -0000 The following message is a courtesy copy of an article that has been posted to epita.cours.compile as well. I forgot the CC, sorry for the duplicate. Index: ChangeLog from Akim Demaille * src/scan-gram.l: Be robust to BRACED_CODE appearing before any rule. Reported by Mickael Labau. * tests/input.at (Torturing the Scanner): Test it. Index: THANKS =================================================================== RCS file: /cvsroot/bison/bison/THANKS,v retrieving revision 1.62 diff -u -r1.62 THANKS --- THANKS 13 Oct 2005 10:13:23 -0000 1.62 +++ THANKS 3 Apr 2006 13:49:50 -0000 @@ -45,6 +45,7 @@ Matt Kraai kraai@alumni.cmu.edu Matt Rosing rosing@peakfive.com Michael Hayes m.hayes@elec.canterbury.ac.nz +Mickael Labau labau_m@epita.fr Mike Castle dalgoda@ix.netcom.com Neil Booth NeilB@earthling.net Nelson H. F. Beebe beebe@math.utah.edu Index: src/scan-gram.l =================================================================== RCS file: /cvsroot/bison/bison/src/scan-gram.l,v retrieving revision 1.85 diff -u -r1.85 scan-gram.l --- src/scan-gram.l 30 Jan 2006 07:25:59 -0000 1.85 +++ src/scan-gram.l 3 Apr 2006 13:49:50 -0000 @@ -292,7 +292,7 @@ /* Code in between braces. */ "{" { - if (current_rule->action) + if (current_rule && current_rule->action) grammar_midrule_action (); STRING_GROW; token_type = BRACED_CODE; Index: tests/input.at =================================================================== RCS file: /cvsroot/bison/bison/tests/input.at,v retrieving revision 1.42 diff -u -r1.42 input.at --- tests/input.at 30 Jan 2006 09:00:40 -0000 1.42 +++ tests/input.at 3 Apr 2006 13:49:51 -0000 @@ -204,6 +204,14 @@ ]]) +AT_DATA([input.y], +[{} +]) +AT_CHECK([bison input.y], [1], [], +[[input.y:1.1-2: syntax error, unexpected {...} +]]) + + AT_DATA_GRAMMAR([input.y], [[%{ /* This is seen in GCC: a %{ and %} in middle of a comment. */ From MAILER-DAEMON Tue Apr 04 20:48:26 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FQwCA-0007Qz-EJ for mharc-bison-patches@gnu.org; Tue, 04 Apr 2006 20:48:26 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FQwC8-0007QH-ND for bison-patches@gnu.org; Tue, 04 Apr 2006 20:48:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FQwC8-0007Px-3u for bison-patches@gnu.org; Tue, 04 Apr 2006 20:48:24 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FQwC7-0007Pt-UA for bison-patches@gnu.org; Tue, 04 Apr 2006 20:48:23 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FQwFW-0005ol-IY for bison-patches@gnu.org; Tue, 04 Apr 2006 20:51:54 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p2+Sun/8.11.7/UCLACS-5.2) with ESMTP id k350mM717437 for ; Tue, 4 Apr 2006 17:48:22 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1FQwC6-0007bG-Ji for bison-patches@gnu.org; Tue, 04 Apr 2006 17:48:22 -0700 To: Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060320232837.GA27369@brasko.net> <878xr4qp0q.fsf@penguin.cs.ucla.edu> <20060403032150.GB10068@brasko.net> From: Paul Eggert Date: Tue, 04 Apr 2006 17:48:22 -0700 In-Reply-To: <20060403032150.GB10068@brasko.net> (Bob Rossi's message of "Sun, 2 Apr 2006 23:21:50 -0400") Message-ID: <874q18g84p.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2006 00:48:25 -0000 Bob Rossi writes: >> Have you had anyone else besides you look at it? What was their >> reaction? > > I suppose I should have answered this sooner. However, no, no one else > has looked at it, and I don't think anyone will. Is there some way that we can fix that? For example, is there someone who needs push parsers, but doesn't yet know that they need them? From MAILER-DAEMON Tue Apr 04 21:10:14 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FQwXG-0003MV-6V for mharc-bison-patches@gnu.org; Tue, 04 Apr 2006 21:10:14 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FQwXD-0003M3-Lf for bison-patches@gnu.org; Tue, 04 Apr 2006 21:10:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FQwXB-0003Lq-Ip for bison-patches@gnu.org; Tue, 04 Apr 2006 21:10:10 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FQwXB-0003Ln-G6 for bison-patches@gnu.org; Tue, 04 Apr 2006 21:10:09 -0400 Received: from [68.230.240.37] (helo=eastrmmtao02.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FQwaa-0006vp-FX for bison-patches@gnu.org; Tue, 04 Apr 2006 21:13:40 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao02.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060405011003.JHTW14821.eastrmmtao02.cox.net@localhost.localdomain>; Tue, 4 Apr 2006 21:10:03 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FQwXB-00078b-VY; Tue, 04 Apr 2006 21:10:09 -0400 Date: Tue, 4 Apr 2006 21:10:09 -0400 From: Bob Rossi To: Paul Eggert Message-ID: <20060405011009.GA14364@brasko.net> Mail-Followup-To: Paul Eggert , Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060320232837.GA27369@brasko.net> <878xr4qp0q.fsf@penguin.cs.ucla.edu> <20060403032150.GB10068@brasko.net> <874q18g84p.fsf@penguin.cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <874q18g84p.fsf@penguin.cs.ucla.edu> User-Agent: Mutt/1.5.9i Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2006 01:10:12 -0000 On Tue, Apr 04, 2006 at 05:48:22PM -0700, Paul Eggert wrote: > Bob Rossi writes: > > >> Have you had anyone else besides you look at it? What was their > >> reaction? > > > > I suppose I should have answered this sooner. However, no, no one else > > has looked at it, and I don't think anyone will. > > Is there some way that we can fix that? For example, is there someone > who needs push parsers, but doesn't yet know that they need them? What is the goal here? Are you interested in discovering what a nice interface for a push parser would be? or are you interested in finding someone to review the patch? An example interface similar to this is here, http://www.hwaci.com/sw/lemon/lemon.html It looks like, pParser = ParseAlloc( malloc ); while( GetNextToken(pTokenizer,&hTokenId, &sToken) ) Parse(pParser, hTokenId, sToken); Parse(pParser, 0, sToken); ParseFree(pParser, free ); This is basically identical to what I've done, except I don't pass the token into the yyparse function. I call set_yychar. This is because I have 4 variables that need to be accessed by the user. Accessor functions seem perfectly reasonable to me. However, we could put the structure in the header file, and allow users to modify the contents of it. Thanks, Bob Rossi From MAILER-DAEMON Wed Apr 05 01:01:46 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FR09K-0005x5-0B for mharc-bison-patches@gnu.org; Wed, 05 Apr 2006 01:01:46 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FR09I-0005wz-7z for bison-patches@gnu.org; Wed, 05 Apr 2006 01:01:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FR09G-0005wn-Mt for bison-patches@gnu.org; Wed, 05 Apr 2006 01:01:43 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FR09G-0005wk-HT for bison-patches@gnu.org; Wed, 05 Apr 2006 01:01:42 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FR0Ch-00055X-HD for bison-patches@gnu.org; Wed, 05 Apr 2006 01:05:15 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p2+Sun/8.11.7/UCLACS-5.2) with ESMTP id k3551d705699 for ; Tue, 4 Apr 2006 22:01:39 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1FR09D-0007dt-3Y for bison-patches@gnu.org; Tue, 04 Apr 2006 22:01:39 -0700 To: Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060320232837.GA27369@brasko.net> <878xr4qp0q.fsf@penguin.cs.ucla.edu> <20060403032150.GB10068@brasko.net> <874q18g84p.fsf@penguin.cs.ucla.edu> <20060405011009.GA14364@brasko.net> From: Paul Eggert Date: Tue, 04 Apr 2006 22:01:39 -0700 In-Reply-To: <20060405011009.GA14364@brasko.net> (Bob Rossi's message of "Tue, 4 Apr 2006 21:10:09 -0400") Message-ID: <87k6a4k43w.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2006 05:01:45 -0000 Bob Rossi writes: > What is the goal here? Are you interested in discovering what a nice > interface for a push parser would be? or are you interested in finding > someone to review the patch? The latter. I want the "many eyes" syndrome to work its magic.... From MAILER-DAEMON Wed Apr 05 05:23:53 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FR4Ez-0008Dx-P0 for mharc-bison-patches@gnu.org; Wed, 05 Apr 2006 05:23:53 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FR4Ex-0008De-VB for bison-patches@gnu.org; Wed, 05 Apr 2006 05:23:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FR4Ev-0008DD-TB for bison-patches@gnu.org; Wed, 05 Apr 2006 05:23:51 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FR4Ev-0008D4-R4 for bison-patches@gnu.org; Wed, 05 Apr 2006 05:23:49 -0400 Received: from [212.247.154.225] (helo=swip.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FR4IP-0005Ly-IR for bison-patches@gnu.org; Wed, 05 Apr 2006 05:27:25 -0400 X-T2-Posting-ID: 2yF4ydxc0UI9xI7FHZPfog== X-Cloudmark-Score: 0.000000 [] Received: from 83.72.134.122.ip.tele2adsl.dk ([83.72.134.122] verified) by mailfe08.swip.net (CommuniGate Pro SMTP 5.0.8) with ESMTP id 171542633 for bison-patches@gnu.org; Wed, 05 Apr 2006 11:23:47 +0200 From: Frans Englich To: bison-patches@gnu.org Date: Wed, 5 Apr 2006 09:35:46 +0000 User-Agent: KMail/1.8.50 References: <20060317194252.GJ30980@brasko.net> <20060403032150.GB10068@brasko.net> <874q18g84p.fsf@penguin.cs.ucla.edu> In-Reply-To: <874q18g84p.fsf@penguin.cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200604050935.46601.frans.englich@telia.com> Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2006 09:23:52 -0000 On Wednesday 05 April 2006 00:48, Paul Eggert wrote: > Bob Rossi writes: [...] > Is there some way that we can fix that? For example, is there someone > who needs push parsers, but doesn't yet know that they need them? Heh, I might be one of them. I googled around a bit, but I still wonder: what advantages does this push-parser patch add to Bison? What does it do? To me it seems like it makes it possible to call the parser instead of that the parser calls you.. possibly solving problems wrt. blocking. Correct? Something else or in addition? Cheers, Frans From MAILER-DAEMON Wed Apr 05 07:23:59 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FR67D-00078R-7N for mharc-bison-patches@gnu.org; Wed, 05 Apr 2006 07:23:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FR67B-000785-NG for bison-patches@gnu.org; Wed, 05 Apr 2006 07:23:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FR679-00077t-Ot for bison-patches@gnu.org; Wed, 05 Apr 2006 07:23:57 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FR679-00077q-K0 for bison-patches@gnu.org; Wed, 05 Apr 2006 07:23:55 -0400 Received: from [68.230.240.35] (helo=eastrmmtao04.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FR6Ae-0004qs-Jd for bison-patches@gnu.org; Wed, 05 Apr 2006 07:27:32 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao04.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060405112352.KGUK19943.eastrmmtao04.cox.net@localhost.localdomain>; Wed, 5 Apr 2006 07:23:52 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FR67D-0005PZ-MA; Wed, 05 Apr 2006 07:23:59 -0400 Date: Wed, 5 Apr 2006 07:23:59 -0400 From: Bob Rossi To: Paul Eggert Message-ID: <20060405112359.GD14364@brasko.net> Mail-Followup-To: Paul Eggert , Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060320232837.GA27369@brasko.net> <878xr4qp0q.fsf@penguin.cs.ucla.edu> <20060403032150.GB10068@brasko.net> <874q18g84p.fsf@penguin.cs.ucla.edu> <20060405011009.GA14364@brasko.net> <87k6a4k43w.fsf@penguin.cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k6a4k43w.fsf@penguin.cs.ucla.edu> User-Agent: Mutt/1.5.9i Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2006 11:23:57 -0000 On Tue, Apr 04, 2006 at 10:01:39PM -0700, Paul Eggert wrote: > Bob Rossi writes: > > > What is the goal here? Are you interested in discovering what a nice > > interface for a push parser would be? or are you interested in finding > > someone to review the patch? > > The latter. I want the "many eyes" syndrome to work its magic.... OK. I'm not sure if I can find people who need this functionality. However, discussing it here could bring some interest. Bob Rossi From MAILER-DAEMON Wed Apr 05 07:31:40 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FR6Ee-0000Sy-C4 for mharc-bison-patches@gnu.org; Wed, 05 Apr 2006 07:31:40 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FR6Ed-0000Sn-HN for bison-patches@gnu.org; Wed, 05 Apr 2006 07:31:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FR6Ec-0000ST-4p for bison-patches@gnu.org; Wed, 05 Apr 2006 07:31:39 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FR6Eb-0000SQ-SR for bison-patches@gnu.org; Wed, 05 Apr 2006 07:31:37 -0400 Received: from [68.230.240.37] (helo=eastrmmtao02.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FR6I6-0005Mk-Tx for bison-patches@gnu.org; Wed, 05 Apr 2006 07:35:15 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao02.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060405113134.PAHR14821.eastrmmtao02.cox.net@localhost.localdomain>; Wed, 5 Apr 2006 07:31:34 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FR6Eg-0005Rv-2l; Wed, 05 Apr 2006 07:31:42 -0400 Date: Wed, 5 Apr 2006 07:31:41 -0400 From: Bob Rossi To: Frans Englich Message-ID: <20060405113141.GE14364@brasko.net> Mail-Followup-To: Frans Englich , bison-patches@gnu.org References: <20060317194252.GJ30980@brasko.net> <20060403032150.GB10068@brasko.net> <874q18g84p.fsf@penguin.cs.ucla.edu> <200604050935.46601.frans.englich@telia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200604050935.46601.frans.englich@telia.com> User-Agent: Mutt/1.5.9i Cc: bison-patches@gnu.org Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2006 11:31:39 -0000 On Wed, Apr 05, 2006 at 09:35:46AM +0000, Frans Englich wrote: > On Wednesday 05 April 2006 00:48, Paul Eggert wrote: > > Bob Rossi writes: > [...] > > > Is there some way that we can fix that? For example, is there someone > > who needs push parsers, but doesn't yet know that they need them? > > Heh, I might be one of them. > > I googled around a bit, but I still wonder: what advantages does this > push-parser patch add to Bison? What does it do? > > To me it seems like it makes it possible to call the parser instead of that > the parser calls you.. possibly solving problems wrt. blocking. Correct? > Something else or in addition? Hi Frans, Before I knew what I wanted, I was calling it an asynchronous parser. Once I brought the discussion here, the word was quickly changed to push parsing. Yes, the pull parser is a parser which asks for the tokens, and doesn't return until it's done. This is a less desirable approach when the parser has to read a large amount of data from a GUI application. Also, the pull parser doesn't work at all in an application that wants to write a parser that using streaming data, over a network socket or unix pipe. In this case, the data is never "fully ready". So, either you have to call your main_loop function from within bison, or you need another solution. The push parser is just that solution. You feed the tokens to bison. This allows me to write a grammar that represents data that will be coming over a stream from another application. I create the parser once at the beggining, and feed it tokens until the other application dies. In this particular instance, CGDB is the program using the push parser, and GDB is the program streaming the GDB/MI protocol over stdout. This patch will greatly improve the design and usability of CGDB. There is 1 other potential gain of the push parser approach. For every yyparse or xxparse grammar that you have generated, you can have more than one parser instance working at the same time on the same grammar. That's because all of the data associated with the parser is located inside a single struct. I'm pretty sure this isn't possible with the %pure-parser. Thanks, Bob Rossi From MAILER-DAEMON Wed Apr 05 07:32:28 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FR6FQ-0000aF-II for mharc-bison-patches@gnu.org; Wed, 05 Apr 2006 07:32:28 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FR6FP-0000a8-5u for bison-patches@gnu.org; Wed, 05 Apr 2006 07:32:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FR6FM-0000Zw-PS for bison-patches@gnu.org; Wed, 05 Apr 2006 07:32:25 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FR6FM-0000Zt-Jq for bison-patches@gnu.org; Wed, 05 Apr 2006 07:32:24 -0400 Received: from [68.230.240.34] (helo=eastrmmtao05.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FR6Ir-0005Pj-JG for bison-patches@gnu.org; Wed, 05 Apr 2006 07:36:01 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao05.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060405113221.FHGK3108.eastrmmtao05.cox.net@localhost.localdomain>; Wed, 5 Apr 2006 07:32:21 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FR6FQ-0005SG-L1; Wed, 05 Apr 2006 07:32:28 -0400 Date: Wed, 5 Apr 2006 07:32:28 -0400 From: Bob Rossi To: Paul Eggert , Bison Patches Message-ID: <20060405113228.GF14364@brasko.net> Mail-Followup-To: Paul Eggert , Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060320232837.GA27369@brasko.net> <878xr4qp0q.fsf@penguin.cs.ucla.edu> <20060403032150.GB10068@brasko.net> <874q18g84p.fsf@penguin.cs.ucla.edu> <20060405011009.GA14364@brasko.net> <87k6a4k43w.fsf@penguin.cs.ucla.edu> <20060405112359.GD14364@brasko.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060405112359.GD14364@brasko.net> User-Agent: Mutt/1.5.9i Cc: Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2006 11:32:27 -0000 On Wed, Apr 05, 2006 at 07:23:59AM -0400, Bob Rossi wrote: > On Tue, Apr 04, 2006 at 10:01:39PM -0700, Paul Eggert wrote: > > Bob Rossi writes: > > > > > What is the goal here? Are you interested in discovering what a nice > > > interface for a push parser would be? or are you interested in finding > > > someone to review the patch? > > > > The latter. I want the "many eyes" syndrome to work its magic.... > > OK. I'm not sure if I can find people who need this functionality. > However, discussing it here could bring some interest. One other thing to note, I am still not looking for a final patch approval, just a "yes sir, this is the correct approach". That way I can write the manual and test suite. Bob Rossi From MAILER-DAEMON Wed Apr 05 07:52:17 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FR6Ya-0006rQ-WF for mharc-bison-patches@gnu.org; Wed, 05 Apr 2006 07:52:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FR6YY-0006r7-U2 for bison-patches@gnu.org; Wed, 05 Apr 2006 07:52:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FR6YX-0006qr-5o for bison-patches@gnu.org; Wed, 05 Apr 2006 07:52:14 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FR6YW-0006qo-Uo for bison-patches@gnu.org; Wed, 05 Apr 2006 07:52:12 -0400 Received: from [212.247.154.33] (helo=swip.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FR6c1-00079s-Ut for bison-patches@gnu.org; Wed, 05 Apr 2006 07:55:50 -0400 X-T2-Posting-ID: 2yF4ydxc0UI9xI7FHZPfog== X-Cloudmark-Score: 0.000000 [] Received: from 83.72.134.122.ip.tele2adsl.dk ([83.72.134.122] verified) by mailfe02.swip.net (CommuniGate Pro SMTP 5.0.8) with ESMTP id 175629443; Wed, 05 Apr 2006 13:52:11 +0200 From: Frans Englich To: bison-patches@gnu.org Date: Wed, 5 Apr 2006 12:04:11 +0000 User-Agent: KMail/1.8.50 References: <20060317194252.GJ30980@brasko.net> <200604050935.46601.frans.englich@telia.com> <20060405113141.GE14364@brasko.net> In-Reply-To: <20060405113141.GE14364@brasko.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200604051204.11555.frans.englich@telia.com> Cc: Bob Rossi Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2006 11:52:15 -0000 On Wednesday 05 April 2006 11:31, Bob Rossi wrote: > On Wed, Apr 05, 2006 at 09:35:46AM +0000, Frans Englich wrote: > > On Wednesday 05 April 2006 00:48, Paul Eggert wrote: > > > Bob Rossi writes: > > > > [...] > > > > > Is there some way that we can fix that? For example, is there someone > > > who needs push parsers, but doesn't yet know that they need them? > > > > Heh, I might be one of them. > > > > I googled around a bit, but I still wonder: what advantages does this > > push-parser patch add to Bison? What does it do? > > > > To me it seems like it makes it possible to call the parser instead of > > that the parser calls you.. possibly solving problems wrt. blocking. > > Correct? Something else or in addition? > > Hi Frans, > > Before I knew what I wanted, I was calling it an asynchronous parser. > Once I brought the discussion here, the word was quickly changed to push > parsing. > > Yes, the pull parser is a parser which asks for the tokens, and > doesn't return until it's done. This is a less desirable approach when > the parser has to read a large amount of data from a GUI application. > Also, the pull parser doesn't work at all in an application that wants > to write a parser that using streaming data, over a network socket or > unix pipe. In this case, the data is never "fully ready". So, either you > have to call your main_loop function from within bison, or you need > another solution. That surely sounds interesting to me as well; I'm writing XQuery/XSL-T/XPath implemetations to be used in GUI apps such as a web browser. > The push parser is just that solution. You feed the tokens to bison. > This allows me to write a grammar that represents data that will be > coming over a stream from another application. I create the parser once > at the beggining, and feed it tokens until the other application dies. > In this particular instance, CGDB is the program using the push parser, > and GDB is the program streaming the GDB/MI protocol over stdout. This > patch will greatly improve the design and usability of CGDB. > > There is 1 other potential gain of the push parser approach. For every > yyparse or xxparse grammar that you have generated, What's the difference between yyparse and xxparse? Or you use the two terms for referring to when the user have multiple grammars with different name prefixes? > you can have more > than one parser instance working at the same time on the same grammar. Doesn't %pure-parser achieve this? > That's because all of the data associated with the parser is located > inside a single struct. I'm pretty sure this isn't possible with the > %pure-parser. Are you saying that: * %pure-parser doesn't really create a reentrant parser? * that a %push-parser also is a fully reentrant/thread safe parser? Keep up the good work. Cheers, Frans From MAILER-DAEMON Wed Apr 05 09:15:46 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FR7rO-0001XM-K8 for mharc-bison-patches@gnu.org; Wed, 05 Apr 2006 09:15:46 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FR7rM-0001X1-Ih for bison-patches@gnu.org; Wed, 05 Apr 2006 09:15:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FR7rK-0001WV-2W for bison-patches@gnu.org; Wed, 05 Apr 2006 09:15:43 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FR7rJ-0001WS-Tt for bison-patches@gnu.org; Wed, 05 Apr 2006 09:15:41 -0400 Received: from [68.230.240.33] (helo=eastrmmtao06.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FR7uq-0008Ej-1P for bison-patches@gnu.org; Wed, 05 Apr 2006 09:19:20 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao06.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060405131538.WTNL9108.eastrmmtao06.cox.net@localhost.localdomain>; Wed, 5 Apr 2006 09:15:38 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FR7rO-0005tN-3q; Wed, 05 Apr 2006 09:15:46 -0400 Date: Wed, 5 Apr 2006 09:15:46 -0400 From: Bob Rossi To: Frans Englich Message-ID: <20060405131546.GH14364@brasko.net> Mail-Followup-To: Frans Englich , bison-patches@gnu.org References: <20060317194252.GJ30980@brasko.net> <200604050935.46601.frans.englich@telia.com> <20060405113141.GE14364@brasko.net> <200604051204.11555.frans.englich@telia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200604051204.11555.frans.englich@telia.com> User-Agent: Mutt/1.5.9i Cc: bison-patches@gnu.org Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2006 13:15:45 -0000 On Wed, Apr 05, 2006 at 12:04:11PM +0000, Frans Englich wrote: > On Wednesday 05 April 2006 11:31, Bob Rossi wrote: > > On Wed, Apr 05, 2006 at 09:35:46AM +0000, Frans Englich wrote: > > > On Wednesday 05 April 2006 00:48, Paul Eggert wrote: > > > > Bob Rossi writes: > > > > > > [...] > > > > > > > Is there some way that we can fix that? For example, is there someone > > > > who needs push parsers, but doesn't yet know that they need them? > > > > > > Heh, I might be one of them. > > > > > > I googled around a bit, but I still wonder: what advantages does this > > > push-parser patch add to Bison? What does it do? > > > > > > To me it seems like it makes it possible to call the parser instead of > > > that the parser calls you.. possibly solving problems wrt. blocking. > > > Correct? Something else or in addition? > > > > Hi Frans, > > > > Before I knew what I wanted, I was calling it an asynchronous parser. > > Once I brought the discussion here, the word was quickly changed to push > > parsing. > > > > Yes, the pull parser is a parser which asks for the tokens, and > > doesn't return until it's done. This is a less desirable approach when > > the parser has to read a large amount of data from a GUI application. > > Also, the pull parser doesn't work at all in an application that wants > > to write a parser that using streaming data, over a network socket or > > unix pipe. In this case, the data is never "fully ready". So, either you > > have to call your main_loop function from within bison, or you need > > another solution. > > That surely sounds interesting to me as well; I'm writing XQuery/XSL-T/XPath > implemetations to be used in GUI apps such as a web browser. Yes, then this could defiantly be helpful. Are you using bison to implement this? If so, do you call your main loop function from within the bison grammar file? If not, do you block while parsing? > > The push parser is just that solution. You feed the tokens to bison. > > This allows me to write a grammar that represents data that will be > > coming over a stream from another application. I create the parser once > > at the beggining, and feed it tokens until the other application dies. > > In this particular instance, CGDB is the program using the push parser, > > and GDB is the program streaming the GDB/MI protocol over stdout. This > > patch will greatly improve the design and usability of CGDB. > > > > There is 1 other potential gain of the push parser approach. For every > > yyparse or xxparse grammar that you have generated, > > What's the difference between yyparse and xxparse? Or you use the two terms > for referring to when the user have multiple grammars with different name > prefixes? Yes, sorry. > > you can have more > > than one parser instance working at the same time on the same grammar. > > Doesn't %pure-parser achieve this? Maybe it does. At first thought, I was thinking it didn't. But now I realize it probably does. So sorry, that's not a real benefit of the push parser. > > That's because all of the data associated with the parser is located > > inside a single struct. I'm pretty sure this isn't possible with the > > %pure-parser. > > Are you saying that: > > * %pure-parser doesn't really create a reentrant parser? I was, but I'm wrong, sorry. > * that a %push-parser also is a fully reentrant/thread safe parser? Yes, the push-parser is reentrant and thread safe. The obvious difference is, you have N parser instances, and can call yyparse (instance) with them whenever you want. Instead of having N potentially blocking parsers. This allows you to use N parsers at the same time in a single thread of execution. Thanks, Bob Rossi From MAILER-DAEMON Wed Apr 05 09:53:12 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FR8Rb-0007GP-VX for mharc-bison-patches@gnu.org; Wed, 05 Apr 2006 09:53:11 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FR8Rb-0007GE-Eu for bison-patches@gnu.org; Wed, 05 Apr 2006 09:53:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FR8RY-0007Fd-Mc for bison-patches@gnu.org; Wed, 05 Apr 2006 09:53:10 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FR8RY-0007FZ-Hg for bison-patches@gnu.org; Wed, 05 Apr 2006 09:53:08 -0400 Received: from [212.247.155.97] (helo=swip.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FR8V4-0002x9-QE for bison-patches@gnu.org; Wed, 05 Apr 2006 09:56:47 -0400 X-T2-Posting-ID: 2yF4ydxc0UI9xI7FHZPfog== X-Cloudmark-Score: 0.000000 [] Received: from 83.72.134.122.ip.tele2adsl.dk ([83.72.134.122] verified) by mailfe12.swip.net (CommuniGate Pro SMTP 5.0.8) with ESMTP id 4494764; Wed, 05 Apr 2006 15:53:06 +0200 From: Frans Englich To: Bob Rossi Date: Wed, 5 Apr 2006 14:05:07 +0000 User-Agent: KMail/1.8.50 References: <20060317194252.GJ30980@brasko.net> <200604051204.11555.frans.englich@telia.com> <20060405131546.GH14364@brasko.net> In-Reply-To: <20060405131546.GH14364@brasko.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200604051405.07642.frans.englich@telia.com> Cc: bison-patches@gnu.org Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2006 13:53:11 -0000 On Wednesday 05 April 2006 13:15, Bob Rossi wrote: > On Wed, Apr 05, 2006 at 12:04:11PM +0000, Frans Englich wrote: > > On Wednesday 05 April 2006 11:31, Bob Rossi wrote: > > > On Wed, Apr 05, 2006 at 09:35:46AM +0000, Frans Englich wrote: [...] > > That surely sounds interesting to me as well; I'm writing > > XQuery/XSL-T/XPath implemetations to be used in GUI apps such as a web > > browser. > > Yes, then this could defiantly be helpful. Are you using bison to > implement this? Yes. > If so, do you call your main loop function from within > the bison grammar file? If not, do you block while parsing? I currently block, and haven't spent any effort at doing it properly(and will probably continue to post pone it until the push-parser stuff has been released). An input buffer is built asyncronously, and once it's complete, I let the bison/tokenizer loose. That helps at least a bit; during the time the parser executes it doesn't block because of waiting on IO, it is only the computation time. Thanks for the clarifications. Cheers, Frans From MAILER-DAEMON Wed Apr 05 10:01:42 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FR8Zq-0001cW-16 for mharc-bison-patches@gnu.org; Wed, 05 Apr 2006 10:01:42 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FR8Zo-0001cB-Na for bison-patches@gnu.org; Wed, 05 Apr 2006 10:01:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FR8Zn-0001bl-7X for bison-patches@gnu.org; Wed, 05 Apr 2006 10:01:40 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FR8Zn-0001bi-2T for bison-patches@gnu.org; Wed, 05 Apr 2006 10:01:39 -0400 Received: from [68.230.240.37] (helo=eastrmmtao02.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FR8dJ-0003m7-DM for bison-patches@gnu.org; Wed, 05 Apr 2006 10:05:17 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao02.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060405140133.SGKQ14821.eastrmmtao02.cox.net@localhost.localdomain>; Wed, 5 Apr 2006 10:01:33 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FR8Zp-00065E-9W; Wed, 05 Apr 2006 10:01:41 -0400 Date: Wed, 5 Apr 2006 10:01:41 -0400 From: Bob Rossi To: Frans Englich Message-ID: <20060405140141.GI14364@brasko.net> Mail-Followup-To: Frans Englich , bison-patches@gnu.org References: <20060317194252.GJ30980@brasko.net> <200604051204.11555.frans.englich@telia.com> <20060405131546.GH14364@brasko.net> <200604051405.07642.frans.englich@telia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200604051405.07642.frans.englich@telia.com> User-Agent: Mutt/1.5.9i Cc: bison-patches@gnu.org Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2006 14:01:40 -0000 > > If so, do you call your main loop function from within > > the bison grammar file? If not, do you block while parsing? > > I currently block, and haven't spent any effort at doing it properly(and will > probably continue to post pone it until the push-parser stuff has been > released). An input buffer is built asynchronously, and once it's complete, I > let the bison/tokenizer loose. That helps at least a bit; during the time the > parser executes it doesn't block because of waiting on IO, it is only the > computation time. > > Thanks for the clarifications. OK, that makes a lot of sense. In my case, a single MI output command, which is what the bison grammar file implements can be arbitrary in size. For instance, ever hit 'bt' in GDB when the program being debugged crash via an infinite recursion bug? GDB usually spews out frame 1 .. frame 2 .. frame 10000 .. for a really long time. This would make my program hang while parsing the data. The push parser was really the only alternative to me. Well, if anyone does look at the patch, it was really mechanical to make. It should be fairly obvious what is going on. To be honest, I don't even know how the original parser works. It doesn't matter though, simply because the changes are completely mechanical. Bob Rossi From MAILER-DAEMON Thu Apr 06 11:03:38 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRW1K-0002sO-UV for mharc-bison-patches@gnu.org; Thu, 06 Apr 2006 11:03:38 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRW1J-0002s7-7v for bison-patches@gnu.org; Thu, 06 Apr 2006 11:03:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRW1D-0002p6-4y for bison-patches@gnu.org; Thu, 06 Apr 2006 11:03:35 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRW1C-0002p3-Vz for bison-patches@gnu.org; Thu, 06 Apr 2006 11:03:31 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FRW4x-0000s7-Oa for bison-patches@gnu.org; Thu, 06 Apr 2006 11:07:24 -0400 Received: from sulaco-eth.lrde.epita.fr ([192.168.101.154]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FRW1B-00042f-1p; Thu, 06 Apr 2006 17:03:29 +0200 In-Reply-To: <20060405112359.GD14364@brasko.net> References: <20060317194252.GJ30980@brasko.net> <20060320232837.GA27369@brasko.net> <878xr4qp0q.fsf@penguin.cs.ucla.edu> <20060403032150.GB10068@brasko.net> <874q18g84p.fsf@penguin.cs.ucla.edu> <20060405011009.GA14364@brasko.net> <87k6a4k43w.fsf@penguin.cs.ucla.edu> <20060405112359.GD14364@brasko.net> Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: quoted-printable From: Akim Demaille Date: Thu, 6 Apr 2006 17:02:58 +0200 To: Bob Rossi X-Mailer: Apple Mail (2.749.3) Cc: Paul Eggert , Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2006 15:03:37 -0000 Le 5 avr. 06 =E0 13:23, Bob Rossi a =E9crit : > On Tue, Apr 04, 2006 at 10:01:39PM -0700, Paul Eggert wrote: >> Bob Rossi writes: >> >>> What is the goal here? Are you interested in discovering what a nice >>> interface for a push parser would be? or are you interested in =20 >>> finding >>> someone to review the patch? >> >> The latter. I want the "many eyes" syndrome to work its magic.... > > OK. I'm not sure if I can find people who need this functionality. > However, discussing it here could bring some interest. I am interested (and maybe back). In some situations having a pull =20 parser is a bit of a pain and a push interface simplifies the writing.= From MAILER-DAEMON Thu Apr 06 11:14:00 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRWBM-0007ri-Cf for mharc-bison-patches@gnu.org; Thu, 06 Apr 2006 11:14:00 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRWBL-0007rd-T8 for bison-patches@gnu.org; Thu, 06 Apr 2006 11:13:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRWBJ-0007rR-Eu for bison-patches@gnu.org; Thu, 06 Apr 2006 11:13:58 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRWBJ-0007rO-9R for bison-patches@gnu.org; Thu, 06 Apr 2006 11:13:57 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FRWF4-0001k4-GV for bison-patches@gnu.org; Thu, 06 Apr 2006 11:17:50 -0400 Received: from nostromo.lrde.epita.fr ([192.168.101.52]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FRWBH-0004zA-OY; Thu, 06 Apr 2006 17:13:55 +0200 From: Akim Demaille To: Paul Eggert References: <20060207014218.GB19121@brasko.net> <871wye4si5.fsf@penguin.cs.ucla.edu> <20060208014518.GA3975@brasko.net> <87irrq1el3.fsf@penguin.cs.ucla.edu> <20060208205931.GG3975@brasko.net> <87wtg5yo0m.fsf@penguin.cs.ucla.edu> <20060212024702.GC4207@brasko.net> <87psltt37h.fsf@penguin.cs.ucla.edu> <20060213004227.GE4207@brasko.net> Date: Thu, 06 Apr 2006 17:13:55 +0200 In-Reply-To: <20060213004227.GE4207@brasko.net> (Bob Rossi's message of "Sun, 12 Feb 2006 19:42:27 -0500") Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bison-patches@gnu.org Subject: Re: push parser X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2006 15:14:00 -0000 >>> "Bob" == Bob Rossi writes: > Anyways, I ran into an m4 question that might be answered here. I have > this > m4_define([b4_yystate],[b4_push_if([(pv->yystate)],yystate)]) > and when I try to use b4_yystate() in this context > ]b4_yyn()[ = yypact]b4_yystate()[; You don't need the parens. ]b4_yyn[ = yypact]b4_yystate[; > it works fine. However, I need the C array brackets in the output so > however I try to write the line > ]b4_yyn()[ = yypact[]b4_yystate()[]; > or countless other variations, I just can't get it. The scanner provides some "bigraphs": you can use @{ and @} to stand for [ and ] whatever is the current quotation level. They are converted last, m4 never sees them as [ and ]. > look like > yypack[yystate]; yypack@{]b4_yystate[@} you might also want to m4_define([b4_yypack], [yypack@{$1@}]) and b4_yypack([b4_yystate]) From MAILER-DAEMON Thu Apr 06 11:16:42 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRWDy-0000Hk-DT for mharc-bison-patches@gnu.org; Thu, 06 Apr 2006 11:16:42 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRWDw-0000G8-5s for bison-patches@gnu.org; Thu, 06 Apr 2006 11:16:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRWDu-0000Dk-96 for bison-patches@gnu.org; Thu, 06 Apr 2006 11:16:39 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRWDu-0000Dd-3I for bison-patches@gnu.org; Thu, 06 Apr 2006 11:16:38 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FRWHf-0001yS-8K for bison-patches@gnu.org; Thu, 06 Apr 2006 11:20:31 -0400 Received: from nostromo.lrde.epita.fr ([192.168.101.52]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FRWDs-00055t-Ls for bison-patches@gnu.org; Thu, 06 Apr 2006 17:16:36 +0200 From: Akim Demaille To: bison-patches@gnu.org References: <20060207014218.GB19121@brasko.net> <20060214014908.GA1671@brasko.net> Date: Thu, 06 Apr 2006 17:16:36 +0200 In-Reply-To: <20060214014908.GA1671@brasko.net> (Bob Rossi's message of "Mon, 13 Feb 2006 20:49:08 -0500") Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: push parser X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2006 15:16:40 -0000 >>> "Bob" == Bob Rossi writes: > I added the %push-parser option, so that a bison input grammar file can > ask for itself to be a push-parser. What should Bison knows about this? is it just a means to select the right skeleton, or it actually changes something for bison itself? > This simple enhancement to bison already raises questions. A > %push-parse and %pure-parser don't make sense together. The local > variables store in %pure-parser are already stored in the context > that is used when %push-parser is used. Is it OK to have to > competing options like this? They make sense by themselves, but not > together. Is there a precedent in bison that I can simply follow? > Possibly it should be an error to declare both of these? I wouldn't worry too much about useless options and I actually don't: C++ parsers are of course pure, but %pure-parser can be set or not, it doesn't change anything. From MAILER-DAEMON Thu Apr 06 11:18:06 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRWFK-0001DO-1c for mharc-bison-patches@gnu.org; Thu, 06 Apr 2006 11:18:06 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRWFI-0001DJ-8C for bison-patches@gnu.org; Thu, 06 Apr 2006 11:18:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRWFG-0001D7-Bh for bison-patches@gnu.org; Thu, 06 Apr 2006 11:18:03 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRWFG-0001D4-8o for bison-patches@gnu.org; Thu, 06 Apr 2006 11:18:02 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FRWJ1-00027c-EL for bison-patches@gnu.org; Thu, 06 Apr 2006 11:21:55 -0400 Received: from nostromo.lrde.epita.fr ([192.168.101.52]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FRWFE-00057c-Qp; Thu, 06 Apr 2006 17:18:00 +0200 From: Akim Demaille To: Paul Eggert References: <20060214024915.GC1671@brasko.net> <87y80eqvuh.fsf@penguin.cs.ucla.edu> Date: Thu, 06 Apr 2006 17:18:00 +0200 In-Reply-To: <87y80eqvuh.fsf@penguin.cs.ucla.edu> (Paul Eggert's message of "Mon, 13 Feb 2006 22:48:38 -0800") Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bison-patches@gnu.org Subject: Re: nonpure/pure/push X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2006 15:18:04 -0000 >>> "Paul" == Paul Eggert writes: >> First, I would like to know if when using a nonpure parser, if users >> of bison access those global data variables? > Never underestimate the power of Bison users to refer to all those > crufty globals... :) :) :) From MAILER-DAEMON Thu Apr 06 11:19:54 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRWH3-00025w-Vc for mharc-bison-patches@gnu.org; Thu, 06 Apr 2006 11:19:54 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRWH1-00023F-Ha for bison-patches@gnu.org; Thu, 06 Apr 2006 11:19:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRWH0-00022Q-5d for bison-patches@gnu.org; Thu, 06 Apr 2006 11:19:51 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRWGz-00022M-Tj; Thu, 06 Apr 2006 11:19:49 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FRWKl-0002FB-2o; Thu, 06 Apr 2006 11:23:43 -0400 Received: from nostromo.lrde.epita.fr ([192.168.101.52]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FRWGy-00058n-4i; Thu, 06 Apr 2006 17:19:48 +0200 From: Akim Demaille To: Paul Eggert References: <87fym4efzb.fsf@penguin.cs.ucla.edu> Date: Thu, 06 Apr 2006 17:19:47 +0200 In-Reply-To: <87fym4efzb.fsf@penguin.cs.ucla.edu> (Paul Eggert's message of "Mon, 27 Feb 2006 11:52:56 -0800") Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bison-patches@gnu.org, Waldek Hebisch , bug-bison@gnu.org Subject: Re: Stack overflow X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2006 15:19:51 -0000 >>> "Paul" == Paul Eggert writes: > Waldek Hebisch writes: >> bison-2.1 fails to detect stack overflow in GLR parser. > * data/glr.c (yyexpandGLRStack): Catch an off-by-one error that > led to a segmentation fault in GNU Pascal. Problem reported > by Waldek Hebisch. How come GNU Pascal wishes to use GLR? I thought Pascal's syntax was clean. From MAILER-DAEMON Thu Apr 06 11:22:42 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRWJm-00037E-Ib for mharc-bison-patches@gnu.org; Thu, 06 Apr 2006 11:22:42 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRWJl-00036R-2y for bison-patches@gnu.org; Thu, 06 Apr 2006 11:22:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRWJj-00035Y-9m for bison-patches@gnu.org; Thu, 06 Apr 2006 11:22:40 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRWJj-00035R-3K for bison-patches@gnu.org; Thu, 06 Apr 2006 11:22:39 -0400 Received: from [68.230.240.37] (helo=eastrmmtao02.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FRWNU-0002T8-BU for bison-patches@gnu.org; Thu, 06 Apr 2006 11:26:32 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao02.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060406152234.ZTJB14821.eastrmmtao02.cox.net@localhost.localdomain>; Thu, 6 Apr 2006 11:22:34 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FRWJn-0007jJ-Cg; Thu, 06 Apr 2006 11:22:43 -0400 Date: Thu, 6 Apr 2006 11:22:43 -0400 From: Bob Rossi To: Akim Demaille Message-ID: <20060406152243.GA29093@brasko.net> Mail-Followup-To: Akim Demaille , Paul Eggert , bison-patches@gnu.org References: <871wye4si5.fsf@penguin.cs.ucla.edu> <20060208014518.GA3975@brasko.net> <87irrq1el3.fsf@penguin.cs.ucla.edu> <20060208205931.GG3975@brasko.net> <87wtg5yo0m.fsf@penguin.cs.ucla.edu> <20060212024702.GC4207@brasko.net> <87psltt37h.fsf@penguin.cs.ucla.edu> <20060213004227.GE4207@brasko.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i Cc: Paul Eggert , bison-patches@gnu.org Subject: Re: push parser X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2006 15:22:41 -0000 On Thu, Apr 06, 2006 at 05:13:55PM +0200, Akim Demaille wrote: > >>> "Bob" == Bob Rossi writes: > > > Anyways, I ran into an m4 question that might be answered here. I have > > this > > m4_define([b4_yystate],[b4_push_if([(pv->yystate)],yystate)]) > > > and when I try to use b4_yystate() in this context > > ]b4_yyn()[ = yypact]b4_yystate()[; > > You don't need the parens. OK, thanks for the suggestions. I did find a better approach to writing the patch, and no longer needed to do this. The "better" patch is the last one posted on bison-patches by me. Bob Rossi From MAILER-DAEMON Thu Apr 06 11:27:20 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRWOG-0004lH-RQ for mharc-bison-patches@gnu.org; Thu, 06 Apr 2006 11:27:20 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRWOF-0004lC-Mf for bison-patches@gnu.org; Thu, 06 Apr 2006 11:27:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRWOE-0004kr-5x for bison-patches@gnu.org; Thu, 06 Apr 2006 11:27:19 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRWOD-0004ko-VG for bison-patches@gnu.org; Thu, 06 Apr 2006 11:27:17 -0400 Received: from [68.230.240.35] (helo=eastrmmtao04.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FRWRz-0002qM-8z for bison-patches@gnu.org; Thu, 06 Apr 2006 11:31:11 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao04.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060406152714.VWDW19943.eastrmmtao04.cox.net@localhost.localdomain>; Thu, 6 Apr 2006 11:27:14 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FRWOK-0007kc-3H; Thu, 06 Apr 2006 11:27:24 -0400 Date: Thu, 6 Apr 2006 11:27:24 -0400 From: Bob Rossi To: Akim Demaille Message-ID: <20060406152724.GB29093@brasko.net> Mail-Followup-To: Akim Demaille , bison-patches@gnu.org References: <20060207014218.GB19121@brasko.net> <20060214014908.GA1671@brasko.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i Cc: bison-patches@gnu.org Subject: Re: push parser X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2006 15:27:19 -0000 On Thu, Apr 06, 2006 at 05:16:36PM +0200, Akim Demaille wrote: > >>> "Bob" == Bob Rossi writes: > > > I added the %push-parser option, so that a bison input grammar file can > > ask for itself to be a push-parser. > > What should Bison knows about this? is it just a means to select the > right skeleton, or it actually changes something for bison itself? It is exactly like %pure-parser. It does not select a different skeleton. In fact, %pure-parser uses the yacc.c skeleton. I put m4 conditionals in yacc.c, and if %pure-parser is set, yacc.c outputs a pure parser. This mostly means that yacc.c creates a struct with all the variables that yyparse needs, and that yyparse does 'pv->yychar' instead of 'yychar'. Thanks, Bob Rossi From MAILER-DAEMON Thu Apr 06 11:29:00 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRWPs-0005O6-0M for mharc-bison-patches@gnu.org; Thu, 06 Apr 2006 11:29:00 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRWPr-0005Nu-34 for bison-patches@gnu.org; Thu, 06 Apr 2006 11:28:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRWPq-0005NZ-L9 for bison-patches@gnu.org; Thu, 06 Apr 2006 11:28:58 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRWPq-0005NW-GX for bison-patches@gnu.org; Thu, 06 Apr 2006 11:28:58 -0400 Received: from [68.230.240.37] (helo=eastrmmtao02.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FRWTb-00030c-Rc for bison-patches@gnu.org; Thu, 06 Apr 2006 11:32:52 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao02.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060406152855.ZWPN14821.eastrmmtao02.cox.net@localhost.localdomain>; Thu, 6 Apr 2006 11:28:55 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FRWPw-0007lZ-L8; Thu, 06 Apr 2006 11:29:04 -0400 Date: Thu, 6 Apr 2006 11:29:04 -0400 From: Bob Rossi To: Akim Demaille , bison-patches@gnu.org Message-ID: <20060406152904.GC29093@brasko.net> Mail-Followup-To: Akim Demaille , bison-patches@gnu.org References: <20060207014218.GB19121@brasko.net> <20060214014908.GA1671@brasko.net> <20060406152724.GB29093@brasko.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060406152724.GB29093@brasko.net> User-Agent: Mutt/1.5.9i Cc: Subject: Re: push parser X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2006 15:28:59 -0000 On Thu, Apr 06, 2006 at 11:27:24AM -0400, Bob Rossi wrote: > On Thu, Apr 06, 2006 at 05:16:36PM +0200, Akim Demaille wrote: > > >>> "Bob" == Bob Rossi writes: > > > > > I added the %push-parser option, so that a bison input grammar file can > > > ask for itself to be a push-parser. > > > > What should Bison knows about this? is it just a means to select the > > right skeleton, or it actually changes something for bison itself? > > It is exactly like %pure-parser. It does not select a different > skeleton. In fact, %pure-parser uses the yacc.c skeleton. ^^^^^^^^^^^^ Argh. I mean to say %push-parser here. > > I put m4 conditionals in yacc.c, and if %pure-parser is set, yacc.c > outputs a pure parser. This mostly means that yacc.c creates a struct > with all the variables that yyparse needs, and that yyparse does > 'pv->yychar' instead of 'yychar'. > > Thanks, > Bob Rossi > > From MAILER-DAEMON Thu Apr 06 12:21:19 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRXEV-0003SC-Kj for mharc-bison-patches@gnu.org; Thu, 06 Apr 2006 12:21:19 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRXEU-0003Rn-Pt for bison-patches@gnu.org; Thu, 06 Apr 2006 12:21:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRXES-0003RX-WD for bison-patches@gnu.org; Thu, 06 Apr 2006 12:21:18 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRXES-0003RU-Q2 for bison-patches@gnu.org; Thu, 06 Apr 2006 12:21:16 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FRXIE-0007l8-Lc for bison-patches@gnu.org; Thu, 06 Apr 2006 12:25:10 -0400 Received: from sulaco-eth.lrde.epita.fr ([192.168.101.154]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FRXER-0000Lg-4b; Thu, 06 Apr 2006 18:21:15 +0200 In-Reply-To: <20060406152724.GB29093@brasko.net> References: <20060207014218.GB19121@brasko.net> <20060214014908.GA1671@brasko.net> <20060406152724.GB29093@brasko.net> Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: quoted-printable From: Akim Demaille Date: Thu, 6 Apr 2006 18:20:44 +0200 To: Bob Rossi X-Mailer: Apple Mail (2.749.3) Cc: bison-patches@gnu.org Subject: Re: push parser X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2006 16:21:18 -0000 Le 6 avr. 06 =E0 17:27, Bob Rossi a =E9crit : > On Thu, Apr 06, 2006 at 05:16:36PM +0200, Akim Demaille wrote: >>>>> "Bob" =3D=3D Bob Rossi writes: >> >>> I added the %push-parser option, so that a bison input grammar =20 >>> file can >>> ask for itself to be a push-parser. >> >> What should Bison knows about this? is it just a means to select the >> right skeleton, or it actually changes something for bison itself? > > It is exactly like %pure-parser. It does not select a different > skeleton. In fact, %pure-parser uses the yacc.c skeleton. Oh, great! I wasn't sure you managed to implement the push parser in =20= yacc.c itself. Did you try to bench your yacc.c in pull mode vs. the =20= stock yacc.c?= From MAILER-DAEMON Thu Apr 06 12:24:07 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRXHD-0004G3-33 for mharc-bison-patches@gnu.org; Thu, 06 Apr 2006 12:24:07 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRXHA-0004Fd-Tc for bison-patches@gnu.org; Thu, 06 Apr 2006 12:24:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRXH8-0004FQ-Uu for bison-patches@gnu.org; Thu, 06 Apr 2006 12:24:03 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRXH8-0004FL-P3 for bison-patches@gnu.org; Thu, 06 Apr 2006 12:24:02 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FRXKu-00082z-Hg for bison-patches@gnu.org; Thu, 06 Apr 2006 12:27:56 -0400 Received: from nostromo.lrde.epita.fr ([192.168.101.52]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FRXH7-000112-8c for bison-patches@gnu.org; Thu, 06 Apr 2006 18:24:01 +0200 From: Akim Demaille To: Bison Patches References: <6B0FE59B-9A11-4A84-B7CD-649D273DC420@lrde.epita.fr> Date: Thu, 06 Apr 2006 18:24:01 +0200 In-Reply-To: <6B0FE59B-9A11-4A84-B7CD-649D273DC420@lrde.epita.fr> (Akim Demaille's message of "Mon, 6 Mar 2006 10:40:37 +0100") Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: 2.2 and GPL X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2006 16:24:05 -0000 >>> "Akim" == Akim Demaille writes: > Hi friends, > How about releasing 2.2? > What should be done to finalize the efforts that were > made to propagate the GPL exception to the other skeletons? > As far as I can see, we're waiting for nothing but someone > asking for it again :) The question seems to be stuck, again :( What is missing for us to release 2.2 now? From MAILER-DAEMON Thu Apr 06 12:25:18 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRXIM-0004Zp-5W for mharc-bison-patches@gnu.org; Thu, 06 Apr 2006 12:25:18 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRXIK-0004ZU-LP for bison-patches@gnu.org; Thu, 06 Apr 2006 12:25:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRXII-0004ZH-3Z for bison-patches@gnu.org; Thu, 06 Apr 2006 12:25:15 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRXIH-0004ZE-Tx for bison-patches@gnu.org; Thu, 06 Apr 2006 12:25:13 -0400 Received: from [68.230.240.36] (helo=eastrmmtao03.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FRXM3-0008B4-Oc for bison-patches@gnu.org; Thu, 06 Apr 2006 12:29:07 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao03.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060406162510.LXET29285.eastrmmtao03.cox.net@localhost.localdomain>; Thu, 6 Apr 2006 12:25:10 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FRXIN-0008Cm-Tk; Thu, 06 Apr 2006 12:25:19 -0400 Date: Thu, 6 Apr 2006 12:25:19 -0400 From: Bob Rossi To: Akim Demaille Message-ID: <20060406162519.GH29093@brasko.net> Mail-Followup-To: Akim Demaille , bison-patches@gnu.org References: <20060207014218.GB19121@brasko.net> <20060214014908.GA1671@brasko.net> <20060406152724.GB29093@brasko.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.9i Cc: bison-patches@gnu.org Subject: Re: push parser X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2006 16:25:16 -0000 On Thu, Apr 06, 2006 at 06:20:44PM +0200, Akim Demaille wrote: > > Le 6 avr. 06 à 17:27, Bob Rossi a écrit : > > >On Thu, Apr 06, 2006 at 05:16:36PM +0200, Akim Demaille wrote: > >>>>>"Bob" == Bob Rossi writes: > >> > >>>I added the %push-parser option, so that a bison input grammar > >>>file can > >>>ask for itself to be a push-parser. > >> > >>What should Bison knows about this? is it just a means to select the > >>right skeleton, or it actually changes something for bison itself? > > > >It is exactly like %pure-parser. It does not select a different > >skeleton. In fact, %pure-parser uses the yacc.c skeleton. > > Oh, great! I wasn't sure you managed to implement the push parser in > yacc.c itself. Did you try to bench your yacc.c in pull mode vs. the > stock yacc.c? No, I didn't really understand how to do that thoroughly. Do you have any ideas? Bob Rossi From MAILER-DAEMON Thu Apr 06 12:26:02 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRXJ4-0004f5-EL for mharc-bison-patches@gnu.org; Thu, 06 Apr 2006 12:26:02 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRXJ2-0004es-TM for bison-patches@gnu.org; Thu, 06 Apr 2006 12:26:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRXJ1-0004eg-L3 for bison-patches@gnu.org; Thu, 06 Apr 2006 12:26:00 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRXJ1-0004ed-Gc for bison-patches@gnu.org; Thu, 06 Apr 2006 12:25:59 -0400 Received: from [68.230.240.36] (helo=eastrmmtao03.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FRXMn-0008EY-9U for bison-patches@gnu.org; Thu, 06 Apr 2006 12:29:53 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao03.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060406162556.LXON29285.eastrmmtao03.cox.net@localhost.localdomain>; Thu, 6 Apr 2006 12:25:56 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FRXJ7-0008DT-Rf; Thu, 06 Apr 2006 12:26:05 -0400 Date: Thu, 6 Apr 2006 12:26:05 -0400 From: Bob Rossi To: Akim Demaille Message-ID: <20060406162605.GI29093@brasko.net> Mail-Followup-To: Akim Demaille , Bison Patches References: <6B0FE59B-9A11-4A84-B7CD-649D273DC420@lrde.epita.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i Cc: Bison Patches Subject: Re: 2.2 and GPL X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2006 16:26:01 -0000 On Thu, Apr 06, 2006 at 06:24:01PM +0200, Akim Demaille wrote: > >>> "Akim" == Akim Demaille writes: > > > Hi friends, > > How about releasing 2.2? > > > What should be done to finalize the efforts that were > > made to propagate the GPL exception to the other skeletons? > > As far as I can see, we're waiting for nothing but someone > > asking for it again :) > > The question seems to be stuck, again :( What is missing for us to > release 2.2 now? Hmmm, the push parser? :) Bob Rossi From MAILER-DAEMON Thu Apr 06 13:02:17 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRXs9-0002mD-2L for mharc-bison-patches@gnu.org; Thu, 06 Apr 2006 13:02:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRXs6-0002m7-Ux for bison-patches@gnu.org; Thu, 06 Apr 2006 13:02:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRXs6-0002ln-7u for bison-patches@gnu.org; Thu, 06 Apr 2006 13:02:14 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRXs6-0002lk-2Y for bison-patches@gnu.org; Thu, 06 Apr 2006 13:02:14 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FRXvr-00031R-T8 for bison-patches@gnu.org; Thu, 06 Apr 2006 13:06:08 -0400 Received: from sulaco-eth.lrde.epita.fr ([192.168.101.154]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FRXs4-0004MV-BQ; Thu, 06 Apr 2006 19:02:12 +0200 In-Reply-To: <20060406162519.GH29093@brasko.net> References: <20060207014218.GB19121@brasko.net> <20060214014908.GA1671@brasko.net> <20060406152724.GB29093@brasko.net> <20060406162519.GH29093@brasko.net> Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: quoted-printable From: Akim Demaille Date: Thu, 6 Apr 2006 19:02:11 +0200 To: Bob Rossi X-Mailer: Apple Mail (2.749.3) Cc: bison-patches@gnu.org Subject: Re: push parser X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2006 17:02:15 -0000 Le 6 avr. 06 =E0 18:25, Bob Rossi a =E9crit : > On Thu, Apr 06, 2006 at 06:20:44PM +0200, Akim Demaille wrote: >> >> Le 6 avr. 06 =E0 17:27, Bob Rossi a =E9crit : >> >>> On Thu, Apr 06, 2006 at 05:16:36PM +0200, Akim Demaille wrote: >>>>>>> "Bob" =3D=3D Bob Rossi writes: >>>> >>>>> I added the %push-parser option, so that a bison input grammar >>>>> file can >>>>> ask for itself to be a push-parser. >>>> >>>> What should Bison knows about this? is it just a means to =20 >>>> select the >>>> right skeleton, or it actually changes something for bison itself? >>> >>> It is exactly like %pure-parser. It does not select a different >>> skeleton. In fact, %pure-parser uses the yacc.c skeleton. >> >> Oh, great! I wasn't sure you managed to implement the push parser in >> yacc.c itself. Did you try to bench your yacc.c in pull mode vs. the >> stock yacc.c? > > No, I didn't really understand how to do that thoroughly. Do you =20 > have any > ideas? Yes, there are a couple of large grammars in the testsuite. I'll toy =20= with you yacc.c do bench it.= From MAILER-DAEMON Fri Apr 07 08:42:38 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRqIQ-00014K-4L for mharc-bison-patches@gnu.org; Fri, 07 Apr 2006 08:42:38 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRqIO-00014B-6y for bison-patches@gnu.org; Fri, 07 Apr 2006 08:42:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRqIL-000135-4F for bison-patches@gnu.org; Fri, 07 Apr 2006 08:42:35 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRqIK-00012x-9S for bison-patches@gnu.org; Fri, 07 Apr 2006 08:42:32 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FRqMG-0008WM-Te for bison-patches@gnu.org; Fri, 07 Apr 2006 08:46:38 -0400 Received: from nostromo.lrde.epita.fr ([192.168.101.52]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FRqIH-0007it-F1 for bison-patches@gnu.org; Fri, 07 Apr 2006 14:42:29 +0200 From: Akim Demaille To: Bison Patches References: <20060317194252.GJ30980@brasko.net> Date: Fri, 07 Apr 2006 14:42:29 +0200 In-Reply-To: <20060317194252.GJ30980@brasko.net> (Bob Rossi's message of "Fri, 17 Mar 2006 14:42:52 -0500") Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2006 12:42:36 -0000 --=-=-= Bob, I'm starting to toy with your implementation, and to try to bench it. It seems that there is about a 15% performance loss of push.c compared to yacc.c, both used in pull mode without compiler optimization on my Mac. sulaco-eth% PATH=$PWD/_build/tests:$PATH ./bench.pl push-push yacc-pure yacc-yacc push-pure push-yacc calc: Benchmark: timing 50 iterations of push-pure, push-push, push-yacc, yacc-pure, yacc-yacc... push-pure: 64 wallclock secs ( 0.00 usr 0.07 sys + 45.05 cusr 1.36 csys = 46.48 CPU) @ 714.29/s (n=50) push-push: 77 wallclock secs ( 0.00 usr 0.07 sys + 50.53 cusr 1.56 csys = 52.16 CPU) @ 714.29/s (n=50) push-yacc: 66 wallclock secs ( 0.00 usr 0.07 sys + 45.51 cusr 1.40 csys = 46.98 CPU) @ 714.29/s (n=50) yacc-pure: 55 wallclock secs ( 0.00 usr 0.07 sys + 36.98 cusr 1.25 csys = 38.30 CPU) @ 714.29/s (n=50) yacc-yacc: 54 wallclock secs ( 0.00 usr 0.07 sys + 38.12 cusr 1.23 csys = 39.42 CPU) @ 714.29/s (n=50) Rate push-push yacc-yacc yacc-pure push-pure push-yacc push-push 714/s -- 0% 0% 0% -0% yacc-yacc 714/s 0% -- 0% 0% -0% yacc-pure 714/s 0% 0% -- 0% -0% push-pure 714/s 0% 0% 0% -- -0% push-yacc 714/s 0% 0% 0% 0% -- I confess I don't understand the table output by this Perl module here. What is this "rate"? What matters is: push-pure: 64 wallclock secs push-push: 77 wallclock secs push-yacc: 66 wallclock secs yacc-pure: 55 wallclock secs yacc-yacc: 54 wallclock secs With optimization (-O2): sulaco-eth% PATH=$PWD/_build/tests:$PATH ./bench.pl push-push yacc-pure yacc-yacc push-pure push-yacc calc: Benchmark: timing 50 iterations of push-pure, push-push, push-yacc, yacc-pure, yacc-yacc... push-pure: 31 wallclock secs ( 0.00 usr 0.07 sys + 20.95 cusr 0.94 csys = 21.96 CPU) @ 714.29/s (n=50) push-push: 34 wallclock secs ( 0.00 usr 0.07 sys + 22.96 cusr 0.97 csys = 24.00 CPU) @ 714.29/s (n=50) push-yacc: 31 wallclock secs ( 0.00 usr 0.07 sys + 21.48 cusr 0.92 csys = 22.47 CPU) @ 714.29/s (n=50) yacc-pure: 26 wallclock secs ( 0.00 usr 0.07 sys + 17.79 cusr 0.88 csys = 18.74 CPU) @ 714.29/s (n=50) yacc-yacc: 25 wallclock secs ( 0.00 usr 0.08 sys + 18.51 cusr 0.87 csys = 19.46 CPU) @ 625.00/s (n=50) Rate yacc-yacc yacc-pure push-pure push-push push-yacc yacc-yacc 625/s -- -12% -12% -12% -12% yacc-pure 714/s 14% -- 0% -0% -0% push-pure 714/s 14% 0% -- -0% -0% push-push 714/s 14% 0% 0% -- 0% push-yacc 714/s 14% 0% 0% 0% -- I.e.: push-pure: 31 wallclock secs push-push: 34 wallclock secs push-yacc: 31 wallclock secs yacc-pure: 26 wallclock secs yacc-yacc: 25 wallclock secs More experiments (and more eyes on this script) would help. I have a few comments. 1. I think you should not change the semantics of yyparse in the push parser. In fact, I think the push parser should always provide yyparse as the good old pull interface wrapping the yyparse_push interface or whatever. 2. What is the way one is expected to pass yylval? I cheated: #if YYPUSH static int yyparse_wrapper () { struct yypvars *ctx = yypvarsinit (); do { yyparse (ctx); set_yychar (ctx, yylex ()); ctx->yylval = yylval; } while (get_yyresult (ctx) != 0); free (ctx); } #define yyparse yyparse_wrapper #endif 3. I don't think we should maintain the Cartesian product of all the badly designed features, so I suggest that push => pure. There are a couple of place where the (m4) code could be simplified then. 4. Also, YYPARSE_PARAM is bad, does not scale well, etc. Don't bother with it except to maintain compatibility with the old mode. Attached is your diff, but this time with a "push.c" skeleton, leaving yacc.c as it was before. That's easier to bench (alternatively I could have introduced a yacc.old.c, but that's clearer). --=-=-= Content-Disposition: inline; filename=push.diff Index: data/Makefile.am =================================================================== RCS file: /cvsroot/bison/bison/data/Makefile.am,v retrieving revision 1.12 diff -u -r1.12 Makefile.am --- data/Makefile.am 14 Nov 2005 08:13:07 -0000 1.12 +++ data/Makefile.am 7 Apr 2006 09:30:31 -0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2002, 2005 Free Software Foundation, Inc. +## Copyright (C) 2002, 2005, 2006 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 @@ -16,7 +16,7 @@ ## 02110-1301 USA dist_pkgdata_DATA = README \ - c.m4 yacc.c glr.c \ + c.m4 yacc.c glr.c push.c \ c++.m4 location.cc lalr1.cc glr.cc m4sugardir = $(pkgdatadir)/m4sugar Index: data/c.m4 =================================================================== RCS file: /cvsroot/bison/bison/data/c.m4,v retrieving revision 1.53 diff -u -r1.53 c.m4 --- data/c.m4 22 Jan 2006 07:38:49 -0000 1.53 +++ data/c.m4 7 Apr 2006 09:30:31 -0000 @@ -62,6 +62,9 @@ /* Pure parsers. */ [#]define YYPURE b4_pure +/* Push parsers. */ +[#]define YYPUSH b4_push + /* Using locations. */ [#]define YYLSP_NEEDED b4_locations_flag ]) @@ -185,6 +188,15 @@ [$2])]) +# b4_push_if(IF-TRUE, IF-FALSE) +# ----------------------------- +# Expand IF-TRUE, if %push-parser, IF-FALSE otherwise. +m4_define([b4_push_if], +[m4_if(b4_push, [1], + [$1], + [$2])]) + + ## ------------------------- ## ## Assigning token numbers. ## Index: data/push.c =================================================================== RCS file: data/push.c diff -N data/push.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ data/push.c 7 Apr 2006 09:30:31 -0000 @@ -0,0 +1,1631 @@ +m4_divert(-1) -*- C -*- + +# Yacc compatible skeleton for Bison + +# Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +# 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 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA + +m4_include(b4_pkgdatadir/[c.m4]) + +## ---------------- ## +## Default values. ## +## ---------------- ## + +# Stack parameters. +m4_define_default([b4_stack_depth_max], [10000]) +m4_define_default([b4_stack_depth_init], [200]) + + +## ------------------------ ## +## Pure/impure interfaces. ## +## ------------------------ ## + + +# b4_yacc_pure_if(IF-TRUE, IF-FALSE) +# ---------------------------------- +# Expand IF-TRUE, if %pure-parser and %parse-param, IF-FALSE otherwise. +m4_define([b4_yacc_pure_if], +[b4_pure_if([m4_ifset([b4_parse_param], + [$1], [$2])], + [$2])]) + + +# b4_yyerror_args +# --------------- +# Arguments passed to yyerror: user args plus yylloc. +m4_define([b4_yyerror_args], +[b4_yacc_pure_if([b4_location_if([&]b4_yylloc[, ])])dnl +m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])]) + + +# b4_lex_param +# ------------ +# Accumulate in b4_lex_param all the yylex arguments. +# b4_lex_param arrives quoted twice, but we want to keep only one level. +m4_define([b4_lex_param], +m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&]b4_yylval[]]][]dnl +b4_location_if([, [[YYLTYPE *], [&]b4_yylloc[]]])m4_ifdef([b4_lex_param], [, ])])dnl +m4_ifdef([b4_lex_param], b4_lex_param))) + + + +## ------------ ## +## Data Types. ## +## ------------ ## + +# b4_int_type(MIN, MAX) +# --------------------- +# Return the smallest int type able to handle numbers ranging from +# MIN to MAX (included). Overwrite the version from c.m4, which +# uses only C89 types, so that the user can override the shorter +# types, and so that pre-C89 compilers are handled correctly. +m4_define([b4_int_type], +[m4_if(b4_ints_in($@, [0], [255]), [1], [yytype_uint8], + b4_ints_in($@, [-128], [127]), [1], [yytype_int8], + + b4_ints_in($@, [0], [65535]), [1], [yytype_uint16], + b4_ints_in($@, [-32768], [32767]), [1], [yytype_int16], + + m4_eval([0 <= $1]), [1], [unsigned int], + + [int])]) + + +## ----------------- ## +## Semantic Values. ## +## ----------------- ## + + +# b4_lhs_value([TYPE]) +# -------------------- +# Expansion of $$. +m4_define([b4_lhs_value], +[(pv->yyval[]m4_ifval([$1], [.$1]))]) + + +# b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) +# -------------------------------------- +# Expansion of $NUM, where the current rule has RULE-LENGTH +# symbols on RHS. +m4_define([b4_rhs_value], +[(pv->yyvsp@{($2) - ($1)@}m4_ifval([$3], [.$3]))]) + +m4_define([b4_rhs_value_no_pv], +[(yyvsp@{($2) - ($1)@}m4_ifval([$3], [.$3]))]) + + +## ----------- ## +## Locations. ## +## ----------- ## + +# b4_lhs_location() +# ----------------- +# Expansion of @$. +m4_define([b4_lhs_location], +[(pv->yyloc)]) + + +# b4_rhs_location(RULE-LENGTH, NUM) +# --------------------------------- +# Expansion of @NUM, where the current rule has RULE-LENGTH symbols +# on RHS. +m4_define([b4_rhs_location], +[(pv->yylsp@{($2) - ($1)@})]) + +m4_define([b4_rhs_location_no_pv], +[(yylsp@{($2) - ($1)@})]) + + + +## --------------------------------------------------------- ## +## Defining symbol actions, e.g., printers and destructors. ## +## --------------------------------------------------------- ## + +# We do want M4 expansion after # for CPP macros. +m4_changecom() +m4_divert(0)dnl +@output @output_parser_name@ +b4_copyright([Skeleton parser for Yacc-like parsing with Bison], + [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])[ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +]b4_identification +m4_if(b4_prefix, [yy], [], +[/* Substitute the variable and function names. */ +#define yyparse b4_prefix[]parse +#define yypvarsinit b4_prefix[]pvarsinit +#define yylex b4_prefix[]lex +#define yyerror b4_prefix[]error +#define yylval b4_prefix[]lval +#define yychar b4_prefix[]char +#define yydebug b4_prefix[]debug +#define yynerrs b4_prefix[]nerrs +b4_location_if([#define yylloc b4_prefix[]lloc])]) +m4_define([b4_yychar],[b4_pure_if([(pv->yychar)],b4_push_if([(pv->yychar)],yychar))]) +m4_define([b4_yylval],[b4_pure_if([(pv->yylval)],b4_push_if([(pv->yylval)],yylval))]) +m4_define([b4_yynerrs],[b4_pure_if([(pv->yynerrs)],[b4_push_if([(pv->yynerrs)],[yynerrs])])]) +m4_define([b4_yylloc],[b4_pure_if([(pv->yylloc)],b4_push_if([(pv->yylloc)],yylloc))])[ + +]b4_token_enums_defines(b4_tokens)[ + +/* Copy the first part of user declarations. */ +]b4_pre_prologue[ + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG ]b4_debug[ +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE ]b4_error_verbose[ +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE ]b4_token_table[ +#endif + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +]m4_ifdef([b4_stype], +[typedef union[]m4_bregexp(b4_stype, [^{], [ YYSTYPE]) +b4_stype +/* Line __line__ of yacc.c. */ +b4_syncline([@oline@], [@ofile@]) + YYSTYPE;], +[typedef int YYSTYPE;])[ +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + +]b4_location_if([#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif +])[ + +/* Copy the second part of user declarations. */ +]b4_post_prologue + +/* Line __line__ of yacc.c. */ +b4_syncline([@oline@], [@ofile@])[ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif ]b4_c_modern[ +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && ]b4_c_modern[ +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +]b4_c_function_def([YYID], [static int], [[int i], [i]])[ +{ + return i; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && ]b4_c_modern[ +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && ]b4_c_modern[ +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && ]b4_c_modern[ +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (]b4_location_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss; + YYSTYPE yyvs; + ]b4_location_if([ YYLTYPE yyls; +])dnl +[}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +]b4_location_if( +[# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAXIMUM)], +[# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM)])[ + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, pv->Stack, yysize); \ + pv->Stack = &yyptr->Stack; \ + yynewbytes = pv->yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL ]b4_final_state_number[ +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST ]b4_last[ + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS ]b4_tokens_number[ +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS ]b4_nterms_number[ +/* YYNRULES -- Number of rules. */ +#define YYNRULES ]b4_rules_number[ +/* YYNRULES -- Number of states. */ +#define YYNSTATES ]b4_states_number[ + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK ]b4_undef_token_number[ +#define YYMAXUTOK ]b4_user_token_number_max[ + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const ]b4_int_type_for([b4_translate])[ yytranslate[] = +{ + ]b4_translate[ +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const ]b4_int_type_for([b4_prhs])[ yyprhs[] = +{ + ]b4_prhs[ +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const ]b4_int_type_for([b4_rhs])[ yyrhs[] = +{ + ]b4_rhs[ +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const ]b4_int_type_for([b4_rline])[ yyrline[] = +{ + ]b4_rline[ +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + ]b4_tname[ +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const ]b4_int_type_for([b4_toknum])[ yytoknum[] = +{ + ]b4_toknum[ +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const ]b4_int_type_for([b4_r1])[ yyr1[] = +{ + ]b4_r1[ +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const ]b4_int_type_for([b4_r2])[ yyr2[] = +{ + ]b4_r2[ +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const ]b4_int_type_for([b4_defact])[ yydefact[] = +{ + ]b4_defact[ +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const ]b4_int_type_for([b4_defgoto])[ yydefgoto[] = +{ + ]b4_defgoto[ +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF ]b4_pact_ninf[ +static const ]b4_int_type_for([b4_pact])[ yypact[] = +{ + ]b4_pact[ +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const ]b4_int_type_for([b4_pgoto])[ yypgoto[] = +{ + ]b4_pgoto[ +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF ]b4_table_ninf[ +static const ]b4_int_type_for([b4_table])[ yytable[] = +{ + ]b4_table[ +}; + +static const ]b4_int_type_for([b4_check])[ yycheck[] = +{ + ]b4_check[ +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const ]b4_int_type_for([b4_stos])[ yystos[] = +{ + ]b4_stos[ +}; + +#define yyerrok (pv->yyerrstatus = 0) +#define yyclearin (]b4_yychar[ = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!pv->yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (]b4_yychar[ == YYEMPTY && yylen == 1) \ + { \ + ]b4_yychar[ = (Token); \ + ]b4_yylval[ = (Value); \ + yytoken = YYTRANSLATE (]b4_yychar[); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (]b4_pure_if([&]b4_yylval[[]b4_location_if([, &]b4_yylloc[]), ])[YYLEX_PARAM) +#else +# define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[ +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value]b4_location_if([, Location])[]b4_user_args[); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + +]b4_yy_symbol_print_generate([b4_c_function_def])[ + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +]b4_c_function_def([yy_stack_print], [static void], + [[yytype_int16 *bottom], [bottom]], + [[yytype_int16 *top], [top]])[ +{ + YYFPRINTF (stderr, "Stack now"); + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +]b4_c_function_def([yy_reduce_print], [static void], + [[YYSTYPE *yyvsp], [yyvsp]], + b4_location_if([[[YYLTYPE *yylsp], [yylsp]],]) + [[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,]) + b4_parse_param)[ +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &]b4_rhs_value_no_pv(yynrhs, yyi + 1)[ + ]b4_location_if([, &]b4_rhs_location_no_pv(yynrhs, yyi + 1))[]dnl + b4_user_args[); + fprintf (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (pv->yyvsp, ]b4_location_if([pv->yylsp, ])[Rule]b4_user_args[); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH ]b4_stack_depth_init[ +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH ]b4_stack_depth_max[ +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +]b4_c_function_def([yystrlen], [static YYSIZE_T], + [[const char *yystr], [yystr]])[ +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +]b4_c_function_def([yystpcpy], [static char *], + [[char *yydest], [yydest]], [[const char *yysrc], [yysrc]])[ +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + size_t yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn < YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +]b4_yydestruct_generate([b4_c_function_def])[ + + +/* Prevent warnings from -Wmissing-prototypes. */ + +#ifdef YYPARSE_PARAM +]b4_c_function_decl([yyparse], [int], + [[void *YYPARSE_PARAM], [YYPARSE_PARAM]])[ +#elif YYPUSH +]b4_c_function_decl([get_yyresult], [int], [[void *PVVOID], [PVVOID]])[ +]b4_c_function_decl([set_yychar], [void], [[void *PVVOID], [PVVOID]], [[int yychar], [yychar]])[ +]b4_c_function_decl([yypvarsinit], [void *], [[void], []])[ +]b4_c_function_decl([yyparse], [void], + [[void *PVVOID], [PVVOID]])[ +#else /* ! YYPARSE_PARAM */ +]b4_c_function_decl([yyparse], [int], b4_parse_param)[ +#endif /* ! YYPARSE_PARAM */ + + +]m4_divert_push([KILL])# ======================== M4 code. +# b4_declare_parser_variables +# --------------------------- +# Declare the variables that are global, or local to YYPARSE if +# pure-parser. +m4_define([b4_declare_parser_variables], +[/* The look-ahead symbol. */ +int yychar; + +/* The semantic value of the look-ahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs;b4_location_if([ +/* Location data for the look-ahead symbol. */ +YYLTYPE yylloc;]) +]) + +m4_define([b4_init_parser_variables],[ + b4_yychar = YYEMPTY; /* Cause a token to be read. */ + b4_yynerrs = 0; +b4_location_if([[ +#if YYLTYPE_IS_TRIVIAL + /* Initialize the default location before parsing starts. */ + ]b4_yylloc[.first_line = ]b4_yylloc[.last_line = 1; + ]b4_yylloc[.first_column = ]b4_yylloc[.last_column = 0; +#endif +]])]) + +# b4_declare_yyparse_variables +# ---------------------------- +# Declare all the variables that are needed local to YYPARSE +m4_define([b4_declare_yyparse_variables], +[[struct yypvars + { +]]b4_declare_parser_variables[[ + int yystate; + int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg; + YYSIZE_T yymsg_alloc; +#endif + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp;]]b4_location_if([[[ + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2];]]])[ +#define YYPOPSTACK(N) (pv->yyvsp -= (N), pv->yyssp -= (N)]b4_location_if([[, pv->yylsp -= (N)]])[) + YYSIZE_T yystacksize; + int yylen; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + /* Used to determine if this is the first time this instance has + been used. */ + int yynew;]b4_location_if([YYLTYPE yyloc;])[ + }; + +/* Init the parser data structure. Use malloc, should perhaps use a + system dependent equivalent function. */ +void* +yypvarsinit (void) +{ + struct yypvars *pv; + pv= (struct yypvars *) malloc(sizeof(struct yypvars)); + pv->yystate = 0; + pv->yyresult = -1; + pv->yyerrstatus = 0; + pv->yytoken = 0; + +#if YYERROR_VERBOSE + pv->yymsg = pv->yymsgbuf; + pv->yymsg_alloc = sizeof pv->yymsgbuf; +#endif + + pv->yyss = pv->yyssa; + pv->yyvs = pv->yyvsa; + + ]b4_location_if([pv->yyls = pv->yylsa;])[ + pv->yystacksize = YYINITDEPTH; + + pv->yyssp = pv->yyss; + pv->yyvsp = pv->yyvs; + + pv->yynew = 1; + +]b4_location_if([ pv->yylsp = pv->yyls;])[ + /* Init parser variables */ + ]b4_init_parser_variables()[ + + return (void*) pv; +} + +int +get_yyresult (void *PVVOID) +{ + struct yypvars *pv = (struct yypvars*)PVVOID; + return pv->yyresult; +} + +void +set_yychar (void *PVVOID, int yychar) +{ + struct yypvars *pv = (struct yypvars*)PVVOID; + if (pv) + pv->yychar = yychar; +}]) +m4_divert_pop([KILL])dnl# ====================== End of M4 code. + +b4_pure_if([], b4_push_if([], + [b4_declare_parser_variables])) + +b4_declare_yyparse_variables + +/*----------. +| yyparse. | +`----------*/ + +#ifdef YYPARSE_PARAM +b4_c_function_def([yyparse], [int], [[void *YYPARSE_PARAM], [YYPARSE_PARAM]]) +#elif YYPUSH +b4_c_function_def([yyparse], [void], [[void *PVVOID], [PVVOID]]) +#else /* ! YYPARSE_PARAM */ +b4_c_function_def([yyparse], [int], b4_parse_param) +#endif +{[ + ]b4_pure_if([b4_declare_parser_variables])[ + struct yypvars *pv; + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + YYDPRINTF ((stderr, "Starting parse\n")); + + ]b4_push_if([pv = (struct yypvars*)PVVOID;],[pv = yypvarsinit ();])[ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + ]b4_push_if([],[b4_init_parser_variables])[ + +]m4_ifdef([b4_initial_action], [ +m4_pushdef([b4_at_dollar], [m4_define([b4_at_dollar_used])]b4_yylloc[])dnl +m4_pushdef([b4_dollar_dollar], [m4_define([b4_dollar_dollar_used])]b4_yylval[])dnl + /* User initialization code. */ +b4_initial_action +m4_popdef([b4_dollar_dollar])dnl +m4_popdef([b4_at_dollar])dnl +/* Line __line__ of yacc.c. */ +b4_syncline([@oline@], [@ofile@]) +])dnl +m4_ifdef([b4_dollar_dollar_used],[[ pv->yyvsp[0] = ]b4_yylval[; +]])dnl +m4_ifdef([b4_at_dollar_used], [[ pv->yylsp[0] = ]b4_yylloc[; +]])dnl +[ ]b4_push_if([ + if (pv->yynew == 0) goto gottoken; + pv->yynew= 0;])[ + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + pv->yyssp++; + + yysetstate: + *pv->yyssp = pv->yystate; + + if (pv->yyss + pv->yystacksize - 1 <= pv->yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = pv->yyssp - pv->yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; +]b4_location_if([ YYLTYPE *yyls1 = yyls;])[ + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), +]b4_location_if([ &yyls1, yysize * sizeof (*yylsp),])[ + &pv->yystacksize); +]b4_location_if([ yyls = yyls1;])[ + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= pv->yystacksize) + goto yyexhaustedlab; + pv->yystacksize *= 2; + if (YYMAXDEPTH < pv->yystacksize) + pv->yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss; + YYSTYPE *yyvs;]b4_location_if([YYLTYPE *yyls;])[ + + yytype_int16 *yyss1 = pv->yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (pv->yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); +]b4_location_if([ YYSTACK_RELOCATE (yyls);])[ +# undef YYSTACK_RELOCATE + if (yyss1 != pv->yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + pv->yyssp = pv->yyss + yysize - 1; + pv->yyvsp = pv->yyvs + yysize - 1; +]b4_location_if([ pv->yylsp = pv->yyls + yysize - 1;])[ + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) pv->yystacksize)); + + if (pv->yyss + pv->yystacksize - 1 <= pv->yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", pv->yystate)); + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + look-ahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to look-ahead token. */ + pv->yyn = yypact[pv->yystate]; + if (pv->yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a look-ahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + if (]b4_yychar[ == YYEMPTY) + { + ]b4_push_if([ + YYDPRINTF ((stderr, "Returns for a new token: ")); + pv->yyresult= 4; + return; +gottoken: + YYDPRINTF((stderr, "\nGot token %d", pv->yychar));],[ + YYDPRINTF ((stderr, "Reading a token: ")); + ]b4_yychar[ = YYLEX;])[ + } + + if (]b4_yychar[ <= YYEOF) + { + ]b4_yychar[ = pv->yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + pv->yytoken = YYTRANSLATE (]b4_yychar[); + YY_SYMBOL_PRINT ("Next token is", pv->yytoken, &]b4_yylval[, &]b4_yylloc[); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + pv->yyn += pv->yytoken; + if (pv->yyn < 0 || YYLAST < pv->yyn || yycheck[pv->yyn] != pv->yytoken) + goto yydefault; + pv->yyn = yytable[pv->yyn]; + if (pv->yyn <= 0) + { + if (pv->yyn == 0 || pv->yyn == YYTABLE_NINF) + goto yyerrlab; + pv->yyn = -pv->yyn; + goto yyreduce; + } + + if (pv->yyn == YYFINAL) + YYACCEPT; + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (pv->yyerrstatus) + pv->yyerrstatus--; + + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", pv->yytoken, &]b4_yylval[, &]b4_yylloc[); + + /* Discard the shifted token unless it is eof. */ + if (]b4_yychar[ != YYEOF) + ]b4_yychar[ = YYEMPTY; + + pv->yystate = pv->yyn; + *++(pv->yyvsp) = ]b4_yylval[; +]b4_location_if([ *++(pv->yylsp) = ]b4_yylloc[;])[ + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + pv->yyn = yydefact[pv->yystate]; + if (pv->yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + pv->yylen = yyr2[pv->yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + pv->yyval = pv->yyvsp[1-pv->yylen]; + +]b4_location_if( +[[ /* Default location. */ + YYLLOC_DEFAULT (pv->yyloc, (pv->yylsp - pv->yylen), pv->yylen);]])[ + YY_REDUCE_PRINT (pv->yyn); + switch (pv->yyn) + { + ]b4_actions +/* Line __line__ of yacc.c. */ +b4_syncline([@oline@], [@ofile@])[ + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[pv->yyn], &pv->yyval, &pv->yyloc); + + YYPOPSTACK (pv->yylen); + pv->yylen = 0; + YY_STACK_PRINT (pv->yyss, pv->yyssp); + + *++(pv->yyvsp) = pv->yyval; +]b4_location_if([ *++(pv->yylsp) = pv->yyloc;])[ + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + pv->yyn = yyr1[pv->yyn]; + + pv->yystate = yypgoto[pv->yyn - YYNTOKENS] + *pv->yyssp; + if (0 <= pv->yystate && pv->yystate <= YYLAST && yycheck[pv->yystate] == *pv->yyssp) + pv->yystate = yytable[pv->yystate]; + else + pv->yystate = yydefgoto[pv->yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!pv->yyerrstatus) + { + ++]b4_yynerrs[; +#if ! YYERROR_VERBOSE + yyerror (]b4_yyerror_args[YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, pv->yystate, ]b4_yychar[); + if (pv->yymsg_alloc < yysize && pv->yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (pv->yymsg != pv->yymsgbuf) + YYSTACK_FREE (pv->yymsg); + pv->yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (pv->yymsg) + pv->yymsg_alloc = yyalloc; + else + { + pv->yymsg = pv->yymsgbuf; + pv->yymsg_alloc = sizeof pv->yymsgbuf; + } + } + + if (0 < yysize && yysize <= pv->yymsg_alloc) + { + (void) yysyntax_error (pv->yymsg, pv->yystate, ]b4_yychar[); + yyerror (]b4_yyerror_args[pv->yymsg); + } + else + { + yyerror (]b4_yyerror_args[YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + +]b4_location_if([[ pv->yyerror_range[0] = ]b4_yylloc[;]])[ + + if (pv->yyerrstatus == 3) + { + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ + + if (]b4_yychar[ <= YYEOF) + { + /* Return failure if at end of input. */ + if (]b4_yychar[ == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + pv->yytoken, &]b4_yylval[]b4_location_if([, &]b4_yylloc[])[]b4_user_args[); + ]b4_yychar[ = YYEMPTY; + } + } + + /* Else will try to reuse look-ahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + +]b4_location_if([[ pv->yyerror_range[0] = pv->yylsp[1-pv->yylen]; +]])[ /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (pv->yylen); + pv->yylen = 0; + YY_STACK_PRINT (pv->yyss, pv->yyssp); + pv->yystate = *pv->yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + pv->yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + pv->yyn = yypact[pv->yystate]; + if (pv->yyn != YYPACT_NINF) + { + pv->yyn += YYTERROR; + if (0 <= pv->yyn && pv->yyn <= YYLAST && yycheck[pv->yyn] == YYTERROR) + { + pv->yyn = yytable[pv->yyn]; + if (0 < pv->yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (pv->yyssp == pv->yyss) + YYABORT; + +]b4_location_if([[ pv->yyerror_range[0] = *pv->yylsp;]])[ + yydestruct ("Error: popping", + yystos[pv->yystate], pv->yyvsp]b4_location_if([, pv->yylsp])[]b4_user_args[); + YYPOPSTACK (1); + pv->yystate = *pv->yyssp; + YY_STACK_PRINT (pv->yyss, pv->yyssp); + } + + if (pv->yyn == YYFINAL) + YYACCEPT; + + *++(pv->yyvsp) = ]b4_yylval[; +]b4_location_if([[ + pv->yyerror_range[1] = ]b4_yylloc[; + /* Using YYLLOC is tempting, but would change the location of + the look-ahead. YYLOC is available though. */ + YYLLOC_DEFAULT (pv->yyloc, (pv->yyerror_range - 1), 2); + *++(pv->yylsp) = pv->yyloc;]])[ + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[pv->yyn], pv->yyvsp, pv->yylsp); + + pv->yystate = pv->yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + pv->yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + pv->yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (]b4_yyerror_args[YY_("memory exhausted")); + pv->yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (]b4_yychar[ != YYEOF && ]b4_yychar[ != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + pv->yytoken, &]b4_yylval[]b4_location_if([, &]b4_yylloc[])[]b4_user_args[); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (pv->yylen); + YY_STACK_PRINT (pv->yyss, pv->yyssp); + while (pv->yyssp != pv->yyss) + { + yydestruct ("Cleanup: popping", + yystos[*pv->yyssp], pv->yyvsp]b4_location_if([, pv->yylsp])[]b4_user_args[); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (pv->yyss != pv->yyssa) + YYSTACK_FREE (pv->yyss); +#endif +#if YYERROR_VERBOSE + if (pv->yymsg != pv->yymsgbuf) + YYSTACK_FREE (pv->yymsg); +#endif + + ]b4_push_if([],[{ + int yyresult = pv->yyresult; + free (pv); + return yyresult;}])[ +]} + + +b4_epilogue +m4_if(b4_defines_flag, 0, [], +[@output @output_header_name@ +b4_copyright([Skeleton parser for Yacc-like parsing with Bison], + [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006]) + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +b4_token_enums_defines(b4_tokens) + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +m4_ifdef([b4_stype], +[typedef union[]m4_bregexp(b4_stype, [^{], [ YYSTYPE]) +b4_stype +/* Line __line__ of yacc.c. */ +b4_syncline([@oline@], [@ofile@]) + YYSTYPE;], +[typedef int YYSTYPE;]) +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + +b4_pure_if([], +[extern YYSTYPE b4_prefix[]lval;]) + +b4_location_if( +[#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + +m4_if(b4_pure, [0], +[extern YYLTYPE b4_prefix[]lloc;]) +]) +]) Index: src/getargs.c =================================================================== RCS file: /cvsroot/bison/bison/src/getargs.c,v retrieving revision 1.66 diff -u -r1.66 getargs.c --- src/getargs.c 3 Jan 2006 19:12:55 -0000 1.66 +++ src/getargs.c 7 Apr 2006 09:30:31 -0000 @@ -58,6 +58,7 @@ bool nondeterministic_parser = false; bool glr_parser = false; bool pure_parser = false; +bool push_parser = false; const char *skeleton = NULL; const char *include = NULL; Index: src/getargs.h =================================================================== RCS file: /cvsroot/bison/bison/src/getargs.h,v retrieving revision 1.28 diff -u -r1.28 getargs.h --- src/getargs.h 24 Jul 2005 07:24:22 -0000 1.28 +++ src/getargs.h 7 Apr 2006 09:30:31 -0000 @@ -50,6 +50,11 @@ extern bool pure_parser; +/* PUSH_PARSER is true if should generate a parser that is capble of being + called asynchronously. Is must be pure and reentrant. */ + +extern bool push_parser; + /* NONDETERMINISTIC_PARSER is true iff conflicts are accepted. This is used by the GLR parser, and might be used in BackTracking parsers too. */ Index: src/output.c =================================================================== RCS file: /cvsroot/bison/bison/src/output.c,v retrieving revision 1.245 diff -u -r1.245 output.c --- src/output.c 21 Jan 2006 04:35:09 -0000 1.245 +++ src/output.c 7 Apr 2006 09:30:31 -0000 @@ -590,6 +590,7 @@ MUSCLE_INSERT_BOOL ("error_verbose", error_verbose); MUSCLE_INSERT_BOOL ("locations_flag", locations_flag); MUSCLE_INSERT_BOOL ("pure", pure_parser); + MUSCLE_INSERT_BOOL ("push", push_parser); MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag); /* File names. */ Index: src/parse-gram.y =================================================================== RCS file: /cvsroot/bison/bison/src/parse-gram.y,v retrieving revision 1.73 diff -u -r1.73 parse-gram.y --- src/parse-gram.y 30 Jan 2006 09:00:40 -0000 1.73 +++ src/parse-gram.y 7 Apr 2006 09:30:31 -0000 @@ -78,7 +78,6 @@ %locations %pure-parser %error-verbose -%defines %name-prefix="gram_" %initial-action @@ -149,6 +148,7 @@ PERCENT_OUTPUT "%output" PERCENT_PARSE_PARAM "%parse-param {...}" PERCENT_PURE_PARSER "%pure-parser" + PERCENT_PUSH_PARSER "%push-parser" PERCENT_REQUIRE "%require" PERCENT_SKELETON "%skeleton" PERCENT_START "%start" @@ -245,6 +245,7 @@ | "%output" "=" string_content { spec_outfile = $3; } | "%parse-param {...}" { add_param ("parse_param", $1, @1); } | "%pure-parser" { pure_parser = true; } +| "%push-parser" { push_parser = true; } | "%require" string_content { version_check (&@2, $2); } | "%skeleton" string_content { skeleton = $2; } | "%token-table" { token_table_flag = true; } Index: src/scan-gram.l =================================================================== RCS file: /cvsroot/bison/bison/src/scan-gram.l,v retrieving revision 1.86 diff -u -r1.86 scan-gram.l --- src/scan-gram.l 3 Apr 2006 13:50:10 -0000 1.86 +++ src/scan-gram.l 7 Apr 2006 09:30:31 -0000 @@ -245,6 +245,7 @@ "%prec" rule_length--; return PERCENT_PREC; "%printer" token_type = PERCENT_PRINTER; BEGIN SC_PRE_CODE; "%pure"[-_]"parser" return PERCENT_PURE_PARSER; + "%push"[-_]"parser" return PERCENT_PUSH_PARSER; "%require" return PERCENT_REQUIRE; "%right" return PERCENT_RIGHT; "%skeleton" return PERCENT_SKELETON; --=-=-= If you have this patch installed, then run this benchmarking script with Bison in your path. To exercise a built non-installed bison, the easiest is to use the script "bison" in tests/. --=-=-= Content-Type: text/x-perl Content-Disposition: inline; filename=bench.pl Content-Transfer-Encoding: quoted-printable #! /usr/bin/perl -w use IO::File; use Benchmark qw (:all); my $bison =3D $ENV{'BISON'} || 'bison'; ################################################################## sub triangular_grammar ($$$) { my ($base, $max, $directives) =3D @_; my $out =3D new IO::File ">$base.y" or die; print $out < #include static int yylex (void); static void yyerror (const char *msg); %} %union { int val; }; %token END "end" %type exp input EOF for my $size (1 .. $max) { print $out "%token t$size $size \"$size\"\n"; }; print $out < $max) return 0; else if (inner > outer) { inner =3D 1; ++outer; return END; } return inner++; } static void yyerror (const char *msg) { fprintf (stderr, "%s\\n", msg); } int main (void) { yydebug =3D !!getenv ("YYDEBUG"); return yyparse (); } EOF } ################################################################## sub calc_input ($$) { my ($base, $max) =3D @_; my $out =3D new IO::File ">$base.input" or die; foreach (1 .. $max) { print $out "0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21+2= 2+23+24+25+26+27+28+29+30+31+32+33+34+35+36+37+38+39+40+41+42+43+44+45+46+4= 7+48+49+50+51+52+53+54+55+56+57+58+59+60+61+62+63+64+65+66+67+68+69+70+71+7= 2+73+74+75+76+77+78+79+80+81+82+83+84+85+86+87+88+89+90+91+92+93+94+95+96+9= 7+98+99\n"; print $out "1+1*(2+2*(3+3*(4+4*(5+5*(6+6*(7+7*(8+8*(9+9*(10+10*(11+11= *(12+12*(13+13*(14+14*(15+15*(16+16*(17+17*(18+18*(19+19*(20+20*(21+21*(22+= 22*(23+23*(24+24*(25+25*(26+26*(27+27*(28+28*(29+29*(30+30*(31+31*(32+32*(3= 3+33*(34+34*(35+35*(36+36*(37+37*(38+38*(39+39*(40+40*(41+41*(42+42*(43+43*= (44+44*(45+45*(46+46*(47+47*(48+48*(49+49*(50+50*(51+51*(52+52*(53+53*(54+5= 4*(55+55*(56+56*(57+57*(58+58*(59+59*(60+60*(61+61*(62+62*(63+63*(64+64*(65= +65*(66+66*(67+67*(68+68*(69+69*(70+70*(71+71*(72+72*(73+73*(74+74*(75+75*(= 76+76*(77+77*(78+78*(79+79*(80+80*(81+81*(82+82*(83+83*(84+84*(85+85*(86+86= *(87+87*(88+88*(89+89*(90+90*(91+91*(92+92*(93+93*(94+94*(95+95*(96+96*(97+= 97*(98+98*(99+99*(100+100*(101+101*(102+102*(103+103*(104+104*(105+105*(106= +106*(107+107*(108+108*(109+109*(110+110*(111+111*(112+112*(113+113*(114+11= 4*(115+115*(116+116*(117+117*(118+118*(119+119*(120+120*(121+121*(122+122*(= 123+123*(124+124*(125+125*(126+126*(127+127*(128+128*(129+129*(130+130*(131= +131*(132+132*(133+133*(134+134*(135+135*(136+136*(137+137*(138+138*(139+13= 9*(140+140*(141+141*(142+142*(143+143*(144+144*(145+145*(146+146*(147+147*(= 148+148*(149+149*(150+150*(151+151*(152+152*(153+153*(154+154*(155+155*(156= +156*(157+157*(158+158*(159+159*(160+160*(161+161*(162+162*(163+163*(164+16= 4*(165+165*(166+166*(167+167*(168+168*(169+169*(170+170*(171+171*(172+172*(= 173+173*(174+174*(175+175*(176+176*(177+177*(178+178*(179+179*(180+180*(181= +181*(182+182*(183+183*(184+184*(185+185*(186+186*(187+187*(188+188*(189+18= 9*(190+190*(191+191*(192+192*(193+193*(194+194*(195+195*(196+196*(197+197*(= 198+198*(199+199*(200+200*(201+201*(202+202*(203+203*(204+204*(205+205*(206= +206*(207+207*(208+208*(209+209*(210+210*(211+211*(212+212*(213+213*(214+21= 4*(215+215*(216+216*(217+217*(218+218*(219+219*(220+220*(221+221*(222+222*(= 223+223*(224+224*(225+225*(226+226*(227+227*(228+228*(229+229*(230+230*(231= +231*(232+232*(233+233*(234+234*(235+235*(236+236*(237+237*(238+238*(239+23= 9*(240+240*(241+241*(242+242*(243+243*(244+244*(245+245*(246+246*(247+247*(= 248+248*(249+249*(250+250*(251+251*(252+252*(253+253*(254+254*(255+255*(256= +256*(257+257*(258+258*(259+259*(260+260*(261+261*(262+262*(263+263*(264+26= 4*(265+265*(266+266*(267+267*(268+268*(269+269*(270+270*(271+271*(272+272*(= 273+273*(274+274*(275+275*(276+276*(277+277*(278+278*(279+279*(280+280*(281= +281*(282+282*(283+283*(284+284*(285+285*(286+286*(287+287*(288+288*(289+28= 9*(290+290*(291+291*(292+292*(293+293*(294+294*(295+295*(296+296*(297+297*(= 298+298*(299+299*(300+300*(301+301*(302+302*(303+303*(304+304*(305+305*(306= +306*(307+307*(308+308*(309+309*(310+310*(311+311*(312+312*(313+313*(314+31= 4*(315+315*(316+316*(317+317*(318+318*(319+319*(320+320*(321+321*(322+322*(= 323+323*(324+324*(325+325*(326+326*(327+327*(328+328*(329+329*(330+330*(331= +331*(332+332*(333+333*(334+334*(335+335*(336+336*(337+337*(338+338*(339+33= 9*(340+340*(341+341*(342+342*(343+343*(344+344*(345+345*(346+346*(347+347*(= 348+348*(349+349*(350+350*(351+351*(352+352*(353+353*(354+354*(355+355*(356= +356*(357+357*(358+358*(359+359*(360+360*(361+361*(362+362*(363+363*(364+36= 4*(365+365*(366+366*(367+367*(368+368*(369+369*(370+370*(371+371*(372+372*(= 373+373*(374+374*(375+375*(376+376*(377+377*(378+378*(379+379*(380+380*(381= +381*(382+382*(383+383*(384+384*(385+385*(386+386*(387+387*(388+388*(389+38= 9*(390+390*(391+391*(392+392*(393+393*(394+394*(395+395*(396+396*(397+397*(= 398+398*(399+399*(400+400*(401+401*(402+402*(403+403*(404+404*(405+405*(406= +406*(407+407*(408+408*(409+409*(410+410*(411+411*(412+412*(413+413*(414+41= 4*(415+415*(416+416*(417+417*(418+418*(419+419*(420+420*(421+421*(422+422*(= 423+423*(424+424*(425+425*(426+426*(427+427*(428+428*(429+429*(430+430*(431= +431*(432+432*(433+433*(434+434*(435+435*(436+436*(437+437*(438+438*(439+43= 9*(440+440*(441+441*(442+442*(443+443*(444+444*(445+445*(446+446*(447+447*(= 448+448*(449+449*(450+450*(451+451*(452+452*(453+453*(454+454*(455+455*(456= +456*(457+457*(458+458*(459+459*(460+460*(461+461*(462+462*(463+463*(464+46= 4*(465+465*(466+466*(467+467*(468+468*(469+469*(470+470*(471+471*(472+472*(= 473+473*(474+474*(475+475*(476+476*(477+477*(478+478*(479+479*(480+480*(481= +481*(482+482*(483+483*(484+484*(485+485*(486+486*(487+487*(488+488*(489+48= 9*(490+490*(491+491*(492+492*(493+493*(494+494*(495+495*(496+496*(497+497*(= 498+498*(499+499*(500+500*(501+501*(502+502*(503+503*(504+504*(505+505*(506= +506*(507+507*(508+508*(509+509*(510+510*(511+511*(512+512*(513+513*(514+51= 4*(515+515*(516+516*(517+517*(518+518*(519+519*(520+520*(521+521*(522+522*(= 523+523*(524+524*(525+525*(526+526*(527+527*(528+528*(529+529*(530+530*(531= +531*(532+532*(533+533*(534+534*(535+535*(536+536*(537+537*(538+538*(539+53= 9*(540+540*(541+541*(542+542*(543+543*(544+544*(545+545*(546+546*(547+547*(= 548+548*(549+549*(550+550*(551+551*(552+552*(553+553*(554+554*(555+555*(556= +556*(557+557*(558+558*(559+559*(560+560*(561+561*(562+562*(563+563*(564+56= 4*(565+565*(566+566*(567+567*(568+568*(569+569*(570+570*(571+571*(572+572*(= 573+573*(574+574*(575+575*(576+576*(577+577*(578+578*(579+579*(580+580*(581= +581*(582+582*(583+583*(584+584*(585+585*(586+586*(587+587*(588+588*(589+58= 9*(590+590*(591+591*(592+592*(593+593*(594+594*(595+595*(596+596*(597+597*(= 598+598*(599+599*(600+600*(601+601*(602+602*(603+603*(604+604*(605+605*(606= +606*(607+607*(608+608*(609+609*(610+610*(611+611*(612+612*(613+613*(614+61= 4*(615+615*(616+616*(617+617*(618+618*(619+619*(620+620*(621+621*(622+622*(= 623+623*(624+624*(625+625*(626+626*(627+627*(628+628*(629+629*(630+630*(631= +631*(632+632*(633+633*(634+634*(635+635*(636+636*(637+637*(638+638*(639+63= 9*(640+640*(641+641*(642+642*(643+643*(644+644*(645+645*(646+646*(647+647*(= 648+648*(649+649*(650+650*(651+651*(652+652*(653+653*(654+654*(655+655*(656= +656*(657+657*(658+658*(659+659*(660+660*(661+661*(662+662*(663+663*(664+66= 4*(665+665*(666+666*(667+667*(668+668*(669+669*(670+670*(671+671*(672+672*(= 673+673*(674+674*(675+675*(676+676*(677+677*(678+678*(679+679*(680+680*(681= +681*(682+682*(683+683*(684+684*(685+685*(686+686*(687+687*(688+688*(689+68= 9*(690+690*(691+691*(692+692*(693+693*(694+694*(695+695*(696+696*(697+697*(= 698+698*(699+699*(700+700*(701+701*(702+702*(703+703*(704+704*(705+705*(706= +706*(707+707*(708+708*(709+709*(710+710*(711+711*(712+712*(713+713*(714+71= 4*(715+715*(716+716*(717+717*(718+718*(719+719*(720+720*(721+721*(722+722*(= 723+723*(724+724*(725+725*(726+726*(727+727*(728+728*(729+729*(730+730*(731= +731*(732+732*(733+733*(734+734*(735+735*(736+736*(737+737*(738+738*(739+73= 9*(740+740*(741+741*(742+742*(743+743*(744+744*(745+745*(746+746*(747+747*(= 748+748*(749+749*(750+750*(751+751*(752+752*(753+753*(754+754*(755+755*(756= +756*(757+757*(758+758*(759+759*(760+760*(761+761*(762+762*(763+763*(764+76= 4*(765+765*(766+766*(767+767*(768+768*(769+769*(770+770*(771+771*(772+772*(= 773+773*(774+774*(775+775*(776+776*(777+777*(778+778*(779+779*(780+780*(781= +781*(782+782*(783+783*(784+784*(785+785*(786+786*(787+787*(788+788*(789+78= 9*(790+790*(791+791*(792+792*(793+793*(794+794*(795+795*(796+796*(797+797*(= 798+798*(799+799*(800+800*(801+801*(802+802*(803+803*(804+804*(805+805*(806= +806*(807+807*(808+808*(809+809*(810+810*(811+811*(812+812*(813+813*(814+81= 4*(815+815*(816+816*(817+817*(818+818*(819+819*(820+820*(821+821*(822+822*(= 823+823*(824+824*(825+825*(826+826*(827+827*(828+828*(829+829*(830+830*(831= +831*(832+832*(833+833*(834+834*(835+835*(836+836*(837+837*(838+838*(839+83= 9*(840+840*(841+841*(842+842*(843+843*(844+844*(845+845*(846+846*(847+847*(= 848+848*(849+849*(850+850*(851+851*(852+852*(853+853*(854+854*(855+855*(856= +856*(857+857*(858+858*(859+859*(860+860*(861+861*(862+862*(863+863*(864+86= 4*(865+865*(866+866*(867+867*(868+868*(869+869*(870+870*(871+871*(872+872*(= 873+873*(874+874*(875+875*(876+876*(877+877*(878+878*(879+879*(880+880*(881= +881*(882+882*(883+883*(884+884*(885+885*(886+886*(887+887*(888+888*(889+88= 9*(890+890*(891+891*(892+892*(893+893*(894+894*(895+895*(896+896*(897+897*(= 898+898*(899+899*(900+900*(901+901*(902+902*(903+903*(904+904*(905+905*(906= +906*(907+907*(908+908*(909+909*(910+910*(911+911*(912+912*(913+913*(914+91= 4*(915+915*(916+916*(917+917*(918+918*(919+919*(920+920*(921+921*(922+922*(= 923+923*(924+924*(925+925*(926+926*(927+927*(928+928*(929+929*(930+930*(931= +931*(932+932*(933+933*(934+934*(935+935*(936+936*(937+937*(938+938*(939+93= 9*(940+940*(941+941*(942+942*(943+943*(944+944*(945+945*(946+946*(947+947*(= 948+948*(949+949*(950+950*(951+951*(952+952*(953+953*(954+954*(955+955*(956= +956*(957+957*(958+958*(959+959*(960+960*(961+961*(962+962*(963+963*(964+96= 4*(965+965*(966+966*(967+967*(968+968*(969+969*(970+970*(971+971*(972+972*(= 973+973*(974+974*(975+975*(976+976*(977+977*(978+978*(979+979*(980+980*(981= +981*(982+982*(983+983*(984+984*(985+985*(986+986*(987+987*(988+988*(989+98= 9*(990+990*(991+991*(992+992*(993+993*(994+994*(995+995*(996+996*(997+997*(= 998+998*(999+999*(1000+1000*(1001))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\n"; } } ################################################################## sub calc_grammar ($$$) { my ($base, $max, $directives) =3D @_; my $out =3D new IO::File ">$base.y" or die; print $out < #include #include #include #define USE(Var) /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; static semantic_value global_result =3D 0; static int global_count =3D 0; %} /* Exercise %union. */ $directives %error-verbose %union { semantic_value ival; }; %{ static int power (int base, int exponent); /* yyerror receives the location if: - %location & %pure & %glr - %location & %pure & %yacc & %parse-param. */ static void yyerror (const char *s); #if YYPURE static int yylex (YYSTYPE* yylvalp); #else static int yylex (void); #endif %} /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=3D' /* comparison */ %left '-' '+' %left '*' '/' %left NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\\n' | exp '\\n' { USE (\$1); } ; exp: NUM { \$\$ =3D \$1; } | exp '=3D' exp { if (\$1 !=3D \$3) fprintf (stderr, "calc: error: %d !=3D %d\\n", \$1, \$3); \$\$ =3D \$1; } | exp '+' exp { \$\$ =3D \$1 + \$3; } | exp '-' exp { \$\$ =3D \$1 - \$3; } | exp '*' exp { \$\$ =3D \$1 * \$3; } | exp '/' exp { \$\$ =3D \$1 / \$3; } | '-' exp %prec NEG { \$\$ =3D -\$2; } | exp '^' exp { \$\$ =3D power (\$1, \$3); } | '(' exp ')' { \$\$ =3D \$2; } | '(' error ')' { \$\$ =3D 1111; } | '!' { \$\$ =3D 0; YYERROR; } | '-' error { \$\$ =3D 0; YYERROR; } ; %% /* The input. */ static FILE *input; static void yyerror (const char *s) { fprintf (stderr, "%s\\n", s); } static int get_char (void) { return getc (input); } static void unget_char ( int c) { ungetc (c, input); } static int read_signed_integer (void) { int c =3D get_char (); int sign =3D 1; int n =3D 0; if (c =3D=3D '-') { c =3D get_char (); sign =3D -1; } while (isdigit (c)) { n =3D 10 * n + (c - '0'); c =3D get_char (); } unget_char (c); return sign * n; } #if YYPUSH static YYSTYPE yylval; #endif static int #if YYPURE # define yylval (*yylvalp) yylex (YYSTYPE* yylvalp) #else yylex (void) #endif { int c; /* Skip white space. */ while ((c =3D get_char ()) =3D=3D ' ' || c =3D=3D '\t') { } /* process numbers */ if (c =3D=3D '.' || isdigit (c)) { unget_char ( c); yylval.ival =3D read_signed_integer (); return NUM; } /* Return end-of-file. */ if (c =3D=3D EOF) return CALC_EOF; /* Return single chars. */ return c; } static int power (int base, int exponent) { int res =3D 1; if (exponent < 0) exit (3); for (/* Niente */; exponent; --exponent) res *=3D base; return res; } #if YYPUSH static int=20 yyparse_wrapper () { struct yypvars *ctx =3D yypvarsinit (); do {=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20 yyparse (ctx);=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 set_yychar (ctx, yylex ());=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20 ctx->yylval =3D yylval; } while (get_yyresult (ctx) !=3D 0);=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 free (ctx);=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 }=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20 #define yyparse yyparse_wrapper #endif int main (int argc, const char **argv) { semantic_value result =3D 0; int count =3D 0; int status; input =3D fopen ("calc.input", "r"); if (!input) { perror ("calc.input"); return 3; } status =3D yyparse (); if (global_result !=3D result) abort (); if (global_count !=3D count) abort (); return status; } EOF } ################################################################## sub compile ($) { my ($base) =3D @_; system ("bison $base.y -o $base.c"); system ("gcc -O2 $base.c -o $base");=20=20 } sub bench_grammar ($) { my ($gram) =3D @_; my %test =3D ( "yacc-yacc" =3D> '', "yacc-pure" =3D> '%pure-parser', "push-yacc" =3D> '%skeleton "push.c"', "push-pure" =3D> '%skeleton "push.c" %pure-parser', "push-push" =3D> '%skeleton "push.c" %push-parser', ); =20=20 my %bench; while (my ($name, $directives) =3D each %test) { print STDERR "$name\n"; my $generator =3D "$gram" . "_grammar"; &$generator ($name, 200, $directives);=20=20 compile ($name); $bench{$name} =3D "system ('./$name');" } print "$gram:\n"; my $res =3D timethese (50, \%bench); cmpthese ($res); } calc_input ('calc', 200); bench_grammar ('calc'); ### Setup "GNU" style for perl-mode and cperl-mode. ## Local Variables: ## perl-indent-level: 2 ## perl-continued-statement-offset: 2 ## perl-continued-brace-offset: 0 ## perl-brace-offset: 0 ## perl-brace-imaginary-offset: 0 ## perl-label-offset: -2 ## cperl-indent-level: 2 ## cperl-brace-offset: 0 ## cperl-continued-brace-offset: 0 ## cperl-label-offset: -2 ## cperl-extra-newline-before-brace: t ## cperl-merge-trailing-else: nil ## cperl-continued-statement-offset: 2 ## End: --=-=-=-- From MAILER-DAEMON Fri Apr 07 09:51:57 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRrNV-0007LV-Hv for mharc-bison-patches@gnu.org; Fri, 07 Apr 2006 09:51:57 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRrNU-0007KB-JV for bison-patches@gnu.org; Fri, 07 Apr 2006 09:51:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRrNS-0007IO-JV for bison-patches@gnu.org; Fri, 07 Apr 2006 09:51:55 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRrNS-0007I5-Fi for bison-patches@gnu.org; Fri, 07 Apr 2006 09:51:54 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FRrRP-0005s9-Oy for bison-patches@gnu.org; Fri, 07 Apr 2006 09:56:00 -0400 Received: from sulaco-eth.lrde.epita.fr ([192.168.101.154]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FRrNP-0000Yn-DY; Fri, 07 Apr 2006 15:51:51 +0200 In-Reply-To: References: <20060317194252.GJ30980@brasko.net> Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <676AFDF2-74E3-492C-B112-72808D051FE0@lrde.epita.fr> Content-Transfer-Encoding: quoted-printable From: Akim Demaille Date: Fri, 7 Apr 2006 15:51:20 +0200 To: Akim Demaille X-Mailer: Apple Mail (2.749.3) Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2006 13:51:57 -0000 Le 7 avr. 06 =E0 14:42, Akim Demaille a =E9crit : > Benchmark: timing 50 iterations of push-pure, push-push, push-yacc, =20= > yacc-pure, yacc-yacc... > push-pure: 64 wallclock secs ( 0.00 usr 0.07 sys + 45.05 cusr =20 > 1.36 csys =3D 46.48 CPU) @ 714.29/s (n=3D50) > push-push: 77 wallclock secs ( 0.00 usr 0.07 sys + 50.53 cusr =20 > 1.56 csys =3D 52.16 CPU) @ 714.29/s (n=3D50) > push-yacc: 66 wallclock secs ( 0.00 usr 0.07 sys + 45.51 cusr =20 > 1.40 csys =3D 46.98 CPU) @ 714.29/s (n=3D50) > yacc-pure: 55 wallclock secs ( 0.00 usr 0.07 sys + 36.98 cusr =20 > 1.25 csys =3D 38.30 CPU) @ 714.29/s (n=3D50) > yacc-yacc: 54 wallclock secs ( 0.00 usr 0.07 sys + 38.12 cusr =20 > 1.23 csys =3D 39.42 CPU) @ 714.29/s (n=3D50) > Rate push-push yacc-yacc yacc-pure push-pure push-yacc > push-push 714/s -- 0% 0% 0% -0% > yacc-yacc 714/s 0% -- 0% 0% -0% > yacc-pure 714/s 0% 0% -- 0% -0% > push-pure 714/s 0% 0% 0% -- -0% > push-yacc 714/s 0% 0% 0% 0% -- > > I confess I don't understand the table output by this Perl module > here. What is this "rate"? Now (that I read the code) I have it: to compute the rate, it sums =20 the usr and sys time for the parent (i.e., the call to "system") =20 which is consistenly 0.07 here for the 50 iterations. Hence, a =20 "rate" of 50/0.07 / 714,285714285714. If I change the cmpthese call into "cmpthese ($res, 'nop')" (nop =20 stands for noparents), and similarly for timethese, then I have =20 better results: No optimization: Benchmark: timing 50 iterations of push-pure, push-push, push-yacc, =20 yacc-pure, yacc-yacc... push-pure: 64 wallclock secs (45.00 cusr + 1.26 csys =3D 46.26 CPU) @ =20= 1.08/s (n=3D50) push-push: 66 wallclock secs (50.38 cusr + 1.21 csys =3D 51.59 CPU) @ =20= 0.97/s (n=3D50) push-yacc: 68 wallclock secs (45.49 cusr + 1.30 csys =3D 46.79 CPU) @ =20= 1.07/s (n=3D50) yacc-pure: 57 wallclock secs (36.95 cusr + 1.17 csys =3D 38.12 CPU) @ =20= 1.31/s (n=3D50) yacc-yacc: 57 wallclock secs (38.06 cusr + 1.17 csys =3D 39.23 CPU) @ =20= 1.27/s (n=3D50) Rate push-push push-yacc push-pure yacc-yacc yacc-pure push-push 0.969/s -- -9% -10% -24% -26% push-yacc 1.07/s 10% -- -1% -16% -19% push-pure 1.08/s 12% 1% -- -15% -18% yacc-yacc 1.27/s 32% 19% 18% -- -3% yacc-pure 1.31/s 35% 23% 21% 3% -- (as an aside, there is no point in not using pure parsers: they are =20 slightly faster. But I'm on a PPC, so I wouldn't be surprised if =20 more stuff be kept in registers, hence easily beating global =20 variables... Maybe the figures would be different on Intel chips). With -O2: Benchmark: timing 50 iterations of push-pure, push-push, push-yacc, =20 yacc-pure, yacc-yacc... push-pure: 30 wallclock secs (20.94 cusr + 0.88 csys =3D 21.82 CPU) @ =20= 2.29/s (n=3D50) push-push: 34 wallclock secs (22.96 cusr + 0.95 csys =3D 23.91 CPU) @ =20= 2.09/s (n=3D50) push-yacc: 30 wallclock secs (21.47 cusr + 0.91 csys =3D 22.38 CPU) @ =20= 2.23/s (n=3D50) yacc-pure: 26 wallclock secs (17.78 cusr + 0.85 csys =3D 18.63 CPU) @ =20= 2.68/s (n=3D50) yacc-yacc: 25 wallclock secs (18.50 cusr + 0.85 csys =3D 19.35 CPU) @ =20= 2.58/s (n=3D50) Rate push-push push-yacc push-pure yacc-yacc yacc-pure push-push 2.09/s -- -6% -9% -19% -22% push-yacc 2.23/s 7% -- -3% -14% -17% push-pure 2.29/s 10% 3% -- -11% -15% yacc-yacc 2.58/s 24% 16% 13% -- -4% yacc-pure 2.68/s 28% 20% 17% 4% -- For fun, -O3: Benchmark: timing 50 iterations of push-pure, push-push, push-yacc, =20 yacc-pure, yacc-yacc... push-pure: 26 wallclock secs (17.99 cusr + 0.84 csys =3D 18.83 CPU) @ =20= 2.66/s (n=3D50) push-push: 28 wallclock secs (19.84 cusr + 0.86 csys =3D 20.70 CPU) @ =20= 2.42/s (n=3D50) push-yacc: 27 wallclock secs (18.46 cusr + 0.89 csys =3D 19.35 CPU) @ =20= 2.58/s (n=3D50) yacc-pure: 22 wallclock secs (15.88 cusr + 0.82 csys =3D 16.70 CPU) @ =20= 2.99/s (n=3D50) yacc-yacc: 22 wallclock secs (16.43 cusr + 0.81 csys =3D 17.24 CPU) @ =20= 2.90/s (n=3D50) Rate push-push push-yacc push-pure yacc-yacc yacc-pure push-push 2.42/s -- -7% -9% -17% -19% push-yacc 2.58/s 7% -- -3% -11% -14% push-pure 2.66/s 10% 3% -- -8% -11% yacc-yacc 2.90/s 20% 12% 9% -- -3% yacc-pure 2.99/s 24% 16% 13% 3% -- sulaco-eth% gcc --version powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 (Apple Computer, Inc. =20 build 5026) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There =20 is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR =20 PURPOSE. From MAILER-DAEMON Fri Apr 07 10:04:48 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRrZw-0003HY-Eb for mharc-bison-patches@gnu.org; Fri, 07 Apr 2006 10:04:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRrZv-0003HA-2Z for bison-patches@gnu.org; Fri, 07 Apr 2006 10:04:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRrZs-0003Da-Bi for bison-patches@gnu.org; Fri, 07 Apr 2006 10:04:46 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRrZs-0003DN-1J for bison-patches@gnu.org; Fri, 07 Apr 2006 10:04:44 -0400 Received: from [68.230.240.37] (helo=eastrmmtao02.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FRrdq-0006sl-D5 for bison-patches@gnu.org; Fri, 07 Apr 2006 10:08:50 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao02.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060407140438.TMLF14821.eastrmmtao02.cox.net@localhost.localdomain>; Fri, 7 Apr 2006 10:04:38 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FRrZx-0000DV-Rt; Fri, 07 Apr 2006 10:04:49 -0400 Date: Fri, 7 Apr 2006 10:04:49 -0400 From: Bob Rossi To: Akim Demaille Message-ID: <20060407140449.GA23931@brasko.net> Mail-Followup-To: Akim Demaille , Bison Patches References: <20060317194252.GJ30980@brasko.net> <676AFDF2-74E3-492C-B112-72808D051FE0@lrde.epita.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <676AFDF2-74E3-492C-B112-72808D051FE0@lrde.epita.fr> User-Agent: Mutt/1.5.9i Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2006 14:04:47 -0000 > >Benchmark: timing 50 iterations of push-pure, push-push, push-yacc, > >yacc-pure, yacc-yacc... > > push-pure: 64 wallclock secs ( 0.00 usr 0.07 sys + 45.05 cusr > >1.36 csys = 46.48 CPU) @ 714.29/s (n=50) > > push-push: 77 wallclock secs ( 0.00 usr 0.07 sys + 50.53 cusr > >1.56 csys = 52.16 CPU) @ 714.29/s (n=50) > > push-yacc: 66 wallclock secs ( 0.00 usr 0.07 sys + 45.51 cusr > >1.40 csys = 46.98 CPU) @ 714.29/s (n=50) > > yacc-pure: 55 wallclock secs ( 0.00 usr 0.07 sys + 36.98 cusr > >1.25 csys = 38.30 CPU) @ 714.29/s (n=50) > > yacc-yacc: 54 wallclock secs ( 0.00 usr 0.07 sys + 38.12 cusr > >1.23 csys = 39.42 CPU) @ 714.29/s (n=50) > > Rate push-push yacc-yacc yacc-pure push-pure push-yacc > >push-push 714/s -- 0% 0% 0% -0% > >yacc-yacc 714/s 0% -- 0% 0% -0% > >yacc-pure 714/s 0% 0% -- 0% -0% > >push-pure 714/s 0% 0% 0% -- -0% > >push-yacc 714/s 0% 0% 0% 0% -- > > > >I confess I don't understand the table output by this Perl module > >here. What is this "rate"? > > Now (that I read the code) I have it: to compute the rate, it sums > the usr and sys time for the parent (i.e., the call to "system") > which is consistenly 0.07 here for the 50 iterations. Hence, a > "rate" of 50/0.07 / 714,285714285714. > > If I change the cmpthese call into "cmpthese ($res, 'nop')" (nop > stands for noparents), and similarly for timethese, then I have > better results: > > > No optimization: > Benchmark: timing 50 iterations of push-pure, push-push, push-yacc, > yacc-pure, yacc-yacc... > push-pure: 64 wallclock secs (45.00 cusr + 1.26 csys = 46.26 CPU) @ > 1.08/s (n=50) > push-push: 66 wallclock secs (50.38 cusr + 1.21 csys = 51.59 CPU) @ > 0.97/s (n=50) > push-yacc: 68 wallclock secs (45.49 cusr + 1.30 csys = 46.79 CPU) @ > 1.07/s (n=50) > yacc-pure: 57 wallclock secs (36.95 cusr + 1.17 csys = 38.12 CPU) @ > 1.31/s (n=50) > yacc-yacc: 57 wallclock secs (38.06 cusr + 1.17 csys = 39.23 CPU) @ > 1.27/s (n=50) > Rate push-push push-yacc push-pure yacc-yacc yacc-pure > push-push 0.969/s -- -9% -10% -24% -26% > push-yacc 1.07/s 10% -- -1% -16% -19% > push-pure 1.08/s 12% 1% -- -15% -18% > yacc-yacc 1.27/s 32% 19% 18% -- -3% > yacc-pure 1.31/s 35% 23% 21% 3% -- > > (as an aside, there is no point in not using pure parsers: they are > slightly faster. But I'm on a PPC, so I wouldn't be surprised if > more stuff be kept in registers, hence easily beating global > variables... Maybe the figures would be different on Intel chips). > > With -O2: > > Benchmark: timing 50 iterations of push-pure, push-push, push-yacc, > yacc-pure, yacc-yacc... > push-pure: 30 wallclock secs (20.94 cusr + 0.88 csys = 21.82 CPU) @ > 2.29/s (n=50) > push-push: 34 wallclock secs (22.96 cusr + 0.95 csys = 23.91 CPU) @ > 2.09/s (n=50) > push-yacc: 30 wallclock secs (21.47 cusr + 0.91 csys = 22.38 CPU) @ > 2.23/s (n=50) > yacc-pure: 26 wallclock secs (17.78 cusr + 0.85 csys = 18.63 CPU) @ > 2.68/s (n=50) > yacc-yacc: 25 wallclock secs (18.50 cusr + 0.85 csys = 19.35 CPU) @ > 2.58/s (n=50) > Rate push-push push-yacc push-pure yacc-yacc yacc-pure > push-push 2.09/s -- -6% -9% -19% -22% > push-yacc 2.23/s 7% -- -3% -14% -17% > push-pure 2.29/s 10% 3% -- -11% -15% > yacc-yacc 2.58/s 24% 16% 13% -- -4% > yacc-pure 2.68/s 28% 20% 17% 4% -- > > For fun, -O3: > > Benchmark: timing 50 iterations of push-pure, push-push, push-yacc, > yacc-pure, yacc-yacc... > push-pure: 26 wallclock secs (17.99 cusr + 0.84 csys = 18.83 CPU) @ > 2.66/s (n=50) > push-push: 28 wallclock secs (19.84 cusr + 0.86 csys = 20.70 CPU) @ > 2.42/s (n=50) > push-yacc: 27 wallclock secs (18.46 cusr + 0.89 csys = 19.35 CPU) @ > 2.58/s (n=50) > yacc-pure: 22 wallclock secs (15.88 cusr + 0.82 csys = 16.70 CPU) @ > 2.99/s (n=50) > yacc-yacc: 22 wallclock secs (16.43 cusr + 0.81 csys = 17.24 CPU) @ > 2.90/s (n=50) > Rate push-push push-yacc push-pure yacc-yacc yacc-pure > push-push 2.42/s -- -7% -9% -17% -19% > push-yacc 2.58/s 7% -- -3% -11% -14% > push-pure 2.66/s 10% 3% -- -8% -11% > yacc-yacc 2.90/s 20% 12% 9% -- -3% > yacc-pure 2.99/s 24% 16% 13% 3% -- > > > > > sulaco-eth% gcc --version > powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 (Apple Computer, Inc. > build 5026) > Copyright (C) 2005 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There > is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR > PURPOSE. I still don't know how to read those charts. I would assume that more 'wallclock' seems like it's slower. However, the 'Rate' makes the push parser seem the fastest! What does that mean? Is there an easy script I can run on my Linux/AMD machine to generate these results? Thanks, Bob Rossi From MAILER-DAEMON Fri Apr 07 10:27:13 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRrvd-0004r2-7n for mharc-bison-patches@gnu.org; Fri, 07 Apr 2006 10:27:13 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRrvb-0004pd-Kk for bison-patches@gnu.org; Fri, 07 Apr 2006 10:27:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRrva-0004oM-Gw for bison-patches@gnu.org; Fri, 07 Apr 2006 10:27:11 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRrva-0004o0-9t for bison-patches@gnu.org; Fri, 07 Apr 2006 10:27:10 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FRrzY-00014U-Lc for bison-patches@gnu.org; Fri, 07 Apr 2006 10:31:17 -0400 Received: from sulaco-eth.lrde.epita.fr ([192.168.101.154]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FRrvY-00012r-Ba; Fri, 07 Apr 2006 16:27:08 +0200 In-Reply-To: <20060407140449.GA23931@brasko.net> References: <20060317194252.GJ30980@brasko.net> <676AFDF2-74E3-492C-B112-72808D051FE0@lrde.epita.fr> <20060407140449.GA23931@brasko.net> Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: multipart/mixed; boundary=Apple-Mail-11-756556403 Message-Id: <6D0F7DA2-1714-4647-ABF3-20A1DE277AAF@lrde.epita.fr> From: Akim Demaille Date: Fri, 7 Apr 2006 16:26:37 +0200 To: Bob Rossi X-Mailer: Apple Mail (2.749.3) Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2006 14:27:11 -0000 --Apple-Mail-11-756556403 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Le 7 avr. 06 =E0 16:04, Bob Rossi a =E9crit : >> With -O2: >> >> Benchmark: timing 50 iterations of push-pure, push-push, push-yacc, >> yacc-pure, yacc-yacc... >> push-pure: 30 wallclock secs (20.94 cusr + 0.88 csys =3D 21.82 CPU) = @ >> 2.29/s (n=3D50) >> push-push: 34 wallclock secs (22.96 cusr + 0.95 csys =3D 23.91 CPU) = @ >> 2.09/s (n=3D50) >> push-yacc: 30 wallclock secs (21.47 cusr + 0.91 csys =3D 22.38 CPU) = @ >> 2.23/s (n=3D50) >> yacc-pure: 26 wallclock secs (17.78 cusr + 0.85 csys =3D 18.63 CPU) = @ >> 2.68/s (n=3D50) >> yacc-yacc: 25 wallclock secs (18.50 cusr + 0.85 csys =3D 19.35 CPU) = @ >> 2.58/s (n=3D50) >> Rate push-push push-yacc push-pure yacc-yacc yacc-pure >> push-push 2.09/s -- -6% -9% -19% -22% >> push-yacc 2.23/s 7% -- -3% -14% -17% >> push-pure 2.29/s 10% 3% -- -11% -15% >> yacc-yacc 2.58/s 24% 16% 13% -- -4% >> yacc-pure 2.68/s 28% 20% 17% 4% -- > > I still don't know how to read those charts. I would assume that more > 'wallclock' seems like it's slower. However, the 'Rate' makes the push > parser seem the fastest! What does that mean? Rate is the number of times the test can be run in one second. The =20 higher, the better. This table says stock yacc.c is 16% faster than =20 your yacc.c in the default mode. The grammar is the calculator's, and it's computing values. I guess =20 most parsers do execute more demanding actions... I wouldn't really =20 be able to judge whether we can drop 15% performances like this. > > Is there an easy script I can run on my Linux/AMD machine to generate > these results? Yes, the script I had attached. Here it is with the chidren stuff =20 fixed. --Apple-Mail-11-756556403 Content-Transfer-Encoding: quoted-printable Content-Type: text/x-perl-script; x-unix-mode=0755; name="bench.pl" Content-Disposition: attachment; filename=bench.pl #! /usr/bin/perl -w use IO::File; use Benchmark qw (:all); my $bison =3D $ENV{'BISON'} || 'bison'; ################################################################## sub triangular_grammar ($$$) { my ($base, $max, $directives) =3D @_; my $out =3D new IO::File ">$base.y" or die; print $out < #include static int yylex (void); static void yyerror (const char *msg); %} %union { int val; }; %token END "end" %type exp input EOF for my $size (1 .. $max) { print $out "%token t$size $size \"$size\"\n"; }; print $out < $max) return 0; else if (inner > outer) { inner =3D 1; ++outer; return END; } return inner++; } static void yyerror (const char *msg) { fprintf (stderr, "%s\\n", msg); } int main (void) { yydebug =3D !!getenv ("YYDEBUG"); return yyparse (); } EOF } ################################################################## sub calc_input ($$) { my ($base, $max) =3D @_; my $out =3D new IO::File ">$base.input" or die; foreach (1 .. $max) { print $out = "0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21+22+23+24+25+26+27= +28+29+30+31+32+33+34+35+36+37+38+39+40+41+42+43+44+45+46+47+48+49+50+51+5= 2+53+54+55+56+57+58+59+60+61+62+63+64+65+66+67+68+69+70+71+72+73+74+75+76+= 77+78+79+80+81+82+83+84+85+86+87+88+89+90+91+92+93+94+95+96+97+98+99\n"; print $out = "1+1*(2+2*(3+3*(4+4*(5+5*(6+6*(7+7*(8+8*(9+9*(10+10*(11+11*(12+12*(13+13*(= 14+14*(15+15*(16+16*(17+17*(18+18*(19+19*(20+20*(21+21*(22+22*(23+23*(24+2= 4*(25+25*(26+26*(27+27*(28+28*(29+29*(30+30*(31+31*(32+32*(33+33*(34+34*(3= 5+35*(36+36*(37+37*(38+38*(39+39*(40+40*(41+41*(42+42*(43+43*(44+44*(45+45= *(46+46*(47+47*(48+48*(49+49*(50+50*(51+51*(52+52*(53+53*(54+54*(55+55*(56= +56*(57+57*(58+58*(59+59*(60+60*(61+61*(62+62*(63+63*(64+64*(65+65*(66+66*= (67+67*(68+68*(69+69*(70+70*(71+71*(72+72*(73+73*(74+74*(75+75*(76+76*(77+= 77*(78+78*(79+79*(80+80*(81+81*(82+82*(83+83*(84+84*(85+85*(86+86*(87+87*(= 88+88*(89+89*(90+90*(91+91*(92+92*(93+93*(94+94*(95+95*(96+96*(97+97*(98+9= 8*(99+99*(100+100*(101+101*(102+102*(103+103*(104+104*(105+105*(106+106*(1= 07+107*(108+108*(109+109*(110+110*(111+111*(112+112*(113+113*(114+114*(115= +115*(116+116*(117+117*(118+118*(119+119*(120+120*(121+121*(122+122*(123+1= 23*(124+124*(125+125*(126+126*(127+127*(128+128*(129+129*(130+130*(131+131= *(132+132*(133+133*(134+134*(135+135*(136+136*(137+137*(138+138*(139+139*(= 140+140*(141+141*(142+142*(143+143*(144+144*(145+145*(146+146*(147+147*(14= 8+148*(149+149*(150+150*(151+151*(152+152*(153+153*(154+154*(155+155*(156+= 156*(157+157*(158+158*(159+159*(160+160*(161+161*(162+162*(163+163*(164+16= 4*(165+165*(166+166*(167+167*(168+168*(169+169*(170+170*(171+171*(172+172*= (173+173*(174+174*(175+175*(176+176*(177+177*(178+178*(179+179*(180+180*(1= 81+181*(182+182*(183+183*(184+184*(185+185*(186+186*(187+187*(188+188*(189= +189*(190+190*(191+191*(192+192*(193+193*(194+194*(195+195*(196+196*(197+1= 97*(198+198*(199+199*(200+200*(201+201*(202+202*(203+203*(204+204*(205+205= *(206+206*(207+207*(208+208*(209+209*(210+210*(211+211*(212+212*(213+213*(= 214+214*(215+215*(216+216*(217+217*(218+218*(219+219*(220+220*(221+221*(22= 2+222*(223+223*(224+224*(225+225*(226+226*(227+227*(228+228*(229+229*(230+= 230*(231+231*(232+232*(233+233*(234+234*(235+235*(236+236*(237+237*(238+23= 8*(239+239*(240+240*(241+241*(242+242*(243+243*(244+244*(245+245*(246+246*= (247+247*(248+248*(249+249*(250+250*(251+251*(252+252*(253+253*(254+254*(2= 55+255*(256+256*(257+257*(258+258*(259+259*(260+260*(261+261*(262+262*(263= +263*(264+264*(265+265*(266+266*(267+267*(268+268*(269+269*(270+270*(271+2= 71*(272+272*(273+273*(274+274*(275+275*(276+276*(277+277*(278+278*(279+279= *(280+280*(281+281*(282+282*(283+283*(284+284*(285+285*(286+286*(287+287*(= 288+288*(289+289*(290+290*(291+291*(292+292*(293+293*(294+294*(295+295*(29= 6+296*(297+297*(298+298*(299+299*(300+300*(301+301*(302+302*(303+303*(304+= 304*(305+305*(306+306*(307+307*(308+308*(309+309*(310+310*(311+311*(312+31= 2*(313+313*(314+314*(315+315*(316+316*(317+317*(318+318*(319+319*(320+320*= (321+321*(322+322*(323+323*(324+324*(325+325*(326+326*(327+327*(328+328*(3= 29+329*(330+330*(331+331*(332+332*(333+333*(334+334*(335+335*(336+336*(337= +337*(338+338*(339+339*(340+340*(341+341*(342+342*(343+343*(344+344*(345+3= 45*(346+346*(347+347*(348+348*(349+349*(350+350*(351+351*(352+352*(353+353= *(354+354*(355+355*(356+356*(357+357*(358+358*(359+359*(360+360*(361+361*(= 362+362*(363+363*(364+364*(365+365*(366+366*(367+367*(368+368*(369+369*(37= 0+370*(371+371*(372+372*(373+373*(374+374*(375+375*(376+376*(377+377*(378+= 378*(379+379*(380+380*(381+381*(382+382*(383+383*(384+384*(385+385*(386+38= 6*(387+387*(388+388*(389+389*(390+390*(391+391*(392+392*(393+393*(394+394*= (395+395*(396+396*(397+397*(398+398*(399+399*(400+400*(401+401*(402+402*(4= 03+403*(404+404*(405+405*(406+406*(407+407*(408+408*(409+409*(410+410*(411= +411*(412+412*(413+413*(414+414*(415+415*(416+416*(417+417*(418+418*(419+4= 19*(420+420*(421+421*(422+422*(423+423*(424+424*(425+425*(426+426*(427+427= *(428+428*(429+429*(430+430*(431+431*(432+432*(433+433*(434+434*(435+435*(= 436+436*(437+437*(438+438*(439+439*(440+440*(441+441*(442+442*(443+443*(44= 4+444*(445+445*(446+446*(447+447*(448+448*(449+449*(450+450*(451+451*(452+= 452*(453+453*(454+454*(455+455*(456+456*(457+457*(458+458*(459+459*(460+46= 0*(461+461*(462+462*(463+463*(464+464*(465+465*(466+466*(467+467*(468+468*= (469+469*(470+470*(471+471*(472+472*(473+473*(474+474*(475+475*(476+476*(4= 77+477*(478+478*(479+479*(480+480*(481+481*(482+482*(483+483*(484+484*(485= +485*(486+486*(487+487*(488+488*(489+489*(490+490*(491+491*(492+492*(493+4= 93*(494+494*(495+495*(496+496*(497+497*(498+498*(499+499*(500+500*(501+501= *(502+502*(503+503*(504+504*(505+505*(506+506*(507+507*(508+508*(509+509*(= 510+510*(511+511*(512+512*(513+513*(514+514*(515+515*(516+516*(517+517*(51= 8+518*(519+519*(520+520*(521+521*(522+522*(523+523*(524+524*(525+525*(526+= 526*(527+527*(528+528*(529+529*(530+530*(531+531*(532+532*(533+533*(534+53= 4*(535+535*(536+536*(537+537*(538+538*(539+539*(540+540*(541+541*(542+542*= (543+543*(544+544*(545+545*(546+546*(547+547*(548+548*(549+549*(550+550*(5= 51+551*(552+552*(553+553*(554+554*(555+555*(556+556*(557+557*(558+558*(559= +559*(560+560*(561+561*(562+562*(563+563*(564+564*(565+565*(566+566*(567+5= 67*(568+568*(569+569*(570+570*(571+571*(572+572*(573+573*(574+574*(575+575= *(576+576*(577+577*(578+578*(579+579*(580+580*(581+581*(582+582*(583+583*(= 584+584*(585+585*(586+586*(587+587*(588+588*(589+589*(590+590*(591+591*(59= 2+592*(593+593*(594+594*(595+595*(596+596*(597+597*(598+598*(599+599*(600+= 600*(601+601*(602+602*(603+603*(604+604*(605+605*(606+606*(607+607*(608+60= 8*(609+609*(610+610*(611+611*(612+612*(613+613*(614+614*(615+615*(616+616*= (617+617*(618+618*(619+619*(620+620*(621+621*(622+622*(623+623*(624+624*(6= 25+625*(626+626*(627+627*(628+628*(629+629*(630+630*(631+631*(632+632*(633= +633*(634+634*(635+635*(636+636*(637+637*(638+638*(639+639*(640+640*(641+6= 41*(642+642*(643+643*(644+644*(645+645*(646+646*(647+647*(648+648*(649+649= *(650+650*(651+651*(652+652*(653+653*(654+654*(655+655*(656+656*(657+657*(= 658+658*(659+659*(660+660*(661+661*(662+662*(663+663*(664+664*(665+665*(66= 6+666*(667+667*(668+668*(669+669*(670+670*(671+671*(672+672*(673+673*(674+= 674*(675+675*(676+676*(677+677*(678+678*(679+679*(680+680*(681+681*(682+68= 2*(683+683*(684+684*(685+685*(686+686*(687+687*(688+688*(689+689*(690+690*= (691+691*(692+692*(693+693*(694+694*(695+695*(696+696*(697+697*(698+698*(6= 99+699*(700+700*(701+701*(702+702*(703+703*(704+704*(705+705*(706+706*(707= +707*(708+708*(709+709*(710+710*(711+711*(712+712*(713+713*(714+714*(715+7= 15*(716+716*(717+717*(718+718*(719+719*(720+720*(721+721*(722+722*(723+723= *(724+724*(725+725*(726+726*(727+727*(728+728*(729+729*(730+730*(731+731*(= 732+732*(733+733*(734+734*(735+735*(736+736*(737+737*(738+738*(739+739*(74= 0+740*(741+741*(742+742*(743+743*(744+744*(745+745*(746+746*(747+747*(748+= 748*(749+749*(750+750*(751+751*(752+752*(753+753*(754+754*(755+755*(756+75= 6*(757+757*(758+758*(759+759*(760+760*(761+761*(762+762*(763+763*(764+764*= (765+765*(766+766*(767+767*(768+768*(769+769*(770+770*(771+771*(772+772*(7= 73+773*(774+774*(775+775*(776+776*(777+777*(778+778*(779+779*(780+780*(781= +781*(782+782*(783+783*(784+784*(785+785*(786+786*(787+787*(788+788*(789+7= 89*(790+790*(791+791*(792+792*(793+793*(794+794*(795+795*(796+796*(797+797= *(798+798*(799+799*(800+800*(801+801*(802+802*(803+803*(804+804*(805+805*(= 806+806*(807+807*(808+808*(809+809*(810+810*(811+811*(812+812*(813+813*(81= 4+814*(815+815*(816+816*(817+817*(818+818*(819+819*(820+820*(821+821*(822+= 822*(823+823*(824+824*(825+825*(826+826*(827+827*(828+828*(829+829*(830+83= 0*(831+831*(832+832*(833+833*(834+834*(835+835*(836+836*(837+837*(838+838*= (839+839*(840+840*(841+841*(842+842*(843+843*(844+844*(845+845*(846+846*(8= 47+847*(848+848*(849+849*(850+850*(851+851*(852+852*(853+853*(854+854*(855= +855*(856+856*(857+857*(858+858*(859+859*(860+860*(861+861*(862+862*(863+8= 63*(864+864*(865+865*(866+866*(867+867*(868+868*(869+869*(870+870*(871+871= *(872+872*(873+873*(874+874*(875+875*(876+876*(877+877*(878+878*(879+879*(= 880+880*(881+881*(882+882*(883+883*(884+884*(885+885*(886+886*(887+887*(88= 8+888*(889+889*(890+890*(891+891*(892+892*(893+893*(894+894*(895+895*(896+= 896*(897+897*(898+898*(899+899*(900+900*(901+901*(902+902*(903+903*(904+90= 4*(905+905*(906+906*(907+907*(908+908*(909+909*(910+910*(911+911*(912+912*= (913+913*(914+914*(915+915*(916+916*(917+917*(918+918*(919+919*(920+920*(9= 21+921*(922+922*(923+923*(924+924*(925+925*(926+926*(927+927*(928+928*(929= +929*(930+930*(931+931*(932+932*(933+933*(934+934*(935+935*(936+936*(937+9= 37*(938+938*(939+939*(940+940*(941+941*(942+942*(943+943*(944+944*(945+945= *(946+946*(947+947*(948+948*(949+949*(950+950*(951+951*(952+952*(953+953*(= 954+954*(955+955*(956+956*(957+957*(958+958*(959+959*(960+960*(961+961*(96= 2+962*(963+963*(964+964*(965+965*(966+966*(967+967*(968+968*(969+969*(970+= 970*(971+971*(972+972*(973+973*(974+974*(975+975*(976+976*(977+977*(978+97= 8*(979+979*(980+980*(981+981*(982+982*(983+983*(984+984*(985+985*(986+986*= (987+987*(988+988*(989+989*(990+990*(991+991*(992+992*(993+993*(994+994*(9= 95+995*(996+996*(997+997*(998+998*(999+999*(1000+1000*(1001)))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))\n"; } } ################################################################## sub calc_grammar ($$$) { my ($base, $max, $directives) =3D @_; my $out =3D new IO::File ">$base.y" or die; print $out < #include #include #include #define USE(Var) /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; static semantic_value global_result =3D 0; static int global_count =3D 0; %} /* Exercise %union. */ $directives %error-verbose %union { semantic_value ival; }; %{ static int power (int base, int exponent); /* yyerror receives the location if: - %location & %pure & %glr - %location & %pure & %yacc & %parse-param. */ static void yyerror (const char *s); #if YYPURE static int yylex (YYSTYPE* yylvalp); #else static int yylex (void); #endif %} /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=3D' /* comparison */ %left '-' '+' %left '*' '/' %left NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\\n' | exp '\\n' { USE (\$1); } ; exp: NUM { \$\$ =3D \$1; } | exp '=3D' exp { if (\$1 !=3D \$3) fprintf (stderr, "calc: error: %d !=3D %d\\n", \$1, \$3); \$\$ =3D \$1; } | exp '+' exp { \$\$ =3D \$1 + \$3; } | exp '-' exp { \$\$ =3D \$1 - \$3; } | exp '*' exp { \$\$ =3D \$1 * \$3; } | exp '/' exp { \$\$ =3D \$1 / \$3; } | '-' exp %prec NEG { \$\$ =3D -\$2; } | exp '^' exp { \$\$ =3D power (\$1, \$3); } | '(' exp ')' { \$\$ =3D \$2; } | '(' error ')' { \$\$ =3D 1111; } | '!' { \$\$ =3D 0; YYERROR; } | '-' error { \$\$ =3D 0; YYERROR; } ; %% /* The input. */ static FILE *input; static void yyerror (const char *s) { fprintf (stderr, "%s\\n", s); } static int get_char (void) { return getc (input); } static void unget_char ( int c) { ungetc (c, input); } static int read_signed_integer (void) { int c =3D get_char (); int sign =3D 1; int n =3D 0; if (c =3D=3D '-') { c =3D get_char (); sign =3D -1; } while (isdigit (c)) { n =3D 10 * n + (c - '0'); c =3D get_char (); } unget_char (c); return sign * n; } #if YYPUSH static YYSTYPE yylval; #endif static int #if YYPURE # define yylval (*yylvalp) yylex (YYSTYPE* yylvalp) #else yylex (void) #endif { int c; /* Skip white space. */ while ((c =3D get_char ()) =3D=3D ' ' || c =3D=3D '\t') { } /* process numbers */ if (c =3D=3D '.' || isdigit (c)) { unget_char ( c); yylval.ival =3D read_signed_integer (); return NUM; } /* Return end-of-file. */ if (c =3D=3D EOF) return CALC_EOF; /* Return single chars. */ return c; } static int power (int base, int exponent) { int res =3D 1; if (exponent < 0) exit (3); for (/* Niente */; exponent; --exponent) res *=3D base; return res; } #if YYPUSH static int=20 yyparse_wrapper () { struct yypvars *ctx =3D yypvarsinit (); do { = =20 yyparse (ctx); = =20 set_yychar (ctx, yylex ()); = =20 ctx->yylval =3D yylval; } while (get_yyresult (ctx) !=3D 0); = =20 free (ctx); =20 } =20 #define yyparse yyparse_wrapper #endif int main (int argc, const char **argv) { semantic_value result =3D 0; int count =3D 0; int status; input =3D fopen ("calc.input", "r"); if (!input) { perror ("calc.input"); return 3; } status =3D yyparse (); if (global_result !=3D result) abort (); if (global_count !=3D count) abort (); return status; } EOF } ################################################################## sub compile ($) { my ($base) =3D @_; system ("bison $base.y -o $base.c"); system ("gcc $base.c -o $base"); =20 } sub bench_grammar ($) { my ($gram) =3D @_; my %test =3D ( "yacc-yacc" =3D> '', "yacc-pure" =3D> '%pure-parser', "push-yacc" =3D> '%skeleton "push.c"', "push-pure" =3D> '%skeleton "push.c" %pure-parser', "push-push" =3D> '%skeleton "push.c" %push-parser', ); =20 my %bench; while (my ($name, $directives) =3D each %test) { print STDERR "$name\n"; my $generator =3D "$gram" . "_grammar"; &$generator ($name, 200, $directives); compile ($name); $bench{$name} =3D "system ('./$name');" } print "$gram:\n"; my $res =3D timethese (50, \%bench, 'nop'); cmpthese ($res, 'nop'); } calc_input ('calc', 200); bench_grammar ('calc'); ### Setup "GNU" style for perl-mode and cperl-mode. ## Local Variables: ## perl-indent-level: 2 ## perl-continued-statement-offset: 2 ## perl-continued-brace-offset: 0 ## perl-brace-offset: 0 ## perl-brace-imaginary-offset: 0 ## perl-label-offset: -2 ## cperl-indent-level: 2 ## cperl-brace-offset: 0 ## cperl-continued-brace-offset: 0 ## cperl-label-offset: -2 ## cperl-extra-newline-before-brace: t ## cperl-merge-trailing-else: nil ## cperl-continued-statement-offset: 2 ## End: --Apple-Mail-11-756556403-- From MAILER-DAEMON Fri Apr 07 10:41:08 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRs96-0002U2-Q7 for mharc-bison-patches@gnu.org; Fri, 07 Apr 2006 10:41:08 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRs94-0002TL-RS for bison-patches@gnu.org; Fri, 07 Apr 2006 10:41:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRs91-0002RH-T1 for bison-patches@gnu.org; Fri, 07 Apr 2006 10:41:06 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRs91-0002R0-L0 for bison-patches@gnu.org; Fri, 07 Apr 2006 10:41:03 -0400 Received: from [68.230.240.34] (helo=eastrmmtao05.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FRsD0-0002Df-DT for bison-patches@gnu.org; Fri, 07 Apr 2006 10:45:10 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao05.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060407144100.KLIO3108.eastrmmtao05.cox.net@localhost.localdomain>; Fri, 7 Apr 2006 10:41:00 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FRs99-0000Mm-5Z; Fri, 07 Apr 2006 10:41:11 -0400 Date: Fri, 7 Apr 2006 10:41:11 -0400 From: Bob Rossi To: Akim Demaille Message-ID: <20060407144111.GC23931@brasko.net> Mail-Followup-To: Akim Demaille , Bison Patches References: <20060317194252.GJ30980@brasko.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2006 14:41:07 -0000 On Fri, Apr 07, 2006 at 02:42:29PM +0200, Akim Demaille wrote: > Bob, > > I'm starting to toy with your implementation, and to try to bench it. > It seems that there is about a 15% performance loss of push.c compared > to yacc.c, both used in pull mode without compiler optimization on my > Mac. OK, I thought the 15% increase did not seem correct. The only major difference besides an extra function call per token, is that yyparse has to get 'pv->yychar' instead of 'yychar'. I personally believe that any good compiler/CPU will store the address of pv->yychar and be able to access that at the same speed as yychar. Here's how somone put it that Emailed me privatly from the question I asked on gcc-help: My question: I'm currently writing a patch to bison, and can not afford to effect it's efficiency. Theoretically, a function in bison uses a local variable named "lfoo" and a global variable named "gfoo". I need to pack both of these into a struct, named "sfoo". If the function currently uses the variables directly like 'lfoo = 0;', will changing them to 'sfoo_obj->lfoo = 0;' effect the efficiency of the program in regards to speed? Response: I am not exactly sure what size of a change in performance you would consider significant. And it seems like for different types of processors, the impact would be different. For a risc type chip (power-pc), there is a toc pointer which is always in a register. To load the address of gfoo, it is an indexed look up from the toc. Usually one instruction and one memory fetch to get the address. At that point, the code can get or set the value of gfoo. For lfoo, the value could be held in a register. If not, then it is much ilke gfoo except instead of relative to the toc, it is relative to the stack pointer. If almost every variable is inside the struct, then the pointer to the struct will most likely be held in a register so the access to sfoo will be exactly like gfoo or lfoo in the case that lfoo is not in a register. If, instead, you are going to have many structs, then you are likely going to have an extra instruction to get the address of the struct as well as an extra memory reference. But, for a sequence of references that are close together to the same struct, the compiler will likely optimize out the extra fetches for the address of the struct. All this to say -- try it out. Or maybe compile the code to assembly and look at the difference in the assembly. My guess is that you will not be able to tell the difference but a lot of testing will show a small change. > More experiments (and more eyes on this script) would help. > > > I have a few comments. > > 1. I think you should not change the semantics of yyparse in the push > parser. In fact, I think the push parser should always provide > yyparse as the good old pull interface wrapping the yyparse_push > interface or whatever. > OK, so you would like the push parser to have a yyparse () function that internally calls yyparse_push? I can do that, even though I really don't see the point. Why would a user want to use the push parser if they didn't want to use it in push mode? There probably is some advantage to this that I can't think of though. Would you like me to name it yyparse_push? or yyparse_wrapper? > 2. What is the way one is expected to pass yylval? I cheated: > > #if YYPUSH > static int > yyparse_wrapper () > { > struct yypvars *ctx = yypvarsinit (); > do { > yyparse (ctx); > set_yychar (ctx, yylex ()); > ctx->yylval = yylval; > } while (get_yyresult (ctx) != 0); > free (ctx); > } > #define yyparse yyparse_wrapper > #endif There are currently 4 user visible variables. They are yychar, yylval, yynerrs, and yylloc. I am proposing 4 set's of set/get functions that give the user access to these variables. If that is acceptable, I'll add the functions into the patch. We could also make the definition of the struct yypvars in a header file so user's could access the data directly. Alternativly, we could make a yyuvars struct, which yypvars includes. Then put the yyuvars struct in the header. However, this will yield 2 levels of indirection in the yyparse function when attempting to access the user visible areas. I prefer the set/get functions myself. > 3. I don't think we should maintain the Cartesian product of all the > badly designed features, so I suggest that push => pure. There are > a couple of place where the (m4) code could be simplified then. Are you saying you don't want to see %push-parser option, but rather change %pure-parser to be the new "push parser"? If so, that would be 1 good reason for keeping yyparse () and adding a new function yyparse_push. I would be happy to do this if you want. > 4. Also, YYPARSE_PARAM is bad, does not scale well, etc. Don't bother > with it except to maintain compatibility with the old mode. OK, so just take those cases out? > Attached is your diff, but this time with a "push.c" skeleton, leaving > yacc.c as it was before. That's easier to bench (alternatively I > could have introduced a yacc.old.c, but that's clearer). Thanks, I'll try this out. Bob Rossi From MAILER-DAEMON Fri Apr 07 10:57:24 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRsOq-0002TG-Cv for mharc-bison-patches@gnu.org; Fri, 07 Apr 2006 10:57:24 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRsOo-0002TA-PC for bison-patches@gnu.org; Fri, 07 Apr 2006 10:57:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRsOn-0002SV-4d for bison-patches@gnu.org; Fri, 07 Apr 2006 10:57:22 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRsOm-0002SQ-Tl for bison-patches@gnu.org; Fri, 07 Apr 2006 10:57:20 -0400 Received: from [68.230.240.34] (helo=eastrmmtao05.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FRsSl-0003ux-P4 for bison-patches@gnu.org; Fri, 07 Apr 2006 11:01:27 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao05.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060407145717.KXBL3108.eastrmmtao05.cox.net@localhost.localdomain> for ; Fri, 7 Apr 2006 10:57:17 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FRsOu-0001yF-UM for bison-patches@gnu.org; Fri, 07 Apr 2006 10:57:28 -0400 Date: Fri, 7 Apr 2006 10:57:28 -0400 From: Bob Rossi To: Bison Patches Message-ID: <20060407145728.GD23931@brasko.net> Mail-Followup-To: Bison Patches Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.9i Subject: bootstrap X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2006 14:57:23 -0000 Hi, I'm wondering what the best way to bootstrap bison is when you have a patch that changes the parser. (like the push parser). Should I do a 'cvs co bison', then a bootstrap in that directory, then apply the patch, then do a configure and build? Thanks, Bob Rossi From MAILER-DAEMON Fri Apr 07 12:06:50 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRtU2-0001il-HD for mharc-bison-patches@gnu.org; Fri, 07 Apr 2006 12:06:50 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRtU1-0001i9-4w for bison-patches@gnu.org; Fri, 07 Apr 2006 12:06:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRtTz-0001hB-Df for bison-patches@gnu.org; Fri, 07 Apr 2006 12:06:48 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRtTz-0001h7-6F for bison-patches@gnu.org; Fri, 07 Apr 2006 12:06:47 -0400 Received: from [68.230.240.38] (helo=eastrmmtao01.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FRtXy-0001GV-Ns for bison-patches@gnu.org; Fri, 07 Apr 2006 12:10:54 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao01.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060407160643.JPY3988.eastrmmtao01.cox.net@localhost.localdomain>; Fri, 7 Apr 2006 12:06:43 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FRtU6-0005ov-KA; Fri, 07 Apr 2006 12:06:54 -0400 Date: Fri, 7 Apr 2006 12:06:54 -0400 From: Bob Rossi To: Akim Demaille Message-ID: <20060407160654.GA1264@brasko.net> Mail-Followup-To: Akim Demaille , Bison Patches References: <20060317194252.GJ30980@brasko.net> <676AFDF2-74E3-492C-B112-72808D051FE0@lrde.epita.fr> <20060407140449.GA23931@brasko.net> <6D0F7DA2-1714-4647-ABF3-20A1DE277AAF@lrde.epita.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6D0F7DA2-1714-4647-ABF3-20A1DE277AAF@lrde.epita.fr> User-Agent: Mutt/1.5.9i Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2006 16:06:49 -0000 > >Is there an easy script I can run on my Linux/AMD machine to generate > >these results? > > Yes, the script I had attached. Here it is with the chidren stuff > fixed. OK, I have the script, and I have bison installed in /home/bob/cvs/bison/bench/target. How do I run this script? Thanks, Bob Rossi From MAILER-DAEMON Fri Apr 07 12:13:47 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRtal-0005I5-B4 for mharc-bison-patches@gnu.org; Fri, 07 Apr 2006 12:13:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRtak-0005GV-17 for bison-patches@gnu.org; Fri, 07 Apr 2006 12:13:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRtai-0005Ee-8e for bison-patches@gnu.org; Fri, 07 Apr 2006 12:13:45 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRtai-0005EI-1j for bison-patches@gnu.org; Fri, 07 Apr 2006 12:13:44 -0400 Received: from [68.230.240.37] (helo=eastrmmtao02.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FRteh-00022N-JZ for bison-patches@gnu.org; Fri, 07 Apr 2006 12:17:51 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao02.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060407161340.WMTO14821.eastrmmtao02.cox.net@localhost.localdomain>; Fri, 7 Apr 2006 12:13:40 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FRtap-0005yW-Pi; Fri, 07 Apr 2006 12:13:51 -0400 Date: Fri, 7 Apr 2006 12:13:51 -0400 From: Bob Rossi To: Akim Demaille , Bison Patches Message-ID: <20060407161351.GB1264@brasko.net> Mail-Followup-To: Akim Demaille , Bison Patches References: <20060317194252.GJ30980@brasko.net> <676AFDF2-74E3-492C-B112-72808D051FE0@lrde.epita.fr> <20060407140449.GA23931@brasko.net> <6D0F7DA2-1714-4647-ABF3-20A1DE277AAF@lrde.epita.fr> <20060407160654.GA1264@brasko.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060407160654.GA1264@brasko.net> User-Agent: Mutt/1.5.9i Cc: Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2006 16:13:46 -0000 On Fri, Apr 07, 2006 at 12:06:54PM -0400, Bob Rossi wrote: > > >Is there an easy script I can run on my Linux/AMD machine to generate > > >these results? > > > > Yes, the script I had attached. Here it is with the chidren stuff > > fixed. > > OK, I have the script, and I have bison installed in > /home/bob/cvs/bison/bench/target. Hmmm, let me clarify. I did 'export BISON=/home/bob/cvs/bison/bench/target/bin/bison' was that a good idea? It seems as if, PATH=/home/bob/cvs/bison/bench/target/bin:$PATH perl bench.pl is running the script, will this give me the results you want? Finally, after doing these things in this order: - a fresh cvs co - apply patch - ./bootstrap - ./configure - make I get a compile error. I had to manually do, cd src/ /usr/bin/bison parse-gram.y mv parse-gram.tab.c parse-gram.c mv parse-gram.tab.h parse-gram.h and then do a make again. Is this OK? Here are the results with a normal ./configure. I'm curious to see why this slows down so much. Maybe I should run gprof. Thanks, Bob Rossi Benchmark: timing 50 iterations of push-pure, push-push, push-yacc, yacc-pure, yacc-yacc... push-pure: 24 wallclock secs (22.90 cusr + 0.30 csys = 23.20 CPU) @ 2.16/s (n=50) push-push: 26 wallclock secs (25.16 cusr + 0.30 csys = 25.46 CPU) @ 1.96/s (n=50) push-yacc: 22 wallclock secs (22.21 cusr + 0.28 csys = 22.49 CPU) @ 2.22/s (n=50) yacc-pure: 18 wallclock secs (17.68 cusr + 0.30 csys = 17.98 CPU) @ 2.78/s (n=50) yacc-yacc: 18 wallclock secs (17.36 cusr + 0.30 csys = 17.66 CPU) @ 2.83/s (n=50) Rate push-push push-pure push-yacc yacc-pure yacc-yacc push-push 1.96/s -- -9% -12% -29% -31% push-pure 2.16/s 10% -- -3% -22% -24% push-yacc 2.22/s 13% 3% -- -20% -21% yacc-pure 2.78/s 42% 29% 25% -- -2% yacc-yacc 2.83/s 44% 31% 27% 2% -- You have mail in /var/mail/bob From MAILER-DAEMON Fri Apr 07 16:59:39 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FRy3P-00060O-AC for mharc-bison-patches@gnu.org; Fri, 07 Apr 2006 16:59:39 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRy3N-0005zu-PE for bison-patches@gnu.org; Fri, 07 Apr 2006 16:59:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRy3M-0005zh-UN for bison-patches@gnu.org; Fri, 07 Apr 2006 16:59:37 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRy3M-0005ze-PF for bison-patches@gnu.org; Fri, 07 Apr 2006 16:59:36 -0400 Received: from [68.230.240.33] (helo=eastrmmtao06.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FRy7P-0001Bd-1d for bison-patches@gnu.org; Fri, 07 Apr 2006 17:03:47 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao06.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060407205932.HWUV9108.eastrmmtao06.cox.net@localhost.localdomain>; Fri, 7 Apr 2006 16:59:32 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FRy3U-00064t-CS; Fri, 07 Apr 2006 16:59:44 -0400 Date: Fri, 7 Apr 2006 16:59:44 -0400 From: Bob Rossi To: Akim Demaille Message-ID: <20060407205944.GD1264@brasko.net> Mail-Followup-To: Akim Demaille , Bison Patches References: <20060317194252.GJ30980@brasko.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="/9DWx/yDrRhgMJTb" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2006 20:59:38 -0000 --/9DWx/yDrRhgMJTb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Apr 07, 2006 at 02:42:29PM +0200, Akim Demaille wrote: > Bob, > > I'm starting to toy with your implementation, and to try to bench it. > It seems that there is about a 15% performance loss of push.c compared > to yacc.c, both used in pull mode without compiler optimization on my > Mac. Does the attached gprof info tell you anything? I only ran each case once to get the gprof file. Bob Rossi --/9DWx/yDrRhgMJTb Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gprof.txt" % the percentage of the total running time of the time program used by this function. cumulative a running sum of the number of seconds accounted seconds for by this function and those listed above it. self the number of seconds accounted for by this seconds function alone. This is the major sort for this listing. calls the number of times this function was invoked, if this function is profiled, else blank. self the average number of milliseconds spent in this ms/call function per call, if this function is profiled, else blank. total the average number of milliseconds spent in this ms/call function and its descendents per call, if this function is profiled, else blank. name the name of the function. This is the minor sort for this listing. The index shows the location of the function in the gprof listing. If the index is in parenthesis it shows where it would appear in the gprof listing if it were to be printed. yacc-yacc Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 72.35 1.57 1.57 1 1.57 2.17 yyparse 12.44 1.84 0.27 1240401 0.00 0.00 yylex 8.29 2.02 0.18 420200 0.00 0.00 read_signed_integer 3.46 2.10 0.07 2856601 0.00 0.00 get_char 3.46 2.17 0.07 840400 0.00 0.00 unget_char 0.00 2.17 0.00 1 0.00 0.00 yydestruct Call graph (explanation follows) granularity: each sample hit covers 4 byte(s) for 0.46% of 2.17 seconds index % time self children called name 1.57 0.60 1/1 main [2] [1] 100.0 1.57 0.60 1 yyparse [1] 0.27 0.33 1240401/1240401 yylex [3] 0.00 0.00 1/1 yydestruct [7] ----------------------------------------------- [2] 100.0 0.00 2.17 main [2] 1.57 0.60 1/1 yyparse [1] ----------------------------------------------- 0.27 0.33 1240401/1240401 yyparse [1] [3] 27.6 0.27 0.33 1240401 yylex [3] 0.18 0.08 420200/420200 read_signed_integer [4] 0.04 0.00 420200/840400 unget_char [6] 0.03 0.00 1240401/2856601 get_char [5] ----------------------------------------------- 0.18 0.08 420200/420200 yylex [3] [4] 12.0 0.18 0.08 420200 read_signed_integer [4] 0.04 0.00 1616200/2856601 get_char [5] 0.04 0.00 420200/840400 unget_char [6] ----------------------------------------------- 0.03 0.00 1240401/2856601 yylex [3] 0.04 0.00 1616200/2856601 read_signed_integer [4] [5] 3.5 0.07 0.00 2856601 get_char [5] ----------------------------------------------- 0.04 0.00 420200/840400 read_signed_integer [4] 0.04 0.00 420200/840400 yylex [3] [6] 3.5 0.07 0.00 840400 unget_char [6] ----------------------------------------------- 0.00 0.00 1/1 yyparse [1] [7] 0.0 0.00 0.00 1 yydestruct [7] ----------------------------------------------- yacc-pure Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 62.98 1.48 1.48 1 1.48 2.24 yyparse 12.98 1.78 0.30 1240401 0.00 0.00 yylex 10.00 2.02 0.23 420200 0.00 0.00 read_signed_integer 8.09 2.21 0.19 2856601 0.00 0.00 get_char 3.40 2.29 0.08 yyerror 1.28 2.32 0.03 840400 0.00 0.00 unget_char 1.28 2.35 0.03 power 0.00 2.35 0.00 1 0.00 0.00 yydestruct Call graph (explanation follows) granularity: each sample hit covers 4 byte(s) for 0.43% of 2.35 seconds index % time self children called name 1.48 0.76 1/1 main [2] [1] 95.3 1.48 0.76 1 yyparse [1] 0.30 0.46 1240401/1240401 yylex [3] 0.00 0.00 1/1 yydestruct [9] ----------------------------------------------- [2] 95.3 0.00 2.24 main [2] 1.48 0.76 1/1 yyparse [1] ----------------------------------------------- 0.30 0.46 1240401/1240401 yyparse [1] [3] 32.3 0.30 0.46 1240401 yylex [3] 0.23 0.12 420200/420200 read_signed_integer [4] 0.08 0.00 1240401/2856601 get_char [5] 0.01 0.00 420200/840400 unget_char [7] ----------------------------------------------- 0.23 0.12 420200/420200 yylex [3] [4] 15.2 0.23 0.12 420200 read_signed_integer [4] 0.11 0.00 1616200/2856601 get_char [5] 0.01 0.00 420200/840400 unget_char [7] ----------------------------------------------- 0.08 0.00 1240401/2856601 yylex [3] 0.11 0.00 1616200/2856601 read_signed_integer [4] [5] 8.1 0.19 0.00 2856601 get_char [5] ----------------------------------------------- [6] 3.4 0.08 0.00 yyerror [6] ----------------------------------------------- 0.01 0.00 420200/840400 read_signed_integer [4] 0.01 0.00 420200/840400 yylex [3] [7] 1.3 0.03 0.00 840400 unget_char [7] ----------------------------------------------- [8] 1.3 0.03 0.00 power [8] ----------------------------------------------- 0.00 0.00 1/1 yyparse [1] [9] 0.0 0.00 0.00 1 yydestruct [9] ----------------------------------------------- push-yacc Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 79.09 3.29 3.29 1 3.29 4.06 yyparse 6.25 3.55 0.26 2856601 0.00 0.00 get_char 5.89 3.79 0.24 420200 0.00 0.00 read_signed_integer 4.93 4.00 0.20 1240401 0.00 0.00 yylex 1.92 4.08 0.08 yyerror 1.44 4.14 0.06 840400 0.00 0.00 unget_char 0.48 4.16 0.02 power 0.00 4.16 0.00 1 0.00 0.00 yydestruct 0.00 4.16 0.00 1 0.00 0.00 yypvarsinit Call graph (explanation follows) granularity: each sample hit covers 4 byte(s) for 0.24% of 4.16 seconds index % time self children called name 3.29 0.77 1/1 main [2] [1] 97.6 3.29 0.77 1 yyparse [1] 0.20 0.56 1240401/1240401 yylex [3] 0.00 0.00 1/1 yypvarsinit [10] 0.00 0.00 1/1 yydestruct [9] ----------------------------------------------- [2] 97.6 0.00 4.06 main [2] 3.29 0.77 1/1 yyparse [1] ----------------------------------------------- 0.20 0.56 1240401/1240401 yyparse [1] [3] 18.5 0.20 0.56 1240401 yylex [3] 0.24 0.18 420200/420200 read_signed_integer [4] 0.11 0.00 1240401/2856601 get_char [5] 0.03 0.00 420200/840400 unget_char [7] ----------------------------------------------- 0.24 0.18 420200/420200 yylex [3] [4] 10.1 0.24 0.18 420200 read_signed_integer [4] 0.15 0.00 1616200/2856601 get_char [5] 0.03 0.00 420200/840400 unget_char [7] ----------------------------------------------- 0.11 0.00 1240401/2856601 yylex [3] 0.15 0.00 1616200/2856601 read_signed_integer [4] [5] 6.2 0.26 0.00 2856601 get_char [5] ----------------------------------------------- [6] 1.9 0.08 0.00 yyerror [6] ----------------------------------------------- 0.03 0.00 420200/840400 read_signed_integer [4] 0.03 0.00 420200/840400 yylex [3] [7] 1.4 0.06 0.00 840400 unget_char [7] ----------------------------------------------- [8] 0.5 0.02 0.00 power [8] ----------------------------------------------- 0.00 0.00 1/1 yyparse [1] [9] 0.0 0.00 0.00 1 yydestruct [9] ----------------------------------------------- 0.00 0.00 1/1 yyparse [1] [10] 0.0 0.00 0.00 1 yypvarsinit [10] ----------------------------------------------- push-push Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 71.79 2.69 2.69 1240402 0.00 0.00 yyparse 9.22 3.03 0.34 1240402 0.00 0.00 yylex 7.62 3.31 0.28 420200 0.00 0.00 read_signed_integer 3.61 3.45 0.14 2856602 0.00 0.00 get_char 2.94 3.56 0.11 1 0.11 3.71 yyparse_wrapper 2.14 3.64 0.08 1240402 0.00 0.00 get_yyresult 1.20 3.69 0.04 1240402 0.00 0.00 set_yychar 0.67 3.71 0.03 yyerror 0.53 3.73 0.02 840400 0.00 0.00 unget_char 0.27 3.74 0.01 power 0.00 3.74 0.00 1 0.00 0.00 yydestruct 0.00 3.74 0.00 1 0.00 0.00 yypvarsinit Call graph (explanation follows) granularity: each sample hit covers 4 byte(s) for 0.27% of 3.74 seconds index % time self children called name 0.11 3.60 1/1 main [2] [1] 99.1 0.11 3.60 1 yyparse_wrapper [1] 2.69 0.00 1240402/1240402 yyparse [3] 0.34 0.44 1240402/1240402 yylex [4] 0.08 0.00 1240402/1240402 get_yyresult [7] 0.04 0.00 1240402/1240402 set_yychar [8] 0.00 0.00 1/1 yypvarsinit [13] ----------------------------------------------- [2] 99.1 0.00 3.71 main [2] 0.11 3.60 1/1 yyparse_wrapper [1] ----------------------------------------------- 2.69 0.00 1240402/1240402 yyparse_wrapper [1] [3] 71.8 2.69 0.00 1240402 yyparse [3] 0.00 0.00 1/1 yydestruct [12] ----------------------------------------------- 0.34 0.44 1240402/1240402 yyparse_wrapper [1] [4] 21.0 0.34 0.44 1240402 yylex [4] 0.28 0.09 420200/420200 read_signed_integer [5] 0.06 0.00 1240402/2856602 get_char [6] 0.01 0.00 420200/840400 unget_char [10] ----------------------------------------------- 0.28 0.09 420200/420200 yylex [4] [5] 9.9 0.28 0.09 420200 read_signed_integer [5] 0.08 0.00 1616200/2856602 get_char [6] 0.01 0.00 420200/840400 unget_char [10] ----------------------------------------------- 0.06 0.00 1240402/2856602 yylex [4] 0.08 0.00 1616200/2856602 read_signed_integer [5] [6] 3.6 0.14 0.00 2856602 get_char [6] ----------------------------------------------- 0.08 0.00 1240402/1240402 yyparse_wrapper [1] [7] 2.1 0.08 0.00 1240402 get_yyresult [7] ----------------------------------------------- 0.04 0.00 1240402/1240402 yyparse_wrapper [1] [8] 1.2 0.04 0.00 1240402 set_yychar [8] ----------------------------------------------- [9] 0.7 0.03 0.00 yyerror [9] ----------------------------------------------- 0.01 0.00 420200/840400 read_signed_integer [5] 0.01 0.00 420200/840400 yylex [4] [10] 0.5 0.02 0.00 840400 unget_char [10] ----------------------------------------------- [11] 0.3 0.01 0.00 power [11] ----------------------------------------------- 0.00 0.00 1/1 yyparse [3] [12] 0.0 0.00 0.00 1 yydestruct [12] ----------------------------------------------- 0.00 0.00 1/1 yyparse_wrapper [1] [13] 0.0 0.00 0.00 1 yypvarsinit [13] ----------------------------------------------- push-pure Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 77.78 2.80 2.80 1 2.80 3.60 yyparse 8.06 3.09 0.29 2856601 0.00 0.00 get_char 7.36 3.35 0.27 1240401 0.00 0.00 yylex 5.28 3.54 0.19 420200 0.00 0.00 read_signed_integer 1.39 3.60 0.05 840400 0.00 0.00 unget_char 0.14 3.60 0.01 power 0.00 3.60 0.00 1 0.00 0.00 yydestruct 0.00 3.60 0.00 1 0.00 0.00 yypvarsinit Call graph (explanation follows) granularity: each sample hit covers 4 byte(s) for 0.28% of 3.60 seconds index % time self children called name 2.80 0.80 1/1 main [2] [1] 99.9 2.80 0.80 1 yyparse [1] 0.27 0.53 1240401/1240401 yylex [3] 0.00 0.00 1/1 yypvarsinit [9] 0.00 0.00 1/1 yydestruct [8] ----------------------------------------------- [2] 99.9 0.00 3.60 main [2] 2.80 0.80 1/1 yyparse [1] ----------------------------------------------- 0.27 0.53 1240401/1240401 yyparse [1] [3] 22.1 0.27 0.53 1240401 yylex [3] 0.19 0.19 420200/420200 read_signed_integer [4] 0.13 0.00 1240401/2856601 get_char [5] 0.03 0.00 420200/840400 unget_char [6] ----------------------------------------------- 0.19 0.19 420200/420200 yylex [3] [4] 10.5 0.19 0.19 420200 read_signed_integer [4] 0.16 0.00 1616200/2856601 get_char [5] 0.03 0.00 420200/840400 unget_char [6] ----------------------------------------------- 0.13 0.00 1240401/2856601 yylex [3] 0.16 0.00 1616200/2856601 read_signed_integer [4] [5] 8.1 0.29 0.00 2856601 get_char [5] ----------------------------------------------- 0.03 0.00 420200/840400 read_signed_integer [4] 0.03 0.00 420200/840400 yylex [3] [6] 1.4 0.05 0.00 840400 unget_char [6] ----------------------------------------------- [7] 0.1 0.01 0.00 power [7] ----------------------------------------------- 0.00 0.00 1/1 yyparse [1] [8] 0.0 0.00 0.00 1 yydestruct [8] ----------------------------------------------- 0.00 0.00 1/1 yyparse [1] [9] 0.0 0.00 0.00 1 yypvarsinit [9] ----------------------------------------------- --/9DWx/yDrRhgMJTb-- From MAILER-DAEMON Fri Apr 07 22:21:01 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FS34P-0008UP-Jm for mharc-bison-patches@gnu.org; Fri, 07 Apr 2006 22:21:01 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FS34N-0008UE-83 for bison-patches@gnu.org; Fri, 07 Apr 2006 22:20:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FS34L-0008To-HF for bison-patches@gnu.org; Fri, 07 Apr 2006 22:20:58 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FS34L-0008Tj-C1 for bison-patches@gnu.org; Fri, 07 Apr 2006 22:20:57 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FS38Q-0002hQ-VN for bison-patches@gnu.org; Fri, 07 Apr 2006 22:25:11 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p2+Sun/8.11.7/UCLACS-5.2) with ESMTP id k382Ku717204 for ; Fri, 7 Apr 2006 19:20:56 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1FS34K-0003iZ-4W for bison-patches@gnu.org; Fri, 07 Apr 2006 19:20:56 -0700 To: Bison Patches References: <20060407145728.GD23931@brasko.net> From: Paul Eggert Date: Fri, 07 Apr 2006 19:20:56 -0700 In-Reply-To: <20060407145728.GD23931@brasko.net> (Bob Rossi's message of "Fri, 7 Apr 2006 10:57:28 -0400") Message-ID: <878xqg7qpj.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: bootstrap X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Apr 2006 02:21:00 -0000 Bob Rossi writes: > Should I do a 'cvs co bison', then a bootstrap in that directory, then > apply the patch, then do a configure and build? Sounds good to me. From MAILER-DAEMON Sat Apr 08 14:58:42 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FSIdt-00038z-NF for mharc-bison-patches@gnu.org; Sat, 08 Apr 2006 14:58:41 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FSIdr-00037X-5Z for bison-patches@gnu.org; Sat, 08 Apr 2006 14:58:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FSIdo-00036S-S8 for bison-patches@gnu.org; Sat, 08 Apr 2006 14:58:38 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FSIdo-00036N-Mf for bison-patches@gnu.org; Sat, 08 Apr 2006 14:58:36 -0400 Received: from [68.230.240.38] (helo=eastrmmtao01.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FSIi3-0006I3-R9 for bison-patches@gnu.org; Sat, 08 Apr 2006 15:03:00 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao01.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060408185832.WNCS3988.eastrmmtao01.cox.net@localhost.localdomain>; Sat, 8 Apr 2006 14:58:32 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FSIdx-0002UW-D1; Sat, 08 Apr 2006 14:58:45 -0400 Date: Sat, 8 Apr 2006 14:58:45 -0400 From: Bob Rossi To: Akim Demaille Message-ID: <20060408185845.GE1264@brasko.net> Mail-Followup-To: Akim Demaille , Bison Patches References: <20060317194252.GJ30980@brasko.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Apr 2006 18:58:39 -0000 On Fri, Apr 07, 2006 at 02:42:29PM +0200, Akim Demaille wrote: > Bob, > > I'm starting to toy with your implementation, and to try to bench it. > It seems that there is about a 15% performance loss of push.c compared > to yacc.c, both used in pull mode without compiler optimization on my > Mac. You know, it would be possible to only create the structure for the push parser mode, and to leave all variables declared in yyparse for normal mode and for pure mode. This would be more m4 magic, but would fix the performance problems. I wrote it the way it is now because it was cleaner. I only had to do m4 magic for 'pv->yychar' vs 'yychar' for the 4 user visible variables (instead of all the variables), because all 3 versions used the structure. What do you think? Bob Rossi From MAILER-DAEMON Mon Apr 10 15:44:00 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FT2Iq-0003E7-MS for mharc-bison-patches@gnu.org; Mon, 10 Apr 2006 15:44:00 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FT2Io-0003E2-BD for bison-patches@gnu.org; Mon, 10 Apr 2006 15:43:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FT2Im-0003DX-0o for bison-patches@gnu.org; Mon, 10 Apr 2006 15:43:57 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FT2Il-0003DM-KR for bison-patches@gnu.org; Mon, 10 Apr 2006 15:43:55 -0400 Received: from [68.230.240.34] (helo=eastrmmtao05.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FT2NT-0001dL-Bi for bison-patches@gnu.org; Mon, 10 Apr 2006 15:48:47 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao05.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060410194350.RJJO3108.eastrmmtao05.cox.net@localhost.localdomain>; Mon, 10 Apr 2006 15:43:50 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FT2Ix-000339-6c; Mon, 10 Apr 2006 15:44:07 -0400 Date: Mon, 10 Apr 2006 15:44:07 -0400 From: Bob Rossi To: Akim Demaille , Bison Patches Message-ID: <20060410194407.GA11595@brasko.net> Mail-Followup-To: Akim Demaille , Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060408185845.GE1264@brasko.net> User-Agent: Mutt/1.5.9i Cc: Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Apr 2006 19:43:58 -0000 On Sat, Apr 08, 2006 at 02:58:45PM -0400, Bob Rossi wrote: > On Fri, Apr 07, 2006 at 02:42:29PM +0200, Akim Demaille wrote: > > Bob, > > > > I'm starting to toy with your implementation, and to try to bench it. > > It seems that there is about a 15% performance loss of push.c compared > > to yacc.c, both used in pull mode without compiler optimization on my > > Mac. > > You know, it would be possible to only create the structure for the push > parser mode, and to leave all variables declared in yyparse for normal > mode and for pure mode. This would be more m4 magic, but would fix the > performance problems. > > I wrote it the way it is now because it was cleaner. I only had to do m4 > magic for 'pv->yychar' vs 'yychar' for the 4 user visible variables > (instead of all the variables), because all 3 versions used the structure. > > What do you think? Is this something I should do? Thanks, Bob Rossi From MAILER-DAEMON Mon Apr 17 22:19:55 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FVfop-000095-Mc for mharc-bison-patches@gnu.org; Mon, 17 Apr 2006 22:19:55 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FVfon-00008Q-7Y for bison-patches@gnu.org; Mon, 17 Apr 2006 22:19:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FVfoj-00006Y-JI for bison-patches@gnu.org; Mon, 17 Apr 2006 22:19:52 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FVfoj-00006V-D0 for bison-patches@gnu.org; Mon, 17 Apr 2006 22:19:49 -0400 Received: from [68.230.240.33] (helo=eastrmmtao06.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FVfpV-00038W-PN for bison-patches@gnu.org; Mon, 17 Apr 2006 22:20:37 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao06.cox.net (InterMail vM.6.01.06.01 201-2131-130-101-20060113) with ESMTP id <20060418021947.HJHP18886.eastrmmtao06.cox.net@localhost.localdomain>; Mon, 17 Apr 2006 22:19:47 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FVfok-0006QS-91; Mon, 17 Apr 2006 22:19:50 -0400 Date: Mon, 17 Apr 2006 22:19:50 -0400 From: Bob Rossi To: Akim Demaille , Bison Patches Message-ID: <20060418021950.GD12678@brasko.net> Mail-Followup-To: Akim Demaille , Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> <20060410194407.GA11595@brasko.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060410194407.GA11595@brasko.net> User-Agent: Mutt/1.5.9i Cc: Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Apr 2006 02:19:53 -0000 On Mon, Apr 10, 2006 at 03:44:07PM -0400, Bob Rossi wrote: > On Sat, Apr 08, 2006 at 02:58:45PM -0400, Bob Rossi wrote: > > On Fri, Apr 07, 2006 at 02:42:29PM +0200, Akim Demaille wrote: > > > Bob, > > > > > > I'm starting to toy with your implementation, and to try to bench it. > > > It seems that there is about a 15% performance loss of push.c compared > > > to yacc.c, both used in pull mode without compiler optimization on my > > > Mac. > > > > You know, it would be possible to only create the structure for the push > > parser mode, and to leave all variables declared in yyparse for normal > > mode and for pure mode. This would be more m4 magic, but would fix the > > performance problems. > > > > I wrote it the way it is now because it was cleaner. I only had to do m4 > > magic for 'pv->yychar' vs 'yychar' for the 4 user visible variables > > (instead of all the variables), because all 3 versions used the structure. > > > > What do you think? > > Is this something I should do? Hi everyone, I hope I can get some suggestions soon. I don't want this to be forgotten about. Either we can make the push parser a separate file, we can allow the user to loose the 10% speed performance, I can attempt to do the above suggestion, or I can see what happens if I declare the struct globally, and when in push-yacc and pure-yacc mode, declare variables on the stack with the same name as the struct's fields. This may improve the speed. Any of these ideas sound good? Thanks, Bob Rossi From MAILER-DAEMON Wed Apr 19 21:27:39 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FWNxL-0000br-Gd for mharc-bison-patches@gnu.org; Wed, 19 Apr 2006 21:27:39 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FWNxK-0000bl-EZ for bison-patches@gnu.org; Wed, 19 Apr 2006 21:27:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FWNxI-0000bX-QW for bison-patches@gnu.org; Wed, 19 Apr 2006 21:27:38 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FWNxI-0000bU-Nc for bison-patches@gnu.org; Wed, 19 Apr 2006 21:27:36 -0400 Received: from [130.127.200.32] (helo=ces.clemson.edu) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FWNyW-0006Jf-Jm for bison-patches@gnu.org; Wed, 19 Apr 2006 21:28:52 -0400 Received: from unixlab02.ces.clemson.edu (unixlab02.ces.clemson.edu [130.127.220.152]) by ces.clemson.edu (8.13.6/8.13.6) with ESMTP id k3K1QoR1006680; Wed, 19 Apr 2006 21:26:56 -0400 (EDT) Received: from localhost (jdenny@localhost) by unixlab02.ces.clemson.edu (8.9.3/8.9.3) with ESMTP id VAA15892; Wed, 19 Apr 2006 21:26:50 -0400 (EDT) X-Authentication-Warning: unixlab02.ces.clemson.edu: jdenny owned process doing -bs Date: Wed, 19 Apr 2006 21:26:50 -0400 (EDT) From: "Joel E. Denny" To: Bob Rossi In-Reply-To: <20060418021950.GD12678@brasko.net> Message-ID: References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> <20060410194407.GA11595@brasko.net> <20060418021950.GD12678@brasko.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.45 Cc: Akim Demaille , Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Apr 2006 01:27:38 -0000 On Mon, 17 Apr 2006, Bob Rossi wrote: > Hi everyone, I hope I can get some suggestions soon. I don't want this > to be forgotten about. > > Either we can make the push parser a separate file There are 4 skeletons now. Push parser mode could be desirable for any of them. Coding the push parser in separate skeletons could mean a total of 8 skeletons and a lot of redundant code. This doesn't seem like the right way to go. >, we can allow the user to loose the 10% speed performance I'm not concerned with this performance loss much for my current usage, but I imagine this is not acceptable to many Bison users. >, I can attempt to do the above > suggestion, or > > I can see what happens if I declare the struct globally, and when in > push-yacc and pure-yacc mode, declare variables on the stack with the > same name as the struct's fields. This may improve the speed. I don't have time to study these two alternatives and form a thoughtful opinion. It seems that others don't at the moment either. Maybe you could try one or both and report your findings. Joel From MAILER-DAEMON Wed Apr 19 22:25:15 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FWOr5-0004Yu-SF for mharc-bison-patches@gnu.org; Wed, 19 Apr 2006 22:25:15 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FWOr4-0004Yp-6I for bison-patches@gnu.org; Wed, 19 Apr 2006 22:25:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FWOr2-0004Yc-M1 for bison-patches@gnu.org; Wed, 19 Apr 2006 22:25:13 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FWOr2-0004YZ-Go for bison-patches@gnu.org; Wed, 19 Apr 2006 22:25:12 -0400 Received: from [68.230.240.36] (helo=eastrmmtao03.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FWOsG-0002Y2-TI for bison-patches@gnu.org; Wed, 19 Apr 2006 22:26:29 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao03.cox.net (InterMail vM.6.01.06.01 201-2131-130-101-20060113) with ESMTP id <20060420022508.BXLE14554.eastrmmtao03.cox.net@localhost.localdomain>; Wed, 19 Apr 2006 22:25:08 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FWOr4-0005vx-Rj; Wed, 19 Apr 2006 22:25:14 -0400 Date: Wed, 19 Apr 2006 22:25:14 -0400 From: Bob Rossi To: "Joel E. Denny" Message-ID: <20060420022514.GA15657@brasko.net> Mail-Followup-To: "Joel E. Denny" , Akim Demaille , Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> <20060410194407.GA11595@brasko.net> <20060418021950.GD12678@brasko.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i Cc: Akim Demaille , Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Apr 2006 02:25:14 -0000 On Wed, Apr 19, 2006 at 09:26:50PM -0400, Joel E. Denny wrote: > On Mon, 17 Apr 2006, Bob Rossi wrote: > > > Hi everyone, I hope I can get some suggestions soon. I don't want this > > to be forgotten about. > > > > Either we can make the push parser a separate file > > There are 4 skeletons now. Push parser mode could be desirable for any of > them. Coding the push parser in separate skeletons could mean a total of > 8 skeletons and a lot of redundant code. This doesn't seem like the right > way to go. I agree. Plus, the changes are not large. > >, we can allow the user to loose the 10% speed performance > > I'm not concerned with this performance loss much for my current usage, > but I imagine this is not acceptable to many Bison users. I have a patch that I'll post here shortly. Still trying to generate a parser that works. It should increase the performance and get yacc mode within 1% of it's original speed. > >, I can attempt to do the above > > suggestion, or > > > > I can see what happens if I declare the struct globally, and when in > > push-yacc and pure-yacc mode, declare variables on the stack with the > > same name as the struct's fields. This may improve the speed. > > I don't have time to study these two alternatives and form a thoughtful > opinion. It seems that others don't at the moment either. Maybe you > could try one or both and report your findings. I appreciate the honest suggestion. After I post the next patch, maybe I could get some feedback. It is a smaller patch. Bob Rossi From MAILER-DAEMON Thu Apr 20 05:13:46 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FWVEQ-0003ZL-Ic for mharc-bison-patches@gnu.org; Thu, 20 Apr 2006 05:13:46 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FWVEP-0003ZE-V8 for bison-patches@gnu.org; Thu, 20 Apr 2006 05:13:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FWVEO-0003Yy-8J for bison-patches@gnu.org; Thu, 20 Apr 2006 05:13:45 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FWVEO-0003Yv-6l for bison-patches@gnu.org; Thu, 20 Apr 2006 05:13:44 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FWVFg-0007HI-KP for bison-patches@gnu.org; Thu, 20 Apr 2006 05:15:04 -0400 Received: from nostromo.lrde.epita.fr ([192.168.101.52]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FWVEM-0001LL-SS for bison-patches@gnu.org; Thu, 20 Apr 2006 11:13:42 +0200 From: Akim Demaille To: Bison Patches References: <20060317194252.GJ30980@brasko.net> <676AFDF2-74E3-492C-B112-72808D051FE0@lrde.epita.fr> <20060407140449.GA23931@brasko.net> <6D0F7DA2-1714-4647-ABF3-20A1DE277AAF@lrde.epita.fr> <20060407160654.GA1264@brasko.net> Date: Thu, 20 Apr 2006 11:13:42 +0200 In-Reply-To: <20060407160654.GA1264@brasko.net> (Bob Rossi's message of "Fri, 7 Apr 2006 12:06:54 -0400") Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Apr 2006 09:13:46 -0000 >>> "Bob" == Bob Rossi writes: >> >Is there an easy script I can run on my Linux/AMD machine to generate >> >these results? >> >> Yes, the script I had attached. Here it is with the chidren stuff >> fixed. > OK, I have the script, and I have bison installed in > /home/bob/cvs/bison/bench/target. > How do I run this script? The instructions were buried at the end of my message. If you have this patch installed, then run this benchmarking script with Bison in your path. To exercise a built non-installed bison, the easiest is to use the script "bison" in tests/. With an example: sulaco-eth% PATH=$PWD/_build/tests:$PATH ./bench.pl bench expects to have a bison that supports a skeleton named push.c. From MAILER-DAEMON Thu Apr 20 05:16:25 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FWVGz-0004Uu-19 for mharc-bison-patches@gnu.org; Thu, 20 Apr 2006 05:16:25 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FWVGx-0004UJ-K9 for bison-patches@gnu.org; Thu, 20 Apr 2006 05:16:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FWVGv-0004TU-MW for bison-patches@gnu.org; Thu, 20 Apr 2006 05:16:23 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FWVGv-0004TR-HM for bison-patches@gnu.org; Thu, 20 Apr 2006 05:16:21 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FWVIC-0007UL-B6 for bison-patches@gnu.org; Thu, 20 Apr 2006 05:17:40 -0400 Received: from nostromo.lrde.epita.fr ([192.168.101.52]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FWVGp-0001QE-P7 for bison-patches@gnu.org; Thu, 20 Apr 2006 11:16:15 +0200 From: Akim Demaille To: Bison Patches References: <20060317194252.GJ30980@brasko.net> <676AFDF2-74E3-492C-B112-72808D051FE0@lrde.epita.fr> <20060407140449.GA23931@brasko.net> <6D0F7DA2-1714-4647-ABF3-20A1DE277AAF@lrde.epita.fr> <20060407160654.GA1264@brasko.net> <20060407161351.GB1264@brasko.net> Date: Thu, 20 Apr 2006 11:16:15 +0200 In-Reply-To: <20060407161351.GB1264@brasko.net> (Bob Rossi's message of "Fri, 7 Apr 2006 12:13:51 -0400") Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Apr 2006 09:16:23 -0000 >>> "Bob" == Bob Rossi writes: > Hmmm, let me clarify. I did > 'export BISON=/home/bob/cvs/bison/bench/target/bin/bison' > was that a good idea? I will update the script to make it more user friendly. > It seems as if, > PATH=/home/bob/cvs/bison/bench/target/bin:$PATH perl bench.pl > is running the script, will this give me the results you want? > Finally, after doing these things in this order: > - a fresh cvs co > - apply patch > - ./bootstrap > - ./configure > - make > I get a compile error. I had to manually do, > cd src/ > /usr/bin/bison parse-gram.y > mv parse-gram.tab.c parse-gram.c > mv parse-gram.tab.h parse-gram.h > and then do a make again. Is this OK? What sort of error did you find? Maybe there are conflicts in the generated files, that's very possible, in which case rm src/parse*[ch] should suffice. > Here are the results with a normal ./configure. I'm curious to see why > this slows down so much. Maybe I should run gprof. Yes, probably. This will probably not be fun :( From MAILER-DAEMON Thu Apr 20 05:26:49 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FWVR3-0000hs-6Q for mharc-bison-patches@gnu.org; Thu, 20 Apr 2006 05:26:49 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FWVR1-0000hT-Gj for bison-patches@gnu.org; Thu, 20 Apr 2006 05:26:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FWVR0-0000h9-6i for bison-patches@gnu.org; Thu, 20 Apr 2006 05:26:46 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FWVR0-0000h6-1A for bison-patches@gnu.org; Thu, 20 Apr 2006 05:26:46 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FWVSI-0000C3-Dq for bison-patches@gnu.org; Thu, 20 Apr 2006 05:28:06 -0400 Received: from nostromo.lrde.epita.fr ([192.168.101.52]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FWVQy-0001bP-K9 for bison-patches@gnu.org; Thu, 20 Apr 2006 11:26:44 +0200 From: Akim Demaille To: Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060407144111.GC23931@brasko.net> Date: Thu, 20 Apr 2006 11:26:44 +0200 In-Reply-To: <20060407144111.GC23931@brasko.net> (Bob Rossi's message of "Fri, 7 Apr 2006 10:41:11 -0400") Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Apr 2006 09:26:47 -0000 >>> "Bob" == Bob Rossi writes: > Theoretically, a function in bison uses a local variable named > "lfoo" and a global variable named "gfoo". I need to pack both > of these into a struct, named "sfoo". I agree the most probable loss is there: formerly register stored variables are now in ram. Some compilers are able to remove the cost of this abstraction though. >> 1. I think you should not change the semantics of yyparse in the push >> parser. In fact, I think the push parser should always provide >> yyparse as the good old pull interface wrapping the yyparse_push >> interface or whatever. >> > OK, so you would like the push parser to have a yyparse () function that > internally calls yyparse_push? I can do that, even though I really don't > see the point. Why would a user want to use the push parser if they > didn't want to use it in push mode? There probably is some advantage to > this that I can't think of though. I think that keeping a common interface is a very important feature. I'm very happy I can switch from yacc.c to glr.c or from lalr1.cc to glr.cc straightforwardly. That eases the migration from one set up to another. And it also considerably eases our maintenance tasks: same tests suite and same bench suite. > Would you like me to name it yyparse_push? or yyparse_wrapper? *wrapper is way too generic a name, push is ok. > There are currently 4 user visible variables. They are > yychar, yylval, yynerrs, and yylloc. > I am proposing 4 set's of set/get functions that give the user access to > these variables. If that is acceptable, I'll add the functions into the > patch. Yes, I think this is a best approach. >> 3. I don't think we should maintain the Cartesian product of all the >> badly designed features, so I suggest that push => pure. There are >> a couple of place where the (m4) code could be simplified then. > Are you saying you don't want to see %push-parser option, but rather > change %pure-parser to be the new "push parser"? No, I'm suggesting that push.c should not support non pure parsers, i.e., if the user asked for push, then pure comes as an additional feature. >> 4. Also, YYPARSE_PARAM is bad, does not scale well, etc. Don't bother >> with it except to maintain compatibility with the old mode. > OK, so just take those cases out? Yes. It is hard to extend to the other skeletons etc. That's an old feature that plain yacc.c should be the only one to have to deal with. From MAILER-DAEMON Thu Apr 20 05:34:46 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FWVYk-0004a4-6q for mharc-bison-patches@gnu.org; Thu, 20 Apr 2006 05:34:46 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FWVYh-0004Wr-OF for bison-patches@gnu.org; Thu, 20 Apr 2006 05:34:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FWVYh-0004WJ-6o for bison-patches@gnu.org; Thu, 20 Apr 2006 05:34:43 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FWVYh-0004W7-3r for bison-patches@gnu.org; Thu, 20 Apr 2006 05:34:43 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FWVZz-0000uY-GL for bison-patches@gnu.org; Thu, 20 Apr 2006 05:36:03 -0400 Received: from nostromo.lrde.epita.fr ([192.168.101.52]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FWVYf-0001gm-K7 for bison-patches@gnu.org; Thu, 20 Apr 2006 11:34:41 +0200 From: Akim Demaille To: Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> Date: Thu, 20 Apr 2006 11:34:41 +0200 In-Reply-To: <20060408185845.GE1264@brasko.net> (Bob Rossi's message of "Sat, 8 Apr 2006 14:58:45 -0400") Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Apr 2006 09:34:44 -0000 >>> "Bob" == Bob Rossi writes: > On Fri, Apr 07, 2006 at 02:42:29PM +0200, Akim Demaille wrote: >> Bob, >> >> I'm starting to toy with your implementation, and to try to bench it. >> It seems that there is about a 15% performance loss of push.c compared >> to yacc.c, both used in pull mode without compiler optimization on my >> Mac. > You know, it would be possible to only create the structure for the push > parser mode, and to leave all variables declared in yyparse for normal > mode and for pure mode. This would be more m4 magic, but would fix the > performance problems. > I wrote it the way it is now because it was cleaner. I only had to do m4 > magic for 'pv->yychar' vs 'yychar' for the 4 user visible variables > (instead of all the variables), because all 3 versions used the structure. > What do you think? I think we should struggle to keep our implementation as simple as possible, and be ready to trade simplicity against efficiency (to some extend). The 15% loss I observed seem acceptable to me, but we should strive to get rid of them. If we can't have any better figures with your current set up, then, yes, the best approach is to add more m4 magic so that push.c used in plain yacc mode leaves us with the initial performances. People know that LR parsers are not very efficient, but that's a fair trade for the flexibility that comes with a parser generator. My example, a calculator, is probably the worst case for Bison --- of course you could have a parser that does nothing but parsing, but is this case really relevant for genuine uses of Bison? ---, so really, as of today, I'm confident we could use push.c instead of yacc.c Still, you seem to experience nastier figures, so we might have to try harder :( Or poll our users. We could also try to bench gcc in yacc.c or in push.c: I guess you can't tell the difference. From MAILER-DAEMON Thu Apr 20 05:38:16 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FWVc8-0005F6-Oi for mharc-bison-patches@gnu.org; Thu, 20 Apr 2006 05:38:16 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FWVc7-0005Eq-2q for bison-patches@gnu.org; Thu, 20 Apr 2006 05:38:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FWVc4-0005Ed-M3 for bison-patches@gnu.org; Thu, 20 Apr 2006 05:38:13 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FWVc4-0005Ea-Gv for bison-patches@gnu.org; Thu, 20 Apr 2006 05:38:12 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FWVdN-00018u-1t for bison-patches@gnu.org; Thu, 20 Apr 2006 05:39:33 -0400 Received: from nostromo.lrde.epita.fr ([192.168.101.52]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FWVc2-0001nM-Qq; Thu, 20 Apr 2006 11:38:10 +0200 From: Akim Demaille To: "Joel E. Denny" References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> <20060410194407.GA11595@brasko.net> <20060418021950.GD12678@brasko.net> <20060420022514.GA15657@brasko.net> Date: Thu, 20 Apr 2006 11:38:10 +0200 In-Reply-To: <20060420022514.GA15657@brasko.net> (Bob Rossi's message of "Wed, 19 Apr 2006 22:25:14 -0400") Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Apr 2006 09:38:15 -0000 >>> "Bob" == Bob Rossi writes: > I have a patch that I'll post here shortly. Still trying to generate a > parser that works. It should increase the performance and get yacc mode > within 1% of it's original speed. That's very good news! Please, besides the patch, also include a complete copy of push.c. Also, have you tried to play with inlining directives? Maybe inlining yyparse_push into yyparse enables more optimizations from the compiler: it might be finally able to keep more values in register, without having all the time to store them in the stack and restore them afterward. From MAILER-DAEMON Thu Apr 20 06:09:02 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FWW5u-0005XL-7g for mharc-bison-patches@gnu.org; Thu, 20 Apr 2006 06:09:02 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FWW5s-0005V2-L0 for bison-patches@gnu.org; Thu, 20 Apr 2006 06:09:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FWW5r-0005Ul-4W for bison-patches@gnu.org; Thu, 20 Apr 2006 06:09:00 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FWW5q-0005Ui-VS for bison-patches@gnu.org; Thu, 20 Apr 2006 06:08:58 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FWW79-0004T9-Re for bison-patches@gnu.org; Thu, 20 Apr 2006 06:10:20 -0400 Received: from nostromo.lrde.epita.fr ([192.168.101.52]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FWW5p-0002Z5-Ep for bison-patches@gnu.org; Thu, 20 Apr 2006 12:08:57 +0200 From: Akim Demaille To: Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> Date: Thu, 20 Apr 2006 12:08:57 +0200 In-Reply-To: (Akim Demaille's message of "Thu, 20 Apr 2006 11:34:41 +0200") Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Apr 2006 10:09:00 -0000 >>> "Akim" == Akim Demaille writes: > The 15% loss I observed seem acceptable to me, but we should strive to > get rid of them. Well, I seem to have imagined that 15%. Rate push-push push-yacc push-pure yacc-yacc yacc-pure push-push 2.12/s -- -6% -8% -19% -22% push-yacc 2.26/s 6% -- -2% -13% -17% push-pure 2.32/s 9% 3% -- -11% -15% yacc-yacc 2.61/s 23% 15% 13% -- -4% yacc-pure 2.71/s 28% 20% 17% 4% -- Really, there is no reason to make non pure parsers :) I wish I could deprecate this feature. From MAILER-DAEMON Thu Apr 20 13:02:57 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FWcYT-0003Qp-BW for mharc-bison-patches@gnu.org; Thu, 20 Apr 2006 13:02:57 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FWcYR-0003Qh-Jx for bison-patches@gnu.org; Thu, 20 Apr 2006 13:02:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FWcYO-0003QS-RS for bison-patches@gnu.org; Thu, 20 Apr 2006 13:02:54 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FWcYO-0003QP-OX for bison-patches@gnu.org; Thu, 20 Apr 2006 13:02:52 -0400 Received: from [68.230.240.33] (helo=eastrmmtao06.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FWcZk-0000dB-QU for bison-patches@gnu.org; Thu, 20 Apr 2006 13:04:17 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao06.cox.net (InterMail vM.6.01.06.01 201-2131-130-101-20060113) with ESMTP id <20060420170249.TPJT18886.eastrmmtao06.cox.net@localhost.localdomain>; Thu, 20 Apr 2006 13:02:49 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FWcYS-0000PY-Mv; Thu, 20 Apr 2006 13:02:56 -0400 Date: Thu, 20 Apr 2006 13:02:56 -0400 From: Bob Rossi To: Akim Demaille Message-ID: <20060420170256.GD15657@brasko.net> Mail-Followup-To: Akim Demaille , Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="s/l3CgOIzMHHjg/5" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Apr 2006 17:02:55 -0000 --s/l3CgOIzMHHjg/5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Apr 20, 2006 at 12:08:57PM +0200, Akim Demaille wrote: > >>> "Akim" == Akim Demaille writes: > > > The 15% loss I observed seem acceptable to me, but we should strive to > > get rid of them. > > Well, I seem to have imagined that 15%. > > Rate push-push push-yacc push-pure yacc-yacc yacc-pure > push-push 2.12/s -- -6% -8% -19% -22% > push-yacc 2.26/s 6% -- -2% -13% -17% > push-pure 2.32/s 9% 3% -- -11% -15% > yacc-yacc 2.61/s 23% 15% 13% -- -4% > yacc-pure 2.71/s 28% 20% 17% 4% -- > > Really, there is no reason to make non pure parsers :) I wish I could > deprecate this feature. OK, what do you think of this patch? Again, I didn't bother cleaning it up to much, I'll do that if the numbers are acceptable. What do you think of the numbers? For some reason the push_opt yacc parser is faster than the regular yacc parser. Go figure. Benchmark: timing 50 iterations of push-opt-pure, push-opt-push, push-opt-yacc, push-pure, push-push, push-yacc, yacc-pure, yacc-yacc... push-opt-pure: 29 wallclock secs (28.03 cusr + 0.35 csys = 28.38 CPU) @ 1.76/s (n=50) push-opt-push: 43 wallclock secs (42.58 cusr + 0.32 csys = 42.90 CPU) @ 1.17/s (n=50) push-opt-yacc: 28 wallclock secs (27.37 cusr + 0.31 csys = 27.68 CPU) @ 1.81/s (n=50) push-pure: 35 wallclock secs (34.51 cusr + 0.32 csys = 34.83 CPU) @ 1.44/s (n=50) push-push: 42 wallclock secs (41.67 cusr + 0.30 csys = 41.97 CPU) @ 1.19/s (n=50) push-yacc: 35 wallclock secs (34.78 cusr + 0.32 csys = 35.10 CPU) @ 1.42/s (n=50) yacc-pure: 28 wallclock secs (28.05 cusr + 0.31 csys = 28.36 CPU) @ 1.76/s (n=50) yacc-yacc: 28 wallclock secs (27.50 cusr + 0.31 csys = 27.81 CPU) @ 1.80/s (n=50) Rate push-opt-push push-push push-yacc push-pure push-opt-pure yacc-pure yacc-yacc push-opt-yacc push-opt-push 1.17/s -- -2% -18% -19% -34% -34% -35% -35% push-push 1.19/s 2% -- -16% -17% -32% -32% -34% -34% push-yacc 1.42/s 22% 20% -- -1% -19% -19% -21% -21% push-pure 1.44/s 23% 20% 1% -- -19% -19% -20% -21% push-opt-pure 1.76/s 51% 48% 24% 23% -- -0% -2% -2% yacc-pure 1.76/s 51% 48% 24% 23% 0% -- -2% -2% yacc-yacc 1.80/s 54% 51% 26% 25% 2% 2% -- -0% push-opt-yacc 1.81/s 55% 52% 27% 26% 3% 2% 0% -- I've attached push_opt.c, and the new bench.pl script I'm using. You can diff it to yours to see the difference. Thanks, Bob Rossi --s/l3CgOIzMHHjg/5 Content-Type: text/x-perl; charset=us-ascii Content-Disposition: attachment; filename="bench.pl" Content-Transfer-Encoding: quoted-printable #! /usr/bin/perl -w use IO::File; use Benchmark qw (:all); my $bison =3D $ENV{'BISON'} || 'bison'; ################################################################## sub triangular_grammar ($$$) { my ($base, $max, $directives) =3D @_; my $out =3D new IO::File ">$base.y" or die; print $out < #include static int yylex (void); static void yyerror (const char *msg); %} %union { int val; }; %token END "end" %type exp input EOF for my $size (1 .. $max) { print $out "%token t$size $size \"$size\"\n"; }; print $out < $max) return 0; else if (inner > outer) { inner =3D 1; ++outer; return END; } return inner++; } static void yyerror (const char *msg) { fprintf (stderr, "%s\\n", msg); } int main (void) { yydebug =3D !!getenv ("YYDEBUG"); return yyparse (); } EOF } ################################################################## sub calc_input ($$) { my ($base, $max) =3D @_; my $out =3D new IO::File ">$base.input" or die; foreach (1 .. $max) { print $out "0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21+2= 2+23+24+25+26+27+28+29+30+31+32+33+34+35+36+37+38+39+40+41+42+43+44+45+46+4= 7+48+49+50+51+52+53+54+55+56+57+58+59+60+61+62+63+64+65+66+67+68+69+70+71+7= 2+73+74+75+76+77+78+79+80+81+82+83+84+85+86+87+88+89+90+91+92+93+94+95+96+9= 7+98+99\n"; print $out "1+1*(2+2*(3+3*(4+4*(5+5*(6+6*(7+7*(8+8*(9+9*(10+10*(11+11= *(12+12*(13+13*(14+14*(15+15*(16+16*(17+17*(18+18*(19+19*(20+20*(21+21*(22+= 22*(23+23*(24+24*(25+25*(26+26*(27+27*(28+28*(29+29*(30+30*(31+31*(32+32*(3= 3+33*(34+34*(35+35*(36+36*(37+37*(38+38*(39+39*(40+40*(41+41*(42+42*(43+43*= (44+44*(45+45*(46+46*(47+47*(48+48*(49+49*(50+50*(51+51*(52+52*(53+53*(54+5= 4*(55+55*(56+56*(57+57*(58+58*(59+59*(60+60*(61+61*(62+62*(63+63*(64+64*(65= +65*(66+66*(67+67*(68+68*(69+69*(70+70*(71+71*(72+72*(73+73*(74+74*(75+75*(= 76+76*(77+77*(78+78*(79+79*(80+80*(81+81*(82+82*(83+83*(84+84*(85+85*(86+86= *(87+87*(88+88*(89+89*(90+90*(91+91*(92+92*(93+93*(94+94*(95+95*(96+96*(97+= 97*(98+98*(99+99*(100+100*(101+101*(102+102*(103+103*(104+104*(105+105*(106= +106*(107+107*(108+108*(109+109*(110+110*(111+111*(112+112*(113+113*(114+11= 4*(115+115*(116+116*(117+117*(118+118*(119+119*(120+120*(121+121*(122+122*(= 123+123*(124+124*(125+125*(126+126*(127+127*(128+128*(129+129*(130+130*(131= +131*(132+132*(133+133*(134+134*(135+135*(136+136*(137+137*(138+138*(139+13= 9*(140+140*(141+141*(142+142*(143+143*(144+144*(145+145*(146+146*(147+147*(= 148+148*(149+149*(150+150*(151+151*(152+152*(153+153*(154+154*(155+155*(156= +156*(157+157*(158+158*(159+159*(160+160*(161+161*(162+162*(163+163*(164+16= 4*(165+165*(166+166*(167+167*(168+168*(169+169*(170+170*(171+171*(172+172*(= 173+173*(174+174*(175+175*(176+176*(177+177*(178+178*(179+179*(180+180*(181= +181*(182+182*(183+183*(184+184*(185+185*(186+186*(187+187*(188+188*(189+18= 9*(190+190*(191+191*(192+192*(193+193*(194+194*(195+195*(196+196*(197+197*(= 198+198*(199+199*(200+200*(201+201*(202+202*(203+203*(204+204*(205+205*(206= +206*(207+207*(208+208*(209+209*(210+210*(211+211*(212+212*(213+213*(214+21= 4*(215+215*(216+216*(217+217*(218+218*(219+219*(220+220*(221+221*(222+222*(= 223+223*(224+224*(225+225*(226+226*(227+227*(228+228*(229+229*(230+230*(231= +231*(232+232*(233+233*(234+234*(235+235*(236+236*(237+237*(238+238*(239+23= 9*(240+240*(241+241*(242+242*(243+243*(244+244*(245+245*(246+246*(247+247*(= 248+248*(249+249*(250+250*(251+251*(252+252*(253+253*(254+254*(255+255*(256= +256*(257+257*(258+258*(259+259*(260+260*(261+261*(262+262*(263+263*(264+26= 4*(265+265*(266+266*(267+267*(268+268*(269+269*(270+270*(271+271*(272+272*(= 273+273*(274+274*(275+275*(276+276*(277+277*(278+278*(279+279*(280+280*(281= +281*(282+282*(283+283*(284+284*(285+285*(286+286*(287+287*(288+288*(289+28= 9*(290+290*(291+291*(292+292*(293+293*(294+294*(295+295*(296+296*(297+297*(= 298+298*(299+299*(300+300*(301+301*(302+302*(303+303*(304+304*(305+305*(306= +306*(307+307*(308+308*(309+309*(310+310*(311+311*(312+312*(313+313*(314+31= 4*(315+315*(316+316*(317+317*(318+318*(319+319*(320+320*(321+321*(322+322*(= 323+323*(324+324*(325+325*(326+326*(327+327*(328+328*(329+329*(330+330*(331= +331*(332+332*(333+333*(334+334*(335+335*(336+336*(337+337*(338+338*(339+33= 9*(340+340*(341+341*(342+342*(343+343*(344+344*(345+345*(346+346*(347+347*(= 348+348*(349+349*(350+350*(351+351*(352+352*(353+353*(354+354*(355+355*(356= +356*(357+357*(358+358*(359+359*(360+360*(361+361*(362+362*(363+363*(364+36= 4*(365+365*(366+366*(367+367*(368+368*(369+369*(370+370*(371+371*(372+372*(= 373+373*(374+374*(375+375*(376+376*(377+377*(378+378*(379+379*(380+380*(381= +381*(382+382*(383+383*(384+384*(385+385*(386+386*(387+387*(388+388*(389+38= 9*(390+390*(391+391*(392+392*(393+393*(394+394*(395+395*(396+396*(397+397*(= 398+398*(399+399*(400+400*(401+401*(402+402*(403+403*(404+404*(405+405*(406= +406*(407+407*(408+408*(409+409*(410+410*(411+411*(412+412*(413+413*(414+41= 4*(415+415*(416+416*(417+417*(418+418*(419+419*(420+420*(421+421*(422+422*(= 423+423*(424+424*(425+425*(426+426*(427+427*(428+428*(429+429*(430+430*(431= +431*(432+432*(433+433*(434+434*(435+435*(436+436*(437+437*(438+438*(439+43= 9*(440+440*(441+441*(442+442*(443+443*(444+444*(445+445*(446+446*(447+447*(= 448+448*(449+449*(450+450*(451+451*(452+452*(453+453*(454+454*(455+455*(456= +456*(457+457*(458+458*(459+459*(460+460*(461+461*(462+462*(463+463*(464+46= 4*(465+465*(466+466*(467+467*(468+468*(469+469*(470+470*(471+471*(472+472*(= 473+473*(474+474*(475+475*(476+476*(477+477*(478+478*(479+479*(480+480*(481= +481*(482+482*(483+483*(484+484*(485+485*(486+486*(487+487*(488+488*(489+48= 9*(490+490*(491+491*(492+492*(493+493*(494+494*(495+495*(496+496*(497+497*(= 498+498*(499+499*(500+500*(501+501*(502+502*(503+503*(504+504*(505+505*(506= +506*(507+507*(508+508*(509+509*(510+510*(511+511*(512+512*(513+513*(514+51= 4*(515+515*(516+516*(517+517*(518+518*(519+519*(520+520*(521+521*(522+522*(= 523+523*(524+524*(525+525*(526+526*(527+527*(528+528*(529+529*(530+530*(531= +531*(532+532*(533+533*(534+534*(535+535*(536+536*(537+537*(538+538*(539+53= 9*(540+540*(541+541*(542+542*(543+543*(544+544*(545+545*(546+546*(547+547*(= 548+548*(549+549*(550+550*(551+551*(552+552*(553+553*(554+554*(555+555*(556= +556*(557+557*(558+558*(559+559*(560+560*(561+561*(562+562*(563+563*(564+56= 4*(565+565*(566+566*(567+567*(568+568*(569+569*(570+570*(571+571*(572+572*(= 573+573*(574+574*(575+575*(576+576*(577+577*(578+578*(579+579*(580+580*(581= +581*(582+582*(583+583*(584+584*(585+585*(586+586*(587+587*(588+588*(589+58= 9*(590+590*(591+591*(592+592*(593+593*(594+594*(595+595*(596+596*(597+597*(= 598+598*(599+599*(600+600*(601+601*(602+602*(603+603*(604+604*(605+605*(606= +606*(607+607*(608+608*(609+609*(610+610*(611+611*(612+612*(613+613*(614+61= 4*(615+615*(616+616*(617+617*(618+618*(619+619*(620+620*(621+621*(622+622*(= 623+623*(624+624*(625+625*(626+626*(627+627*(628+628*(629+629*(630+630*(631= +631*(632+632*(633+633*(634+634*(635+635*(636+636*(637+637*(638+638*(639+63= 9*(640+640*(641+641*(642+642*(643+643*(644+644*(645+645*(646+646*(647+647*(= 648+648*(649+649*(650+650*(651+651*(652+652*(653+653*(654+654*(655+655*(656= +656*(657+657*(658+658*(659+659*(660+660*(661+661*(662+662*(663+663*(664+66= 4*(665+665*(666+666*(667+667*(668+668*(669+669*(670+670*(671+671*(672+672*(= 673+673*(674+674*(675+675*(676+676*(677+677*(678+678*(679+679*(680+680*(681= +681*(682+682*(683+683*(684+684*(685+685*(686+686*(687+687*(688+688*(689+68= 9*(690+690*(691+691*(692+692*(693+693*(694+694*(695+695*(696+696*(697+697*(= 698+698*(699+699*(700+700*(701+701*(702+702*(703+703*(704+704*(705+705*(706= +706*(707+707*(708+708*(709+709*(710+710*(711+711*(712+712*(713+713*(714+71= 4*(715+715*(716+716*(717+717*(718+718*(719+719*(720+720*(721+721*(722+722*(= 723+723*(724+724*(725+725*(726+726*(727+727*(728+728*(729+729*(730+730*(731= +731*(732+732*(733+733*(734+734*(735+735*(736+736*(737+737*(738+738*(739+73= 9*(740+740*(741+741*(742+742*(743+743*(744+744*(745+745*(746+746*(747+747*(= 748+748*(749+749*(750+750*(751+751*(752+752*(753+753*(754+754*(755+755*(756= +756*(757+757*(758+758*(759+759*(760+760*(761+761*(762+762*(763+763*(764+76= 4*(765+765*(766+766*(767+767*(768+768*(769+769*(770+770*(771+771*(772+772*(= 773+773*(774+774*(775+775*(776+776*(777+777*(778+778*(779+779*(780+780*(781= +781*(782+782*(783+783*(784+784*(785+785*(786+786*(787+787*(788+788*(789+78= 9*(790+790*(791+791*(792+792*(793+793*(794+794*(795+795*(796+796*(797+797*(= 798+798*(799+799*(800+800*(801+801*(802+802*(803+803*(804+804*(805+805*(806= +806*(807+807*(808+808*(809+809*(810+810*(811+811*(812+812*(813+813*(814+81= 4*(815+815*(816+816*(817+817*(818+818*(819+819*(820+820*(821+821*(822+822*(= 823+823*(824+824*(825+825*(826+826*(827+827*(828+828*(829+829*(830+830*(831= +831*(832+832*(833+833*(834+834*(835+835*(836+836*(837+837*(838+838*(839+83= 9*(840+840*(841+841*(842+842*(843+843*(844+844*(845+845*(846+846*(847+847*(= 848+848*(849+849*(850+850*(851+851*(852+852*(853+853*(854+854*(855+855*(856= +856*(857+857*(858+858*(859+859*(860+860*(861+861*(862+862*(863+863*(864+86= 4*(865+865*(866+866*(867+867*(868+868*(869+869*(870+870*(871+871*(872+872*(= 873+873*(874+874*(875+875*(876+876*(877+877*(878+878*(879+879*(880+880*(881= +881*(882+882*(883+883*(884+884*(885+885*(886+886*(887+887*(888+888*(889+88= 9*(890+890*(891+891*(892+892*(893+893*(894+894*(895+895*(896+896*(897+897*(= 898+898*(899+899*(900+900*(901+901*(902+902*(903+903*(904+904*(905+905*(906= +906*(907+907*(908+908*(909+909*(910+910*(911+911*(912+912*(913+913*(914+91= 4*(915+915*(916+916*(917+917*(918+918*(919+919*(920+920*(921+921*(922+922*(= 923+923*(924+924*(925+925*(926+926*(927+927*(928+928*(929+929*(930+930*(931= +931*(932+932*(933+933*(934+934*(935+935*(936+936*(937+937*(938+938*(939+93= 9*(940+940*(941+941*(942+942*(943+943*(944+944*(945+945*(946+946*(947+947*(= 948+948*(949+949*(950+950*(951+951*(952+952*(953+953*(954+954*(955+955*(956= +956*(957+957*(958+958*(959+959*(960+960*(961+961*(962+962*(963+963*(964+96= 4*(965+965*(966+966*(967+967*(968+968*(969+969*(970+970*(971+971*(972+972*(= 973+973*(974+974*(975+975*(976+976*(977+977*(978+978*(979+979*(980+980*(981= +981*(982+982*(983+983*(984+984*(985+985*(986+986*(987+987*(988+988*(989+98= 9*(990+990*(991+991*(992+992*(993+993*(994+994*(995+995*(996+996*(997+997*(= 998+998*(999+999*(1000+1000*(1001))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\n"; } } ################################################################## sub calc_grammar ($$$) { my ($base, $max, $directives) =3D @_; my $out =3D new IO::File ">$base.y" or die; print $out < #include #include #include #define USE(Var) /* Exercise pre-prologue dependency to %union. */ typedef int semantic_value; static semantic_value global_result =3D 0; static int global_count =3D 0; %} /* Exercise %union. */ $directives %error-verbose %union { semantic_value ival; }; %{ static int power (int base, int exponent); /* yyerror receives the location if: - %location & %pure & %glr - %location & %pure & %yacc & %parse-param. */ static void yyerror (const char *s); #if YYPURE static int yylex (YYSTYPE* yylvalp); #else static int yylex (void); #endif %} /* Bison Declarations */ %token CALC_EOF 0 "end of input" %token NUM "number" %type exp %nonassoc '=3D' /* comparison */ %left '-' '+' %left '*' '/' %left NEG /* negation--unary minus */ %right '^' /* exponentiation */ /* Grammar follows */ %% input: line | input line ; line: '\\n' | exp '\\n' { USE (\$1); } ; exp: NUM { \$\$ =3D \$1; } | exp '=3D' exp { if (\$1 !=3D \$3) fprintf (stderr, "calc: error: %d !=3D %d\\n", \$1, \$3); \$\$ =3D \$1; } | exp '+' exp { \$\$ =3D \$1 + \$3; } | exp '-' exp { \$\$ =3D \$1 - \$3; } | exp '*' exp { \$\$ =3D \$1 * \$3; } | exp '/' exp { \$\$ =3D \$1 / \$3; } | '-' exp %prec NEG { \$\$ =3D -\$2; } | exp '^' exp { \$\$ =3D power (\$1, \$3); } | '(' exp ')' { \$\$ =3D \$2; } | '(' error ')' { \$\$ =3D 1111; } | '!' { \$\$ =3D 0; YYERROR; } | '-' error { \$\$ =3D 0; YYERROR; } ; %% /* The input. */ static FILE *input; static void yyerror (const char *s) { fprintf (stderr, "%s\\n", s); } static int get_char (void) { return getc (input); } static void unget_char ( int c) { ungetc (c, input); } static int read_signed_integer (void) { int c =3D get_char (); int sign =3D 1; int n =3D 0; if (c =3D=3D '-') { c =3D get_char (); sign =3D -1; } while (isdigit (c)) { n =3D 10 * n + (c - '0'); c =3D get_char (); } unget_char (c); return sign * n; } #if YYPUSH #ifndef HAVE_YYSTYPE static YYSTYPE yylval; #endif #endif static int #if YYPURE # define yylval (*yylvalp) yylex (YYSTYPE* yylvalp) #else yylex (void) #endif { int c; /* Skip white space. */ while ((c =3D get_char ()) =3D=3D ' ' || c =3D=3D '\t') { } /* process numbers */ if (c =3D=3D '.' || isdigit (c)) { unget_char ( c); yylval.ival =3D read_signed_integer (); return NUM; } /* Return end-of-file. */ if (c =3D=3D EOF) return CALC_EOF; /* Return single chars. */ return c; } static int power (int base, int exponent) { int res =3D 1; if (exponent < 0) exit (3); for (/* Niente */; exponent; --exponent) res *=3D base; return res; } #if YYPUSH static int=20 yyparse_wrapper () { struct yypvars *ctx =3D yypvarsinit (); do { = =20 set_yychar (ctx, yylex ()); = =20 yyparse (ctx); = =20 // set_yychar (ctx, yylex ()); = =20 ctx->yylval =3D yylval; } while (get_yyresult (ctx) !=3D 0); = =20 free (ctx); =20 } =20 #define yyparse yyparse_wrapper #endif int main (int argc, const char **argv) { semantic_value result =3D 0; int count =3D 0; int status; input =3D fopen ("calc.input", "r"); if (!input) { perror ("calc.input"); return 3; } status =3D yyparse (); if (global_result !=3D result) abort (); if (global_count !=3D count) abort (); return status; } EOF } ################################################################## sub compile ($) { my ($base) =3D @_; system ("bison $base.y -o $base.c"); system ("gcc -pg $base.c -o $base"); =20 } sub bench_grammar ($) { my ($gram) =3D @_; my %test =3D ( "yacc-yacc" =3D> '', "yacc-pure" =3D> '%pure-parser', "push-yacc" =3D> '%skeleton "push.c"', "push-pure" =3D> '%skeleton "push.c" %pure-parser', "push-push" =3D> '%skeleton "push.c" %push-parser', "push-opt-yacc" =3D> '%skeleton "push_opt.c"', "push-opt-pure" =3D> '%skeleton "push_opt.c" %pure-parser', "push-opt-push" =3D> '%skeleton "push_opt.c" %push-parser', ); =20 my %bench; while (my ($name, $directives) =3D each %test) { print STDERR "$name\n"; my $generator =3D "$gram" . "_grammar"; &$generator ($name, 200, $directives); compile ($name); $bench{$name} =3D "system ('./$name');"; } print "$gram:\n"; my $res =3D timethese (50, \%bench, 'nop'); cmpthese ($res, 'nop'); } calc_input ('calc', 200); bench_grammar ('calc'); ### Setup "GNU" style for perl-mode and cperl-mode. ## Local Variables: ## perl-indent-level: 2 ## perl-continued-statement-offset: 2 ## perl-continued-brace-offset: 0 ## perl-brace-offset: 0 ## perl-brace-imaginary-offset: 0 ## perl-label-offset: -2 ## cperl-indent-level: 2 ## cperl-brace-offset: 0 ## cperl-continued-brace-offset: 0 ## cperl-label-offset: -2 ## cperl-extra-newline-before-brace: t ## cperl-merge-trailing-else: nil ## cperl-continued-statement-offset: 2 ## End: --s/l3CgOIzMHHjg/5 Content-Type: text/x-csrc; charset=us-ascii Content-Disposition: attachment; filename="push_opt.c" m4_divert(-1) -*- C -*- # Yacc compatible skeleton for Bison # Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # 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 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA m4_include(b4_pkgdatadir/[c.m4]) ## ---------------- ## ## Default values. ## ## ---------------- ## # Stack parameters. m4_define_default([b4_stack_depth_max], [10000]) m4_define_default([b4_stack_depth_init], [200]) ## ------------------------ ## ## Pure/impure interfaces. ## ## ------------------------ ## # b4_yacc_pure_if(IF-TRUE, IF-FALSE) # ---------------------------------- # Expand IF-TRUE, if %pure-parser and %parse-param, IF-FALSE otherwise. m4_define([b4_yacc_pure_if], [b4_pure_if([m4_ifset([b4_parse_param], [$1], [$2])], [$2])]) # b4_yyerror_args # --------------- # Arguments passed to yyerror: user args plus yylloc. m4_define([b4_yyerror_args], [b4_yacc_pure_if([b4_location_if([&yylloc, ])])dnl m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])]) # b4_lex_param # ------------ # Accumulate in b4_lex_param all the yylex arguments. # b4_lex_param arrives quoted twice, but we want to keep only one level. m4_define([b4_lex_param], m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl b4_location_if([, [[YYLTYPE *], [&yylloc]]])m4_ifdef([b4_lex_param], [, ])])dnl m4_ifdef([b4_lex_param], b4_lex_param))) ## ------------ ## ## Data Types. ## ## ------------ ## # b4_int_type(MIN, MAX) # --------------------- # Return the smallest int type able to handle numbers ranging from # MIN to MAX (included). Overwrite the version from c.m4, which # uses only C89 types, so that the user can override the shorter # types, and so that pre-C89 compilers are handled correctly. m4_define([b4_int_type], [m4_if(b4_ints_in($@, [0], [255]), [1], [yytype_uint8], b4_ints_in($@, [-128], [127]), [1], [yytype_int8], b4_ints_in($@, [0], [65535]), [1], [yytype_uint16], b4_ints_in($@, [-32768], [32767]), [1], [yytype_int16], m4_eval([0 <= $1]), [1], [unsigned int], [int])]) ## ----------------- ## ## Semantic Values. ## ## ----------------- ## # b4_lhs_value([TYPE]) # -------------------- # Expansion of $$. m4_define([b4_lhs_value], [(yyval[]m4_ifval([$1], [.$1]))]) # b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) # -------------------------------------- # Expansion of $NUM, where the current rule has RULE-LENGTH # symbols on RHS. m4_define([b4_rhs_value], [(yyvsp@{($2) - ($1)@}m4_ifval([$3], [.$3]))]) ## ----------- ## ## Locations. ## ## ----------- ## # b4_lhs_location() # ----------------- # Expansion of @$. m4_define([b4_lhs_location], [(yyloc)]) # b4_rhs_location(RULE-LENGTH, NUM) # --------------------------------- # Expansion of @NUM, where the current rule has RULE-LENGTH symbols # on RHS. m4_define([b4_rhs_location], [(yylsp@{($2) - ($1)@})]) ## --------------------------------------------------------- ## ## Defining symbol actions, e.g., printers and destructors. ## ## --------------------------------------------------------- ## # We do want M4 expansion after # for CPP macros. m4_changecom() m4_divert(0)dnl @output @output_parser_name@ b4_copyright([Skeleton parser for Yacc-like parsing with Bison], [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])[ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ ]b4_identification m4_if(b4_prefix, [yy], [], [/* Substitute the variable and function names. */ #define yyparse b4_prefix[]parse #define yypvarsinit b4_prefix[]pvarsinit #define yylex b4_prefix[]lex #define yyerror b4_prefix[]error #define yylval b4_prefix[]lval #define yychar b4_prefix[]char #define yydebug b4_prefix[]debug #define yynerrs b4_prefix[]nerrs b4_location_if([#define yylloc b4_prefix[]lloc])])[ ]b4_token_enums_defines(b4_tokens)[ /* Copy the first part of user declarations. */ ]b4_pre_prologue[ /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG ]b4_debug[ #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE ]b4_error_verbose[ #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE ]b4_token_table[ #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED ]m4_ifdef([b4_stype], [typedef union[]m4_bregexp(b4_stype, [^{], [ YYSTYPE]) b4_stype /* Line __line__ of yacc.c. */ b4_syncline([@oline@], [@ofile@]) YYSTYPE;], [typedef int YYSTYPE;])[ # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif ]b4_location_if([#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; } YYLTYPE; # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif ])[ /* Copy the second part of user declarations. */ ]b4_post_prologue /* Line __line__ of yacc.c. */ b4_syncline([@oline@], [@ofile@])[ #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif ]b4_c_modern[ typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && ]b4_c_modern[ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else ]b4_c_function_def([YYID], [static int], [[int i], [i]])[ { return i; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && ]b4_c_modern[ # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && ]b4_c_modern[ void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && ]b4_c_modern[ void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (]b4_location_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ && ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss; YYSTYPE yyvs; ]b4_location_if([ YYLTYPE yyls; ])dnl [}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ ]b4_location_if( [# define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAXIMUM)], [# define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM)])[ /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL ]b4_final_state_number[ /* YYLAST -- Last index in YYTABLE. */ #define YYLAST ]b4_last[ /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS ]b4_tokens_number[ /* YYNNTS -- Number of nonterminals. */ #define YYNNTS ]b4_nterms_number[ /* YYNRULES -- Number of rules. */ #define YYNRULES ]b4_rules_number[ /* YYNRULES -- Number of states. */ #define YYNSTATES ]b4_states_number[ /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK ]b4_undef_token_number[ #define YYMAXUTOK ]b4_user_token_number_max[ #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const ]b4_int_type_for([b4_translate])[ yytranslate[] = { ]b4_translate[ }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const ]b4_int_type_for([b4_prhs])[ yyprhs[] = { ]b4_prhs[ }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const ]b4_int_type_for([b4_rhs])[ yyrhs[] = { ]b4_rhs[ }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const ]b4_int_type_for([b4_rline])[ yyrline[] = { ]b4_rline[ }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { ]b4_tname[ }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] = { ]b4_toknum[ }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const ]b4_int_type_for([b4_r1])[ yyr1[] = { ]b4_r1[ }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const ]b4_int_type_for([b4_r2])[ yyr2[] = { ]b4_r2[ }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const ]b4_int_type_for([b4_defact])[ yydefact[] = { ]b4_defact[ }; /* YYDEFGOTO[NTERM-NUM]. */ static const ]b4_int_type_for([b4_defgoto])[ yydefgoto[] = { ]b4_defgoto[ }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF ]b4_pact_ninf[ static const ]b4_int_type_for([b4_pact])[ yypact[] = { ]b4_pact[ }; /* YYPGOTO[NTERM-NUM]. */ static const ]b4_int_type_for([b4_pgoto])[ yypgoto[] = { ]b4_pgoto[ }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF ]b4_table_ninf[ static const ]b4_int_type_for([b4_table])[ yytable[] = { ]b4_table[ }; static const ]b4_int_type_for([b4_check])[ yycheck[] = { ]b4_check[ }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const ]b4_int_type_for([b4_stos])[ yystos[] = { ]b4_stos[ }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (]b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])[YYLEX_PARAM) #else # define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[ #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value]b4_location_if([, Location])[]b4_user_args[); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) ]b4_yy_symbol_print_generate([b4_c_function_def])[ /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ ]b4_c_function_def([yy_stack_print], [static void], [[yytype_int16 *bottom], [bottom]], [[yytype_int16 *top], [top]])[ { YYFPRINTF (stderr, "Stack now"); for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ ]b4_c_function_def([yy_reduce_print], [static void], [[YYSTYPE *yyvsp], [yyvsp]], b4_location_if([[[YYLTYPE *yylsp], [yylsp]],]) [[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,]) b4_parse_param)[ { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &]b4_rhs_value(yynrhs, yyi + 1)[ ]b4_location_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl b4_user_args[); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, ]b4_location_if([yylsp, ])[Rule]b4_user_args[); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH ]b4_stack_depth_init[ #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH ]b4_stack_depth_max[ #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ ]b4_c_function_def([yystrlen], [static YYSIZE_T], [[const char *yystr], [yystr]])[ { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ ]b4_c_function_def([yystpcpy], [static char *], [[char *yydest], [yydest]], [[const char *yysrc], [yysrc]])[ { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { size_t yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn < YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ ]b4_yydestruct_generate([b4_c_function_def])[ /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM ]b4_c_function_decl([yyparse], [int], [[void *YYPARSE_PARAM], [YYPARSE_PARAM]])[ #elif YYPUSH ]b4_c_function_decl([get_yyresult], [int], [[void *PVVOID], [PVVOID]])[ ]b4_c_function_decl([set_yychar], [void], [[void *PVVOID], [PVVOID]], [[int yychar], [yychar]])[ ]b4_c_function_decl([yypvarsinit], [void *], [[void], []])[ ]b4_c_function_decl([yyparse], [void], [[void *PVVOID], [PVVOID]])[ #else /* ! YYPARSE_PARAM */ ]b4_c_function_decl([yyparse], [int], b4_parse_param)[ #endif /* ! YYPARSE_PARAM */ ]m4_divert_push([KILL])# ======================== M4 code. # b4_declare_parser_variables # --------------------------- # Declare the variables that are global, or local to YYPARSE if # pure-parser. m4_define([b4_declare_parser_variables], [/* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs;b4_location_if([ /* Location data for the look-ahead symbol. */ YYLTYPE yylloc;]) ]) # b4_declare_yyparse_variables # ---------------------------- # Declare all the variables that are needed local to YYPARSE m4_define([b4_declare_yyparse_variables], [[struct yypvars { ]]b4_declare_parser_variables[[ int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsgbuf_ptr; char *yymsg; YYSIZE_T yymsg_alloc; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss_ptr; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs_ptr; YYSTYPE *yyvs; YYSTYPE *yyvsp;]]b4_location_if([[[ /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls_ptr; YYLTYPE *yyls; YYLTYPE *yylsp; /* The locations where the error started and ended. */ YYLTYPE yyerror_range[2]; YYLTYPE *yyerror_range_ptr;]]])[ YYSIZE_T yystacksize; int yylen; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* Used to determine if this is the first time this instance has been used. */ int yynew;]b4_location_if([YYLTYPE yyloc;])[ }; /* Init the parser data structure. Use malloc, should perhaps use a system dependent equivalent function. */ void* yypvarsinit (void) { struct yypvars *pv; pv= (struct yypvars *) malloc(sizeof(struct yypvars)); pv->yystate = 0; pv->yyresult = -1; pv->yyerrstatus = 0; pv->yytoken = 0; #if YYERROR_VERBOSE pv->yymsgbuf_ptr = pv->yymsgbuf; pv->yymsg = pv->yymsgbuf; pv->yymsg_alloc = sizeof pv->yymsgbuf; #endif pv->yyss_ptr = pv->yyssa; pv->yyss = pv->yyss_ptr; pv->yyvs_ptr = pv->yyvsa; pv->yyvs = pv->yyvs_ptr; ]b4_location_if([ pv->yyls_ptr = pv->yylsa; pv->yyls = pv->yyls_ptr;])[ pv->yystacksize = YYINITDEPTH; pv->yyssp = pv->yyss; pv->yyvsp = pv->yyvs; pv->yynew = 1; ]b4_location_if([ pv->yylsp = pv->yyls;])[ /* Init parser variables */ return (void*) pv; } int get_yyresult (void *PVVOID) { struct yypvars *pv = (struct yypvars*)PVVOID; return pv->yyresult; } void set_yychar (void *PVVOID, int yychar) { struct yypvars *pv = (struct yypvars*)PVVOID; if (pv) pv->yychar = yychar; }]) m4_divert_pop([KILL])dnl# ====================== End of M4 code. b4_pure_if([], [b4_declare_parser_variables]) b4_declare_yyparse_variables /*----------. | yyparse. | `----------*/ #define HAVE_YYSTYPE 1 #ifdef YYPARSE_PARAM b4_c_function_def([yyparse], [int], [[void *YYPARSE_PARAM], [YYPARSE_PARAM]]) #elif YYPUSH b4_c_function_def([yyparse], [void], [[void *PVVOID], [PVVOID]]) #else /* ! YYPARSE_PARAM */ b4_c_function_def([yyparse], [int], b4_parse_param) #endif {[ ]b4_pure_if([b4_declare_parser_variables])[ struct yypvars *pv; int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsgbuf_ptr = yymsgbuf; char *yymsg = yymsgbuf_ptr; YYSIZE_T yymsg_alloc = sizeof yymsgbuf_ptr; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss_ptr = yyssa;; yytype_int16 *yyss = yyss_ptr; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs_ptr = yyvsa; YYSTYPE *yyvs = yyvs_ptr; YYSTYPE *yyvsp; ]b4_location_if( [[ /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls_ptr = yylsa; YYLTYPE *yyls = yyls_ptr; YYLTYPE *yylsp; /* The locations where the error started and ended. */ YYLTYPE yyerror_range[2]; YYLTYPE *yyerror_range_ptr = yyerror_range;; ]])[ #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)]b4_location_if([, yylsp -= (N)])[) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; ]b4_location_if([ YYLTYPE yyloc;])[ /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); ]b4_push_if([pv = (struct yypvars*)PVVOID;],[pv = yypvarsinit ();])[ yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; ]b4_location_if([[ yylsp = yyls; #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 0; #endif ]]) m4_ifdef([b4_initial_action], [ m4_pushdef([b4_at_dollar], [m4_define([b4_at_dollar_used])yylloc])dnl m4_pushdef([b4_dollar_dollar], [m4_define([b4_dollar_dollar_used])yylval])dnl /* User initialization code. */ b4_initial_action m4_popdef([b4_dollar_dollar])dnl m4_popdef([b4_at_dollar])dnl /* Line __line__ of yacc.c. */ b4_syncline([@oline@], [@ofile@]) ])dnl m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval; ]])dnl m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc; ]])dnl [ ]b4_push_if([ /* Initialize the locals to the current context. */ yychar = pv->yychar; yylval = pv->yylval; yynerrs = pv->yynerrs; ]b4_location_if([ yylloc = pv->yylloc;])[ yystate = pv->yystate; yyn = pv->yyn; yyresult = pv->yyresult; yyerrstatus = pv->yyerrstatus; yytoken = pv->yytoken; #if YYERROR_VERBOSE yymsgbuf_ptr = pv->yymsgbuf_ptr; yymsg = pv->yymsg;; yymsg_alloc = pv->yymsg_alloc; #endif yyss_ptr = pv->yyss_ptr; yyss = pv->yyss; yyssp = pv->yyssp; yyvs_ptr = pv->yyvs_ptr; yyvs = pv->yyvs; yyvsp = pv->yyvsp; ]b4_location_if([[ /* The location stack. */ yyls_ptr = pv->yyls_ptr; yyls = pv->yyls; yylsp = pv->yylsp; yyerror_range_ptr = pv->yyerror_range_ptr;]])[ yystacksize = pv->yystacksize; yylen = pv->yylen; yyval = pv->yyval; ]b4_location_if([yyloc = pv->yyloc;])[ if (pv->yynew == 0) { goto gottoken; } pv->yynew= 0;])[ goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; ]b4_location_if([ YYLTYPE *yyls1 = yyls;])[ /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), ]b4_location_if([ &yyls1, yysize * sizeof (*yylsp),])[ &yystacksize); ]b4_location_if([ yyls = yyls1;])[ yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); ]b4_location_if([ YYSTACK_RELOCATE (yyls);])[ # undef YYSTACK_RELOCATE if (yyss1 != yyss_ptr) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; ]b4_location_if([ yylsp = yyls + yysize - 1;])[ YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { ]b4_push_if([ YYDPRINTF ((stderr, "Returns for a new token: ")); yyresult= 4; /* Initialize the locals to the current context. */ pv->yychar = yychar; pv->yylval = yylval; pv->yynerrs = yynerrs; ]b4_location_if([ pv->yylloc = yylloc;])[ pv->yystate = yystate; pv->yyn = yyn; pv->yyresult = yyresult; pv->yyerrstatus = yyerrstatus; pv->yytoken = yytoken; #if YYERROR_VERBOSE pv->yymsgbuf_ptr = yymsgbuf_ptr; pv->yymsg = yymsg;; pv->yymsg_alloc = yymsg_alloc; #endif pv->yyss_ptr = yyss_ptr; pv->yyss = yyss; pv->yyssp = yyssp; pv->yyvs_ptr = yyvs_ptr; pv->yyvs = yyvs; pv->yyvsp = yyvsp; ]b4_location_if([[ /* The location stack. */ pv->yyls_ptr = yyls_ptr; pv->yyls = yyls; pv->yylsp = yylsp; pv->yyerror_range_ptr = yyerror_range_ptr;]])[ pv->yystacksize = yystacksize; pv->yylen = yylen; pv->yyval = yyval; ]b4_location_if([pv->yyloc = yyloc;])[ return; gottoken: YYDPRINTF((stderr, "\nGot token %d", yychar));],[ YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX;])[ } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; ]b4_location_if([ *++yylsp = yylloc;])[ goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; ]b4_location_if( [[ /* Default location. */ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[ YY_REDUCE_PRINT (yyn); switch (yyn) { ]b4_actions /* Line __line__ of yacc.c. */ b4_syncline([@oline@], [@ofile@])[ default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; ]b4_location_if([ *++yylsp = yyloc;])[ /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (]b4_yyerror_args[YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf_ptr) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf_ptr; yymsg_alloc = sizeof yymsgbuf_ptr; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (]b4_yyerror_args[yymsg); } else { yyerror (]b4_yyerror_args[YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } ]b4_location_if([[ yyerror_range_ptr[0] = yylloc;]])[ if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval]b4_location_if([, &yylloc])[]b4_user_args[); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; ]b4_location_if([[ yyerror_range_ptr[0] = yylsp[1-yylen]; ]])[ /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; ]b4_location_if([[ yyerror_range_ptr[0] = *yylsp;]])[ yydestruct ("Error: popping", yystos[yystate], yyvsp]b4_location_if([, yylsp])[]b4_user_args[); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; ]b4_location_if([[ yyerror_range_ptr[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of the look-ahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range_ptr - 1), 2); *++yylsp = yyloc;]])[ /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (]b4_yyerror_args[YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval]b4_location_if([, &yylloc])[]b4_user_args[); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[]b4_user_args[); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyss_ptr) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf_ptr) YYSTACK_FREE (yymsg); #endif ]b4_push_if([pv->yyresult = yyresult;],[ free (pv); return yyresult; ])[ ]} b4_epilogue m4_if(b4_defines_flag, 0, [], [@output @output_header_name@ b4_copyright([Skeleton parser for Yacc-like parsing with Bison], [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006]) /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ b4_token_enums_defines(b4_tokens) #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED m4_ifdef([b4_stype], [typedef union[]m4_bregexp(b4_stype, [^{], [ YYSTYPE]) b4_stype /* Line __line__ of yacc.c. */ b4_syncline([@oline@], [@ofile@]) YYSTYPE;], [typedef int YYSTYPE;]) # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif b4_pure_if([], [extern YYSTYPE b4_prefix[]lval;]) b4_location_if( [#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; } YYLTYPE; # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif m4_if(b4_pure, [0], [extern YYLTYPE b4_prefix[]lloc;]) ]) ]) --s/l3CgOIzMHHjg/5-- From MAILER-DAEMON Mon Apr 24 04:37:21 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FXwZN-00053N-OK for mharc-bison-patches@gnu.org; Mon, 24 Apr 2006 04:37:21 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FXwZM-00053F-0E for bison-patches@gnu.org; Mon, 24 Apr 2006 04:37:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FXwZK-000533-HM for bison-patches@gnu.org; Mon, 24 Apr 2006 04:37:19 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FXwZK-000530-Bb for bison-patches@gnu.org; Mon, 24 Apr 2006 04:37:18 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FXwbV-0002XS-RV for bison-patches@gnu.org; Mon, 24 Apr 2006 04:39:34 -0400 Received: from sulaco.lrde.epita.fr ([192.168.105.164]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FXwZI-0001a5-9L; Mon, 24 Apr 2006 10:37:16 +0200 Mime-Version: 1.0 (Apple Message framework v749.3) Message-Id: Content-Type: multipart/mixed; boundary=Apple-Mail-1-56882519 To: Bison Patches From: Akim Demaille Date: Mon, 24 Apr 2006 10:36:46 +0200 X-Mailer: Apple Mail (2.749.3) Subject: FYI: bench.pl X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2006 08:37:20 -0000 --Apple-Mail-1-56882519 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; x-unix-mode=0644; name="diffs.txt" Content-Disposition: attachment; filename=diffs.txt Index: ChangeLog from Akim Demaille * etc/README, etc/bench.pl: New. Index: etc/README =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: etc/README diff -N etc/README --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ etc/README 24 Apr 2006 08:35:35 -0000 @@ -0,0 +1,43 @@ +A directory of tools provided to people using CVS Bison. None of +these is distributed. + +* bench.pl +A primitive Perl script to run benches. Currently its only bench is +the usual calculator: it has a lightweight processing part (but not +null), so it is really emphasizing the cost of the whole parsing +(including scanning and I/O). + +Set the envvars BISON and CC to the programs and flags you want to +use. They default to bison and gcc. To run a non-installed bison +from a tarball built in _build, I suggest the following. + + BISON=3D_build/tests/bison CC=3D'gcc -O2' ./bench.pl + +(The _build/tests/bison wrapper makes sure that _build/src/bison will +use the tarballs' skeletons, not those already installed as a +straightforward use of _build/src/bison would.) + +-- + +Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of Bison, the GNU Compiler Compiler. + +Bison is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +Bison 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 autoconf; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. + +Local Variables: +mode: outline +End: Index: etc/bench.pl =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: etc/bench.pl diff -N etc/bench.pl --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ etc/bench.pl 24 Apr 2006 08:35:35 -0000 @@ -0,0 +1,413 @@ +#! /usr/bin/perl -w + +# Copyright (C) 2006 Free Software Foundation, Inc. +#=20 +# This file is part of Bison, the GNU Compiler Compiler. +#=20 +# Bison is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +#=20 +# Bison 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. +#=20 +# You should have received a copy of the GNU General Public License +# along with autoconf; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +=20 +use IO::File; +use Benchmark qw (:all); + +my $bison =3D $ENV{'BISON'} || 'bison'; +my $cc =3D $ENV{'CC'} || 'gcc'; + +################################################################## + +sub triangular_grammar ($$$) +{ + my ($base, $max, $directives) =3D @_; + + my $out =3D new IO::File ">$base.y" + or die; + print $out < +#include + +static int yylex (void); +static void yyerror (const char *msg); +%} +%union +{ + int val; +}; + +%token END "end" +%type exp input +EOF + + for my $size (1 .. $max) + { + print $out "%token t$size $size \"$size\"\n"; + }; + +print $out < $max) + return 0; + else if (inner > outer) + { + inner =3D 1; + ++outer; + return END; + } + return inner++; +} + +static void +yyerror (const char *msg) +{ + fprintf (stderr, "%s\\n", msg); +} + +int +main (void) +{ + yydebug =3D !!getenv ("YYDEBUG"); + return yyparse (); +} +EOF +} + +################################################################## + +sub calc_input ($$) +{ + my ($base, $max) =3D @_; + my $out =3D new IO::File ">$base.input" + or die; + foreach (1 .. $max) + { + print $out = "0+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21+22+23+24+25+26+27= +28+29+30+31+32+33+34+35+36+37+38+39+40+41+42+43+44+45+46+47+48+49+50+51+5= 2+53+54+55+56+57+58+59+60+61+62+63+64+65+66+67+68+69+70+71+72+73+74+75+76+= 77+78+79+80+81+82+83+84+85+86+87+88+89+90+91+92+93+94+95+96+97+98+99\n"; + print $out = "1+1*(2+2*(3+3*(4+4*(5+5*(6+6*(7+7*(8+8*(9+9*(10+10*(11+11*(12+12*(13+13*(= 14+14*(15+15*(16+16*(17+17*(18+18*(19+19*(20+20*(21+21*(22+22*(23+23*(24+2= 4*(25+25*(26+26*(27+27*(28+28*(29+29*(30+30*(31+31*(32+32*(33+33*(34+34*(3= 5+35*(36+36*(37+37*(38+38*(39+39*(40+40*(41+41*(42+42*(43+43*(44+44*(45+45= *(46+46*(47+47*(48+48*(49+49*(50+50*(51+51*(52+52*(53+53*(54+54*(55+55*(56= +56*(57+57*(58+58*(59+59*(60+60*(61+61*(62+62*(63+63*(64+64*(65+65*(66+66*= (67+67*(68+68*(69+69*(70+70*(71+71*(72+72*(73+73*(74+74*(75+75*(76+76*(77+= 77*(78+78*(79+79*(80+80*(81+81*(82+82*(83+83*(84+84*(85+85*(86+86*(87+87*(= 88+88*(89+89*(90+90*(91+91*(92+92*(93+93*(94+94*(95+95*(96+96*(97+97*(98+9= 8*(99+99*(100+100*(101+101*(102+102*(103+103*(104+104*(105+105*(106+106*(1= 07+107*(108+108*(109+109*(110+110*(111+111*(112+112*(113+113*(114+114*(115= +115*(116+116*(117+117*(118+118*(119+119*(120+120*(121+121*(122+122*(123+1= 23*(124+124*(125+125*(126+126*(127+127*(128+128*(129+129*(130+130*(131+131= *(132+132*(133+133*(134+134*(135+135*(136+136*(137+137*(138+138*(139+139*(= 140+140*(141+141*(142+142*(143+143*(144+144*(145+145*(146+146*(147+147*(14= 8+148*(149+149*(150+150*(151+151*(152+152*(153+153*(154+154*(155+155*(156+= 156*(157+157*(158+158*(159+159*(160+160*(161+161*(162+162*(163+163*(164+16= 4*(165+165*(166+166*(167+167*(168+168*(169+169*(170+170*(171+171*(172+172*= (173+173*(174+174*(175+175*(176+176*(177+177*(178+178*(179+179*(180+180*(1= 81+181*(182+182*(183+183*(184+184*(185+185*(186+186*(187+187*(188+188*(189= +189*(190+190*(191+191*(192+192*(193+193*(194+194*(195+195*(196+196*(197+1= 97*(198+198*(199+199*(200+200*(201+201*(202+202*(203+203*(204+204*(205+205= *(206+206*(207+207*(208+208*(209+209*(210+210*(211+211*(212+212*(213+213*(= 214+214*(215+215*(216+216*(217+217*(218+218*(219+219*(220+220*(221+221*(22= 2+222*(223+223*(224+224*(225+225*(226+226*(227+227*(228+228*(229+229*(230+= 230*(231+231*(232+232*(233+233*(234+234*(235+235*(236+236*(237+237*(238+23= 8*(239+239*(240+240*(241+241*(242+242*(243+243*(244+244*(245+245*(246+246*= (247+247*(248+248*(249+249*(250+250*(251+251*(252+252*(253+253*(254+254*(2= 55+255*(256+256*(257+257*(258+258*(259+259*(260+260*(261+261*(262+262*(263= +263*(264+264*(265+265*(266+266*(267+267*(268+268*(269+269*(270+270*(271+2= 71*(272+272*(273+273*(274+274*(275+275*(276+276*(277+277*(278+278*(279+279= *(280+280*(281+281*(282+282*(283+283*(284+284*(285+285*(286+286*(287+287*(= 288+288*(289+289*(290+290*(291+291*(292+292*(293+293*(294+294*(295+295*(29= 6+296*(297+297*(298+298*(299+299*(300+300*(301+301*(302+302*(303+303*(304+= 304*(305+305*(306+306*(307+307*(308+308*(309+309*(310+310*(311+311*(312+31= 2*(313+313*(314+314*(315+315*(316+316*(317+317*(318+318*(319+319*(320+320*= (321+321*(322+322*(323+323*(324+324*(325+325*(326+326*(327+327*(328+328*(3= 29+329*(330+330*(331+331*(332+332*(333+333*(334+334*(335+335*(336+336*(337= +337*(338+338*(339+339*(340+340*(341+341*(342+342*(343+343*(344+344*(345+3= 45*(346+346*(347+347*(348+348*(349+349*(350+350*(351+351*(352+352*(353+353= *(354+354*(355+355*(356+356*(357+357*(358+358*(359+359*(360+360*(361+361*(= 362+362*(363+363*(364+364*(365+365*(366+366*(367+367*(368+368*(369+369*(37= 0+370*(371+371*(372+372*(373+373*(374+374*(375+375*(376+376*(377+377*(378+= 378*(379+379*(380+380*(381+381*(382+382*(383+383*(384+384*(385+385*(386+38= 6*(387+387*(388+388*(389+389*(390+390*(391+391*(392+392*(393+393*(394+394*= (395+395*(396+396*(397+397*(398+398*(399+399*(400+400*(401+401*(402+402*(4= 03+403*(404+404*(405+405*(406+406*(407+407*(408+408*(409+409*(410+410*(411= +411*(412+412*(413+413*(414+414*(415+415*(416+416*(417+417*(418+418*(419+4= 19*(420+420*(421+421*(422+422*(423+423*(424+424*(425+425*(426+426*(427+427= *(428+428*(429+429*(430+430*(431+431*(432+432*(433+433*(434+434*(435+435*(= 436+436*(437+437*(438+438*(439+439*(440+440*(441+441*(442+442*(443+443*(44= 4+444*(445+445*(446+446*(447+447*(448+448*(449+449*(450+450*(451+451*(452+= 452*(453+453*(454+454*(455+455*(456+456*(457+457*(458+458*(459+459*(460+46= 0*(461+461*(462+462*(463+463*(464+464*(465+465*(466+466*(467+467*(468+468*= (469+469*(470+470*(471+471*(472+472*(473+473*(474+474*(475+475*(476+476*(4= 77+477*(478+478*(479+479*(480+480*(481+481*(482+482*(483+483*(484+484*(485= +485*(486+486*(487+487*(488+488*(489+489*(490+490*(491+491*(492+492*(493+4= 93*(494+494*(495+495*(496+496*(497+497*(498+498*(499+499*(500+500*(501+501= *(502+502*(503+503*(504+504*(505+505*(506+506*(507+507*(508+508*(509+509*(= 510+510*(511+511*(512+512*(513+513*(514+514*(515+515*(516+516*(517+517*(51= 8+518*(519+519*(520+520*(521+521*(522+522*(523+523*(524+524*(525+525*(526+= 526*(527+527*(528+528*(529+529*(530+530*(531+531*(532+532*(533+533*(534+53= 4*(535+535*(536+536*(537+537*(538+538*(539+539*(540+540*(541+541*(542+542*= (543+543*(544+544*(545+545*(546+546*(547+547*(548+548*(549+549*(550+550*(5= 51+551*(552+552*(553+553*(554+554*(555+555*(556+556*(557+557*(558+558*(559= +559*(560+560*(561+561*(562+562*(563+563*(564+564*(565+565*(566+566*(567+5= 67*(568+568*(569+569*(570+570*(571+571*(572+572*(573+573*(574+574*(575+575= *(576+576*(577+577*(578+578*(579+579*(580+580*(581+581*(582+582*(583+583*(= 584+584*(585+585*(586+586*(587+587*(588+588*(589+589*(590+590*(591+591*(59= 2+592*(593+593*(594+594*(595+595*(596+596*(597+597*(598+598*(599+599*(600+= 600*(601+601*(602+602*(603+603*(604+604*(605+605*(606+606*(607+607*(608+60= 8*(609+609*(610+610*(611+611*(612+612*(613+613*(614+614*(615+615*(616+616*= (617+617*(618+618*(619+619*(620+620*(621+621*(622+622*(623+623*(624+624*(6= 25+625*(626+626*(627+627*(628+628*(629+629*(630+630*(631+631*(632+632*(633= +633*(634+634*(635+635*(636+636*(637+637*(638+638*(639+639*(640+640*(641+6= 41*(642+642*(643+643*(644+644*(645+645*(646+646*(647+647*(648+648*(649+649= *(650+650*(651+651*(652+652*(653+653*(654+654*(655+655*(656+656*(657+657*(= 658+658*(659+659*(660+660*(661+661*(662+662*(663+663*(664+664*(665+665*(66= 6+666*(667+667*(668+668*(669+669*(670+670*(671+671*(672+672*(673+673*(674+= 674*(675+675*(676+676*(677+677*(678+678*(679+679*(680+680*(681+681*(682+68= 2*(683+683*(684+684*(685+685*(686+686*(687+687*(688+688*(689+689*(690+690*= (691+691*(692+692*(693+693*(694+694*(695+695*(696+696*(697+697*(698+698*(6= 99+699*(700+700*(701+701*(702+702*(703+703*(704+704*(705+705*(706+706*(707= +707*(708+708*(709+709*(710+710*(711+711*(712+712*(713+713*(714+714*(715+7= 15*(716+716*(717+717*(718+718*(719+719*(720+720*(721+721*(722+722*(723+723= *(724+724*(725+725*(726+726*(727+727*(728+728*(729+729*(730+730*(731+731*(= 732+732*(733+733*(734+734*(735+735*(736+736*(737+737*(738+738*(739+739*(74= 0+740*(741+741*(742+742*(743+743*(744+744*(745+745*(746+746*(747+747*(748+= 748*(749+749*(750+750*(751+751*(752+752*(753+753*(754+754*(755+755*(756+75= 6*(757+757*(758+758*(759+759*(760+760*(761+761*(762+762*(763+763*(764+764*= (765+765*(766+766*(767+767*(768+768*(769+769*(770+770*(771+771*(772+772*(7= 73+773*(774+774*(775+775*(776+776*(777+777*(778+778*(779+779*(780+780*(781= +781*(782+782*(783+783*(784+784*(785+785*(786+786*(787+787*(788+788*(789+7= 89*(790+790*(791+791*(792+792*(793+793*(794+794*(795+795*(796+796*(797+797= *(798+798*(799+799*(800+800*(801+801*(802+802*(803+803*(804+804*(805+805*(= 806+806*(807+807*(808+808*(809+809*(810+810*(811+811*(812+812*(813+813*(81= 4+814*(815+815*(816+816*(817+817*(818+818*(819+819*(820+820*(821+821*(822+= 822*(823+823*(824+824*(825+825*(826+826*(827+827*(828+828*(829+829*(830+83= 0*(831+831*(832+832*(833+833*(834+834*(835+835*(836+836*(837+837*(838+838*= (839+839*(840+840*(841+841*(842+842*(843+843*(844+844*(845+845*(846+846*(8= 47+847*(848+848*(849+849*(850+850*(851+851*(852+852*(853+853*(854+854*(855= +855*(856+856*(857+857*(858+858*(859+859*(860+860*(861+861*(862+862*(863+8= 63*(864+864*(865+865*(866+866*(867+867*(868+868*(869+869*(870+870*(871+871= *(872+872*(873+873*(874+874*(875+875*(876+876*(877+877*(878+878*(879+879*(= 880+880*(881+881*(882+882*(883+883*(884+884*(885+885*(886+886*(887+887*(88= 8+888*(889+889*(890+890*(891+891*(892+892*(893+893*(894+894*(895+895*(896+= 896*(897+897*(898+898*(899+899*(900+900*(901+901*(902+902*(903+903*(904+90= 4*(905+905*(906+906*(907+907*(908+908*(909+909*(910+910*(911+911*(912+912*= (913+913*(914+914*(915+915*(916+916*(917+917*(918+918*(919+919*(920+920*(9= 21+921*(922+922*(923+923*(924+924*(925+925*(926+926*(927+927*(928+928*(929= +929*(930+930*(931+931*(932+932*(933+933*(934+934*(935+935*(936+936*(937+9= 37*(938+938*(939+939*(940+940*(941+941*(942+942*(943+943*(944+944*(945+945= *(946+946*(947+947*(948+948*(949+949*(950+950*(951+951*(952+952*(953+953*(= 954+954*(955+955*(956+956*(957+957*(958+958*(959+959*(960+960*(961+961*(96= 2+962*(963+963*(964+964*(965+965*(966+966*(967+967*(968+968*(969+969*(970+= 970*(971+971*(972+972*(973+973*(974+974*(975+975*(976+976*(977+977*(978+97= 8*(979+979*(980+980*(981+981*(982+982*(983+983*(984+984*(985+985*(986+986*= (987+987*(988+988*(989+989*(990+990*(991+991*(992+992*(993+993*(994+994*(9= 95+995*(996+996*(997+997*(998+998*(999+999*(1000+1000*(1001)))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))= )))))))))))))))))))))))\n"; + } +} + +################################################################## + +sub calc_grammar ($$$) +{ + my ($base, $max, $directives) =3D @_; + + my $out =3D new IO::File ">$base.y" + or die; + print $out < + +#include +#include +#include +#define USE(Var) + +/* Exercise pre-prologue dependency to %union. */ +typedef int semantic_value; + +static semantic_value global_result =3D 0; +static int global_count =3D 0; +%} + +/* Exercise %union. */ +$directives +%error-verbose +%union +{ + semantic_value ival; +}; + +%{ +static int power (int base, int exponent); +/* yyerror receives the location if: + - %location & %pure & %glr + - %location & %pure & %yacc & %parse-param. */ +static void yyerror (const char *s); +#if YYPURE +static int yylex (YYSTYPE* yylvalp); +#else +static int yylex (void); +#endif +%} + +/* Bison Declarations */ +%token CALC_EOF 0 "end of input" +%token NUM "number" +%type exp + +%nonassoc '=3D' /* comparison */ +%left '-' '+' +%left '*' '/' +%left NEG /* negation--unary minus */ +%right '^' /* exponentiation */ + +/* Grammar follows */ +%% +input: + line +| input line +; + +line: + '\\n' +| exp '\\n' { USE (\$1); } +; + +exp: + NUM { \$\$ =3D \$1; } +| exp '=3D' exp + { + if (\$1 !=3D \$3) + fprintf (stderr, "calc: error: %d !=3D %d\\n", \$1, \$3); + \$\$ =3D \$1; + } +| exp '+' exp { \$\$ =3D \$1 + \$3; } +| exp '-' exp { \$\$ =3D \$1 - \$3; } +| exp '*' exp { \$\$ =3D \$1 * \$3; } +| exp '/' exp { \$\$ =3D \$1 / \$3; } +| '-' exp %prec NEG { \$\$ =3D -\$2; } +| exp '^' exp { \$\$ =3D power (\$1, \$3); } +| '(' exp ')' { \$\$ =3D \$2; } +| '(' error ')' { \$\$ =3D 1111; } +| '!' { \$\$ =3D 0; YYERROR; } +| '-' error { \$\$ =3D 0; YYERROR; } +; +%% +/* The input. */ +static FILE *input; + +static void +yyerror (const char *s) +{ + fprintf (stderr, "%s\\n", s); +} + +static int +get_char (void) +{ + return getc (input); +} + + +static void +unget_char ( int c) +{ + ungetc (c, input); +} + +static int +read_signed_integer (void) +{ + int c =3D get_char (); + int sign =3D 1; + int n =3D 0; + + if (c =3D=3D '-') + { + c =3D get_char (); + sign =3D -1; + } + + while (isdigit (c)) + { + n =3D 10 * n + (c - '0'); + c =3D get_char (); + } + + unget_char (c); + + return sign * n; +} + +#if YYPUSH +#ifndef HAVE_YYSTYPE +static YYSTYPE yylval; +#endif +#endif + +static int +#if YYPURE +# define yylval (*yylvalp) +yylex (YYSTYPE* yylvalp) +#else +yylex (void) +#endif +{ + int c; + + /* Skip white space. */ + while ((c =3D get_char ()) =3D=3D ' ' || c =3D=3D '\t') + { + + } + + /* process numbers */ + if (c =3D=3D '.' || isdigit (c)) + { + unget_char ( c); + yylval.ival =3D read_signed_integer (); + return NUM; + } + + /* Return end-of-file. */ + if (c =3D=3D EOF) + return CALC_EOF; + + /* Return single chars. */ + return c; +} + +static int +power (int base, int exponent) +{ + int res =3D 1; + if (exponent < 0) + exit (3); + for (/* Niente */; exponent; --exponent) + res *=3D base; + return res; +} + + +#if YYPUSH +static int=20 +yyparse_wrapper () +{ + struct yypvars *ctx =3D yypvarsinit (); + do { = =20 + set_yychar (ctx, yylex ()); = =20 + ctx->yylval =3D yylval; + yyparse (ctx); = =20 + } while (get_yyresult (ctx) !=3D 0); = =20 + free (ctx); =20 +} =20 +#define yyparse yyparse_wrapper +#endif + +int +main (int argc, const char **argv) +{ + semantic_value result =3D 0; + int count =3D 0; + int status; + + input =3D fopen ("calc.input", "r"); + if (!input) + { + perror ("calc.input"); + return 3; + } + + status =3D yyparse (); + if (global_result !=3D result) + abort (); + if (global_count !=3D count) + abort (); + + return status; +} +EOF +} + +################################################################## + +sub compile ($) +{ + my ($base) =3D @_; + system ("$bison $base.y -o $base.c") =3D=3D 0 + or die; + system ("$cc -o $base $base.c") =3D=3D 0 + or die; +} + +sub bench_grammar ($) +{ + my ($gram) =3D @_; + my %test =3D + ( + "yacc-yacc" =3D> '', + "yacc-pure" =3D> '%pure-parser', + "push-yacc" =3D> '%skeleton "push.c"', + "push-pure" =3D> '%skeleton "push.c" %pure-parser', + "push-push" =3D> '%skeleton "push.c" %push-parser', + "push-opt-yacc" =3D> '%skeleton "push_opt.c"', + "push-opt-pure" =3D> '%skeleton "push_opt.c" %pure-parser', + "push-opt-push" =3D> '%skeleton "push_opt.c" %push-parser', + ); + =20 + my %bench; + while (my ($name, $directives) =3D each %test) + { + print STDERR "$name\n"; + my $generator =3D "$gram" . "_grammar"; + &$generator ($name, 200, $directives); + compile ($name); + $bench{$name} =3D "system ('./$name');"; + } + + print "$gram:\n"; + my $res =3D timethese (50, \%bench, 'nop'); + cmpthese ($res, 'nop'); +} + +print STDERR "Using $bison, $cc.\n"; +calc_input ('calc', 200); +bench_grammar ('calc'); + +### Setup "GNU" style for perl-mode and cperl-mode. +## Local Variables: +## perl-indent-level: 2 +## perl-continued-statement-offset: 2 +## perl-continued-brace-offset: 0 +## perl-brace-offset: 0 +## perl-brace-imaginary-offset: 0 +## perl-label-offset: -2 +## cperl-indent-level: 2 +## cperl-brace-offset: 0 +## cperl-continued-brace-offset: 0 +## cperl-label-offset: -2 +## cperl-extra-newline-before-brace: t +## cperl-merge-trailing-else: nil +## cperl-continued-statement-offset: 2 +## End: --Apple-Mail-1-56882519 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed --Apple-Mail-1-56882519-- From MAILER-DAEMON Mon Apr 24 05:03:04 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FXwyG-0007I5-OX for mharc-bison-patches@gnu.org; Mon, 24 Apr 2006 05:03:04 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FXwyF-0007Hs-AF for bison-patches@gnu.org; Mon, 24 Apr 2006 05:03:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FXwyE-0007HU-AD for bison-patches@gnu.org; Mon, 24 Apr 2006 05:03:02 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FXwyE-0007HR-6c for bison-patches@gnu.org; Mon, 24 Apr 2006 05:03:02 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FXx0Q-0004o7-5P for bison-patches@gnu.org; Mon, 24 Apr 2006 05:05:18 -0400 Received: from nostromo.lrde.epita.fr ([192.168.101.52]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FXwyC-00027B-Fl for bison-patches@gnu.org; Mon, 24 Apr 2006 11:03:00 +0200 From: Akim Demaille To: Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> <20060420170256.GD15657@brasko.net> Date: Mon, 24 Apr 2006 11:03:00 +0200 In-Reply-To: <20060420170256.GD15657@brasko.net> (Bob Rossi's message of "Thu, 20 Apr 2006 13:02:56 -0400") Message-ID: User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2006 09:03:04 -0000 >>> "Bob" == Bob Rossi writes: > OK, what do you think of this patch? Again, I didn't bother cleaning > it up to much, I'll do that if the numbers are acceptable. What do you > think of the numbers? For some reason the push_opt yacc parser is faster > than the regular yacc parser. Go figure. These figures are very encouraging! I have a bit more loss in push mode than you have (me: 9%, you: 2%), but anyway as I already said I don't consider push-non-pure to be a requirement and I would not try to support it. (popt = push-opt) popt-pure: 48 wallclock secs (36.65 cusr + 1.08 csys = 37.73 CPU) @ 1.33/s (n=50) popt-push: 74 wallclock secs (54.77 cusr + 1.25 csys = 56.02 CPU) @ 0.89/s (n=50) popt-yacc: 51 wallclock secs (37.94 cusr + 1.11 csys = 39.05 CPU) @ 1.28/s (n=50) push-pure: 58 wallclock secs (44.92 cusr + 1.21 csys = 46.13 CPU) @ 1.08/s (n=50) push-push: 61 wallclock secs (50.26 cusr + 1.20 csys = 51.46 CPU) @ 0.97/s (n=50) push-yacc: 57 wallclock secs (45.34 cusr + 1.16 csys = 46.50 CPU) @ 1.08/s (n=50) yacc-pure: 45 wallclock secs (36.84 cusr + 1.06 csys = 37.90 CPU) @ 1.32/s (n=50) yacc-yacc: 47 wallclock secs (37.97 cusr + 1.07 csys = 39.04 CPU) @ 1.28/s (n=50) Rate popt-push push-push push-yacc push-pure popt-yacc yacc-yacc yacc-pure popt-pure popt-push 0.893/s -- -8% -17% -18% -30% -30% -32% -33% push-push 0.972/s 9% -- -10% -10% -24% -24% -26% -27% push-yacc 1.08/s 20% 11% -- -1% -16% -16% -18% -19% push-pure 1.08/s 21% 12% 1% -- -15% -15% -18% -18% popt-yacc 1.28/s 43% 32% 19% 18% -- -0% -3% -3% yacc-yacc 1.28/s 43% 32% 19% 18% 0% -- -3% -3% yacc-pure 1.32/s 48% 36% 23% 22% 3% 3% -- -0% popt-pure 1.33/s 48% 36% 23% 22% 3% 3% 0% -- I don't really understand why the system time should differ significantly between all our parsers (e.g., push-opt-pure 1.08 vs. push-opt-push 1.25; on another run I have 1.15 vs. 1.35). Can there be *good* reasons (ie., due to our programming only, not random issues on the machine we run the bench on) for them to change like this? If there are no good reasons, then maybe we should try to bench using just the user time. Well, there must be good reasons, on my machine at least the difference is stable. It is also vastly dependent on the optimization flags, with -O2 the difference is no longer significant. popt-pure: 22 wallclock secs (17.73 cusr + 0.86 csys = 18.59 CPU) @ 2.69/s (n=50) popt-push: 29 wallclock secs (25.25 cusr + 0.85 csys = 26.10 CPU) @ 1.92/s (n=50) popt-yacc: 21 wallclock secs (18.53 cusr + 0.81 csys = 19.34 CPU) @ 2.59/s (n=50) push-pure: 25 wallclock secs (20.83 cusr + 0.83 csys = 21.66 CPU) @ 2.31/s (n=50) push-push: 26 wallclock secs (22.70 cusr + 0.84 csys = 23.54 CPU) @ 2.12/s (n=50) push-yacc: 24 wallclock secs (21.37 cusr + 0.82 csys = 22.19 CPU) @ 2.25/s (n=50) yacc-pure: 20 wallclock secs (17.71 cusr + 0.81 csys = 18.52 CPU) @ 2.70/s (n=50) yacc-yacc: 22 wallclock secs (18.42 cusr + 0.81 csys = 19.23 CPU) @ 2.60/s (n=50) Rate popt-push push-push push-yacc push-pure popt-yacc yacc-yacc popt-pure yacc-pure popt-push 1.92/s -- -10% -15% -17% -26% -26% -29% -29% push-push 2.12/s 11% -- -6% -8% -18% -18% -21% -21% push-yacc 2.25/s 18% 6% -- -2% -13% -13% -16% -17% push-pure 2.31/s 20% 9% 2% -- -11% -11% -14% -14% popt-yacc 2.59/s 35% 22% 15% 12% -- -1% -4% -4% yacc-yacc 2.60/s 36% 22% 15% 13% 1% -- -3% -4% popt-pure 2.69/s 40% 27% 19% 17% 4% 3% -- -0% yacc-pure 2.70/s 41% 27% 20% 17% 4% 4% 0% -- So as far as I'm concerned, I'm ready to switch to a new skeleton. Now let's focus on making the code nicer to read. But what do the other members of the team (the Pauls and Joel) think? > I've attached push_opt.c, and the new bench.pl script I'm using. You can > diff it to yours to see the difference. I have checked in the bench script in etc/, that will ease the tracking of changes. I have added other changes on top of yours. I did not checkin the push parsers because I don't remember whether we have all the copyright issues settled. If we do, then how about checking in your skeleton so that we can also easily track the differences? As long as the tarball is not touched, I see no problem with adding files even before the 2.2 release. From MAILER-DAEMON Mon Apr 24 05:46:56 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FXxei-0007oe-Tu for mharc-bison-patches@gnu.org; Mon, 24 Apr 2006 05:46:56 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FXxeh-0007o7-Bx for bison-patches@gnu.org; Mon, 24 Apr 2006 05:46:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FXxee-0007mO-Vc for bison-patches@gnu.org; Mon, 24 Apr 2006 05:46:54 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FXxee-0007mI-SK for bison-patches@gnu.org; Mon, 24 Apr 2006 05:46:52 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FXxgr-0008NE-Ax for bison-patches@gnu.org; Mon, 24 Apr 2006 05:49:09 -0400 Received: from sulaco.lrde.epita.fr ([192.168.105.164]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FXxed-0002vV-55; Mon, 24 Apr 2006 11:46:51 +0200 Mime-Version: 1.0 (Apple Message framework v749.3) Message-Id: Content-Type: multipart/mixed; boundary=Apple-Mail-2-61057664 To: Bison Patches From: Akim Demaille Date: Mon, 24 Apr 2006 11:46:22 +0200 X-Mailer: Apple Mail (2.749.3) Subject: FYI: FAQ: Multiple start-symbols X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2006 09:46:55 -0000 --Apple-Mail-2-61057664 Content-Transfer-Encoding: 7bit Content-Type: text/plain; x-unix-mode=0644; name="diffs.txt" Content-Disposition: attachment; filename=diffs.txt Index: ChangeLog from Akim Demaille * doc/bison.texinfo (Multiple start-symbols): New. +2006-04-24 Akim Demaille + * etc/README, etc/bench.pl: New. 2006-04-03 Akim Demaille Index: doc/bison.texinfo =================================================================== RCS file: /cvsroot/bison/bison/doc/bison.texinfo,v retrieving revision 1.184 diff -u -r1.184 bison.texinfo --- doc/bison.texinfo 17 Mar 2006 07:59:20 -0000 1.184 +++ doc/bison.texinfo 24 Apr 2006 09:45:35 -0000 @@ -311,6 +311,7 @@ * How Can I Reset the Parser:: @code{yyparse} Keeps some State * Strings are Destroyed:: @code{yylval} Loses Track of Strings * Implementing Gotos/Loops:: Control Flow in the Calculator +* Multiple start-symbols:: Factoring closely related grammars * Secure? Conform?:: Is Bison @acronym{POSIX} safe? * I can't build Bison:: Troubleshooting * Where can I find help?:: Troubleshouting @@ -7727,6 +7728,7 @@ * How Can I Reset the Parser:: @code{yyparse} Keeps some State * Strings are Destroyed:: @code{yylval} Loses Track of Strings * Implementing Gotos/Loops:: Control Flow in the Calculator +* Multiple start-symbols:: Factoring closely related grammars * Secure? Conform?:: Is Bison @acronym{POSIX} safe? * I can't build Bison:: Troubleshooting * Where can I find help?:: Troubleshouting @@ -7927,6 +7929,55 @@ invited to consult the dedicated literature. +@node Multiple start-symbols +@section Multiple start-symbols + +@display +I have several closely related grammars, and I would like to share their +implementations. In fact, I could use a single grammar but with +multiple entry points. +@end display + +Bison does not support multiple start-symbols, but there is a very +simple means to simulate them. If @code{foo} and @code{bar} are the two +pseudo start-symbols, then introduce two new tokens, say +@code{START_FOO} and @code{START_BAR}, and use them as switches from the +real start-symbol: + +@example +%token START_FOO START_BAR; +%start start; +start: START_FOO foo + | START_BAR bar; +@end example + +These tokens prevents the introduction of new conflicts. As far as the +parser goes, that is all that is needed. + +Now the difficult part is ensuring that the scanner will send these +tokens first. If your scanner is hand-written, that should be +straightforward. If your scanner is generated by Lex, them there is +simple means to do it: recall that anything between @samp{%@{ ... %@}} +after the first @code{%%} is copied verbatim in the top of the generated +@code{yylex} function. Make sure a variable @code{start_token} is +available in the scanner (e.g., a global variable or using +@code{%lex-param} etc.), and use the following: + +@example + /* @r{Prologue.} */ +%% +%@{ + if (start_token) + @{ + int t = start_token; + start_token = 0; + return t; + @} +%@} + /* @r{The rules.} */ +@end example + + @node Secure? Conform? @section Secure? Conform? --Apple-Mail-2-61057664-- From MAILER-DAEMON Mon Apr 24 19:14:34 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FYAGI-0008MH-KV for mharc-bison-patches@gnu.org; Mon, 24 Apr 2006 19:14:34 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FYAGH-0008M8-A8 for bison-patches@gnu.org; Mon, 24 Apr 2006 19:14:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FYAGE-0008Ln-6l for bison-patches@gnu.org; Mon, 24 Apr 2006 19:14:32 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYAGD-0008LW-3m for bison-patches@gnu.org; Mon, 24 Apr 2006 19:14:29 -0400 Received: from [130.127.200.32] (helo=ces.clemson.edu) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FYAIW-0007Jm-Em for bison-patches@gnu.org; Mon, 24 Apr 2006 19:16:53 -0400 Received: from unixlab02.ces.clemson.edu (unixlab02.ces.clemson.edu [130.127.220.152]) by ces.clemson.edu (8.13.6/8.13.6) with ESMTP id k3ONEHhU020691; Mon, 24 Apr 2006 19:14:22 -0400 (EDT) Received: from localhost (jdenny@localhost) by unixlab02.ces.clemson.edu (8.9.3/8.9.3) with ESMTP id TAA18649; Mon, 24 Apr 2006 19:14:17 -0400 (EDT) X-Authentication-Warning: unixlab02.ces.clemson.edu: jdenny owned process doing -bs Date: Mon, 24 Apr 2006 19:14:17 -0400 (EDT) From: "Joel E. Denny" To: Akim Demaille In-Reply-To: Message-ID: References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> <20060420170256.GD15657@brasko.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.45 Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2006 23:14:33 -0000 On Mon, 24 Apr 2006, Akim Demaille wrote: > So as far as I'm concerned, I'm ready to switch to a new skeleton. > Now let's focus on making the code nicer to read. But what do the > other members of the team (the Pauls and Joel) think? Based on what you wrote below, I think you're suggesting temporarily adding a separate undistributed "push.c" for development purposes. After 2.2 is released and we're sure "push.c" is in good shape, we'd rename it "yacc.c" and document it. Am I following? If so, this seems fine to me. > > I've attached push_opt.c, and the new bench.pl script I'm using. You can > > diff it to yours to see the difference. > > I have checked in the bench script in etc/, that will ease the > tracking of changes. I have added other changes on top of yours. > I did not checkin the push parsers because I don't remember whether we > have all the copyright issues settled. If we do, then how about > checking in your skeleton so that we can also easily track the > differences? As long as the tarball is not touched, I see no problem > with adding files even before the 2.2 release. Once you have the push skeleton checked in, I'll find it easier to help out. If I get really turned on to this, I might take on adding push mode to "glr.c". Already, I like Akim's idea of using this feature to facilitate multiple entry points: yyparse_push() to specify the desired entry point followed by a yyparse() to parse the rest of the input from yylex(). Joel From MAILER-DAEMON Tue Apr 25 02:12:33 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FYGmm-0002rY-R8 for mharc-bison-patches@gnu.org; Tue, 25 Apr 2006 02:12:32 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FYGmk-0002rS-U4 for bison-patches@gnu.org; Tue, 25 Apr 2006 02:12:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FYGmj-0002rF-Ok for bison-patches@gnu.org; Tue, 25 Apr 2006 02:12:30 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYGmj-0002rC-IG for bison-patches@gnu.org; Tue, 25 Apr 2006 02:12:29 -0400 Received: from [212.27.42.35] (helo=smtp5-g19.free.fr) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FYGp8-00059P-7K for bison-patches@gnu.org; Tue, 25 Apr 2006 02:14:58 -0400 Received: from [192.168.1.102] (bob75-1-81-57-9-20.fbx.proxad.net [81.57.9.20]) by smtp5-g19.free.fr (Postfix) with ESMTP id C2E7724099; Tue, 25 Apr 2006 08:12:27 +0200 (CEST) In-Reply-To: References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> <20060420170256.GD15657@brasko.net> Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <66BD6917-2FB3-406D-AEA2-52A4AF4E018A@free.fr> Content-Transfer-Encoding: quoted-printable From: Akim Demaille Date: Tue, 25 Apr 2006 08:12:25 +0200 To: "Joel E. Denny" X-Mailer: Apple Mail (2.749.3) Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2006 06:12:31 -0000 Le 25 avr. 06 =E0 01:14, Joel E. Denny a =E9crit : > On Mon, 24 Apr 2006, Akim Demaille wrote: > >> So as far as I'm concerned, I'm ready to switch to a new skeleton. >> Now let's focus on making the code nicer to read. But what do the >> other members of the team (the Pauls and Joel) think? > > Based on what you wrote below, I think you're suggesting temporarily > adding a separate undistributed "push.c" for development purposes. =20= > After > 2.2 is released and we're sure "push.c" is in good shape, we'd =20 > rename it > "yacc.c" and document it. Am I following? If so, this seems fine =20 > to me. Yes, that's my proposal. From MAILER-DAEMON Tue Apr 25 17:53:18 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FYVTB-0006DC-W0 for mharc-bison-patches@gnu.org; Tue, 25 Apr 2006 17:53:18 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FYVTA-0006Bi-DD for bison-patches@gnu.org; Tue, 25 Apr 2006 17:53:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FYVT8-0006AU-SE for bison-patches@gnu.org; Tue, 25 Apr 2006 17:53:16 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYVT8-0006AR-OM; Tue, 25 Apr 2006 17:53:14 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FYVVg-0007Um-7V; Tue, 25 Apr 2006 17:55:52 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p2+Sun/8.11.7/UCLACS-5.2) with ESMTP id k3PLr4704269; Tue, 25 Apr 2006 14:53:04 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1FYVSy-0002Gm-91; Tue, 25 Apr 2006 14:53:04 -0700 To: Juan Manuel Guerrero References: <200604252134.46865.juan.guerrero@gmx.de> From: Paul Eggert Date: Tue, 25 Apr 2006 14:53:04 -0700 In-Reply-To: <200604252134.46865.juan.guerrero@gmx.de> (Juan Manuel Guerrero's message of "Tue, 25 Apr 2006 21:34:46 +0200") Message-ID: <873bg15nlr.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-gnulib@gnu.org, bug-bison@gnu.org, bison-patches@gnu.org Subject: Re: bootstrap script failing due to gettext AM_CPPFLAGS change X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2006 21:53:16 -0000 Juan Manuel Guerrero writes: > ./bootstrap: Bootstrapping CVS bison... > ./bootstrap: getting gnulib files... > [snip] ... > lib/gnulib.mk:29: AM_CPPFLAGS must be set with `=' before using `+=' > lib/Makefile.am:53: `lib/gnulib.mk' included from here > configure.ac: installing `build-aux/ylwrap' > autoreconf: automake failed with exit status: 1 > > I can send the complete output of the bootstrap script if required. > Can someone explain me what is failing here? Thanks for reporting this. This comes from the following change by Claudio Fontana which was installed yesterday into gnulib: http://lists.gnu.org/archive/html/bug-gnulib/2006-03/msg00033.html combined with the fact that Bison does not have an intl/ subdirectory and doesn't use AM_CPPFLAGS. I'd rather not complicate all the Bison builds with an unused -I../intl flag, so I installed this workaround to the Bison bootstrap script, but I hope there's a better way in general. Perhaps we need to distinguish the 'gettext' module from the 'gettext-intl' module? 2006-04-25 Paul Eggert * bootstrap: Comment out the AM_CPPFLAGS line, since we don't use that variable and the line breaks the bootstrap. Problem reported by Juan M. Guerrero. --- bootstrap 20 Jan 2006 00:45:53 -0000 1.34 +++ bootstrap 25 Apr 2006 21:02:36 -0000 1.35 @@ -237,7 +237,8 @@ esac ) >m4/gnulib.m4 || exit (echo '# This file is generated automatically by "bootstrap".' && - $GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_modules + $GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_modules | + sed 's/^[ ]*AM_CPPFLAGS[ ]*+=/# (commented out by bootstrap) &/' ) >lib/gnulib.mk || exit From MAILER-DAEMON Wed Apr 26 10:22:07 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FYku7-0001u8-De for mharc-bison-patches@gnu.org; Wed, 26 Apr 2006 10:22:07 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FYku5-0001sj-OI for bison-patches@gnu.org; Wed, 26 Apr 2006 10:22:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FYku3-0001qd-Sn for bison-patches@gnu.org; Wed, 26 Apr 2006 10:22:05 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYku3-0001qR-PD; Wed, 26 Apr 2006 10:22:03 -0400 Received: from [81.80.162.195] (helo=ftp.ilog.fr) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FYkwk-0007Wn-Sv; Wed, 26 Apr 2006 10:24:51 -0400 Received: from laposte.ilog.fr (cerbere-qfe0 [81.80.162.193]) by ftp.ilog.fr (8.13.1/8.13.1) with ESMTP id k3QELqtj025646; Wed, 26 Apr 2006 16:21:52 +0200 Received: from marbore.ilog.biz (marbore.ilog.biz [172.17.2.61]) by laposte.ilog.fr (8.13.1/8.13.1) with ESMTP id k3QELfsK009390; Wed, 26 Apr 2006 16:21:47 +0200 Received: from honolulu.ilog.fr ([172.16.15.121]) by marbore.ilog.biz with Microsoft SMTPSVC(6.0.3790.1830); Wed, 26 Apr 2006 16:23:19 +0200 Received: from localhost (localhost [127.0.0.1]) by honolulu.ilog.fr (Postfix) with ESMTP id CE4B43C5A5; Wed, 26 Apr 2006 14:19:49 +0000 (UTC) From: Bruno Haible To: Paul Eggert , Juan Manuel Guerrero Date: Wed, 26 Apr 2006 16:19:48 +0200 User-Agent: KMail/1.5 References: <200604252134.46865.juan.guerrero@gmx.de> <873bg15nlr.fsf@penguin.cs.ucla.edu> In-Reply-To: <873bg15nlr.fsf@penguin.cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200604261619.48417.bruno@clisp.org> X-OriginalArrivalTime: 26 Apr 2006 14:23:19.0314 (UTC) FILETIME=[F7368F20:01C6693C] Cc: bug-gnulib@gnu.org, bug-bison@gnu.org, bison-patches@gnu.org Subject: Re: [bug-gnulib] Re: bootstrap script failing due to gettext AM_CPPFLAGS change X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2006 14:22:06 -0000 Paul Eggert wrote: > 2006-04-25 Paul Eggert > > * bootstrap: Comment out the AM_CPPFLAGS line, since we don't use > that variable and the line breaks the bootstrap. Problem reported > by Juan M. Guerrero. Another fix would be to define AM_CPPFLAGS to empty in lib/Makefile.am, paralleling the change that was made in gnulib-tool: * gnulib-tool (func_emit_lib_Makefile_am): Emit empty default value for AM_CPPFLAGS. > I'd rather not complicate all the Bison builds with an unused > -I../intl flag Don't you find an unused -I option acceptable? I know it is ugly, but in the absence of communication between gettextize and gnulib-tool it looked like an working compromise. Should I try to find a different approach? Bruno From MAILER-DAEMON Wed Apr 26 13:26:44 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FYnml-0001Mn-VN for mharc-bison-patches@gnu.org; Wed, 26 Apr 2006 13:26:44 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FYnmj-0001Jb-Rt for bison-patches@gnu.org; Wed, 26 Apr 2006 13:26:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FYnmh-0001H5-DA for bison-patches@gnu.org; Wed, 26 Apr 2006 13:26:41 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYnmh-0001H2-2h; Wed, 26 Apr 2006 13:26:39 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FYnpQ-0000Rv-9t; Wed, 26 Apr 2006 13:29:28 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p2+Sun/8.11.7/UCLACS-5.2) with ESMTP id k3QHQS718236; Wed, 26 Apr 2006 10:26:28 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1FYnmW-0002cD-Eh; Wed, 26 Apr 2006 10:26:28 -0700 To: Bruno Haible References: <200604252134.46865.juan.guerrero@gmx.de> <873bg15nlr.fsf@penguin.cs.ucla.edu> <200604261619.48417.bruno@clisp.org> From: Paul Eggert Date: Wed, 26 Apr 2006 10:26:28 -0700 In-Reply-To: <200604261619.48417.bruno@clisp.org> (Bruno Haible's message of "Wed, 26 Apr 2006 16:19:48 +0200") Message-ID: <87odyow8mz.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: bug-gnulib@gnu.org, bug-bison@gnu.org, Juan Manuel Guerrero , bison-patches@gnu.org Subject: Re: [bug-gnulib] Re: bootstrap script failing due to gettext AM_CPPFLAGS change X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2006 17:26:42 -0000 Bruno Haible writes: > Another fix would be to define AM_CPPFLAGS to empty in lib/Makefile.am, Yes, I thought of that, but that would result in an unused -I../intl option being output by 'make' for every compilation command. I dislike longer 'gcc ...' lines, since they make it harder to follow what the build is actually doing. An extra -I../intl is not a big deal by itself, but every word adds up. >> I'd rather not complicate all the Bison builds with an unused >> -I../intl flag > > Don't you find an unused -I option acceptable? I know it is ugly, but in > the absence of communication between gettextize and gnulib-tool it looked > like an working compromise. Should I try to find a different approach? As I understand it, the long-term goal is to eliminate the -I../intl approach entirely, since it had problems and core utilities don't use it any more. If this is just a bridge then I guess it's OK -- I'll just edit the output of gnulib-tool until the -I../intl stuff goes away. But if the long-term goal is to retain support for -I../intl then I'd prefer it if those who don't use that approach aren't bothered by unnecessary 'make' output. It's just a mild preference, though -- it's not high priority. From MAILER-DAEMON Wed Apr 26 13:42:34 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FYo26-00070M-3u for mharc-bison-patches@gnu.org; Wed, 26 Apr 2006 13:42:34 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FYo24-000704-Rj for bison-patches@gnu.org; Wed, 26 Apr 2006 13:42:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FYo23-0006zc-HG for bison-patches@gnu.org; Wed, 26 Apr 2006 13:42:32 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYo23-0006zX-0g; Wed, 26 Apr 2006 13:42:31 -0400 Received: from [81.80.162.195] (helo=ftp.ilog.fr) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FYo4m-000268-1c; Wed, 26 Apr 2006 13:45:20 -0400 Received: from laposte.ilog.fr (cerbere-qfe0 [81.80.162.193]) by ftp.ilog.fr (8.13.1/8.13.1) with ESMTP id k3QHgPqV013637; Wed, 26 Apr 2006 19:42:25 +0200 Received: from marbore.ilog.biz (marbore.ilog.biz [172.17.2.61]) by laposte.ilog.fr (8.13.1/8.13.1) with ESMTP id k3QHgJEV016981; Wed, 26 Apr 2006 19:42:20 +0200 Received: from honolulu.ilog.fr ([172.16.15.121]) by marbore.ilog.biz with Microsoft SMTPSVC(6.0.3790.1830); Wed, 26 Apr 2006 19:43:58 +0200 Received: from localhost (localhost [127.0.0.1]) by honolulu.ilog.fr (Postfix) with ESMTP id 1DAE13C40E; Wed, 26 Apr 2006 17:40:28 +0000 (UTC) From: Bruno Haible To: Paul Eggert Date: Wed, 26 Apr 2006 19:40:27 +0200 User-Agent: KMail/1.5 References: <200604252134.46865.juan.guerrero@gmx.de> <200604261619.48417.bruno@clisp.org> <87odyow8mz.fsf@penguin.cs.ucla.edu> In-Reply-To: <87odyow8mz.fsf@penguin.cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200604261940.27013.bruno@clisp.org> X-OriginalArrivalTime: 26 Apr 2006 17:43:58.0234 (UTC) FILETIME=[FEF7F7A0:01C66958] Cc: bug-gnulib@gnu.org, bug-bison@gnu.org, Juan Manuel Guerrero , bison-patches@gnu.org Subject: Re: [bug-gnulib] Re: bootstrap script failing due to gettext AM_CPPFLAGS change X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2006 17:42:33 -0000 Paul Eggert wrote: > As I understand it, the long-term goal is to eliminate the -I../intl > approach entirely, since it had problems and core utilities don't use > it any more. "gettextize --intl" is not recommended any more for a few years, but there are no plans to remove it. > I'd prefer it if those who don't use that approach aren't > bothered by unnecessary 'make' output. It's just a mild preference, Understood. Bruno From MAILER-DAEMON Wed Apr 26 21:39:00 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FYvTA-00036W-Dq for mharc-bison-patches@gnu.org; Wed, 26 Apr 2006 21:39:00 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FYvT9-00035P-EC for bison-patches@gnu.org; Wed, 26 Apr 2006 21:38:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FYvT7-00035D-Rb for bison-patches@gnu.org; Wed, 26 Apr 2006 21:38:58 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYvT7-00035A-Mv for bison-patches@gnu.org; Wed, 26 Apr 2006 21:38:57 -0400 Received: from [68.230.240.33] (helo=eastrmmtao06.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FYvVv-00010v-Ju for bison-patches@gnu.org; Wed, 26 Apr 2006 21:41:51 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao06.cox.net (InterMail vM.6.01.06.01 201-2131-130-101-20060113) with ESMTP id <20060427013855.CTHR16402.eastrmmtao06.cox.net@localhost.localdomain>; Wed, 26 Apr 2006 21:38:55 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FYvTM-0007gd-Gy; Wed, 26 Apr 2006 21:39:12 -0400 Date: Wed, 26 Apr 2006 21:39:12 -0400 From: Bob Rossi To: Akim Demaille Message-ID: <20060427013912.GA27056@brasko.net> Mail-Followup-To: Akim Demaille , Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> <20060420170256.GD15657@brasko.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2006 01:39:00 -0000 Sorry for the delayed response. I've been in the hospital since Saturday with my wife and son and just got home today. It turns out that he is perfectly OK! However, since we've been home today, both my wife and I have caught some sort of throat cold. So, I probably won't do anything with this until next week. On Mon, Apr 24, 2006 at 11:03:00AM +0200, Akim Demaille wrote: > >>> "Bob" == Bob Rossi writes: > > > OK, what do you think of this patch? Again, I didn't bother cleaning > > it up to much, I'll do that if the numbers are acceptable. What do you > > think of the numbers? For some reason the push_opt yacc parser is faster > > than the regular yacc parser. Go figure. > > These figures are very encouraging! I have a bit more loss in push > mode than you have (me: 9%, you: 2%), but anyway as I already said I > don't consider push-non-pure to be a requirement and I would not try > to support it. > > (popt = push-opt) > > popt-pure: 48 wallclock secs (36.65 cusr + 1.08 csys = 37.73 CPU) @ 1.33/s (n=50) > popt-push: 74 wallclock secs (54.77 cusr + 1.25 csys = 56.02 CPU) @ 0.89/s (n=50) > popt-yacc: 51 wallclock secs (37.94 cusr + 1.11 csys = 39.05 CPU) @ 1.28/s (n=50) > push-pure: 58 wallclock secs (44.92 cusr + 1.21 csys = 46.13 CPU) @ 1.08/s (n=50) > push-push: 61 wallclock secs (50.26 cusr + 1.20 csys = 51.46 CPU) @ 0.97/s (n=50) > push-yacc: 57 wallclock secs (45.34 cusr + 1.16 csys = 46.50 CPU) @ 1.08/s (n=50) > yacc-pure: 45 wallclock secs (36.84 cusr + 1.06 csys = 37.90 CPU) @ 1.32/s (n=50) > yacc-yacc: 47 wallclock secs (37.97 cusr + 1.07 csys = 39.04 CPU) @ 1.28/s (n=50) > Rate popt-push push-push push-yacc push-pure popt-yacc yacc-yacc yacc-pure popt-pure > popt-push 0.893/s -- -8% -17% -18% -30% -30% -32% -33% > push-push 0.972/s 9% -- -10% -10% -24% -24% -26% -27% > push-yacc 1.08/s 20% 11% -- -1% -16% -16% -18% -19% > push-pure 1.08/s 21% 12% 1% -- -15% -15% -18% -18% > popt-yacc 1.28/s 43% 32% 19% 18% -- -0% -3% -3% > yacc-yacc 1.28/s 43% 32% 19% 18% 0% -- -3% -3% > yacc-pure 1.32/s 48% 36% 23% 22% 3% 3% -- -0% > popt-pure 1.33/s 48% 36% 23% 22% 3% 3% 0% -- > > I don't really understand why the system time should differ > significantly between all our parsers (e.g., push-opt-pure 1.08 > vs. push-opt-push 1.25; on another run I have 1.15 vs. 1.35). Can > there be *good* reasons (ie., due to our programming only, not random > issues on the machine we run the bench on) for them to change like > this? I don't think there is a good programming reason, but I really don't know. The only thing I can think of is we may make more system calls in a particular parser mode. However, I don't think this should be the case. > So as far as I'm concerned, I'm ready to switch to a new skeleton. > Now let's focus on making the code nicer to read. But what do the > other members of the team (the Pauls and Joel) think? This sounds like a good idea to me, at least to track changes like you've stated. However, I don't think I have write privileges to the CVS repository. Can this be granted? or should I just post patches here? I already have write after approval permission on the GDB repository. Do you have a similar mechanism? > > I've attached push_opt.c, and the new bench.pl script I'm using. You can > > diff it to yours to see the difference. > > I have checked in the bench script in etc/, that will ease the > tracking of changes. I have added other changes on top of yours. > I did not checkin the push parsers because I don't remember whether we > have all the copyright issues settled. If we do, then how about > checking in your skeleton so that we can also easily track the > differences? As long as the tarball is not touched, I see no problem > with adding files even before the 2.2 release. I have only verbally been told that Odd signed a copyright assignment. You'll have to check up on that. I have defiantly signed a copyright assignment with the FSF several years ago to work on GDB. If that same assignment covers me for bison then all is good. Of course, if you are already double checking for Odd, ... Thanks, Bob Rossi From MAILER-DAEMON Thu Apr 27 04:16:17 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FZ1fd-00008e-75 for mharc-bison-patches@gnu.org; Thu, 27 Apr 2006 04:16:17 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FZ1fb-00008N-Rl for bison-patches@gnu.org; Thu, 27 Apr 2006 04:16:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FZ1fa-00007t-Ar for bison-patches@gnu.org; Thu, 27 Apr 2006 04:16:15 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FZ1fa-00007n-6x for bison-patches@gnu.org; Thu, 27 Apr 2006 04:16:14 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FZ1iS-0000Tx-21 for bison-patches@gnu.org; Thu, 27 Apr 2006 04:19:12 -0400 Received: from sulaco.lrde.epita.fr ([192.168.105.164]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FZ1fY-0002tG-N4; Thu, 27 Apr 2006 10:16:12 +0200 In-Reply-To: <20060427013912.GA27056@brasko.net> References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> <20060420170256.GD15657@brasko.net> <20060427013912.GA27056@brasko.net> Mime-Version: 1.0 (Apple Message framework v749.3) Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: <6D16C110-EDDE-42E5-9603-8DBB99BF141C@lrde.epita.fr> Content-Transfer-Encoding: quoted-printable From: Akim Demaille Date: Thu, 27 Apr 2006 10:15:40 +0200 To: Bob Rossi X-Mailer: Apple Mail (2.749.3) Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2006 08:16:16 -0000 Le 27 avr. 06 =E0 03:39, Bob Rossi a =E9crit : > Sorry for the delayed response. I've been in the hospital since =20 > Saturday > with my wife and son and just got home today. It turns out that he =20 > is perfectly > OK! That's nice to read! Have a nice recovery. > I don't think there is a good programming reason, but I really don't > know. The only thing I can think of is we may make more system =20 > calls in > a particular parser mode. It is certainly not I/O that make the difference: there is the exact same amount of yylex calls in every case. So can it be a memory allocation issue? I fail to see how it can be: the stack are certainly very similar, there is no deep recursion added etc. I have no clue. And I don't know how to find out. >> So as far as I'm concerned, I'm ready to switch to a new skeleton. >> Now let's focus on making the code nicer to read. But what do the >> other members of the team (the Pauls and Joel) think? > > This sounds like a good idea to me, at least to track changes like > you've stated. However, I don't think I have write privileges to the > CVS repository. Can this be granted? or should I just post patches =20 > here? You definitely need to sign legal papers for Bison itself, those of GDB won't do. Nevertheless I doubt we need to have finish this step to include your skeleton in the CVS repository. Paul, am I right? From MAILER-DAEMON Thu Apr 27 06:44:01 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FZ3yb-0001Id-3e for mharc-bison-patches@gnu.org; Thu, 27 Apr 2006 06:44:01 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FZ3yY-0001IF-W8 for bison-patches@gnu.org; Thu, 27 Apr 2006 06:43:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FZ3yY-0001I3-5q for bison-patches@gnu.org; Thu, 27 Apr 2006 06:43:58 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FZ3yY-0001I0-1p for bison-patches@gnu.org; Thu, 27 Apr 2006 06:43:58 -0400 Received: from [62.39.139.2] (helo=kualalumpur.lrde.epita.fr) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FZ41R-0005dQ-7f for bison-patches@gnu.org; Thu, 27 Apr 2006 06:46:57 -0400 Received: from sulaco.lrde.epita.fr ([192.168.105.164]) by kualalumpur.lrde.epita.fr with esmtp (Exim 4.50) id 1FZ3yW-0005wk-DW; Thu, 27 Apr 2006 12:43:56 +0200 Mime-Version: 1.0 (Apple Message framework v749.3) Message-Id: <1C412365-11F2-4C57-8CC1-1C3BE995CEE1@lrde.epita.fr> Content-Type: multipart/mixed; boundary=Apple-Mail-11-323680259 To: Bison Patches From: Akim Demaille Date: Thu, 27 Apr 2006 12:43:24 +0200 X-Mailer: Apple Mail (2.749.3) Subject: FYI: glr.cc: Dead code X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2006 10:43:59 -0000 --Apple-Mail-11-323680259 Content-Transfer-Encoding: 7bit Content-Type: text/plain; x-unix-mode=0644; name="diffs.txt" Content-Disposition: attachment; filename=diffs.txt Index: ChangeLog from Akim Demaille * data/glr.cc: Remove dead code. Index: data/glr.cc =================================================================== RCS file: /cvsroot/bison/bison/data/glr.cc,v retrieving revision 1.14 diff -u -r1.14 glr.cc --- data/glr.cc 12 Mar 2006 14:45:27 -0000 1.14 +++ data/glr.cc 27 Apr 2006 10:42:55 -0000 @@ -259,15 +259,6 @@ # define YYTOKEN_TABLE ]b4_token_table[ #endif -#if 0 -/* Copy the second part of user declarations. */ -]b4_post_prologue[ - -]/* Line __line__ of glr.cc. */ - -b4_syncline([@oline@], [@ofile@])[ -#endif - /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ --Apple-Mail-11-323680259-- From MAILER-DAEMON Thu Apr 27 11:22:11 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FZ8Jn-0006ds-K9 for mharc-bison-patches@gnu.org; Thu, 27 Apr 2006 11:22:11 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FZ8Jl-0006da-Fm for bison-patches@gnu.org; Thu, 27 Apr 2006 11:22:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FZ8Jh-0006dB-WE for bison-patches@gnu.org; Thu, 27 Apr 2006 11:22:09 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FZ8Jh-0006d8-SE for bison-patches@gnu.org; Thu, 27 Apr 2006 11:22:05 -0400 Received: from [68.230.240.37] (helo=eastrmmtao02.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FZ8Md-0007pf-TC for bison-patches@gnu.org; Thu, 27 Apr 2006 11:25:08 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao02.cox.net (InterMail vM.6.01.06.01 201-2131-130-101-20060113) with ESMTP id <20060427152204.QUI15470.eastrmmtao02.cox.net@localhost.localdomain>; Thu, 27 Apr 2006 11:22:04 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FZ8Jz-0005Wd-7a; Thu, 27 Apr 2006 11:22:23 -0400 Date: Thu, 27 Apr 2006 11:22:23 -0400 From: Bob Rossi To: Akim Demaille Message-ID: <20060427152223.GB27056@brasko.net> Mail-Followup-To: Akim Demaille , Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> <20060420170256.GD15657@brasko.net> <20060427013912.GA27056@brasko.net> <6D16C110-EDDE-42E5-9603-8DBB99BF141C@lrde.epita.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6D16C110-EDDE-42E5-9603-8DBB99BF141C@lrde.epita.fr> User-Agent: Mutt/1.5.9i Cc: Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2006 15:22:10 -0000 > >>So as far as I'm concerned, I'm ready to switch to a new skeleton. > >>Now let's focus on making the code nicer to read. But what do the > >>other members of the team (the Pauls and Joel) think? > > > >This sounds like a good idea to me, at least to track changes like > >you've stated. However, I don't think I have write privileges to the > >CVS repository. Can this be granted? or should I just post patches > >here? > > You definitely need to sign legal papers for Bison itself, those of > GDB won't do. Nevertheless I doubt we need to have finish this step > to include your skeleton in the CVS repository. Paul, am I right? Really, that seems strange to me. I recall the paper I signed saying it was good for all FSF stuff I worked on. However, if need be, mail them to me. I'll give you my address off line if you request it. Thanks, Bob Rossi From MAILER-DAEMON Thu Apr 27 12:32:32 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FZ9Ps-0003f0-II for mharc-bison-patches@gnu.org; Thu, 27 Apr 2006 12:32:32 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FZ9Pr-0003ev-Hs for bison-patches@gnu.org; Thu, 27 Apr 2006 12:32:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FZ9Pq-0003ds-Hq for bison-patches@gnu.org; Thu, 27 Apr 2006 12:32:30 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FZ9Pq-0003dn-B7 for bison-patches@gnu.org; Thu, 27 Apr 2006 12:32:30 -0400 Received: from [131.179.128.19] (helo=kiwi.cs.ucla.edu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FZ9Sm-00063H-UQ for bison-patches@gnu.org; Thu, 27 Apr 2006 12:35:33 -0400 Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.11.7p2+Sun/8.11.7/UCLACS-5.2) with ESMTP id k3RGVs726700; Thu, 27 Apr 2006 09:31:54 -0700 (PDT) Received: from eggert by penguin.cs.ucla.edu with local (Exim 4.50) id 1FZ9PG-00032H-22; Thu, 27 Apr 2006 09:31:54 -0700 To: Akim Demaille References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> <20060420170256.GD15657@brasko.net> <20060427013912.GA27056@brasko.net> <6D16C110-EDDE-42E5-9603-8DBB99BF141C@lrde.epita.fr> From: Paul Eggert Date: Thu, 27 Apr 2006 09:31:54 -0700 In-Reply-To: <6D16C110-EDDE-42E5-9603-8DBB99BF141C@lrde.epita.fr> (Akim Demaille's message of "Thu, 27 Apr 2006 10:15:40 +0200") Message-ID: <87bqunughx.fsf@penguin.cs.ucla.edu> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Bob Rossi , Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2006 16:32:31 -0000 Akim Demaille writes: > You definitely need to sign legal papers for Bison itself, those of > GDB won't do. Nevertheless I doubt we need to have finish this step > to include your skeleton in the CVS repository. Paul, am I right? Sorry, no, he has to sign before it goes into CVS. The CVS repository is public now, so checking things in is equivalent to publishing. From MAILER-DAEMON Thu Apr 27 12:40:07 2006 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FZ9XD-0007kJ-0e for mharc-bison-patches@gnu.org; Thu, 27 Apr 2006 12:40:07 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FZ9XB-0007jm-29 for bison-patches@gnu.org; Thu, 27 Apr 2006 12:40:05 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FZ9X8-0007iw-Sg for bison-patches@gnu.org; Thu, 27 Apr 2006 12:40:04 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FZ9X8-0007ir-Nq for bison-patches@gnu.org; Thu, 27 Apr 2006 12:40:02 -0400 Received: from [68.230.240.38] (helo=eastrmmtao01.cox.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FZ9a5-0006pL-Di for bison-patches@gnu.org; Thu, 27 Apr 2006 12:43:05 -0400 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao01.cox.net (InterMail vM.6.01.06.01 201-2131-130-101-20060113) with ESMTP id <20060427164001.OHGT17255.eastrmmtao01.cox.net@localhost.localdomain>; Thu, 27 Apr 2006 12:40:01 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FZ9XQ-00062O-25; Thu, 27 Apr 2006 12:40:20 -0400 Date: Thu, 27 Apr 2006 12:40:20 -0400 From: Bob Rossi To: Paul Eggert Message-ID: <20060427164020.GC27056@brasko.net> Mail-Followup-To: Paul Eggert , Akim Demaille , Bison Patches References: <20060317194252.GJ30980@brasko.net> <20060408185845.GE1264@brasko.net> <20060420170256.GD15657@brasko.net> <20060427013912.GA27056@brasko.net> <6D16C110-EDDE-42E5-9603-8DBB99BF141C@lrde.epita.fr> <87bqunughx.fsf@penguin.cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87bqunughx.fsf@penguin.cs.ucla.edu> User-Agent: Mutt/1.5.9i Cc: Akim Demaille , Bison Patches Subject: Re: push parser implemenation X-BeenThere: bison-patches@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug fixes and other improvements to Bison List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2006 16:40:05 -0000 On Thu, Apr 27, 2006 at 09:31:54AM -0700, Paul Eggert wrote: > Akim Demaille writes: > > > You definitely need to sign legal papers for Bison itself, those of > > GDB won't do. Nevertheless I doubt we need to have finish this step > > to include your skeleton in the CVS repository. Paul, am I right? > > Sorry, no, he has to sign before it goes into CVS. > > The CVS repository is public now, so checking things in is equivalent > to publishing. OK, I'll be happy to sign, just send me some instructions off line please. BTW, are you all sure that the FSF copyright assignment I signed several years ago isn't good enough? Thanks, Bob Rossi