1 Tom Shields, March 17, 2014
5 - verify debian packaging still works?
7 - there are no #line directives in y.tab.i, other than those that come
8 from the input file and the skeleton file; to fix this, would need to
9 count output lines in externs_file and add 'write_externs_lineno()'
10 similar to 'write_code_lineno()'
11 - if there are no defined symbols, the .tab.h file isn't empty (weird case,
12 may not be worth fixing)
13 - consider: treat []-actions identical to {}-actions if not processing a
14 backtracking parser (avoids test case error)?
17 BTYACC CHANGES CURRENTLY DEFERRED, BY FILE:
18 -------------------------------------------
21 - skeleton for a 'push' parser
22 - needs to be upgraded match the structure of yaccpar.skel
25 - adopt '%include' changes
26 - adopt '%define'/'%ifdef'/'%endif'
27 - adopt -E flag to print preprocessed grammar to stdout
30 - adopt '%include' changes
31 - NOTE: there is a btyacc change that might be worth adopting in byacc
32 [FileError() refactoring to eliminate duplicated code in most of the
33 error message functions]
36 - adopt '%define' changes
37 - adopt '-DNAME' command line option to define preprocessor variable NAME
38 - adopt -E flag to print preprocessed grammar to stdout
39 - adopt '-S skeleton_file' command line option to select an alternate parser
41 - the skeleton file named by the -S flag is used as provided to open the
42 file; consider a change to this behavior to check whether the named file
43 has a path prefix, and if not, look in 'installation' directory if the
44 file is not found in the working directory
47 - adopt '%include' changes
50 - adopt '%include' changes
51 - adopt '%define'/'%ifdef'/'%endif' changes
52 - adopt -E flag to print preprocessed grammar to stdout
53 - NOTE: there is a btyacc change that might be worth adopting in byacc
54 [copy_string() & copy_comment() refactoring to eliminate duplicated
55 code in copy_text() and copy_union()]
58 - NOTE: there is a btyacc change that might be worth adopting in byacc
59 [shifting 'mask' incrementally rather than literal '1' by a variable
60 amount each time thru the loop]
63 ================================================================================
70 - modified from btyacc distribution: don't generate #include defs.h
71 - extended syntax recognized to include '%% insert VERSION here', generating
72 the defines for YYMAJOR, YYMINOR and YYPATCH at that point
73 - made generated tables type 'const char *const' to match skelton.c from
74 byacc-20130925 baseline
75 - added code to append text for write_section() to end of generated skeleton.c
76 - remove conversion of tab to \t in generated skeleton.c
77 - extended syntax recognized to include '%%ifdef', '%%ifndef', '%%else' and
78 '%%endif'; used in yaccpar.skel to bracket code that is specific to
82 - created from skeleton.c in byacc-20140101 baseline; use of this skeleton
83 will create a version of skeleton.c that is close to that in the
84 byacc-20140101 baseline
85 - eliminated 'body_3' and 'trailer_2' skeleton segments - no need to generate
86 yyerror() invocation dynamically; YYERROR_CALL() is already generated
87 earlier, and so can be used in the skeleton to simplify
88 - added 'const' to types in '%% tables' section to match what skel2c,
89 start_int_table() and state_str_table() generate
90 - added a few cosmetic changes (e.g., added some additional comments,
91 reworded debugging output to match yaccpar.skel, changed yygrowstack()
92 to return YYENOMEM for 'out of memory' error, rather than -1, to match
93 yaccpar.skel; changed yyparse() return value from 1 to 2 for the
94 'out of memory' error to match yaccpar.skel)
95 - added '#ifndef'/'#endif' around '#define YYINITSTACKSIZE 200' to allow
96 the value to be changed at compile time
97 - changed 'printf(' to 'fprintf(stderr, '; added stack depth (yydepth) to
98 debugging output from yaccpar.skel
99 - use 'YYINT' rather than 'short' for integer table types
102 - renamed from btyaccpa.ske, merged with btyacc-c.ske
103 - modified from btyacc distribution to match the latest byacc-20140101
104 skeleton structure & data structures
105 - make local functions static
106 - change "virtual memory exceeded" to "memory exhausted" for bison
108 - change debug output generation from printf/puts/putc onto stdout to use
109 fprintf/fputs/fputc onto stderr; include
110 stack depth and whether or not in trial parsing
111 - changed types of generated string tables to be 'const pointer to const char'
112 - check all malloc()/realloc() return values, ensure return value of
113 yyparse() = 2 if parsing failed due to memory exhaustion
114 - change YYDBPR() macro to YYSTYPE_TOSTRING(); define semantics as delivering
115 a char* value representing a semantic value (e.g., yylval or yyval, or the
116 contents of an entry on the semantic stack); additional parameter passed:
117 grammar symbol # (to assist interpretation of semantic value)
118 - change YYPOSN to YYLTYPE and yyposn to yylloc (position corresponding to
119 yylval) for bison compatibility; add yyloc (corresponding to yyval)
120 - move default definition of YYLTYPE into output.c, generating a typedef
121 - add '#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)'/'#endif' around
122 all lines specific to position processing
123 - add '#if defined(YYDESTRUCT_CALL)'/'#endif' around all lines specific to
124 semantic & position stack processing to reclaim memory associated with
126 - add '%%ifdef YYBTYACC'/'%%endif' around all lines specific to backtrack
127 parsing; converted by skel2c into '#if defined(YYBTYACC)'/'#endif'
128 - distinguish between "yacc stack overflow" and "memory exhausted" situations
129 - consolidated termination cleanup code; introduced yyreturn, set to 2 after
130 labels yyoverflow/yyenomem, set to 1 after label yyabort, set to 0 after
131 label yyaccept; all termination cases jump to label yyreturn, which does
132 any cleanup then returns yyreturn value
133 - replaced YYDELETEVAL & YYDELETEPOSN user-supplied macro capability by
134 implementation of byacc-generated yydestruct() as defined by bison
135 compatible %destructor mechanism
136 - moved invocation of 'YYREDUCEPOSNFUNC' macro to immediately prior to, rather
137 than after, execution of final rule action (so that, at some future
138 date, implementation extensions can be added to enable custom calculation
139 of locations associated with non-terminals within rule actions); deleted
140 unnecessary flag 'reduce_posn'; deleted 'YYCALLREDUCEPOSN' macro; deleted
141 C++ variant of 'YYREDUCEPOSNFUNC' invocation
142 - adopt approach similar to bison for default computation of yyloc; change
143 macro 'YYREDUCEPOSNFUNC' name to 'YYLLOC_DEFAULT' for bison compatibility;
144 added 'yyerror_loc_range[2]' to hold start & end locations for error
145 situations that pop the stack
146 - use 'YYINT' rather than 'short' for integer table types, and for indexing
150 http://www.verisign.com/index.html- replaced error() with fprintf()
153 - moved contents of mstring.h to defs.h - mstring.h is obsolete
156 - replaced include of mstring.h with defs.h
157 - changed 'START' to 'HEAD' to remove conflict with 'START' used for
158 the start symbol defined in defs.h
160 modified byacc files:
161 ---------------------
164 - skeleton.c is now generated from the appropriate skeleton file by 'skel2c'
167 - added configuration for --enable-btyacc option; if 'yes' add '-DYYBTYACC'
168 to DEFINES in makefile.in; --enable-btyacc defaults to 'no'
169 - added configuration for --with-max-table-size option; if present,
170 overrides the value of MAXTABLE defined in defs.h
171 - regenerate configure using autoconf
174 - added mstring.c to C_FILES
175 - added mstring$o to OBJS
176 - added @DEFINES@ as value of DEFINES make variable
177 - added new make variable SKELETON with value 'yaccpar.skel'
178 - added rule to generate skeleton.c from $(SKELETON), depending on skel2c
180 - added rm -f skeleton.c distclean rule
181 - moved dependency on makefile from only main$o & skeleton$o to $(OBJS),
182 since if ./configure is run changing, for example, from --enable-btyacc
183 to --disable-btyacc, all files must be recompiled to ensure a clean
185 - add @MAXTABLE@ for optional '-DMAXTABLE=nnn' if configured using
186 --with-max-table-size=nnn
187 - changed 'cd test && rn 0f test-*'to 'rm -f $(testdir)/test-*'
196 - moved contents of mstring.h to defs.h - mstring.h is obsolete
197 - added <limits.h> to get the various system defined machine limits;
198 changed definitions of MAXCHAR, MAXSHORT, MINSHORT & BITS_PER_WORD to use
199 defines from <limits.h>; changed definitions of BIT and SETBIT to use
200 value of BITS_PER_WORD
201 - added typedef for __compar_fn_t, conditioned on _COMPAR_FN_T being
202 undefined (at least for Mac OSX environment)
203 - adopt new symbol class values ACTION and ARGUMENT
204 - adopt changes/additions used by inherited attribute processing
205 - clean up locations of extern function definitions to match where they
206 actually live in source files
207 - adopt error functions from inherited attribute processing; added new error
209 - added keyword code LOCATIONS for %locations
210 - added keyword code DESTRUCTOR for %destructor
211 - added extern decl for 'int locations'; true if %locations present
212 - added extern decl for 'int backtrack'; initialized to 0 (= false), set to
213 1 (= true) if -B flag is present
214 - added extern decl for 'int destructor'; true if at least one %destructor
215 present in grammar spec file
216 - define 'YYINT' as the smallest C type that can be used to address a
217 table of size 'MAXTABLE'; define 'YYINT' based on the value of
218 'MAXTABLE' using the standard system type size definitions from <limits.h>;
219 define 'MAXYYINT' and 'MINYYINT' accordingly
220 - change 'Value_t' and 'Index_t' to 'YYINT' from 'short'
221 - allow 'MAXTABLE' to be defined by '-DMAXTABLE=nnn' at compile-time
224 - changed print_closure(), print_EFF() and print_first_derives() to 'static';
225 added fwd declarations
226 - changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
227 used for variables/parameters that were related to variables/parameters
231 - adopt error functions from inherited attribute processing; added a few
232 additional inherited attribute error functions
235 - changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
236 used for variables/parameters that were related to variables/parameters
240 - changed MAXSHORT to MAXYYINT
243 - changed MAXSHORT to MAXYYINT
244 - changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
245 used for variables/parameters that were related to variables/parameters
249 - changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
250 used for variables/parameters that were related to variables/parameters
254 - backtracking attempts to resolve shift/reduce and reduce/reduce conflicts
257 - generate prefix & YYPREFIX defines into externs file (-i, .tab.i) and
258 code file (-r, .code.c); generate into output file (.tab.c) only if not
259 using -r option; eliminates doubled output of prefix aliases if -r with
260 no -i in y.tab.c and y.code.c or if -r & -i in y.tab.i and y.code.c
261 - changed types of generated string tables to be 'const pointer to const char'
262 - adopt backtracking as an alternative in cases where otherwise we have a
263 conflict in the parsing actions (3, rather than 2, choices)
264 - wrap defines file with (where "yy" is value of 'symbol_prefix')
265 #ifndef __yy_defines_h_
266 #define _yy_defines_h_
271 - avoid writing %%xdecls skeleton section twice if -r used
272 - eliminated 'body_3' and 'trailer_2' skeleton segments - no need to generate
273 yyerror() invocation dynamically; YYERROR_CALL() is already generated
274 earlier, and can be used in the pareser skeleton
275 - if -P flag (pure_parser), add yylloc as 2nd parameter to yylex()
277 - change YYPOSN to YYLTYPE and yyposn to yylloc (position corresponding to
278 yylval) for bison compatibility; add yyloc (corresponding to yyval)
279 - generate yylloc parameters for yylex & yyerror if %locations present
280 - add location as 1st parameter to declaraion & invocation of yyerror() if
282 - output backtrack parsing tables if -B flag is present
283 - added generation of yystos[] with output_accessing_symbols() to allow
284 translation from a parser internal state number to the corresponding
285 grammar symbol number [0 .. nsyms) of the accessing symbol of that parser
286 state; used in the generated code for YYDESTRUCT_CALL() &
287 YYSTYPE_TOSTRING() to enable the correct semantic value union tag to be
288 determined when executing the implementation of YYDESTRUCT_CALL() or
289 YYSTYPE_TOSTRING() (similar to yystos[] in bison)
290 - added to output_prefix(): yystos; yycindex & yyctable if compiling
291 backtracking; yyloc & yylloc if %locations used
292 - extended yyname[] to include all grammar symbols, not just the terminal
293 symbols: '$end', 'error', '$accept', all non-terminals, including internally
294 generated non-terminals for embedded actions in rules, and 'illegal-symbol'
295 (which bison spells '$undefined'); '$end' already defined as a symbol 0,
296 rathern than adding 'end-of-file' as the name of symbol 0; added
297 'illegal-symbol' from byacc-20140101 (NOTE: the comment in the code that
298 says byacc does not predefine '$end' and '$error' is incorrect; however,
299 both bison and byacc spell '$error' as 'error')
300 - added generation of #define YYTRANSLATE() from byacc-20140101, but changed
301 the definition for the undefined symbol case because it is no longer in
302 yyname[YYMAXTOKEN+1] but rather occurs after the last non-terminal symbol;
303 added #define YYUNDFTOKEN to contain the index in yyname of 'illegal-symbol'
304 - generate YYLTYPE in output_ltype() as a struct like for bison rather than
305 using #define in yaccpar.skel
306 - added 'write_code_lineno' invocation at start of 'output_prefix'
307 - added 'write_code_lineno' invocation at start of 'output_pure_parser'
308 - added 'write_code_lineno' invocation prior to generation of #include
310 - added 'write_code_lineno' invocation after 1st 'write_section(fp, xdecls)'
311 - added '++outline;' prior to output of '#define YYTRANSLATE' - this was
312 actually causing almost all of the invocations of 'write_code_lineno' to
313 put out the correct #line directive
314 - corrected 'write_code_lineno' - the line number in a #line directive is
315 the number of the next line, not the number of the #line line
316 - changed MAXSHORT to MAXYYINT; changed 'high' local static from 'int' to
317 'long' so that it can get higher than 'MAXYYINT' without machine-dependent
318 behavior; changed related formats from '%d' to '%ld'
319 - generate 'YYINT' rather than 'short' for integer table types
320 - generate YYDESTRUCT_DECL & YYDESTRUCT_CALL macros, similar to YYERROR_DECL
321 and YYERROR_CALL macros, that can be redefined by user, if desired, to add
322 additional parameters to yydestruct() (and even change the 'yydestruct'
324 - if at least one %destructor present, generate yydestruct(); 1st parameter
325 is a string indicating the context in which yydestruct() is invoked
326 (e.g., discarding input token, discarding state on stack, cleanup when
327 aborting); 2nd parameter is the internal grammar symbol number [0..nsyms)
328 of the accessing symbol of the parser state on the top of the stack; 3rd
329 parameter is a pointer to the semantic value to be reclaimed associated
330 with the grammar symbol in the 2nd parameter; if %locations is defined,
331 the 4th parameter is a pointer to the position value to be reclaimed
332 associated with the grammar symbol in the 2nd parameter
335 - adopt []-actions, similar to {}-actions; {}-actions are only executed when
336 not in trial mode, but []-actions are executed regardless of mode
337 - adopt new symbol class values ACTION and ARGUMENT
338 - adopt inherited attributes (syntax resembles arguments to non-terminal
340 - adopt keyword table lookup from btyacc, modified to handle equivalence
341 of '-' and '_' in spelling of keywords
342 - adopt refactoring of tag table creation into cache_tag() for use in
344 - added new error functions in place of btyacc's generic error() function
345 - changed '0' to 'NULL' for pointer initialization
346 - reworked for-loop at end of get_line (part of DEFERRED '%ifdef/%endif' change)
347 - added %locations directive for bison compatibility to enable position
349 - added decl for 'int locations'; true if %locations present
350 - added decl 'int backtrack'; initialized to 0 (= false), set to
351 1 (= true) if -B flag is present
352 - process %locations if present, set location = 1
353 - only process []-actions and only generate 'if (!yytrial)' prefix for
354 {}-actions if backtracking is enabled
355 - add decl for 'int destructor'; true if at least one %destructor is present
356 - add %destructor directive to enable semantic & position stack processing to
357 reclaim memory associated with discarded symbols
358 - process bison compatible %destructor (set destructor = 1); support @$ in
359 %destructor code to reference the position value if %locations is defined
360 - changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
361 used for variables/parameters that were related to variables/parameters
363 - if %locations present, support @N and @$ syntax as for bison to reference
364 the locations associated with the N-th rhs symbol and the lhs symbol,
368 - initialize fields added to 'struct bucket' for non-terminal symbol
372 - for parse states with conflicts, the contents of the y.output file include
373 the trial shift and/or trial reduce actions
374 - added output to the end of the verbose report showing the correspondance
375 between grammar symbol #, internal parser symbol #, and grammar symbol name
376 - changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
377 used for variables/parameters that were related to variables/parameters
381 - added options 'P', 'V', 'y' and '-o output_file' to the yacc command
382 synopsis (already covered in the description section)
383 - added options 'B', 'D' and 'L' to the yacc command synopsis; added text in
384 the description section
385 - added %locations description to the extensions section