Commit Graph

3518 Commits

Author SHA1 Message Date
Joel E. Denny
966aba6583 Declare %code to be a permanent feature.
* NEWS (2.4.2): Here.
* doc/bison.texinfo (Prologue Alternatives): Don't say it's
experimental.
(Decl Summary): Likewise.
(cherry picked from commit cefb18280b)
2009-05-01 03:00:20 -04:00
Joel E. Denny
812775a039 Convert underscores to dashes in some %define variable names.
For now, just api.push-pull and lr.keep-unreachable-states.
Maintain old names for backward compatibility.
* NEWS (2.5): Document.
* data/c.m4 (b4_identification): Update comment.
* data/yacc.c: Update access.
* doc/bison.texinfo: Update.
* etc/bench.pl.in (bench_grammar): Update use.
* src/files.c (tr): Move to...
* src/getargs.c, src/getargs.h (tr): ... here because I can't
think of a better place to expose it.  My logic is that, for all
uses of tr so far, command-line arguments can be involved, and
getargs.h is already included.
* src/main.c (main): Update access.
* src/muscle_tab.c (muscle_percent_define_insert): Convert old
variable names to new variable names before assigning value.
* src/reader.c (reader): Update setting default.
* tests/calc.at: Update uses.
* tests/conflicts.at (Unreachable States After Conflict
Resolution): Update use.
* tests/input.at (%define enum variables): Update use.
(%define backward compatibility): New test group.
* tests/push.at: Update uses.
* tests/reduce.at: Update uses.
* tests/torture.at: Update uses.
2009-04-30 03:43:42 -04:00
Joel E. Denny
1c4aa81df1 Set all front-end %define defaults in one place.
* src/main.c (main): Move lr.keep_unreachable_states default...
* src/reader.c (reader): ... to here.
2009-04-30 00:31:12 -04:00
Joel E. Denny
1d0f55cc84 Rename lr.default_reductions to lr.default-reductions.
* NEWS (2.5): Here.
* doc/bison.texinfo: Here.
* src/lalr.c (initialize_LA): Here.
* src/print.c (print_reductions): Here.
* src/reader.c (reader): Here.
* src/tables.c (action_row): Here.
* tests/input.at (%define enum variables): Here.
* tests/reduce.at (AT_TEST_LR_DEFAULT_REDUCTIONS): Here.
2009-04-29 21:48:21 -04:00
Joel E. Denny
0b59345789 Pacify ./configure --enable-gcc-warnings.
* tests/input.at (Symbols): Prototype yyerror and yylex.
2009-04-29 20:50:01 -04:00
Akim Demaille
0939aa2d3c tests: check the use of dashes and periods in symbols.
* tests/input.at (Symbol): New test group.
(cherry picked from commit 746ee38c7c)
2009-04-29 20:41:32 -04:00
Joel E. Denny
ae618dcca5 Document how `%define "var" "value"' is not M4-friendly.
* src/parse-gram.y (variable): In comments here.
2009-04-29 20:18:33 -04:00
Joel E. Denny
6789b8bd7b Add copyright updates missed during previous cherry pick.
* src/output.c: Here.
* src/parse-gram.y: Here.
* src/scan-gram.l: Here.
2009-04-29 20:03:52 -04:00
Akim Demaille
663ce7bb3e variables: accept dashes.
* src/scan-gram.l ({id}): Also accept dashes after the initial
	letter.
	({directive}): Use {id}.
	* src/parse-gram.y: Comment and formatting changes.
	* doc/bison.texinfo (Symbols): Adjust the lexical definitions of
	symbols.
	* src/complain.h, src/complain.c (yacc_at): New.
	* src/symtab.c (symbol_new): Use yacc_at to report inappropriate
	symbol names.
	* src/output.c (token_definitions_output): Do not #define token
	names with dashes.
(cherry picked from commit 4f646c3794)

Conflicts:

	data/bison.m4
	src/parse-gram.y
2009-04-29 18:50:12 -04:00
Joel E. Denny
379261b3fd Clean up recent patches a little.
Reported by Akim Demaille.
* doc/bison.texinfo (Understanding): Fix typos.
* src/print.c (print_reductions): Don't use negated variable.
2009-04-24 02:47:42 -04:00
Joel E. Denny
25029e164a List accepted values for a %define enum variable with an invalid value.
Suggested by Akim Demaille at
<http://lists.gnu.org/archive/html/bison-patches/2009-04/msg00082.html>.
* data/bison.m4 (_b4_percent_define_check_values): Implement.
* src/muscle_tab.c (muscle_percent_define_check_values): Implement.
* tests/input.at (%define lr.default_reductions invalid values): Merge
into...
(%define enum variables): ... here, and update output.
2009-04-24 02:47:22 -04:00
Joel E. Denny
620b572773 Rename "default rule" to "default reduction".
This includes changing variable names in code, changing
comments, and renaming %define lr.default_rules to %define
lr.default_reductions.
* NEWS (2.5): Update IELR documentation.
* data/glr.c, data/lalr1.cc, data/lalr1.java, data/yacc.c:
Adjust YYDEFACT and yydefact_ documentation.
* doc/bison.texinfo (Decl Summary): Adjust lr.default_reductions
and lr.type documentation.  Make some other wording
improvements.
(Glossary): Adjust cross-references and Default Reduction
definition.
* src/lalr.c (state_lookahead_tokens_count): Adjust code.
Remove a confusing comment pointed out by Akim Demaille.
(initialize_LA): Adjust code.
* src/print-xml.c (print_reductions): Adjust code.
* src/print.c (print_reductions): Adjust code.
* src/reader.c (reader): Adjust code.
* src/tables.c (action_row): Adjust code.
(token_actions): Adjust code.
* src/tables.h: Adjust YYDEFACT documentation.
* tests/input.at (%define lr.default_rules invalid values):
Rename test group to...
(%define lr.default_reductions invalid values): ... this, and
update grammar file and expected output.
* tests/reduce.at (AT_TEST_LR_DEFAULT_RULES): Rename to...
(AT_TEST_LR_DEFAULT_REDUCTIONS): ... this, and update.
2009-04-23 04:29:25 -04:00
Joel E. Denny
34a6c2d19b Document %define lr.type and lr.default_rules.
* NEWS (2.5): Add an entry.
* src/getargs.c (usage): Mention IELR(1) and canonical LR(1)
besides just LALR(1) and GLR(1).
* doc/bison.texinfo (Introduction): Likewise.
(Language and Grammar): Bison is no longer limited to LALR(1)
restrictions.
(GLR parsing): Say deterministic or LR(1) rather than LALR(1)
when trying to distinguish from GLR.  Talk about LR(1) grammars
rather than LALR(1) grammars.
(Decl Summary): In %define api.push_pull entry, say it applies
to deterministic parsers in C rather than LALR(1) parsers in C.
Add lr.default_rules entry.
Add lr.type entry.
(Mystery Conflicts): Bison is no longer limited to LALR(1)
restrictions.
(Generalized LR Parsing): Same changes as for the previous GLR
section.
(Memory Management): Say deterministic rather than LALR(1).
(Understanding): Correct some bison output.
Index discussion of "accepting state".
Say deterministic rather than LALR(1).
(Bison Options): In --yacc entry, say deterministic rather than
LALR(1).
In --report, --graph, and --xml entries, just don't mention
LALR(1).
(C++ Parsers): Say deterministic rather than LALR(1).
(Table of Symbols): Likewise in YYSTACK_USE_ALLOCA entry.
(Glossary): Add Accepting State, Consistent State, Default Rule,
and IELR(1) definitions.
In Generalized LR (GLR) definition, make same changes as in
previous GLR sections.
In LALR(1) definition, say Bison uses LALR(1) by default rather
than implying Bison is limited to LALR(1).
(LocalWords): Add IELR.
2009-04-21 05:13:36 -04:00
Joel E. Denny
f805dfcb3f Finish implementing %define lr.type.
Its value can be "LALR", "IELR", or "canonical LR".
* lib/timevar.def (TV_IELR_PHASE1): New var.
(TV_IELR_PHASE2): New var.
(TV_IELR_PHASE3): New var.
(TV_IELR_PHASE4): New var.
* src/Makefile.am (bison_SOURCES): Add AnnotationList.c,
AnnotationList.h, InadequacyList.c, InadequacyList.h, Sbitset.c,
Sbitset.h, ielr.h, and ielr.c.
* src/getargs.h, src/getargs.c (enum trace, trace_args,
trace_types): Add trace_ielr.
* src/lalr.h, src/lalr.c (ngotos): Export it.
(F): Rename to...
(goto_follows): ... this, update all uses, and export it.
(set_goto_map): Export it.
(map_goto): Export it.
(compute_lookahead_tokens): Don't free goto_follows yet.  Now
handled in ielr.
(initialize_LA): Export it.  Move lookback allocation to...
(lalr): ... here because, for canonical LR, initialize_LA must
be invoked but lookback and much of the rest of LALR isn't
needed.
* main.c (main): Instead of lalr, invoke ielr, which invokes
lalr.
* src/reader.c (reader): Default lr.type to "LALR".
Default lr.default_rules to "accepting" if lr.type is "canonical
LR".  Leave the default as "all" otherwise.
Check for a valid lr.type value.
* src/state.h, src/state.c (struct state_list): Add state_list
member.
(state_new): Initialize state_list member to NULL.
(state_new_isocore): New function, exported.
* tests/existing.at (AT_TEST_EXISTING_GRAMMAR): New macro that
exercises all values of lr.type.
(GNU AWK Grammar): Rename test group to...
(GNU AWK 3.1.0 Grammar): ... this, and extend to use
AT_TEST_EXISTING_GRAMMAR.
(GNU Cim Grammar): Extend to use AT_TEST_EXISTING_GRAMMAR.
(GNU pic Grammar): Rename test group to...
(GNU pic (Groff 1.18.1) Grammar): ... this, and extend to use
AT_TEST_EXISTING_GRAMMAR.
* tests/reduce.at (AT_TEST_LR_TYPE): New macro that exercises
all values of lr.type.
(Single State Split): New test groups using AT_TEST_LR_TYPE.
(Lane Split): Likewise.
(Complex Lane Split): Likewise.
(Split During Added Lookahead Propagation): Likewise.
2009-04-21 04:04:36 -04:00
Joel E. Denny
166366b28f Add new files for IELR and canonical LR implementation.
* src/AnnotationList.c: New.
* src/AnnotationList.h: New.
* src/InadequacyList.c: New.
* src/InadequacyList.h: New.
* src/Sbitset.c: New.
* src/Sbitset.h: New.
* src/ielr.c: New.
* src/ielr.h: New.
2009-04-21 02:10:57 -04:00
Joel E. Denny
03c07b0394 Implement %define lr.default_rules.
Its value describes the states that are permitted to contain
default rules: "all", "consistent", or "accepting".
* src/reader.c (reader): Default lr.default_rules to "all".
Check for a valid lr.default_rules value.
* src/lalr.c (state_lookahead_tokens_count): If lr.default_rules
is "accepting", then only mark the accepting state as
consistent.
(initialize_LA): Tell state_lookahead_tokens_count whether
lr.default_rules is "accepting".
* src/tables.c (action_row): If lr.default_rules is not "all",
then disable default rules in inconsistent states.
* src/print.c (print_reductions): Use this opportunity to
perform some assertions about whether lr.default_rules was
obeyed correctly.
* tests/local.at (AT_TEST_TABLES_AND_PARSE): New macro that
helps with checking the parser tables for a grammar.
* tests/input.at (%define lr.default_rules invalid values): New
test group.
* tests/reduce.at (AT_TEST_LR_DEFAULT_RULES): New macro using
AT_TEST_TABLES_AND_PARSE.
(`no %define lr.default_rules'): New test group generated by
AT_TEST_LR_DEFAULT_RULES.
(`%define lr.default_rules "all"'): Likewise.
(`%define lr.default_rules "consistent"'): Likewise.
(`%define lr.default_rules "accepting"'): Likewise.
2009-04-21 01:09:35 -04:00
Akim Demaille
44c124a389 Consistently refer to Yacc, not YACC.
* src/getargs.c (usage, warnings_args): s/YACC/Yacc/.
2009-04-20 13:23:01 +02:00
Joel E. Denny
4266073618 Pacify make maintainer-check-posix.
* tests/input.at (%define, --define): Move bison command-line
options before grammar file name.
2009-04-17 16:20:50 -04:00
Joel E. Denny
a2d0567444 Document semicolon warnings.
* NEWS (2.5): Here.
2009-04-17 00:08:39 -04:00
Akim Demaille
c4fae1ef48 Fix portability issue in the test suite.
* tests/local.at (AT_MATCHES_CHECK): New.
	Based on Perl instead of Sed.  Sed has too many portability
	pitfalls, not ever Sed is GNU Sed.
	* tests/actions.at (Fix user actions without a trailing semicolon):
	Use it.
(cherry picked from commit 6617622c9a)
2009-04-17 00:08:23 -04:00
Di-an Jan
42f4393a72 Implement the FIXME that ends an user action with a semicolon
if it seems necessary.

* src/scan-code.l (flex rules section): Flag cpp directive from
any `#' to the first unescaped end-of-line.  Semicolon is not
needed after `;', `{', '}', or cpp directives and is needed after
any other token (whitespaces and comments have no effect).
* tests/actions.at (Fix user actions without a trailing semicolon):
New test.
* tests/input.at (AT_CHECK_UNUSED_VALUES): Add semicolons to
to make user actions complete statements.
Adjust column numbers in error messages.
* tests/regression.at (Fix user actions without a trailing semicolon):
Remove.  Covered by new test.
(cherry picked from commit e8cd1ad655)
2009-04-17 00:06:19 -04:00
Akim Demaille
bd5df716a3 doc: minor fixes.
* doc/bison.texinfo (Decl Summary): Fix entry about %debug.
	(Table of Symbols): Remove duplicate entry for %debug.
2009-04-14 08:12:29 +02:00
Eric Blake
7ba0d59da0 submodules: update to latest
* submodules/autoconf: Use latest upstream Autoconf.

Signed-off-by: Eric Blake <ebb9@byu.net>
2009-04-10 07:36:49 -06:00
Eric Blake
b4d71a9664 Work around autoconf 2.63b bug in testsuite.
* tests/output.at (AT_CHECK_OUTPUT_FILE_NAME): Avoid tripping
autoconf bug related to # in test.

Signed-off-by: Eric Blake <ebb9@byu.net>
(cherry picked from commit ab3a683f05)
2009-04-10 07:15:21 -06:00
Joel E. Denny
4ecd368199 * NEWS (2.5): Describe new -D/--define feature. 2009-04-06 17:29:52 -04:00
Akim Demaille
c65e529237 --trace=muscles
* src/getargs.h, src/getargs.c (trace_muscle): New.
	(trace_types, trace_args): Support it.
	* src/output.c (output_skeleton): Use it.
(cherry picked from commit 5263bea9f7)
2009-04-06 05:56:14 -04:00
Akim Demaille
96002de2e1 muscles_output.
* src/output.c (muscles_output): New, extracted from...
	(output_skeleton): here.
	Adjust.
2009-04-06 05:55:38 -04:00
Akim Demaille
fadb13b5b3 Display the changes in cross-options.texi.
* build-aux/cross-options.pl ($sep): New, to separate items.
	* doc/Makefile.am ($(srcdir)/cross-options.texi): Use diff to display
	the changes.
2009-04-06 05:47:16 -04:00
Di-an Jan
72183df4da Improves options in the manual.
* doc/bison.texinfo (-g, -x): Add space before argument.
	(Option Cross Key): Implement FIXME: listing directives also.
	* build-aux/cross-options.pl:  Read from <STDIN> rather than <>.
	(Short Option): Special case -d.  Put arguments inside @option.
	(Bison Directive): Add column, automatically extracted from
	src/scan-gram.l (actual name passed as the first argument)
	with special case for %define.
	* doc/Makefile.am (doc/cross-options.texi): Pass src/scan-gram.l
	to build-aux/cross-options.pl.
	* src/getargs.c (usage): Document limitations of cross-options.pl.
	* src/scan-gram.l: Likewise.
2009-04-06 05:40:27 -04:00
Akim Demaille
e80b068ce1 Copyright years.
* data/glr.c: Add 2007 and 2008 here, consistenly with the comments.
2009-04-06 04:57:17 -04:00
Akim Demaille
54d8d31419 Really add autoconf as a submodule.
* submodules/autoconf: New.
(cherry picked from commit e5fa6147ef)
2009-04-06 04:44:21 -04:00
Akim Demaille
e3ee30b88f Install autoconf as a submodule to get m4sugar.
* .gitmodules: Add submodules/autoconf.
	* data/m4sugar/foreach.m4, data/m4sugar/m4sugar.m4: Now links into
	submodules/autoconf.
(cherry picked from commit 6c63b895fb)
2009-04-06 04:41:33 -04:00
Joel E. Denny
c4eb1e841e Simplify last patch slightly.
* src/getargs.c (getargs): Here.
(cherry picked from commit 9ce405ce1d)
2009-04-06 04:28:51 -04:00
Joel E. Denny
10fa0146e2 Fix last warning from --enable-gcc-warnings.
* src/getargs.c (getargs): Don't assign const address to non-const
pointer.
(cherry picked from commit a8beef7e6a)
2009-04-06 04:28:51 -04:00
Di-an Jan
6f5be1abf7 Handle --enable-gcc-warnings.
* src/getargs.c (command_line_location): Set parameters to void.
2009-04-06 04:28:51 -04:00
Akim Demaille
11c4e57daf AT_FULL_COMPILE.
* tests/actions.at, tests/regression.at: Use it.
2009-04-06 04:28:51 -04:00
Akim Demaille
e186a28486 Pass command line location to skeleton_arg and language_argmatch.
* src/getargs.h, src/getargs.c (skeleton_arg, language_argmatch):
	The location argument is now mandatory.
	Adjust all dependencies.
	(getargs): Use command_line_location.
2009-04-06 04:28:51 -04:00
Akim Demaille
e14c68313b -D, --define.
* src/getargs.c (usage): Document -D.
	Fix help string for --locations.
	(command_line_location): New.
	(short_options, long_options, getargs): Support -D, --define.
	(getargs): Move -d support at the right place.
	* doc/bison.texinfo (Bison Options): Update.
	* tests/input.at (%define, --define): New.
(cherry picked from commit 58697c6d89)
2009-04-06 04:28:50 -04:00
Akim Demaille
75c21b618d Initialize the muscle table before parsing the command line.
* src/getargs.c (quotearg.h, muscle_tab.h): Include.
	(getargs): Define file_name.
	* src/main.c (main): Initialize muscle_tab before calling
	getargs.
	* src/muscle_tab.c (muscle_init): No longer define file_name, as
	its value is not available yet.
2009-04-06 04:28:50 -04:00
Akim Demaille
33d2a86079 Require the generation of parse-gram.output.
* src/Makefile.am (YACC): Pass --report=all.
(cherry picked from commit 432ac57aaa)
2009-04-06 04:28:50 -04:00
Joel E. Denny
006faedfd3 * NEWS (2.5): New stub. 2009-04-06 04:28:29 -04:00
Joel E. Denny
ecd1b61cd4 Fix options documentation.
* build-aux/cross-options.pl: As in --help output, write optional
arguments as [=ARG] not =[ARG].
* doc/bison.texinfo (Bison Options): Add -W/--warnings argument.
2009-04-06 02:54:38 -04:00
Akim Demaille
f67c40374e Fix --help.
* src/getargs.c (usage): Fix help string for -W.
(cherry picked from commit 9b9e0a7d46)
2009-04-06 00:54:55 -04:00
Akim Demaille
0213d65176 Handle more general types of option arguments.
* build-aux/cross-options.pl: The argument ends at the first
	space, not the first non-symbol character.
	Use @var for each word appearing the argument description.
(cherry picked from commit 74eae918c3)
2009-04-06 00:50:21 -04:00
Joel E. Denny
c19178bfaf Remove spurious initial empty lines.
* data/location.cc: End the @output lines with an @.
2009-04-06 00:39:49 -04:00
Akim Demaille
0d2b2ab033 Remove spurious initial empty lines.
* data/glr.c, data/glr.cc, data/lalr1.cc, data/lalr1.java,
	* data/yacc.c: End the @output lines with an @.
2009-04-06 00:36:42 -04:00
Joel E. Denny
8ba62e3e10 Replace BISON_PROG_GNU_M4 with Autoconf's AC_PROG_GNU_M4.
If the first m4 in $PATH is wrong, it keeps looking.  Moreover, its
requirements for a correct m4 are stricter.
* m4/m4.m4: Replace with Autoconf 2.63's m4/m4.m4.
* configure.ac: Update to use AC_PROG_GNU_M4.
Reported by Eric Blake.
2009-04-04 21:12:23 -04:00
Joel E. Denny
f490771b4b * ChangeLog: Update copyright. 2009-04-04 02:46:19 -04:00
Joel E. Denny
5bc993d947 Help with updating web manual.
* HACKING: Incorporate instructions from gnulib/doc/README.
* bootstrap.conf (gnulib_modules): Add gendocs.
2009-04-03 18:46:58 -04:00
Joel E. Denny
580c075d7f Fix strange %define locations for default values.
Reported by Akim Demaille at
<http://lists.gnu.org/archive/html/bug-bison/2007-12/msg00001.html>
and discussed again starting at
<http://lists.gnu.org/archive/html/bison-patches/2008-11/msg00102.html>.
* data/bison.m4 (b4_percent_define_default): Leave syncline blank
because location information is bogus.
Use angle brackets to delimit fake file name because square brackets
look like over-quoted m4.  Choose a better fake file name.
Use negative line numbers.
* src/muscle_tab.c (muscle_percent_define_default): Likewise.
* src/location.c (location_print): If line for a boundary is negative,
only print that boundary's file name.
* src/location.h: Document that.
* tests/skeletons.at (%define Boolean variables: invalid skeleton
defaults): Update output.
2009-04-03 03:56:58 -04:00