+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