/[bison]/bison/TODO
ViewVC logotype

Diff of /bison/TODO

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.47 by akim, Fri Apr 19 14:52:00 2002 UTC revision 1.48 by akim, Mon Apr 22 12:36:15 2002 UTC
# Line 1  Line 1 
1  -*- outline -*-  -*- outline -*-
2    
3    
4    * URGENT: Prologue
5    The %union is declared after the user C declarations. It can be
6    a problem if YYSTYPE is declared after the user part.
7    
8    Actually, the real problem seems that the %union ought to be output
9    where it was defined.  For instance, in gettext/intl/plural.y, we
10    have:
11    
12            %{
13            ...
14            #include "gettextP.h"
15            ...
16            %}
17    
18            %union {
19              unsigned long int num;
20              enum operator op;
21              struct expression *exp;
22            }
23    
24            %{
25            ...
26            static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
27            ...
28            %}
29    
30    Where the first part defines struct expression, the second uses it to
31    define YYSTYPE, and the last uses YYSTYPE.  Only this order is valid.
32    
33    Note that we have the same problem with GCC.
34    
35    I suggest splitting the prologue into pre-prologue and post-prologue.
36    The reason is that:
37    
38    1. we keep language independance as it is the skeleton that joins the
39    two prologues (there is no need for the engine to encode union yystype
40    and to output it inside the prologue, which breaks the language
41    independance of the generator)
42    
43    2. that makes it possible to have several %union in input.  I think
44    this is a pleasant (but useless currently) feature, but in the future,
45    I want a means to %include other bits of grammars, and _then_ it will
46    be important for the various bits to define their needs in %union.
47    
48  * Coding system independence  * Coding system independence
49  Paul notes:  Paul notes:
50    
# Line 171  critical for user data: when aborting a Line 216  critical for user data: when aborting a
216  error token etc., we often throw away yylval without giving a chance  error token etc., we often throw away yylval without giving a chance
217  of cleaning it up to the user.  of cleaning it up to the user.
218    
 * NEWS  
 Sort from 1.31 NEWS.  
   
 * Prologue  
 The %union is declared after the user C declarations. It can be  
 a problem if YYSTYPE is declared after the user part.   []  
   
 Actually, the real problem seems that the %union ought to be output  
 where it was defined.  For instance, in gettext/intl/plural.y, we  
 have:  
   
         %{  
         ...  
         #include "gettextP.h"  
         ...  
         %}  
   
         %union {  
           unsigned long int num;  
           enum operator op;  
           struct expression *exp;  
         }  
   
         %{  
         ...  
         static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));  
         ...  
         %}  
   
 Where the first part defines struct expression, the second uses it to  
 define YYSTYPE, and the last uses YYSTYPE.  Only this order is valid.  
   
 Note that we have the same problem with GCC.  
   
219  * --graph  * --graph
220  Show reductions.        []  Show reductions.        []
221    
# Line 400  The way I solved this was to define a ma Line 411  The way I solved this was to define a ma
411  be invoked after the action. For reasons of symmetry I also added  be invoked after the action. For reasons of symmetry I also added
412  YYACT_PROLOGUE. Although I had no use for that I can envision how it  YYACT_PROLOGUE. Although I had no use for that I can envision how it
413  might come in handy for debugging purposes.  might come in handy for debugging purposes.
414  All is needed is to add  All is needed is to add
415    
416  #if YYLSP_NEEDED  #if YYLSP_NEEDED
417      YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen, yyloc, (yylsp - yylen));      YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen, yyloc, (yylsp - yylen));

Legend:
Removed from v.1.47  
changed lines
  Added in v.1.48

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26