bison-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] more on prologue alternatives


From: Paolo Bonzini
Subject: Re: [PATCH] more on prologue alternatives
Date: Wed, 04 Oct 2006 15:42:39 +0200
User-agent: Thunderbird 1.5.0.7 (Macintosh/20060909)

And here is the NEWS file update.

Paolo
Index: NEWS
===================================================================
RCS file: /sources/bison/bison/NEWS,v
retrieving revision 1.160
diff -u -r1.160 NEWS
--- NEWS        13 Sep 2006 19:42:04 -0000      1.160
+++ NEWS        4 Oct 2006 13:40:56 -0000
@@ -1,7 +1,7 @@
 Bison News
 ----------
 
-Changes in version 2.3a, 2006-09-13:
+Changes in version 2.3b, 2006-??-??:
 
 * Instead of %union, you can define and use your own union type
   YYSTYPE if your grammar contains at least one <type> tag.
@@ -60,22 +60,14 @@
   file, it always inserts it before the token definitions.
 
 * Bison now provides a more flexible alternative to the traditional Yacc
-  prologue blocks: %before-header, %start-header, %end-header, and
-  %after-header.
+  prologue blocks: %provides, %requires, and %code.
 
   For example, the following declaration order in the grammar file reflects the
   order in which Bison will output these code blocks.  However, you are free to
   declare these code blocks in your grammar file in whatever order is most
   convenient for you:
 
-    %before-header {
-      /* Bison treats this block like a pre-prologue block: it inserts it into
-       * the code file before the contents of the header file.  It does *not*
-       * insert it into the header file.  This is a good place to put
-       * #include's that you want at the top of your code file.  A common
-       * example is `#include "system.h"'.  */
-    }
-    %start-header {
+    %requires {
       /* Bison inserts this block into both the header file and the code file.
        * In both files, the point of insertion is before any Bison-generated
        * token, semantic type, location type, and class definitions.  This is a
@@ -86,14 +78,14 @@
        * new %*-header blocks is not affected by their declaration position
        * relative to any %union in the grammar file.  */
     }
-    %end-header {
+    %provides {
       /* Bison inserts this block into both the header file and the code file.
        * In both files, the point of insertion is after the Bison-generated
        * definitions.  This is a good place to declare or define public
        * functions or data structures that depend on the Bison-generated
        * definitions.  */
     }
-    %after-header {
+    %code {
       /* Bison treats this block like a post-prologue block: it inserts it into
        * the code file after the contents of the header file.  It does *not*
        * insert it into the header file.  This is a good place to declare or
@@ -104,6 +96,12 @@
   If you have multiple occurrences of any one of the above declarations, Bison
   will concatenate the contents in declaration order.
 
+  Pre-prologue and post-prologue %{...%} blocks can still be used,
+  though in general they are not necessary.  Pre-prologue blocks either
+  are better defined as %requires blocks, or they can be transformed into
+  post-prologue blocks (%code) without any effect.  Post-prologue blocks,
+  instead, are synonyms with %code.
+
 * The option `--report=look-ahead' has been changed to `--report=lookahead'.
   The old spelling still works, but is not documented and may be removed
   in a future release.

reply via email to

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