+2007-01-02 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ Encapsulate code properties and related functionality for the various
+ destructors, printers, and actions into a code_props structure and
+ interface. This patch merely implements code_props in scan-code.h and
+ scan-code.l. Future patches will rewrite other modules to use it.
+ Discussed starting at
+ <http://lists.gnu.org/archive/html/bison-patches/2006-11/msg00020.html>.
+ * src/location.h (EMPTY_LOCATION_INIT): Define so that it's easier to
+ consistently initialize const structs that have an empty location
+ field.
+ * src/location.c (empty_location): Initialize with EMPTY_LOCATION_INIT
+ to ensure consistency.
+ * src/scan-code.h (code_props): New structure.
+ (code_props_none_init, CODE_PROPS_NONE_INIT, code_props_none): New
+ function, macro, and const global variable for initializing a
+ code_props with no code.
+ (code_props_plain_init, code_props_symbol_action_init,
+ code_props_rule_action_init, code_props_translate_code): The rest of
+ the new code_props functional interface. Among other things, the init
+ functions set the code_props kind field so that
+ code_props_translate_code will know whether to behave like
+ translate_symbol_action, translate_rule_action, or translate_code.
+ These old translate functions must remain until all other modules are
+ updated to use the new code_props interface.
+ (code_scanner_last_string_free): New function similar to
+ gram_scanner_last_string_free.
+ (code_scanner_free): Add documentation.
+ * src/scan-code.l: Implement the new interface.
+ (code_lex): Make it static, add a code_props* argument, and remove the
+ rule argument.
+ (last_string): New static global similar to the one in scan-gram.l.
+ (SC_RULE_ACTION): Update to use the code_props* argument to code_lex
+ instead of rule.
+ (SC_SYMBOL_ACTION): For $$, set the is_value_used member of the
+ code_props since Bison may one day use this information for destructors
+ and printers.
+ (<*><<EOF>>): Use STRING_FINISH so that last_string is set.
+ (handle_action_dollar): Use symbol_list_n_get and set used flag
+ directly since symbol_list_n_used_set is removed.
+ (translate_action): Add a code_props* argument and remove the rule,
+ action, and location arguments. Pass the code_props* on to code_lex.
+ (translate_rule_action, translate_symbol_action, translate_code):
+ Rewrite as wrappers around the new code_props interface.
+ * src/symlist.h, src/symlist.c (symbol_list_n_used_set): Remove since
+ it would eventually need to break the encapsulation of code_props.
+
+2007-01-01 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ * etc/.cvsignore: New.
+
+2007-01-01 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ Add maintainer-push-check to run maintainer-check using push parsing in
+ place of pull parsing where available.
+ * Makefile.am (maintainer-push-check): New.
+ * data/bison.m4 (b4_use_push_for_pull_if): New.
+ * data/push.c: Redefine b4_push_if and b4_use_push_for_pull_if
+ appropriately based on their existing values.
+ (yypush_parse): Don't print push-parser-specific diagnostics if push
+ parsing is being used in place of pull parsing.
+ * data/yacc.c: If push parsing should replace pull parsing, redirect to
+ push.c.
+ * src/output.c (prepare): Check BISON_USE_PUSH_FOR_PULL environment
+ variable, and insert b4_use_push_for_pull_flag into muscles.
+ * tests/Makefile.am (maintainer-push-check): New.
+
+2006-12-31 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ * data/push.c (yypush_parse): Set yynew = 1 at the end of a parse
+ (whether successful or failed) so that yypush_parse can be invoked
+ again to start a new parse using the same yypstate.
+ * tests/torture.at (AT_DATA_STACK_TORTURE): For push mode, extend to
+ check multiple yypull_parse invocations on the same yypstate. For pull
+ mode, extend to check multiple yyparse invocations.
+ (Exploding the Stack Size with Alloca): Extend to try with
+ %push-pull-parser.
+ (Exploding the Stack Size with Malloc): Likewise.
+
+ * tests/calc.at (Simple LALR Calculator): Don't specify
+ %skeleton "push.c" since %push-pull-parser implies that now.
+ * tests/headers.at (export YYLTYPE): Don't check for the push
+ declarations. Otherwise, this test case can't be used to see if push
+ mode can truly emulate pull mode.
+ * tests/input.at (Torturing the Scanner): Likewise.
+ * tests/local.at (AT_YACC_OR_PUSH_IF, AT_PUSH_IF): Remove.
+ (AT_YYERROR_SEES_LOC_IF): Rather than AT_YACC_OR_PUSH_IF, use
+ AT_YACC_IF, which now includes the case of push mode since %skeleton
+ need not be used for push mode. This will be more intuitive once
+ push.c is renamed to yacc.c.
+
+2006-12-31 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ For push mode, convert yyparse from a macro to a function, invoke yylex
+ instead of passing a yylexp argument to yypull_parse, and don't
+ generate yypull_parse or yyparse unless %push-pull-parser is declared.
+ Discussed starting at
+ <http://lists.gnu.org/archive/html/bison-patches/2006-12/msg00163.html>.
+ * data/bison.m4 (b4_pull_if): New.
+ * data/c.m4 (b4_identification): Define YYPULL similar to YYPUSH.
+ * data/push.c: Improve M4 quoting a little.
+ (b4_generate_macro_args, b4_parenthesize): Remove.
+ (yyparse): If there's a b4_prefix, #define this to b4_prefix[parse]
+ any time a pull parser is requested.
+ Don't #define this as a wrapper around yypull_parse. Instead, when
+ both push and pull are requested, make it a function that does that
+ same thing.
+ (yypull_parse): If there's a b4_prefix, #define this to
+ b4_prefix[pull_parse] when both push and pull are requested.
+ Don't define this as a function unless both push and pull are
+ requested.
+ Remove the yylexp argument and hard-code yylex invocation instead.
+ * etc/bench.pl.in (bench_grammar): Use %push-pull-parser instead of
+ %push-parser.
+ * src/getargs.c (pull_parser): New global initialized to true.
+ * getargs.h (pull_parser): extern it.
+ * src/output.c (prepare): Insert pull_flag muscle.
+ * src/parse-gram.y (PERCENT_PUSH_PULL_PARSER): New token.
+ (prologue_declaration): Set both push_parser and pull_parser = true for
+ %push-pull-parser. Set push_parser = true and pull_parser = false for
+ %push-parser.
+ * src/scan-gram.l: Don't accept %push_parser as an alternative to
+ %push-parser since there's no backward-compatibility concern here.
+ Scan %push-pull-parser.
+ * tests/calc.at (Simple LALR(1) Calculator): Use %push-pull-parser
+ instead of %push-parser.
+ * tests/headers.at (export YYLTYPE): Make yylex static, and don't
+ prototype it in the module that calls yyparse.
+ * tests/input.at (Torturing the Scanner): Likewise.
+ * tests/local.at (AT_PUSH_IF): Check for %push-pull-parser as well.
+
+2006-12-26 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ Update etc/bench.pl. Optimize push mode a little (the yyn change
+ deserves most of the credit).
+ * Makefile.am (SUBDIRS): Add etc subdirectory.
+ * configure.ac (AC_CONFIG_FILES): Add etc/bench.pl and etc/Makefile.
+ * data/push.c (b4_declare_parser_state_variables): Move yyn, yyresult,
+ yytoken, yyval, and yyloc declarations to...
+ (yyparse or yypush_parse): ... here to improve performance. For
+ yypush_parse invocations after the first, be sure to assign yyn its old
+ value again.
+ (yypstate_new): Don't bother initializing the yyresult field since the
+ initial value isn't used.
+ (yyn, yyresult, yytoken, yyval, yyloc): For each NAME in this list,
+ remove the #define that, in push mode, set it to yyps->NAME.
+ * etc/Makefile.am: New.
+ * etc/bench.pl: Remove and build it instead from...
+ * etc/bench.pl.in: ... this new file. Use @abs_top_builddir@ to invoke
+ "tests/bison" from the build directory by default rather than just
+ invoking "bison" from $PATH.
+ (calc_grammar): Update push parser code: don't declare yylval globally,
+ don't define yyparse_wrapper, and don't #define yyparse.
+ (bench_grammar): Update to check all working combinations of yacc.c,
+ push.c, impure, pure, pull, and push.
+
+2006-12-25 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ For push mode, add pull wrappers around yypush_parse.
+ * data/push.c: (b4_generate_macro_args, b4_parenthesize): New macros.
+ (yypull_parse): New function wrapping yypush_parse.
+ (yyparse): New #define wrapping yypull_parse.
+ * tests/calc.at (_AT_DATA_CALC_Y): Call yyparse even when %push-parser
+ is declared.
+ * tests/headers.at (export YYLTYPE): Make yylex global. For push mode,
+ prototype yylex in the module that calls yyparse, and don't prototype
+ yyparse there. Otherwise, the yyparse expansion won't compile.
+ * tests/input.at (Torturing the Scanner): Likewise.
+
+2006-12-25 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ Enable push parsers to operate in impure mode. Thus, %push-parser no
+ longer implies %pure-parser. The point of this change is to move
+ towards being able to test the push parser code by running the entire
+ test suite as if %push-parser had been declared.
+ * data/push.c (yypush_parse): For impure mode, remove the
+ yypushed_char, yypushed_val, and yypushed_loc arguments.
+ Instead, declare these as local variables initialized to the global
+ yychar, yylval, and yylloc.
+ For the first yypush_parse invocation only, restore the initial values
+ of these global variables when it's time to read a token since they
+ have been overwritten.
+ * src/parse-gram.y (prologue_declaration): Don't set pure_parser for
+ %push-parser.
+ * tests/calc.at (Simple LALR(1) Calculator): Always declare
+ %pure-parser along with %push-parser since this test case was designed
+ for pure push parsers.
+ * tests/local.at (AT_PURE_OR_PUSH_IF): Remove unused.
+ (AT_YACC_OR_PUSH_IF): New.
+ (AT_YYERROR_SEES_LOC_IF): Fix enough that the test suite passes, but
+ add a note that it's still wrong for some cases (as it has been for a
+ while).
+ (AT_PURE_LEX_IF): Use AT_PURE_IF instead of AT_PURE_OR_PUSH_IF since
+ %push-parser no longer implies %pure-parser.
+
+2006-12-20 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ Remove some unnecessary differences between the pull parser code and
+ the push parser code. This patch enables yynerrs in push mode.
+ * data/push.c: Reformat M4 a little.
+ (b4_yyerror_range): Remove and convert all uses to just yyerror_range.
+ (b4_declare_scanner_communication_variables): Don't omit yynerrs just
+ because push mode is on. Instead, if pure mode is on, move yynerrs
+ to...
+ (b4_declare_parser_state_variables): ... here.
+ (yynerrs, yyerror_range): For push mode, #define each NAME in this list
+ to yyps->NAME so it can be used in yypush_parse.
+ (yypush_parse): Don't omit uses of yynerrs in push mode.
+
+2006-12-20 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ Fix bug such that the first pushed token's value and location are
+ sometimes overwritten (sometimes by %initial-action) before being used.
+ * data/push.c (yypush_parse): Rename arguments yynchar, yynlval, and
+ yynlloc to yypushed_char, yypushed_val, and yypushed_loc for clarity.
+ For the first yypush_parse invocation, initialize yychar to YYEMPTY to
+ more closely mimic the pull parser logic.
+ Don't copy the pushed token to yychar, yylval, and yylloc until it's
+ time to read a token, which is after any initialization of yylval and
+ yylloc.
+ (gottoken): Rename label to...
+ (yyread_pushed_token): ... for clarity and to avoid infringing on the
+ user namespace.
+
+2006-12-20 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ Rearrange initialization of the parser state variables so that the
+ skeleton doesn't have to have a copy for pull mode and another for push
+ mode. This patch also fixes at least a bug such that yylloc was not
+ initialized (with b4_location_initial_line and
+ b4_location_initial_column) upon calling yypush_parse. However, that
+ initialization now overwrites the first token's location;
+ %initial-action assigning @$ already did the same thing, and both bugs
+ will be fixed in a later patch.
+ * data/push.c (b4_yyssa): Remove and convert all uses to just yyssa.
+ (b4_declare_parser_state_variables): Remove initialization of yytoken,
+ yyss, yyvs, yyls, and yystacksize.
+ (yypstate_new): Remove initialization of some yypstate fields: yystate,
+ yyerrstatus, yytoken, yyss, yyvs, yyls, yystacksize, yyssp, yyvsp, and
+ yylsp.
+ (yyssa, yyvsa, yylsa): For push mode, #define each NAME in this list to
+ yyps->NAME so it can be used in yypush_parse.
+ (yyparse or yypush_parse): For yypush_parse, don't print the
+ "Starting parse" diagnostic for invocations after the first.
+ Add initialization of yytoken, yyss, yyvs, yyls, and yystacksize; for
+ yypush_parse, only do it for the first invocation.
+ Allow yystate, yyerrstatus, yyssp, yyvsp, yylsp, and yylloc
+ initialization to occur in yypush_parse but only on the first
+ invocation.
+
+2006-12-19 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ * data/push.c: Add CPP guards around push parser declarations in both
+ the header and the code file.
+ In the code file, move the push parser declarations to the same place
+ they appear in the header file.
+ Clean up the M4 some, especially the inconsistent underquoting in
+ some b4_c_function_def and b4_c_function_decl uses.
+
+2006-12-19 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ Encapsulate the push parser state variables into an M4 macro so the
+ push skeleton doesn't have to list them again for pull mode's yyparse.
+ For push mode, remove yypush_parse's local equivalents of these
+ variables to eliminate unnecessary copying between the two sets at
+ run-time. This patch also fixes at least a bug related to multiple
+ %initial-action invocations in push mode.
+ * data/push.c (b4_declare_parser_variables): Rename to...
+ (b4_declare_scanner_communication_variables): ... this for clarity and
+ update both uses.
+ (b4_declare_yyparse_variables): Remove and move its contents to the one
+ spot where it was invoked.
+ (b4_declare_parser_state_variables): New macro containing the parser
+ state variables required by push mode.
+ (struct yypstate): Replace all fields but yynew with
+ b4_declare_parser_state_variables.
+ (yystate, yyn, yyresult, yyerrstatus, yytoken, yyss, yyssp, yyvs,
+ yyvsp, yyls, yylsp, yystacksize, yyval, yyloc): For push mode, #define
+ each NAME in this list to yyps->NAME so it can be used in yypush_parse.
+ (yyparse or yypush_parse): For yyparse in pull mode, replace local
+ parser state variable declarations with
+ b4_declare_parser_state_variables.
+ Don't initialize parser state variables when calling yypush_parse since
+ yypstate_new already does that.
+ Invoke the user's initial action only upon the first yypush_parse
+ invocation.
+ Remove all code that copies between the local parser state variables
+ and the yypstate.
+
+2006-12-19 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ * data/push.c (union yyalloc): Rename yyss, yyvs, and yyls fields to
+ prevent a name collision in a future patch where these names will
+ sometimes be #define'd.
+ (YYSTACK_RELOCATE): Add an argument to select a union yyalloc field
+ since it no longer has the same name as the existing argument.
+ (yyparse or yypush_parse): Update all uses of YYSTACK_RELOCATE.
+
+2006-12-19 Paolo Bonzini <bonzini@gnu.org>
+ and Joel E. Denny <jdenny@ces.clemson.edu>
+
+ * doc/bison.texinfo (Decl Summary): In the %language entry, mention
+ that the argument is case-insensitive, and there's no `=' here.
+ For the %skeleton entry, mention that %language is better.
+ (Bison Options): Likewise for --language and --skeleton. Move the
+ --skeleton entry so that the `Tuning the parser' section is sorted
+ alphabetically on long options.
+ (C++ Bison Interface): Don't use the word skeleton. Don't explain the
+ %language directive in detail here; cross-reference the %language
+ documentation instead.
+ (Calc++ Parser): Use `%require "@value{VERSION}"' rather than
+ `%require "2.3b"' so that the example is always up-to-date.
+ (Bison Symbols): Add entries for %language and %skeleton.
+ * examples/extexi (normalize): Instead of replacing every %require
+ argument with the current Bison version, just substitute for
+ `@value{VERSION}'. This guarantees that we're testing what actually
+ appears in the documentation.
+ * examples/calc++/Makefile.am ($(calc_extracted)): Use `$(VERSION)'
+ rather than `@VERSION@'.
+
+2006-12-18 Paul Eggert <eggert@cs.ucla.edu>
+
+ * NEWS: Reword the %language news a bit, and put it earlier.
+
+ * src/getargs.c (skeleton_arg): Last arg is now location const *.
+ Rewrite to simplify the logic.
+ (language_argmatch): Likewise.
+ (program_name): We now own this var.
+ * src/getargs.h (struct bison_language): Use char[] rather than
+ const char *.
+
+ * doc/bison.texinfo (Decl Summary, Bison Options): Don't claim
+ Java is supported.
+ * src/complain.c (program_name): Remove decl; no longer needed.
+ * src/main.c (program_name): Remove; now belongs to getargs.
+
+2006-12-18 Paolo Bonzini <bonzini@gnu.org>
+
+ * NEWS: Document %language.
+
+ * data/Makefile.am (dist_pkgdata_DATA): Add c-skel.m4, c++-skel.m4.
+
+ * data/c-skel.m4, data/c++-skel.m4: New files.
+ * data/glr.c: Complain on push parsers.
+
+ * doc/bison.texinfo (C++ Parser Interface): Prefer %language
+ over %skeleton.
+ (Directives): Document %language and %skeleton.
+ (Command line): Document -L.
+
+ * examples/extexi: Rewrite %require directive.
+ * examples/calc++/Makefile.am: Pass VERSION to extexi.
+
+ * src/files.c (compute_exts_from_gc): Look in language structure
+ for .y extension.
+ (compute_file_name_parts): Check whether .tab should be added.
+ * src/getargs.c (valid_languages, skeleton_prio, language_prio):
+ (language, skeleton_arg, language_argmatch): New.
+ (long_options): Add --language.
+ (getargs): Use skeleton_arg, add -L/--language.
+ * src/getargs.h: Include location.h.
+ (struct bison_language, language, skeleton_arg, language_argmatch): New.
+ * src/output.c (prepare): Pick default skeleton from struct language.
+ Don't dispatch C skeletons here.
+ * src/parse-gram.y (PERCENT_LANGUAGE): New.
+ (prologue_declaration): Add "%language" rule, use skeleton_arg.
+ * src/scan-gram.l ("%language"): New rule.
+
+ * tests/calc.at: Test %skeleton and %language.
+ * tests/local.at (AT_SKEL_CC_IF): Look for %language.
+ (AT_GLR_IF): Look for %skeleton "glr.cc".
+ (AT_LALR1_CC_IF, AT_GLR_CC_IF): Rewrite.
+ (AT_YACC_IF): Reject %language.
+
+2006-12-18 Paul Eggert <eggert@cs.ucla.edu>
+
+ * src/symtab.h (struct semantic_type): Remove the tag 'semantic_type',
+ since it wasn't used; only the typedef name 'semantic_type' is needed.
+ Also, omit trailing white space.
+
+ * bootstrap: Sync from coreutils.
+ (gnulib_extra_files): Add build-aux/announce.gen.
+ (slurp): Adjust .gitignore files like .cvsignore files.
+ * build-aux/announce-gen: Remove from CVS, since bootstrap
+ now creates this.
+
+2006-12-16 Joel E. Denny <jdenny@ces.clemson.edu>
+
+ Make %push-parser imply %pure-parser. This fixes several bugs; see
+ <http://lists.gnu.org/archive/html/bison-patches/2006-12/msg00148.html>.
+ * src/parse-gram.y (prologue_declaration): For %push-parser, also set
+ pure_parser = true.
+ * data/push.c: Don't bother testing b4_push_if when deciding whether
+ to expand b4_declare_parser_variables globally.
+ (yypush_parse): Likewise in here.
+
+ * data/push.c (yypush_parse): Add b4_parse_param to arguments.
+ (yy_reduce_print): Reformat M4 for readability.
+
+2006-12-15 Bob Rossi <bob@brasko.net>
+ and Joel Denny <jdenny@ces.clemson.edu>
+
+ * data/push.c (yypstate): Add typedef, and update all uses of
+ struct yypstate to just yypstate.
+ * tests/calc.at (_AT_DATA_CALC_Y): Update here as well.
+
+2006-12-14 Bob Rossi <bob@brasko.net>
+
+ * data/push.c (yypush_parse): Declare prototype regardless of
+ %locations option.
+
2006-12-14 Bob Rossi <bob@brasko.net>
* data/push.c (yyparse): Remove the prototype and the #define when in