]> git.saurik.com Git - bison.git/blob - TODO
Fix problem reported by Henrik Grubbstroem in
[bison.git] / TODO
1 -*- outline -*-
2
3 * Header guards
4
5 En rentrant chez moi, je relance un `make' sur un projet que j'ai avancé
6 ailleurs durant la semaine. Le système que j'utilise ici est un peu plus
7 à jour que l'autre, et le Bison est probablement plus récent itou. Ici,
8 c'est la version 1.33. J'obtiens, en montrant un peu plus que nécessaire:
9
10 ---------------------------------------------------------------------->
11 cd ~/fpub/pyrexpp/Pyrexpp/
12 LANGUAGE= /usr/bin/make MAKEFLAGS='-k -j2'
13 /usr/bin/make -C .. install
14 make[1]: Entre dans le répertoire `/bpi/titan/home/pinard/fpub/pyrexpp'
15 install -g bpi -m 2775 -d Prépare-titan
16 chmod g+sw Prépare-titan
17 touch Prépare-titan/.estampille
18 /usr/bin/gcc -fPIC -I/usr/include/python2.2 -IPrépare-titan -g -c -o Prépare-titan/ctools.o ctools.c
19 bison -d -o Prépare-titan/c-parser.c c-parser.y
20 /usr/bin/gcc -fPIC -I/usr/include/python2.2 -IPrépare-titan -g -c -o Prépare-titan/c-parser.o Prépare-titan/c-parser.c
21 flex -t c-scanner.l | grep -v '^#line' > Prépare-titan/c-scanner.c
22 /usr/bin/gcc -fPIC -I/usr/include/python2.2 -IPrépare-titan -g -c -o Prépare-titan/c-scanner.o Prépare-titan/c-scanner.c
23 In file included from Prépare-titan/c-scanner.c:547:
24 Prépare-titan/c-parser.h:1: warning: garbage at end of `#ifndef' argument
25 Prépare-titan/c-parser.h:2: warning: missing white space after `#define BISON_PR'
26 /usr/bin/gcc -o Prépare-titan/ctools.so Prépare-titan/ctools.o Prépare-titan/c-scanner.o -shared -lm
27 python setup.py --quiet build
28 install -g bpi -m 664 Prépare-titan/ctools.so /bpi/titan/local/lib/python2.2/site-packages/Pyrexpp
29 python setup.py --quiet install
30 make[1]: Quitte le répertoire `/bpi/titan/home/pinard/fpub/pyrexpp'
31 [...]
32 ----------------------------------------------------------------------<
33
34 Diagnostics que je n'avais sûrement pas, plus tôt en journée, sur l'autre
35 système. En allant voir, je trouve:
36
37 ---------------------------------------------------------------------->
38 #ifndef BISON_PRÉPARE_TITAN_C_PARSER_H
39 # define BISON_PRÉPARE_TITAN_C_PARSER_H
40
41 # ifndef YYSTYPE
42 # define YYSTYPE int
43 # endif
44 # define IDENTIFIER 257
45 [...]
46
47 extern YYSTYPE yylval;
48
49 #endif /* not BISON_PRÉPARE_TITAN_C_PARSER_H */
50 ----------------------------------------------------------------------<
51
52 Le pré-processeur de C n'est pas à l'aise avec les caractères accentués
53 dans les identificateurs.
54
55 Bon, de mon expérience, il n'a jamais été nécessaire de protéger un fichier
56 `.h' de Bison ou Yacc contre de multiples inclusions, mais si ça été
57 fait, je présume qu'il y avait un problème réel et convaincant à régler,
58 et qu'il ne s'agit pas d'une simple fantaisie: je ne mettrai donc pas
59 ça en doute. Mais le choix du nom de l'identificateur laisse à désirer,
60 tu en conviendras :-). Et faut-il vraiment y inclure le répertoire?
61
62
63 * URGENT: Documenting C++ output
64 Write a first documentation for C++ output.
65
66
67 * Documentation
68 Before releasing, make sure the documentation refers to the current
69 `output' format.
70
71
72 * Error messages
73 Some are really funky. For instance
74
75 type clash (`%s' `%s') on default action
76
77 is really weird. Revisit them all.
78
79
80 * read_pipe.c
81 This is not portable to DOS for instance. Implement a more portable
82 scheme. Sources of inspiration include GNU diff, and Free Recode.
83
84
85 * value_components_used
86 Was defined but not used: where was it coming from? It can't be to
87 check if %union is used, since the user is free to $<foo>n on her
88 union, doesn't she?
89
90
91 * Report
92
93 ** GLR
94 How would Paul like to display the conflicted actions? In particular,
95 what when two reductions are possible on a given lookahead, but one is
96 part of $default. Should we make the two reductions explicit, or just
97 keep $default? See the following point.
98
99 ** Disabled Reductions
100 See `tests/conflicts.at (Defaulted Conflicted Reduction)', and decide
101 what we want to do.
102
103 ** Documentation
104 Extend with error productions. The hard part will probably be finding
105 the right rule so that a single state does not exhibit too many yet
106 undocumented ``features''. Maybe an empty action ought to be
107 presented too. Shall we try to make a single grammar with all these
108 features, or should we have several very small grammars?
109
110 ** --report=conflict-path
111 Provide better assistance for understanding the conflicts by providing
112 a sample text exhibiting the (LALR) ambiguity. See the paper from
113 DeRemer and Penello: they already provide the algorithm.
114
115
116 * Extensions
117
118 ** yyerror, yysymprint interface
119 It should be improved, in particular when using Bison features such as
120 locations, and YYPARSE_PARAMS. For the time being, it is recommended
121 to #define yyerror and yyprint to steal internal variables...
122
123 ** Several %unions
124 I think this is a pleasant (but useless currently) feature, but in the
125 future, I want a means to %include other bits of grammars, and _then_
126 it will be important for the various bits to define their needs in
127 %union.
128
129 When implementing multiple-%union support, bare the following in mind:
130
131 - when --yacc, this must be flagged as an error. Don't make it fatal
132 though.
133
134 - The #line must now appear *inside* the definition of yystype.
135 Something like
136
137 {
138 #line 12 "foo.y"
139 int ival;
140 #line 23 "foo.y"
141 char *sval;
142 }
143
144 * Unit rules
145 Maybe we could expand unit rules, i.e., transform
146
147 exp: arith | bool;
148 arith: exp '+' exp;
149 bool: exp '&' exp;
150
151 into
152
153 exp: exp '+' exp | exp '&' exp;
154
155 when there are no actions. This can significantly speed up some
156 grammars. I can't find the papers. In particular the book `LR
157 parsing: Theory and Practice' is impossible to find, but according to
158 `Parsing Techniques: a Practical Guide', it includes information about
159 this issue. Does anybody have it?
160
161
162
163 * Documentation
164
165 ** History/Bibliography
166 Some history of Bison and some bibliography would be most welcome.
167 Are there any Texinfo standards for bibliography?
168
169
170
171 * Java, Fortran, etc.
172
173
174 ** Java
175
176 There are a couple of proposed outputs:
177
178 - BYACC/J
179 which is based on Byacc.
180 <http://troi.lincom-asg.com/~rjamison/byacc/>
181
182 - Bison Java
183 which is based on Bison.
184 <http://www.goice.co.jp/member/mo/hack-progs/bison-java.html>
185
186 Sébastien Serrurier (serrur_s@epita.fr) is working on this: he is
187 expected to contact the authors, design the output, and implement it
188 into Bison.
189
190
191 * Coding system independence
192 Paul notes:
193
194 Currently Bison assumes 8-bit bytes (i.e. that UCHAR_MAX is
195 255). It also assumes that the 8-bit character encoding is
196 the same for the invocation of 'bison' as it is for the
197 invocation of 'cc', but this is not necessarily true when
198 people run bison on an ASCII host and then use cc on an EBCDIC
199 host. I don't think these topics are worth our time
200 addressing (unless we find a gung-ho volunteer for EBCDIC or
201 PDP-10 ports :-) but they should probably be documented
202 somewhere.
203
204
205
206 * --graph
207 Show reductions. []
208
209 * Broken options ?
210 ** %no-lines [ok]
211 ** %no-parser []
212 ** %pure-parser []
213 ** %token-table []
214 ** Options which could use parse_dquoted_param ().
215 Maybe transferred in lex.c.
216 *** %skeleton [ok]
217 *** %output []
218 *** %file-prefix []
219 *** %name-prefix []
220
221 ** Skeleton strategy. []
222 Must we keep %no-parser?
223 %token-table?
224 *** New skeletons. []
225
226 * src/print_graph.c
227 Find the best graph parameters. []
228
229 * doc/bison.texinfo
230 ** Update
231 informations about ERROR_VERBOSE. []
232 ** Add explanations about
233 skeleton muscles. []
234 %skeleton. []
235
236 * testsuite
237 ** tests/pure-parser.at []
238 New tests.
239
240 * input synclines
241 Some users create their foo.y files, and equip them with #line. Bison
242 should recognize these, and preserve them.
243
244 * BTYacc
245 See if we can integrate backtracking in Bison. Contact the BTYacc
246 maintainers.
247
248 ** Keeping the conflicted actions
249 First, analyze the differences between byacc and btyacc (I'm referring
250 to the executables). Find where the conflicts are preserved.
251
252 ** Compare with the GLR tables
253 See how isomorphic the way BTYacc and the way the GLR adjustments in
254 Bison are compatible. *As much as possible* one should try to use the
255 same implementation in the Bison executables. I insist: it should be
256 very feasible to use the very same conflict tables.
257
258 ** Adjust the skeletons
259 Import the skeletons for C and C++.
260
261 ** Improve the skeletons
262 Have them support yysymprint, yydestruct and so forth.
263
264
265 * Precedence
266
267 ** Partial order
268 It is unfortunate that there is a total order for precedence. It
269 makes it impossible to have modular precedence information. We should
270 move to partial orders (sounds like series/parallel orders to me).
271
272 This will be possible with a Bison parser for the grammar, as it will
273 make it much easier to extend the grammar.
274
275 ** Correlation b/w precedence and associativity
276 Also, I fail to understand why we have to assign the same
277 associativity to operators with the same precedence. For instance,
278 why can't I decide that the precedence of * and / is the same, but the
279 latter is nonassoc?
280
281 If there is really no profound motivation, we should find a new syntax
282 to allow specifying this.
283
284 ** RR conflicts
285 See if we can use precedence between rules to solve RR conflicts. See
286 what POSIX says.
287
288
289 * $undefined
290 From Hans:
291 - If the Bison generated parser experiences an undefined number in the
292 character range, that character is written out in diagnostic messages, an
293 addition to the $undefined value.
294
295 Suggest: Change the name $undefined to undefined; looks better in outputs.
296
297
298 * Default Action
299 From Hans:
300 - For use with my C++ parser, I transported the "switch (yyn)" statement
301 that Bison writes to the bison.simple skeleton file. This way, I can remove
302 the current default rule $$ = $1 implementation, which causes a double
303 assignment to $$ which may not be OK under C++, replacing it with a
304 "default:" part within the switch statement.
305
306 Note that the default rule $$ = $1, when typed, is perfectly OK under C,
307 but in the C++ implementation I made, this rule is different from
308 $<type_name>$ = $<type_name>1. I therefore think that one should implement
309 a Bison option where every typed default rule is explicitly written out
310 (same typed ruled can of course be grouped together).
311
312 Note: Robert Anisko handles this. He knows how to do it.
313
314
315 * Warnings
316 It would be nice to have warning support. See how Autoconf handles
317 them, it is fairly well described there. It would be very nice to
318 implement this in such a way that other programs could use
319 lib/warnings.[ch].
320
321 Don't work on this without first announcing you do, as I already have
322 thought about it, and know many of the components that can be used to
323 implement it.
324
325
326 * Pre and post actions.
327 From: Florian Krohm <florian@edamail.fishkill.ibm.com>
328 Subject: YYACT_EPILOGUE
329 To: bug-bison@gnu.org
330 X-Sent: 1 week, 4 days, 14 hours, 38 minutes, 11 seconds ago
331
332 The other day I had the need for explicitly building the parse tree. I
333 used %locations for that and defined YYLLOC_DEFAULT to call a function
334 that returns the tree node for the production. Easy. But I also needed
335 to assign the S-attribute to the tree node. That cannot be done in
336 YYLLOC_DEFAULT, because it is invoked before the action is executed.
337 The way I solved this was to define a macro YYACT_EPILOGUE that would
338 be invoked after the action. For reasons of symmetry I also added
339 YYACT_PROLOGUE. Although I had no use for that I can envision how it
340 might come in handy for debugging purposes.
341 All is needed is to add
342
343 #if YYLSP_NEEDED
344 YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen, yyloc, (yylsp - yylen));
345 #else
346 YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen);
347 #endif
348
349 at the proper place to bison.simple. Ditto for YYACT_PROLOGUE.
350
351 I was wondering what you think about adding YYACT_PROLOGUE/EPILOGUE
352 to bison. If you're interested, I'll work on a patch.
353
354 * Move to Graphviz
355 Well, VCG seems really dead. Move to Graphviz instead. Also, equip
356 the parser with a means to create the (visual) parse tree.
357
358 -----
359
360 Copyright (C) 2001, 2002 Free Software Foundation, Inc.
361
362 This file is part of GNU Bison.
363
364 GNU Bison is free software; you can redistribute it and/or modify
365 it under the terms of the GNU General Public License as published by
366 the Free Software Foundation; either version 2, or (at your option)
367 any later version.
368
369 GNU Bison is distributed in the hope that it will be useful,
370 but WITHOUT ANY WARRANTY; without even the implied warranty of
371 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
372 GNU General Public License for more details.
373
374 You should have received a copy of the GNU General Public License
375 along with Bison; see the file COPYING. If not, write to
376 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
377 Boston, MA 02111-1307, USA.