Compare commits

...
76 Commits
Author SHA1 Message Date
Paul Eggert a47fb7838a build: update gnulib submodule to latest 2026-07-30 08:36:29 -07:00
Paul Eggert 089c39aab2 bison: allow trivially copyable C++ YYLTYPE
Problem reported by James K. Lowden in:
https://lists.gnu.org/r/bison-patches/2026-07/msg00000.html
* data/skeletons/yacc.c: In C++, check that YYLTYPE is
trivially copyable if this is not already known.
But skip the check in older compilers.
2026-07-21 12:52:53 -07:00
Paul Eggert 3841fe9de4 maint: update .gitignore 2026-07-21 12:52:53 -07:00
Paul Eggert 7024830c72 maint: propagate gnulib changes 2026-07-21 12:52:53 -07:00
Paul Eggert 720943cff0 maint: prefer mcel
* bootstrap.conf (gnulib_modules): Add mcel-prefer.
(gnulib_tool_option_extras): Avoid mbiterf.
This simplifies Bison a bit, which does not need
the more-complex mbiterf.
2026-07-21 12:52:53 -07:00
Paul Eggert 706ebd0fa5 bison: port to GCC 16.1.1 -Wclobbered
* data/skeletons/glr.c, data/skeletons/glr2.cc:
Ignore -Wclobbered if GCC 4.6 or later.
2026-07-21 12:52:53 -07:00
Paul Eggert ff9eee58c3 bison: port to GCC 16.1.1 -Wmaybe-uninitialized
* data/skeletons/lalr1.cc: Increase the scope of
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN.
Needed for GCC 16.1.1 20260515 (Red Hat 16.1.1-2).
2026-07-21 12:52:53 -07:00
Paul Eggert 4f6785aee9 build: update gnulib and autoconf submodules to latest 2026-07-21 12:52:53 -07:00
Paul Eggert c3f856a430 bison: port to recent glibc / Gnulib
* src/muscle-tab.c (muscle_grow, muscle_syncline_grow)
(muscle_pair_list_grow, muscle_boundary_grow, string_decode)
(define_directive): Use char *, not char const *, for
pointers that are passed to obstack_free or are stored through.
This avoids undefined behavior in C.
2026-07-21 12:52:53 -07:00
Paul Eggert 8d101c19d4 bison: tighten up output file names
Problem reported by Michał Majchrowicz.
* src/parse-gram.y: Do not allow '/' in %header and %output directives.
2026-04-23 12:49:06 -07:00
Paul Eggert 3169c1e7a2 html: use xsltproc from PATH
* src/print-xml.c (print_html):
* src/reader.c (prepare_percent_define_front_end_variables):
Drop undocumented support for lines like ‘%define tool.xsltproc
"whatever"’, as this can cause more trouble than it cures.
2026-04-23 09:21:37 -07:00
Paul Eggert 39c1239ed5 doc: improve yacc man page fonts
Problem reported by Helge Kreutzmann in:
https://lists.gnu.org/r/bug-bison/2025-12/msg00000.html
* doc/yacc.1.in: Fix fonts.
2026-01-18 10:16:18 -08:00
Paul Eggert dcf16ff191 maint: make update-copyright 2026-01-18 09:45:29 -08:00
Paul Eggert c6d1f65185 doc: improve man page (mostly fonts)
Problems reported by Helge Kreutzmann in:
https://lists.gnu.org/r/bug-bison/2026-01/msg00000.html
* doc/bison.x: Refontify, mostly.
* src/getargs.c (usage): Clarify usage message.
2026-01-18 09:39:28 -08:00
Bruno HaibleandPaul Eggert c1144a5076 tests: Fix test failures of Java tests on Cygwin.
Fix suggested by Paul Eggert.

* tests/atlocal.in (lf): New variable.
* tests/local.at (AT_JAVA_PARSER_CHECK): Pass a Windows-agnostic value
of line.separator to the Java runtime.
2025-08-09 13:58:50 -07:00
Paul Eggert 5d2c34b48c maint: pacify -Wunterminated-string-initialization
* src/symtab.c (is_identifier):
Pacify GCC 15.1 -Wunterminated-string-initialization.
2025-08-03 23:09:33 -07:00
Bruno HaibleandPaul Eggert 5209a67035 build: Avoid failure of the Java tests in Cygwin-based environments.
* examples/test (prog): In Cygwin-based environments, convert the class path
element to native Windows syntax.
2025-08-03 22:51:19 -07:00
Bruno HaibleandPaul Eggert df2ed793af build: Fix "make dvi" and "make distcheck" error.
* bootstrap.conf (gnulib_extra_files): Add build-aux/epsf.tex.
* build-aux/local.mk (EXTRA_DIST): Add build-aux/epsf.tex.
2025-08-03 20:29:41 -07:00
Paul Eggert 84119fd53e build: update gnulib and autoconf submodules to latest 2025-08-03 20:29:41 -07:00
Bruno HaibleandPaul Eggert f8793e27f0 build: Don't hardcode the location of the gnulib directory.
* build-aux/move-if-change: Remove symlink.
* bootstrap.conf (gnulib_extra_files): Add build-aux/move-if-change.
2025-08-03 20:18:29 -07:00
Paul Eggert 2ceaf03d69 maint: update .gitignore files 2025-07-10 18:34:10 -07:00
Paul Eggert 5d0d1b4965 ./bootstrap 2025-07-10 18:34:10 -07:00
Paul Eggert 42a5f17b8f build: update gnulib and autoconf submodules to latest 2025-07-10 18:34:10 -07:00
Paul Eggert 4ff0741f58 maint: make update-copyright 2025-03-17 17:48:06 -07:00
Paul Eggert d7527048a8 maint: port to strict C function type checking
Violation of C standard detected by clang -fsanitize=undefined
with clang 19.1.7 on Fedora 41 x86-64.
* src/counterexample.c (si_bfs_free):
* src/files.c (prefix_map_free, add_prefix_map):
* src/fixits.c (fixit_cmp, fixit_free, fixits_register):
(expand_to_conflict, nonunifying_shift_path)
(search_state_free_children, search_state_free, ssb_free)
(ssb_hasher, ssb_comp, ssb_equals, visited_hasher)
(visited_comparator, ssb_append, unifying_example):
* src/lssi.c (lssi_free, lssi_hasher, lssi_comparator)
(shortest_path_from_start):
* src/parse-simulation.c (free_parse_state)
(parse_state_list_new, parser_pop):
* src/state-item.c (hash_pair_hasher, hash_pair_comparator)
(hash_pair_free, hash_pair_table_create):
Avoid undefined behavior in C, which does not allow you to cast a
function pointer to some other function type and then call it via
that other type.  Instead, use functions with correct types
according to the C standard, and cast their parameters.
* src/getargs.c (xargmatch_fn): Return int const, not int, to
match what ARGMATCH_DEFINE_GROUP does.  In all uses of
ARGMATCH_DEFINE_GROUP, say that they return int, to match
xargmatch_fn.
(FLAGS_ARGMATCH): Do not cast function pointer.
* src/parse-simulation.c (vc_derivation_list_append): New function.
* src/system.h (deconst): New static function.
2025-03-13 13:39:45 -07:00
Paul Eggert 6a4b3240cf maint: pacify gcc 14.2 -Wmaybe-uninitialized
* data/skeletons/lalr1.cc:
* data/skeletons/yacc.c:
Add YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN and
YY_IGNORE_MAYBE_UNINITIALIZED_END to pacify GCC 14,
apparently after inlining.
2025-03-13 13:39:45 -07:00
Paul Eggert aa0c96bf14 maint: adjust to Gnulib API changes
* src/output.c (output_skeleton):
* src/print-xml.c (print_html):
Adjust to Gnulib API changes.
2025-03-13 13:39:45 -07:00
Paul Eggert 3ad31c23f1 doc: pacify texinfo 7.1
* doc/bison.texi: Don’t put @anchor inside @item,
as texinfo 7.1 complains.
2025-03-13 13:39:45 -07:00
Paul Eggert 41a939eece maint: ./bootstrap 2025-03-13 13:39:45 -07:00
Paul Eggert 8b3df1a443 build: update gnulib and autoconf submodules to latest 2025-03-13 13:39:44 -07:00
FutureandPaul Eggert 97852f39f4 maint: remove unnecessary casts before using gnulib functions
* src/parse-gram.y, src/scan-gram.l: Do not cast c-ctype.h function
args to unsigned char unnecessarily.
* src/parse-gram.c: Regenerate.

Copyright-paperwork-exempt: yes
2022-11-04 11:53:52 -07:00
Akim Demaille 25b3d0e1a3 cex: check -Dcex.timeout
* src/counterexample.c (counterexample_init): Remove stray debug
trace.
Complain about invalid values.
* tests/input.at (-Dcex.timeout): New.
2022-09-20 08:25:06 +02:00
Akim Demaille de3041b69a news: update
* NEWS: update.
2022-09-20 07:16:25 +02:00
Adela VaisandAkim Demaille 0faf371992 d: fix syntax error on SymbolKind.toString method
Reported by ledaniel2.
<https://github.com/akimd/bison/issues/88>

* data/skeletons/d.m4: Here.
2022-09-20 07:07:12 +02:00
Adela VaisandAkim Demaille be4528096e d: fix interface syntax error
Fix syntax error regarding interface inheritance of the Lexer. It
appeared when the `%code lexer` option was used.

Reported by ledaniel2.
<https://github.com/akimd/bison/issues/84>

* data/skeletons/lalr1.d: Fix syntax.
* tests/d.at: Test it.
2022-09-20 06:39:05 +02:00
Akim Demaille c025891547 cex: provide the user with a means to change the timeout
Reported by Frank Heckenbach.
https://lists.gnu.org/r/bug-bison/2022-07/msg00011.html

* bootstrap.conf: Use c_strtod, so that even in French locales "1.5"
is accepted, instead of "1,5".
* src/counterexample.c, src/state-item.c: Use xtime_t instead of
time_t, so that accuracy goes from seconds to nanoseconds.
( counterexample_init): Depend on cex.timeout rather than
$TIME_LIMIT.
* doc/bison.texi (%define Summary): Document cex.timeout.
2022-09-16 06:03:28 +02:00
Akim Demaille 15b97a0a6a doc: define the syntax of named references
Reported by Arthur Schwarz.
https://lists.gnu.org/r/help-bison/2022-06/msg00007.html

* doc/bison.texi (Named References): Define the syntax of named
references.
2022-09-12 07:24:21 +02:00
Akim Demaille 290d3d09d4 cex: clarify message
Reported by Frank Heckenbach.
https://lists.gnu.org/r/bug-bison/2022-07/msg00007.html

src/counterexample.c (unifying_example): Prefer "searching for" to
"finding", which is somewhat confusing.
2022-09-10 14:53:39 +02:00
Akim Demaille 374cf8bbaf doc: fix the description of the syntax of %token and %left
Reported by Frank Heckenbach.
https://lists.gnu.org/r/bug-bison/2022-07/msg00007.html

* doc/bison.texi (Symbol Decls): here.
2022-09-10 14:48:24 +02:00
Akim Demaille dd6ca19927 reader: reject rules on YYEOF
We crashed when rules were given on YYEOF.
Reported by Han Zheng.
Fixes https://github.com/akimd/bison/issues/92.

* src/reader.c (check_and_convert_grammar): Make sure YYEOF is not
an nterm.
* tests/input.at (Rule for YYEOF): New.
2022-09-10 14:09:02 +02:00
Akim Demaille 3661ebbb2c gnulib: update 2022-09-10 09:14:10 +02:00
Akim Demaille 6376364120 muscles: fix handling of the "@'" escape
When we use `b4_` or `m4_` somewhere in the input, it is escaped as
`b4@'_`/`m4@'_` so that the warning about unexpanded b4_foo/m4_foo
macros does not fire.

But in the case of muscles, the `@'` escape was not recognized, and an
assertion was triggered.

Reported by Han Zheng.
<https://github.com/akimd/bison/issues/91>

* src/muscle-tab.c (COMMON_DECODE): Handle `@'`.
* tests/skeletons.at (Suspicious sequences): Check that case.
2022-09-04 08:51:53 +02:00
Anthony HeadingandAkim Demaille eb83487606 c++: enable C++11 assignment operators for lalr1.cc
<https://github.com/akimd/bison/pull/85>
<https://lists.gnu.org/r/bug-bison/2022-04/msg00000.html>

* data/skeletons/c++.m4: Enable C++11 assignment operators for
all C++ skeletons.
2022-09-03 09:37:07 +02:00
Akim Demaille ec9c5556d9 tests: ignore messages from the JVM
Reported by Giorgos Pap.
<https://lists.gnu.org/r/bug-bison/2022-08/msg00002.html>

* examples/test: Discard "Picked up _JAVA_OPTIONS:" messages.
2022-09-03 09:13:48 +02:00
Akim Demaille cfef21f5b0 diagnostics: Windows compatibility issues
Suggested by Bruno Haible
<https://lists.gnu.org/r/bug-bison/2022-08/msg00006.html>
following a report from Andrei Malashkin
<https://lists.gnu.org/r/bug-bison/2022-08/msg00003.html>

* src/location.c (caret_set_file): Read the file in binary.
We already deal with CRLF in caret_getc_internal.
2022-09-03 08:58:49 +02:00
Akim Demaille 5555f4d051 regen 2022-08-02 09:07:31 +02:00
Akim Demaille a166d5450e yacc.c, lalr1.cc: fix warnings about yynerrs
Most often yynerrs is not used.  Clang 15 now complains about such
variables.  Bison itself does not compile:

```
src/parse-gram.c:1797:9: error: variable 'gram_nerrs' set but not used [-Werror,-Wunused-but-set-variable]
    int yynerrs = 0;
        ^
src/parse-gram.c:79:25: note: expanded from macro 'yynerrs'
                        ^
1 error generated.
```

Reported by Nikita Popov.
Fixes https://github.com/akimd/bison/issues/89.

* data/skeletons/yacc.c (yynerrs): Flag with YY_ATTRIBUTE_UNUSED.
* data/skeletons/lalr1.cc (yynerrs_): Likewise.
2022-08-02 09:07:31 +02:00
Akim Demaille b7bdf78c18 glr2.cc: fix -Wnoexcept issues
440-453 and 685 failed with GCC 12.1:

```
test.cc:1814:21:   required from here
/opt/local/include/gcc12/c++/bits/stl_construct.h:95:14: error: noexcept-expression evaluates to 'false' because of a call to '{anonymous}::glr_stack_item::glr_stack_item(bool)' [-Werror=noexcept]
   95 |     noexcept(noexcept(::new((void*)0) _Tp(std::declval<_Args>()...)))
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.cc:1486:5: note: but '{anonymous}::glr_stack_item::glr_stack_item(bool)' does not throw; perhaps it should be declared 'noexcept'
 1486 |     glr_stack_item (bool state = true)
      |     ^~~~~~~~~~~~~~
```

Reported by Paul Eggert.
<https://lists.gnu.org/r/bison-patches/2022-07/msg00008.html>

* data/skeletons/glr2.cc (glr_state, glr_stack_item): Declare the
default ctors noexcept.
2022-08-01 08:02:20 +02:00
Akim Demaille 722070124e lalr1.cc: declare stack_symbol_type as noexcept
Many C++ tests (400-25, 440-53, 664-5, 667-76, 679-80, 682-3, 685-9,
692) failed with GCC 12.1:

```
test.cc:843:28:   required from here
/opt/local/include/gcc12/c++/bits/stl_construct.h:95:14: error: noexcept-expression evaluates to 'false' because of a call to 'yy::parser::stack_symbol_type::stack_symbol_type()' [-Werror=noexcept]
   95 |     noexcept(noexcept(::new((void*)0) _Tp(std::declval<_Args>()...)))
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.cc:990:3: note: but 'yy::parser::stack_symbol_type::stack_symbol_type()' does not throw; perhaps it should be declared 'noexcept'
  990 |   parser::stack_symbol_type::stack_symbol_type ()
      |   ^~~~~~
```

Reported by Paul Eggert.
<https://lists.gnu.org/r/bison-patches/2022-07/msg00008.html>

* data/skeletons/lalr1.cc (stack_symbol_type::stack_symbol_type()):
Declare noexcept.
2022-08-01 07:08:52 +02:00
Paul Eggert 657dbff05c maint: update .gitignore for Gnulib 2022-07-31 13:28:52 -07:00
Paul Eggert 6d58f297cc maint: don’t use \] in BREs and EREs
* .travis.yml (jobs):
* doc/local.mk ($(top_srcdir)/%D%/bison.help):
* tests/regression.at (Web2c Actions, Useless Tokens):
* tests/scanner.at (Token numbers: $1):
Use plain ], not \], in a POSIX regular expression,
as POSIX says the interpretation of \] is undefined.
2022-07-31 13:28:52 -07:00
Paul Eggert d95df5028d maint: improve Gnulib checking
* configure.ac: With --enable-gcc-warnings, #define lint,
_FORTIFY_SOURCE, and GNULIB_PORT_CHECK, to better check Gnulib.
2022-07-31 12:00:28 -07:00
Paul Eggert 4e89da6e5d maint: don’t get fdl.texi from Gnulib
This reverses the 2012-01-13T09:39:[email protected] patch,
as Gnulib’s fdl.texi module now says “Don't use this module!”
* bootstrap.conf (gnulib_modules): Remove fdl.
* doc/.gitignore: Don’t ignore fdl.texi.
* doc/fdl.texi: New file, copied from Gnulib.
2022-07-31 12:00:28 -07:00
Paul Eggert aa58acb76e gnulib: update 2022-07-31 12:00:28 -07:00
Akim Demaille db8c1bbbfd style: enforce GNU-style variable names
* examples/c/glr/c++-types.y, tests/cxx-type.at (lineNum, colNum):
Rename as...
(line_num, col_num): these.
2022-07-31 12:58:16 +02:00
Akim Demaille cf686be382 tests: avoid useless variables
Reported by clang's -Wunused-but-set-variable warning.

* configure.ac (warn_common): Add -Wunused-but-set-variable.
* tests/cxx-type.at: Don't emit location track code when we don't use
locations.
2022-07-31 12:56:59 +02:00
Akim Demaille c70b68c60d gnulib: update
We now build cleanly even if libtextstyle is not available.
See https://lists.gnu.org/r/bug-bison/2022-07/msg00002.html.
2022-07-31 11:14:42 +02:00
Akim Demaille 78b767d3eb gnulib: update
There are now new files to track.  See
<https://lists.gnu.org/r/bug-gnulib/2022-07/msg00053.html>.
2022-07-31 10:52:47 +02:00
Akim Demaille cb679b2a09 address unused variables
Reported by recent versions of clang.

* src/counterexample.c (search_state_prepend): Use complexity_cost.
* src/print.c: Remove useless variable.
2022-07-31 09:35:05 +02:00
Akim Demaille 6ee1494d6e doc: explain why location's "column" are defined vaguely
Suuggested by Frank Heckenbach.
<https://lists.gnu.org/r/bug-bison/2022-01/msg00000.html>

* doc/bison.texi (Location Type): Explain why location's "column" are
defined vaguely.
Show tab handling in ltcalc and calc++.
* examples/c/bistromathic/parse.y: Show tab handling.
* examples/c++/calc++/calc++.test,
* examples/c/bistromathic/bistromathic.test:
Check tab handling.
2022-06-15 07:55:13 +02:00
Akim Demaille a475c4d5c1 gnulib: update 2022-06-15 07:55:11 +02:00
Akim Demaille 1183d5ebfe gnulib: update 2022-01-23 18:43:16 +01:00
Paul Eggert 8b96c82b05 doc: improve calling-convention doc
* doc/bison.texi (Calling Convention, Error Reporting Function):
Suggest ‘%code provides’ to declare yylex and yyerror.
Prompted by this email thread:
https://lists.gnu.org/r/bug-bison/2022-01/msg00002.html
2022-01-15 11:16:30 -08:00
Paul Eggert 07e18e7fb4 package: bump copyrights to 2022
Run "make update-copyright".
2022-01-15 11:16:30 -08:00
Bruno HaibleandAkim Demaille 013d598219 gnulib: make use of gnulib-tool's --automake-subdir option
Starting this week, Gnulib supports generating a "non-recursive" Automake
Makefile.am snippet https://lists.gnu.org/r/bug-gnulib/2021-12/msg00085.html.

* bootstrap.conf: Use gnulib-tool's --automake-subdir.
2021-12-19 17:11:30 +01:00
Akim Demaille 83a8f8b707 gnulib: update
To get native non-recursive make support.
2021-12-19 16:49:45 +01:00
Akim Demaille f8e8f57e9f doc: add indexes
* doc/bison.texi (Special Tokens): here.
2021-12-19 16:41:05 +01:00
Akim Demaille 6571c2d1b1 warnings: don't complain about m4_foo and b4_foo when from the user
Currently, occurrences of these identifiers in the user's input yield
spurious warnings.

To tell the difference between a legitimate m4_foo from the user, and
a bad m4_foo coming from a non-evaluated macro of a skeleton, escape
the user's identifiers as m4@'_foo.  We already use @' as a special
sequence to be stripped from the skeleton's output.

See <https://lists.gnu.org/r/bug-bison/2021-10/msg00026.html> and
previous commit ("warnings: be less picky about occurrences of m4_/b4_
in the output").

* src/flex-scanner.h (OBSTACK_SGROW): New.
* src/output.c (output_escaped): Escape m4_ and b4_.
* src/scan-code.l: Likewise.
* src/system.h (obstack_escape): Likewise.
And rewrite as a function.
* tests/skeletons.at (Suspicious sequences): Make sure the user can
use m4_foo/b4_foo without spurious warnings.
2021-11-07 09:52:05 +01:00
Akim Demaille c95d0dd5f5 warnings: be less picky about occurrences of m4_/b4_ in the output
Reported by Marko Mäkelä.
<https://lists.gnu.org/r/bug-bison/2021-10/msg00026.html>

* src/scan-skel.l: It is ok to have foob4_ or foom4_.
* tests/skeletons.at (Suspicious sequences): New.
2021-11-06 19:30:06 +01:00
Akim Demaille 76301e7399 gnulib: update 2021-11-06 09:11:29 +01:00
Akim Demaille c83425ef4e tests: address portability issues about strdup
Reported by Dennis Clarke
<https://lists.gnu.org/r/bug-bison/2021-10/msg00005.html>.
In particular
<https://lists.gnu.org/r/bug-bison/2021-10/msg00023.html>.

* doc/bison.texi, examples/c/glr/c++-types.y,
* examples/c/bistromathic/parse.y tests/testsuite.h:
Define _XOPEN_SOURCE to 600, to get a strdup that works on Solaris.

* tests/glr-regression.at: Use strdup freely.
2021-11-06 09:00:58 +01:00
Akim Demaille c9b5b46d74 tests: fix coding style
* tests/cxx-type.at, tests/glr-regression.at:
Prefer strdup to malloc+strcpy.
Use snake_case.
2021-11-06 08:29:59 +01:00
Akim Demaille 7558cbf373 examples: fix coding style
* examples/c/glr/c++-types.y: Use snake_case identifiers.
Prefer strdup to malloc+strcpy.
2021-11-06 08:29:59 +01:00
Akim Demaille 6e6950fbbc build: check -Wsubobject-linkage in C++
* configure.ac (warn_cxx): here.
2021-10-11 07:14:57 +02:00
Akim Demaille 4fe5a375fa tests: make it easier to spot failures
* examples/c/glr/c++-types.test: Split in several small test cases.
2021-10-09 10:39:22 +02:00
Akim Demaille 7c90a28f17 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2021-09-25 11:11:06 +02:00
287 changed files with 3689 additions and 1892 deletions
+11 -4
View File
@@ -1,10 +1,19 @@
*.a
*.bak
*.diff
*.exe
*.log
*.o
*.orig
*.out
*.output
*.pdf
*.rej
*.stamp
*.tmp
*.trs
*~
.deps
.deps/
.dirstamp
/*.cache
/*.flc
@@ -20,11 +29,9 @@
/Makefile.in
/README-release
/_*
/a.exe
/a.out
/aclocal.m4
/b.out
/bison-*
/build-aux/move-if-change
/conf[0-9]*
/confdefs*
/config.log
+1 -1
View File
@@ -1 +1 @@
3.8.1
3.8.2
+1 -1
View File
@@ -45,7 +45,7 @@ jobs:
- git submodule update --init --recursive
# As of 2021-08, we don't have Autoconf 2.71 on Ubuntu.
- sed -i 's/AC_PREREQ(\[2\.71\])/AC_PREREQ([2.69])/g' configure.ac
- sed -i 's/AC_PREREQ(\[2\.71])/AC_PREREQ([2.69])/g' configure.ac
- ./bootstrap
- ./configure --enable-gcc-warnings || { cat config.log && false; }
- make -j2
+2 -1
View File
@@ -24,7 +24,8 @@ and nasty bugs.
-----
Copyright (C) 1998-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 1998-2015, 2018-2022, 2025-2026 Free Software Foundation,
Inc.
This file is part of Bison, the GNU Compiler Compiler.
+2 -2
View File
@@ -26732,8 +26732,8 @@
-----
Copyright (C) 1987-1988, 1991-2015, 2018-2021 Free Software
Foundation, Inc.
Copyright (C) 1987-1988, 1991-2015, 2018-2022, 2025-2026 Free
Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice and this
+2 -1
View File
@@ -1,6 +1,7 @@
## Process this file with automake to produce Makefile.in.
# Copyright (C) 2001-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2001-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+24 -1
View File
@@ -1,5 +1,27 @@
GNU Bison NEWS
* Noteworthy changes in release ?.? (????-??-??) [?]
The `cex.timeout` %define variable allows to control when we give up
finding a unifying counterexample. For instance `bison -Wcex
-Dcex.timeout=.5 gram.y` to limit to 1/2s.
The C++ skeletons now expose copy and move operators for symbols.
The default (C) skeleton now supports user-defined semantic and location
types that are trivially copyable in C++.
Fixed portability issues of the test suite on Solaris.
Fixed spurious warnings about input containing `m4_` or `b4_`.
Fixed assertion violations found by fuzzing.
Fixed issues with the D skeleton.
Fixed new compiler warnings in the generated parsers (yacc.c, lalr1.cc,
glr2.cc).
* Noteworthy changes in release 3.8.2 (2021-09-25) [stable]
Fixed portability issues of bison on Cygwin.
@@ -4729,7 +4751,8 @@ mode: outline
fill-column: 76
End:
Copyright (C) 1995-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 1995-2015, 2018-2022, 2025-2026 Free Software Foundation,
Inc.
This file is part of Bison, the GNU Parser Generator.
+2 -2
View File
@@ -36,8 +36,8 @@ to the bison package.
-----
Copyright (C) 2002, 2005, 2009-2015, 2018-2021 Free Software Foundation,
Inc.
Copyright (C) 2002, 2005, 2009-2015, 2018-2022, 2025-2026 Free Software
Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+2 -2
View File
@@ -120,8 +120,8 @@ fill-column: 76
ispell-dictionary: "american"
End:
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2021 Free
Software Foundation, Inc.
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2015, 2018-2022,
2025-2026 Free Software Foundation, Inc.
This file is part of GNU bison, the GNU Compiler Compiler.
+2 -2
View File
@@ -12,8 +12,8 @@ the problems you encounter.
-----
Copyright (C) 2002, 2004, 2009-2015, 2018-2021 Free Software Foundation,
Inc.
Copyright (C) 2002, 2004, 2009-2015, 2018-2022, 2025-2026 Free Software
Foundation, Inc.
This file is part of GNU Bison.
+2 -2
View File
@@ -638,8 +638,8 @@ bootstrapped.
<!--
Copyright (C) 2002-2005, 2007-2015, 2018-2021 Free Software Foundation,
Inc.
Copyright (C) 2002-2005, 2007-2015, 2018-2022, 2025-2026 Free Software
Foundation, Inc.
This file is part of GNU Bison.
+9 -3
View File
@@ -14,6 +14,7 @@ Alexandre Duret-Lutz [email protected]
Andre da Costa Barros [email protected]
Andreas Damm [email protected]
Andreas Schwab [email protected]
Andrei Malashkin [email protected]
Andrew Suffield [email protected]
Angelo Borsotti [email protected]
Anthony Heading [email protected]
@@ -46,8 +47,8 @@ Csaba Raduly [email protected]
Dagobert Michelsen [email protected]
Daniel Frużyński [email protected]
Daniel Galloway [email protected]
Daniela Becker [email protected]
Daniel Hagerty [email protected]
Daniela Becker [email protected]
David Barto [email protected]
David J. MacKenzie [email protected]
David Kastrup [email protected]
@@ -81,6 +82,7 @@ Gavin Smith [email protected]
Georg Sauthoff [email protected]
George Neuner [email protected]
Gilles Espinasse [email protected]
Giorgos Pap [email protected]
Goran Uddeborg [email protected]
Guido Trentalancia [email protected]
H. Merijn Brand [email protected]
@@ -117,6 +119,7 @@ Marc Autret [email protected]
Marc Mendiola [email protected]
Marc Schönefeld [email protected]
Mark Boyall [email protected]
Marko Mäkelä [email protected]
Martin Blais [email protected]
Martin Jacobs [email protected]
Martin Mokrejs [email protected]
@@ -128,6 +131,7 @@ Michael Catanzaro [email protected]
Michael Felt [email protected]
Michael Hayes [email protected]
Michael Raskin [email protected]
Michał Majchrowicz [email protected]
Michel d'Hooge [email protected]
Michiel De Wilde [email protected]
Mickael Labau [email protected]
@@ -142,6 +146,7 @@ Nick Bowler [email protected]
Nicolas Bedon [email protected]
Nicolas Burrus [email protected]
Nicolas Tisserand [email protected]
Nikita Popov [email protected]
Nikki Valen [email protected]
Noah Friedman [email protected]
Odd Arild Olsen [email protected]
@@ -169,7 +174,6 @@ Quoc Peyrot [email protected]
R Blake [email protected]
Raja R Harinath [email protected]
Ralf Wildenhues [email protected]
Ryan [email protected]
Rich Wilson [email protected]
Richard Stallman [email protected]
Rici Lake [email protected]
@@ -178,6 +182,7 @@ Rob Vermaas [email protected]
Robert Anisko [email protected]
Robert Yang [email protected]
Roland Levillain [email protected]
Ryan [email protected]
Satya Kiran Popuri [email protected]
Sebastian Setzer [email protected]
Sebastien Fricker [email protected]
@@ -238,7 +243,8 @@ End:
-----
Copyright (C) 2000-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 2000-2015, 2018-2022, 2025-2026 Free Software Foundation,
Inc.
This file is part of Bison, the GNU Parser Generator.
+6 -2
View File
@@ -1,4 +1,8 @@
* Soon
** yyerror_range in GLR
It seems useless that it is based on glr_stack_item, it should be doable
with location only.
** scan-code
The default case is scanning char-per-char.
@@ -710,8 +714,8 @@ fill-column: 76
ispell-dictionary: "american"
End:
Copyright (C) 2001-2004, 2006, 2008-2015, 2018-2021 Free Software
Foundation, Inc.
Copyright (C) 2001-2004, 2006, 2008-2015, 2018-2022, 2025-2026 Free
Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
Executable
+39
View File
@@ -0,0 +1,39 @@
#!/bin/sh
# Convenience script for regenerating all autogeneratable files that are
# omitted from the version control repository. In particular, this script
# also regenerates all aclocal.m4, config.h.in, Makefile.in, configure files
# with new versions of autoconf or automake.
# Copyright (C) 2003-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Originally written by Paul Eggert. The canonical version of this
# script is maintained as top/autogen.sh in gnulib. However, to be
# useful to your package, you should place a copy of it under version
# control in the top-level directory of your package. The intent is
# that all customization can be done with a bootstrap.conf file also
# maintained in your version control; gnulib comes with a template
# build-aux/bootstrap.conf to get you started.
#
# Alternatively, you can use an autogen.sh script that is specific
# to your package.
me="$0"
medir=`dirname "$me"`
# Read the function library and the configuration.
. "$medir"/bootstrap-funclib.sh
autogen "$@"
Executable
+37
View File
@@ -0,0 +1,37 @@
#!/bin/sh
# Convenience script for fetching auxiliary files that are omitted from
# the version control repository of this package.
# Copyright (C) 2003-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Originally written by Paul Eggert. The canonical version of this
# script is maintained as top/autopull.sh in gnulib. However, to be
# useful to your package, you should place a copy of it under version
# control in the top-level directory of your package. The intent is
# that all customization can be done with a bootstrap.conf file also
# maintained in your version control; gnulib comes with a template
# build-aux/bootstrap.conf to get you started.
#
# Alternatively, you can use an autopull.sh script that is specific
# to your package.
me="$0"
medir=`dirname "$me"`
# Read the function library and the configuration.
. "$medir"/bootstrap-funclib.sh
autopull "$@"
+140 -996
View File
File diff suppressed because it is too large Load Diff
+1383
View File
File diff suppressed because it is too large Load Diff
+20 -9
View File
@@ -1,6 +1,7 @@
# Bootstrap configuration.
# Copyright (C) 2006-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2006-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,11 +20,11 @@
gnulib_modules='
argmatch array-list assert assure attribute
bitsetv
calloc-posix close closeout config-h c-strcase
calloc-posix close closeout config-h c-strcase c-strtod
configmake
dirname
error execute extensions
fdl fopen-safer fstrcmp
fopen-safer fstrcmp
getopt-gnu
gettext-h git-version-gen gitlog-to-changelog
gpl-3.0 intprops inttypes isnan javacomp-script
@@ -33,8 +34,8 @@ gnulib_modules='
libtextstyle-optional
linked-list
malloc-gnu
mcel-prefer
mbfile mbswidth
non-recursive-gnulib-prefix-hack
obstack
obstack-printf
perror progname
@@ -45,7 +46,7 @@ gnulib_modules='
realloc-posix
relocatable-prog relocatable-script
rename
spawn-pipe stdbool stpcpy stpncpy strdup-posix strerror strtod strverscmp
spawn-pipe stdbool stpcpy stpncpy strdup-posix strerror strverscmp
sys_ioctl
termios
timevar
@@ -80,13 +81,23 @@ XGETTEXT_OPTIONS_RUNTIME=$XGETTEXT_OPTIONS'\\\
--keyword=YY_ \\\
'
gnulib_tool_option_extras='--symlink --conditional-dependencies --makefile-name=gnulib.mk --po-base=gnulib-po --po-domain=bison'
gnulib_tool_option_extras="\
--automake-subdir\
--automake-subdir-tests\
--avoid=mbiterf\
--conditional-dependencies\
--makefile-name=gnulib.mk\
--po-base=gnulib-po\
--po-domain=bison\
--symlink\
"
gnulib_extra_files="$gnulib_extra_files build-aux/move-if-change"
gnulib_extra_files="$gnulib_extra_files build-aux/epsf.tex"
bootstrap_post_import_hook()
{
# Massage lib/gnulib.mk before using it later in the bootstrapping process.
build-aux/prefix-gnulib-mk --lib-name="$gnulib_name" "lib/$gnulib_mk"
# Ensure that ChangeLog exists, for automake.
test -f ChangeLog || touch ChangeLog
}
+1 -2
View File
@@ -3,10 +3,10 @@
/config.guess
/config.libpath
/config.rpath
/config.rpath~
/config.sub
/depcomp
/do-release-commit-and-tag
/epsf.tex
/gendocs.sh
/git-version-gen
/gitlog-to-changelog
@@ -19,7 +19,6 @@
/libtool-reloc
/mdate-sh
/missing
/prefix-gnulib-mk
/reloc-ldflags
/relocatable.sh.in
/test-driver
+2 -1
View File
@@ -1,4 +1,5 @@
# Copyright (C) 2012-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2012-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+2 -1
View File
@@ -1,4 +1,5 @@
# Copyright (C) 2012-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2012-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# Generate a release announcement message.
# Copyright (C) 2007-2021 Free Software Foundation, Inc.
# Copyright (C) 2007-2022, 2025-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+3 -1
View File
@@ -1,4 +1,5 @@
## Copyright (C) 2000-2015, 2018-2021 Free Software Foundation, Inc.
## Copyright (C) 2000-2015, 2018-2022, 2025-2026 Free Software
## Foundation, Inc.
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -17,6 +18,7 @@ EXTRA_DIST += \
build-aux/Darwin.valgrind \
build-aux/Linux.valgrind \
build-aux/cross-options.pl \
build-aux/epsf.tex \
build-aux/move-if-change \
build-aux/prev-version.txt \
build-aux/update-b4-copyright
-1
View File
@@ -1 +0,0 @@
../gnulib/build-aux/move-if-change
+2 -1
View File
@@ -3,7 +3,8 @@
# Update b4_copyright invocations or b4_copyright_years definitions to
# include the current year.
# Copyright (C) 2009-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2009-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+2 -1
View File
@@ -2,7 +2,8 @@
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
# Copyright (C) 2010-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2010-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# Update expectations in an Autotest test suite.
# Copyright (C) 2019-2021 Free Software Foundation, Inc.
# Copyright (C) 2019-2022, 2025-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+2 -1
View File
@@ -1,5 +1,6 @@
## Customize maint.mk -*- makefile -*-
## Copyright (C) 2008-2015, 2018-2021 Free Software Foundation, Inc.
## Copyright (C) 2008-2015, 2018-2022, 2025-2026 Free Software
## Foundation, Inc.
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
+19 -6
View File
@@ -1,6 +1,7 @@
# Configure template for GNU Bison. -*-Autoconf-*-
#
# Copyright (C) 2001-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2001-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,7 +25,7 @@ AC_INIT([GNU Bison],
[[email protected]],
[],
[https://www.gnu.org/software/bison/])
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2021])
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2026])
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
[The copyright year for this package])
@@ -55,9 +56,6 @@ AC_PROG_CXX
# Gnulib (early checks).
gl_EARLY
# We want ostream_printf and hyperlink support.
gl_LIBTEXTSTYLE_OPTIONAL([0.20.5])
# Gnulib uses '#pragma GCC diagnostic push' to silence some
# warnings, but older gcc doesn't support this.
AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
@@ -132,12 +130,14 @@ if test "$enable_gcc_warnings" = yes; then
-Wformat -Wimplicit-fallthrough -Wmismatched-dealloc -Wnull-dereference
-Wno-sign-compare -Wno-tautological-constant-out-of-range-compare
-Wpointer-arith -Wshadow -Wstrict-aliasing
-Wunused-but-set-variable
-Wwrite-strings
-wr188 -wr2259 -wr3179'
warn_c='-Wbad-function-cast
-Wmissing-prototypes
-Wstrict-prototypes'
warn_cxx='-Wextra-semi -Wnoexcept -Wold-style-cast -Wundefined-func-template
warn_cxx='-Wextra-semi -Wnoexcept -Wsubobject-linkage
-Wold-style-cast -Wundefined-func-template
-Wweak-vtables'
# Warnings for the test suite only.
#
@@ -227,6 +227,16 @@ if test "$enable_gcc_warnings" = yes; then
gl_WARN_ADD([-Wno-deprecated], [WNO_DEPRECATED_CXXFLAGS])
CXXFLAGS=$save_CXXFLAGS
AC_LANG_POP([C++])
AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
AH_VERBATIM([FORTIFY_SOURCE],
[/* Enable compile-time and run-time bounds-checking, and some warnings,
without upsetting glibc 2.15+. */
#if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
# define _FORTIFY_SOURCE 2
#endif
])
AC_DEFINE([GNULIB_PORTCHECK], [1], [Enable some gnulib portability checks.])
fi
@@ -284,6 +294,9 @@ AC_C_INLINE
# gl_EARLY avoids some redundant checks.
gl_INIT
# We want ostream_printf and hyperlink support.
gl_LIBTEXTSTYLE_OPTIONAL([0.20.5])
# Checks for library functions.
AC_CHECK_FUNCS_ONCE([setlocale])
+2 -1
View File
@@ -207,7 +207,8 @@ fill-column: 76
ispell-dictionary: "american"
End:
Copyright (C) 2002, 2008-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 2002, 2008-2015, 2018-2022, 2025-2026 Free Software
Foundation, Inc.
This file is part of GNU Bison.
+1 -1
View File
@@ -1,5 +1,5 @@
/* Default styling rules for Bison when doing terminal output.
Copyright (C) 2019-2021 Free Software Foundation, Inc.
Copyright (C) 2019-2022, 2025-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+2 -2
View File
@@ -1,5 +1,5 @@
## Copyright (C) 2002, 2005-2015, 2018-2021 Free Software Foundation,
## Inc.
## Copyright (C) 2002, 2005-2015, 2018-2022, 2025-2026 Free Software
## Foundation, Inc.
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
+2 -2
View File
@@ -2,8 +2,8 @@
# Language-independent M4 Macros for Bison.
# Copyright (C) 2002, 2004-2015, 2018-2021 Free Software Foundation,
# Inc.
# Copyright (C) 2002, 2004-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# C++ skeleton dispatching for Bison.
# Copyright (C) 2006-2007, 2009-2015, 2018-2021 Free Software
# Copyright (C) 2006-2007, 2009-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
+7 -7
View File
@@ -2,7 +2,7 @@
# C++ skeleton for Bison
# Copyright (C) 2002-2021 Free Software Foundation, Inc.
# Copyright (C) 2002-2022, 2025-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -346,7 +346,7 @@ m4_define([b4_symbol_type_define],
clear ();
}
]b4_glr2_cc_if([[
#if 201103L <= YY_CPLUSPLUS
/// Copy assignment.
basic_symbol& operator= (const basic_symbol& that)
{
@@ -368,7 +368,7 @@ m4_define([b4_symbol_type_define],
location = std::move (that.location);]])[
return *this;
}
]])[
#endif
/// Destroy contents, and record that is empty.
void clear () YY_NOEXCEPT
@@ -454,13 +454,13 @@ m4_define([b4_symbol_type_define],
/// Constructor from (external) token numbers.
by_kind (kind_type t) YY_NOEXCEPT;
]b4_glr2_cc_if([[
#if 201103L <= YY_CPLUSPLUS
/// Copy assignment.
by_kind& operator= (const by_kind& that);
/// Move assignment.
by_kind& operator= (by_kind&& that);
]])[
#endif
/// Record that this symbol is empty.
void clear () YY_NOEXCEPT;
@@ -584,7 +584,7 @@ m4_define([b4_public_types_define],
: kind_ (yytranslate_ (t))
{}
]b4_glr2_cc_if([[
#if 201103L <= YY_CPLUSPLUS
]b4_inline([$1])]b4_parser_class[::by_kind&
b4_parser_class[::by_kind::by_kind::operator= (const by_kind& that)
{
@@ -599,7 +599,7 @@ m4_define([b4_public_types_define],
that.clear ();
return *this;
}
]])[
#endif
]b4_inline([$1])[void
]b4_parser_class[::by_kind::clear () YY_NOEXCEPT
+2 -1
View File
@@ -2,7 +2,8 @@
# Common code for C-like languages (C, C++, Java, etc.)
# Copyright (C) 2012-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2012-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# C skeleton dispatching for Bison.
# Copyright (C) 2006-2007, 2009-2015, 2018-2021 Free Software
# Copyright (C) 2006-2007, 2009-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
+2 -2
View File
@@ -2,8 +2,8 @@
# C M4 Macros for Bison.
# Copyright (C) 2002, 2004-2015, 2018-2021 Free Software Foundation,
# Inc.
# Copyright (C) 2002, 2004-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -2,7 +2,7 @@
# D skeleton dispatching for Bison.
# Copyright (C) 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+3 -4
View File
@@ -2,7 +2,7 @@
# D language support for Bison
# Copyright (C) 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -284,8 +284,7 @@ m4_define([b4_declare_symbol_enum],
that double-quoting is unnecessary unless the string contains an
apostrophe, a comma, or backslash (other than backslash-backslash).
YYSTR is taken from yytname. */
final void toString(W)(W sink) const
if (isOutputRange!(W, char))
final void toString(void delegate(const(char)[]) sink) const
{
immutable string[] yy_sname = @{
]b4_symbol_names[
@@ -296,7 +295,7 @@ m4_define([b4_declare_symbol_enum],
]b4_translatable[
@};]])[
put(sink, yy_sname[yycode_]);
sink.formattedWrite!"%s"(yy_sname[yycode_]);
}
}
]])
+8 -3
View File
@@ -2,7 +2,8 @@
# GLR skeleton for Bison
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2002-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -199,7 +200,7 @@ b4_glr_cc_if([],
[b4_header_if(
[b4_output_begin([b4_spec_header_file])
b4_copyright([Skeleton interface for Bison GLR parsers in C],
[2002-2015, 2018-2021])[
[2002-2015, 2018-2022, 2025-2026])[
]b4_cpp_guard_open([b4_spec_mapped_header_file])[
]b4_shared_declarations[
]b4_cpp_guard_close([b4_spec_mapped_header_file])[
@@ -213,7 +214,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C],
b4_output_begin([b4_parser_file_name])
b4_copyright([Skeleton implementation for Bison GLR parsers in C],
[2002-2015, 2018-2021])[
[2002-2015, 2018-2022, 2025-2026])[
/* C GLR parser skeleton written by Paul Hilfinger. */
]b4_disclaimer[
@@ -306,6 +307,10 @@ static YYLTYPE yyloc_default][]b4_yyloc_default;])[
# include <setjmp.h>
# define YYJMP_BUF jmp_buf
# define YYSETJMP(Env) setjmp (Env)
/* Pacify GCC <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21161>. */
#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
# pragma GCC diagnostic ignored "-Wclobbered"
#endif
/* Pacify Clang and ICC. */
# define YYLONGJMP(Env, Val) \
do { \
+3 -2
View File
@@ -1,6 +1,7 @@
# C++ GLR skeleton for Bison
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2002-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -381,7 +382,7 @@ b4_percent_code_get([[requires]])[
]b4_header_if(
[b4_output_begin([b4_spec_header_file])
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
[2002-2015, 2018-2021])[
[2002-2015, 2018-2022, 2025-2026])[
// C++ GLR parser skeleton written by Akim Demaille.
]b4_disclaimer[
+8 -3
View File
@@ -1,6 +1,7 @@
# C++ GLR skeleton for Bison
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2002-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -482,6 +483,10 @@ namespace
# include <setjmp.h>
# define YYJMP_BUF jmp_buf
# define YYSETJMP(Env) setjmp (Env)
/* Pacify GCC <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21161>. */
#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
# pragma GCC diagnostic ignored "-Wclobbered"
#endif
/* Pacify Clang and ICC. */
# define YYLONGJMP(Env, Val) \
do { \
@@ -818,7 +823,7 @@ namespace ]b4_namespace_ref[
class ]b4_parser_class[::glr_state
{
public:
glr_state ()
glr_state () YY_NOEXCEPT
: yyresolved (false)
, yylrState (0)
, yyposn (0)
@@ -1410,7 +1415,7 @@ namespace
class glr_stack_item
{
public:
glr_stack_item (bool state = true)
glr_stack_item (bool state = true) YY_NOEXCEPT
: is_state_ (state)]b4_parse_assert_if([[
, magic_ (MAGIC)]])[
{
+2 -2
View File
@@ -2,8 +2,8 @@
# Java skeleton dispatching for Bison.
# Copyright (C) 2007, 2009-2015, 2018-2021 Free Software Foundation,
# Inc.
# Copyright (C) 2007, 2009-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+2 -1
View File
@@ -2,7 +2,8 @@
# Java language support for Bison
# Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2007-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+8 -5
View File
@@ -1,6 +1,7 @@
# C++ skeleton for Bison
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2002-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -159,7 +160,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
m4_pushdef([b4_copyright_years],
[2002-2015, 2018-2021])
[2002-2015, 2018-2022, 2025-2026])
m4_define([b4_parser_class],
[b4_percent_define_get([[api.parser.class]])])
@@ -425,7 +426,7 @@ m4_define([b4_shared_declarations],
/// Superclass.
typedef basic_symbol<by_state> super_type;
/// Construct an empty symbol.
stack_symbol_type ();
stack_symbol_type () YY_NOEXCEPT;
/// Move or copy construction.
stack_symbol_type (YY_RVREF (stack_symbol_type) that);
/// Steal the contents from \a sym to build this.
@@ -678,7 +679,7 @@ m4_if(b4_prefix, [yy], [],
return YY_CAST (symbol_kind_type, yystos_[+state]);
}
]b4_parser_class[::stack_symbol_type::stack_symbol_type ()
]b4_parser_class[::stack_symbol_type::stack_symbol_type () YY_NOEXCEPT
{}
]b4_parser_class[::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type) that)
@@ -842,12 +843,13 @@ m4_if(b4_prefix, [yy], [],
int
]b4_parser_class[::parse ()
{
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
int yyn;
/// Length of the RHS of the rule being reduced.
int yylen = 0;
// Error handling.
int yynerrs_ = 0;
int yynerrs_ YY_ATTRIBUTE_UNUSED = 0;
int yyerrstatus_ = 0;
/// The lookahead symbol.
@@ -1178,6 +1180,7 @@ b4_dollar_popdef])[]dnl
}
return yyresult;
YY_IGNORE_MAYBE_UNINITIALIZED_END
}
#if YY_EXCEPTIONS
catch (...)
+6 -4
View File
@@ -1,6 +1,7 @@
# D skeleton for Bison -*- autoconf -*-
# Copyright (C) 2007-2012, 2019-2021 Free Software Foundation, Inc.
# Copyright (C) 2007-2012, 2019-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -61,7 +62,7 @@ b4_use_push_for_pull_if([
# or as class instance variable when doing push parsing.
b4_output_begin([b4_parser_file_name])
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in D],
[2007-2012, 2019-2021])[
[2007-2012, 2019-2022, 2025-2026])[
]b4_disclaimer[
]b4_percent_define_ifdef([package], [module b4_percent_define_get([package]);
])[
@@ -269,9 +270,10 @@ b4_user_union_members
}
}]])[
]b4_lexer_if([[ private class YYLexer implements Lexer {
]b4_lexer_if([[private class YYLexer: Lexer
{
]b4_percent_code_get([[lexer]])[
}
}
]])[
/** The object doing lexical analysis for us. */
private Lexer yylexer;
+2 -1
View File
@@ -1,6 +1,7 @@
# Java skeleton for Bison -*- java -*-
# Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2007-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+3 -2
View File
@@ -1,6 +1,7 @@
# C++ skeleton for Bison
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2002-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,7 +17,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
m4_pushdef([b4_copyright_years],
[2002-2015, 2018-2021])
[2002-2015, 2018-2022, 2025-2026])
# b4_location_file
+2 -1
View File
@@ -1,6 +1,7 @@
# C++ skeleton for Bison
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2002-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+2 -1
View File
@@ -1,6 +1,7 @@
# C++ skeleton for Bison
# Copyright (C) 2002-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2002-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+29 -10
View File
@@ -1,11 +1,11 @@
# -*- C -*-
# Yacc compatible skeleton for Bison
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software
# Foundation, Inc.
# Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2022, 2025-2026 Free
# Software Foundation, Inc.
m4_pushdef([b4_copyright_years],
[1984, 1989-1990, 2000-2015, 2018-2021])
[1984, 1989-1990, 2000-2015, 2018-2022, 2025-2026])
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -256,7 +256,7 @@ int yynerrs;]])])
m4_define([b4_declare_parser_state_variables],
[b4_pure_if([[
/* Number of syntax errors so far. */
int yynerrs]m4_ifval([$1], [ = 0])[;
int yynerrs YY_ATTRIBUTE_UNUSED]m4_ifval([$1], [ = 0])[;
]])[
yy_state_fast_t yystate]m4_ifval([$1], [ = 0])[;
/* Number of tokens to shift before error messages enabled. */
@@ -581,10 +581,27 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
# define YYCOPY_NEEDED 1]])[
#endif /* ]b4_lac_if([[1]], [b4_parse_error_case([simple], [[!defined yyoverflow]], [[1]])])[ */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
|| (]b4_locations_if([[defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL \
&& ]])[defined ]b4_api_PREFIX[STYPE_IS_TRIVIAL && ]b4_api_PREFIX[STYPE_IS_TRIVIAL)))
#ifndef yyoverflow
/* In C++, ]b4_api_PREFIX[STYPE must be trivially copyable.
If ]b4_api_PREFIX[STYPE_IS_TRIVIAL, this is already known.
Otherwise check this if easy, as in newer C++ compilers.]b4_locations_if([[
Likewise for ]b4_api_PREFIX[LTYPE.]])[ */
# if (! (]b4_locations_if([[defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL \
&& ]])[defined ]b4_api_PREFIX[STYPE_IS_TRIVIAL && ]b4_api_PREFIX[STYPE_IS_TRIVIAL) \
&& defined __cplusplus && 201103 <= __cplusplus \
&& !(defined _GLIBCXX_RELEASE \
? _GLIBCXX_RELEASE < 5 \
: defined __GLIBCXX__) \
&& defined __has_include)
# if __has_include (<type_traits>)
# include <type_traits>
]b4_locations_if(
[[static_assert (std::is_trivially_copyable<]b4_api_PREFIX[LTYPE>::value,
"Bison error: api.location.type is not trivially copyable");
]])[static_assert (std::is_trivially_copyable<]b4_api_PREFIX[STYPE>::value,
"Bison error: api.value.type is not trivially copyable");
# endif
# endif
/* A type that is properly aligned for any stack member. */
union yyalloc
@@ -1531,9 +1548,11 @@ yypull_parse (yypstate *yyps]b4_user_formals[)
YYLTYPE yylloc = yyloc_default;]])])[
int yystatus;
do {
]b4_pure_if([[ YYSTYPE yylval;
]b4_pure_if([[ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
YYSTYPE yylval;
int ]])[yychar = ]b4_yylex[;
yystatus = yypush_parse (yyps]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[);
yystatus = yypush_parse (yyps]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[);]b4_pure_if([[
YY_IGNORE_MAYBE_UNINITIALIZED_END]])[
} while (yystatus == YYPUSH_MORE);
return yystatus;
}]])[
+2 -1
View File
@@ -3,7 +3,8 @@
<!--
bison.xsl - common templates for Bison XSLT.
Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 2007-2015, 2018-2022, 2025-2026 Free Software
Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+2 -1
View File
@@ -3,7 +3,8 @@
<!--
xml2dot.xsl - transform Bison XML Report into DOT.
Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 2007-2015, 2018-2022, 2025-2026 Free Software
Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+2 -1
View File
@@ -3,7 +3,8 @@
<!--
xml2text.xsl - transform Bison XML Report into plain text.
Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 2007-2015, 2018-2022, 2025-2026 Free Software
Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+2 -1
View File
@@ -3,7 +3,8 @@
<!--
xml2html.xsl - transform Bison XML Report into XHTML.
Copyright (C) 2007-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 2007-2015, 2018-2022, 2025-2026 Free Software
Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+2 -12
View File
@@ -8,28 +8,18 @@
#/bison.cp
#/bison.cps
#/bison.toc
/*~
/.dirstamp
*.dvi
*.ps
/bison.1
/bison.dvi
/bison.help
/bison.html
/bison.info
/bison.info.bak
/bison.log
/bison.pdf
/bison.ps
/cross-options.texi
/fdl.texi
/figs/*.eps
/figs/*.svg
/gendocs_template
/gendocs_template_min
/gpl-3.0.texi
/refcard.dvi
/refcard.log
/refcard.ps
/relocatable.texi
/stamp-vti
/version.texi
+180 -49
View File
@@ -173,8 +173,8 @@
This manual (@value{UPDATED}) is for GNU Bison (version @value{VERSION}),
the GNU parser generator.
Copyright @copyright{} 1988--1993, 1995, 1998--2015, 2018--2021 Free
Software Foundation, Inc.
Copyright @copyright{} 1988--1993, 1995, 1998--2015, 2018--2022,
2025--2026 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document under
@@ -1736,8 +1736,8 @@ after @samp{//}.
@example
/* Parser for rpcalc. -*- C -*-
Copyright (C) 1988-1993, 1995, 1998-2015, 2018-2021 Free Software
Foundation, Inc.
Copyright (C) 1988--1993, 1995, 1998--2015, 2018--2021, 2025--2026
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -2365,6 +2365,8 @@ analyzer.
* Ltcalc Lexer:: The lexical analyzer.
@end menu
See @ref{Tracking Locations} for details about locations.
@node Ltcalc Declarations
@subsection Declarations for @code{ltcalc}
@@ -2488,7 +2490,7 @@ yylex (void)
@group
/* Skip white space. */
while ((c = getchar ()) == ' ' || c == '\t')
++yylloc.last_column;
yylloc.last_column += c == '\t' ? 8 - ((yylloc.last_column - 1) & 7) : 1;
@end group
@group
@@ -2627,8 +2629,8 @@ calculator.
@example
/* Parser for mfcalc. -*- C -*-
Copyright (C) 1988-1993, 1995, 1998-2015, 2018-2021 Free Software
Foundation, Inc.
Copyright (C) 1988--1993, 1995, 1998--2015, 2018--2021, 2025--2026
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -2644,6 +2646,13 @@ calculator.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
%code top {
/* Portability issues for strdup. */
#ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE 600
#endif
}
@end example
@end ignore
@@ -2756,8 +2765,8 @@ provides for either functions or variables to be placed in the table.
@example
/* Functions for mfcalc. -*- C -*-
Copyright (C) 1988-1993, 1995, 1998-2015, 2018-2021 Free Software
Foundation, Inc.
Copyright (C) 1988--1993, 1995, 1998--2015, 2018--2021, 2025--2026
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -2875,7 +2884,7 @@ found, a pointer to that symbol is returned; otherwise zero is returned.
not make these assumptions. */
#include <assert.h>
#include <stdlib.h> /* malloc, realloc. */
#include <string.h> /* strlen. */
#include <string.h> /* strdup, strlen. */
@end group
@group
@@ -4744,6 +4753,33 @@ to 1 for @code{yylloc} at the beginning of the parsing. To initialize
initialization), use the @code{%initial-action} directive. @xref{Initial
Action Decl}.
@sp 1
@cindex column
The meaning of ``column'' is deliberately left vague since there are several
options, depending on the use cases.
With multibyte input (say UTF-8), simply counting the number of bytes does
not match character positions on the screen. One needs advanced functions
mapping multibyte characters to their visual width (see for instance
Gnulib's @code{mbswidth} and @code{mbsnwidth} functions). Tabulation
characters probably need a dedicated implementation, to match the ``go to
next multiple of 8'' behavior.
However to quote input in error messages, as @command{bison} does:
@example
@group
1.10-12: @derror{error}: invalid identifier: 3.8
1 | %require @derror{3.8}
| @derror{^~~}
@end group
@end example
@noindent
then byte positions are more handy. So in some cases, tracking both visual
character position @emph{and} byte position is the best option. This is
what @command{bison} does.
@node Actions and Locations
@subsection Actions and Locations
@@ -4988,7 +5024,12 @@ exp[result]: exp[left] '/' exp[right]
@end group
@end example
@noindent
Like symbol names (@pxref{Symbols}), reference names can contain letters,
underscores, periods, and non-initial digits and dashes. In bracketed
reference names, leading and trailing blanks and comments are ignored:
@samp{[ name ]} and @samp{[/* A */ name /* for references. */]} are
equivalent to @samp{[name]}.
In order to access a semantic value generated by a midrule action, an
explicit name may also be declared by putting a bracketed name after the
closing brace of the midrule action code:
@@ -5282,15 +5323,27 @@ exclusively nonterminal symbols, use the safer @code{%nterm}:
The syntax of the various directives to declare symbols is as follows.
@example
%token @var{tag}? ( @var{id} @var{number}? @var{string}? )+ ( @var{tag} ( @var{id} @var{number}? @var{string}? )+ )*
%left @var{tag}? ( @var{id} @var{number}?)+ ( @var{tag} ( @var{id} @var{number}? )+ )*
%type @var{tag}? ( @var{id} | @var{char} | @var{string} )+ ( @var{tag} ( @var{id} | @var{char} | @var{string} )+ )*
%nterm @var{tag}? @var{id}+ ( @var{tag} @var{id}+ )*
@group
%token @var{tag}? ( (@var{id}|@var{char}) @var{number}? @var{string}? )+ \
( @var{tag} ( (@var{id}|@var{char}) @var{number}? @var{string}? )+ )*
@end group
@group
%left @var{tag}? ( (@var{id}|@var{char}|@var{string}) @var{number}? )+ \
( @var{tag} ( (@var{id}|@var{char}|@var{string}) @var{number}? )+ )*
@end group
@group
%type @var{tag}? (@var{id}|@var{char}|@var{string})+ \
( @var{tag} (@var{id}|@var{char}|@var{string})+ )*
@end group
@group
%nterm @var{tag}? @var{id}+ \
( @var{tag} @var{id}+ )*
@end group
@end example
@noindent
where @var{tag} denotes a type tag such as @samp{<ival>}, @var{id} denotes
an identifier such as @samp{NUM}, @var{number} a decimal or hexadecimal
an identifier such as @samp{NUM} or @samp{exp}, @var{number} a decimal or hexadecimal
integer such as @samp{300} or @samp{0x12d}, @var{char} a character literal
such as @samp{'+'}, and @var{string} a string literal such as
@samp{"number"}. The postfix quantifiers are @samp{?} (zero or one),
@@ -5973,6 +6026,7 @@ Introduced in Bison 3.8.
@deffn {Directive} %header @var{header-file}
Same as above, but save in the file @file{@var{header-file}}.
The @var{header-file} name should not contain slashes.
@end deffn
@deffn {Directive} %language "@var{language}"
@@ -6026,6 +6080,7 @@ file, treating it as an independent source file in its own right.
@deffn {Directive} %output "@var{file}"
Generate the parser implementation in @file{@var{file}}.
The @var{file} name should not contain slashes.
@end deffn
@deffn {Directive} %pure-parser
@@ -6841,6 +6896,23 @@ Introduced in Bison 3.0.3.
@c api.value.union.name
@c ================================================== cex.timeout
@deffn Directive {%define cex.timeout} @var{duration}
@itemize @bullet
@item Language(s): all
@item Purpose:
Define the time limit for finding unifying counterexamples.
@item Accepted Values: duration in seconds, e.g., @samp{1}, @samp{0.5}.
@item Default Value: 5
@end itemize
@end deffn
@c ================================================== lr.default-reduction
@deffn Directive {%define lr.default-reduction} @var{when}
@@ -7509,22 +7581,41 @@ numeric code for that character is also the code for the token kind. So
@code{unsigned char} to avoid sign-extension. The null character must not
be used this way, because its code is zero and that signifies end-of-input.
Here is an example showing these things:
A simple program might use the following declaration:
@example
%code provides @{
int yylex (void);
@}
@end example
@noindent
and the following definition, either in the grammar file itself or in some
other module that has @code{#include "y.tab.h"}:
@example
#include <stdio.h>
int
yylex (void)
@{
@dots{}
if (c == EOF) /* Detect end-of-input. */
return YYEOF;
@dots{}
else if (c == '+' || c == '-')
return c; /* Assume token kind for '+' is '+'. */
@dots{}
else
return INT; /* Return the kind of the token. */
@dots{}
for (;;)
@{
int c = getchar ();
if (c == EOF)
return YYEOF; /* Report end-of-input. */
if (c == '+' || c == '-')
return c; /* Assume token kind for '+' is '+'. */
if ('0' <= c && c <= '9')
@{
yylval = c - '0';
while ('0' <= (c = getchar ()) && c <= '9')
yylval = yylval * 10 + (c - '0');
ungetc (c, stdin);
return INT; /* Return the kind of the token. */
@}
@dots{}
@}
@}
@end example
@@ -7539,15 +7630,18 @@ utility can be used without change as the definition of @code{yylex}.
In addition to the user defined tokens, Bison generates a few special tokens
that @code{yylex} may return.
@findex YYEOF
The @code{YYEOF} token denotes the end of file, and signals to the parser
that there is nothing left afterwards. @xref{Calling Convention}, for an
example.
@findex YYUNDEF
Returning @code{YYUNDEF} tells the parser that some lexical error was found.
It will emit an error message about an ``invalid token'', and enter
error-recovery (@pxref{Error Recovery}). Returning an unknown token kind
results in the exact same behavior.
@findex YYerror
Returning @code{YYerror} requires the parser to enter error-recovery
@emph{without} emitting an error message. This way the lexical analyzer can
produce an accurate error messages about the invalid input (something the
@@ -7799,10 +7893,22 @@ In some cases diagnostics like @w{@code{"syntax error"}} are
translated automatically from English to some other language before
they are passed to @code{yyerror}. @xref{Internationalization}.
The following definition suffices in simple programs:
A simple program might use the following declaration:
@example
%code provides @{
void yyerror (char const *);
@}
@end example
@noindent
and the following definition, either in the grammar file itself or in some
other module that has @code{#include "y.tab.h"}:
@example
@group
#include <stdio.h>
void
yyerror (char const *s)
@{
@@ -11544,22 +11650,26 @@ Options controlling the diagnostics.
Output warnings falling in @var{category}. @var{category} can be one
of:
@table @code
@item @anchor{Wconflicts-sr}conflicts-sr
@itemx @anchor{Wconflicts-rr}conflicts-rr
@item conflicts-sr
@itemx conflicts-rr
@anchor{Wconflicts-sr}
@anchor{Wconflicts-rr}
S/R and R/R conflicts. These warnings are enabled by default. However, if
the @code{%expect} or @code{%expect-rr} directive is specified, an
unexpected number of conflicts is an error, and an expected number of
conflicts is not reported, so @option{-W} and @option{--warning} then have
no effect on the conflict report.
@item @anchor{Wcounterexamples}counterexamples
@item counterexamples
@itemx cex
@anchor{Wcounterexamples}
Provide counterexamples for conflicts. @xref{Counterexamples}.
Counterexamples take time to compute. The option @option{-Wcex} should be
used by the developer when working on the grammar; it hardly makes sense to
use it in a CI.
@item @anchor{Wdangling-alias}dangling-alias
@item dangling-alias
@anchor{Wdangling-alias}
Report string literals that are not bound to a token symbol.
String literals, which allow for better error messages, are (too) liberally
@@ -11605,16 +11715,19 @@ foo: "baz" @{@}
| @dwarning{^~~~~}
@end example
@item @anchor{Wdeprecated}deprecated
@item deprecated
@anchor{Wdeprecated}
Deprecated constructs whose support will be removed in future versions of
Bison.
@item @anchor{Wempty-rule}empty-rule
@item empty-rule
@anchor{Wempty-rule}
Empty rules without @code{%empty}. @xref{Empty Rules}. Disabled by
default, but enabled by uses of @code{%empty}, unless
@option{-Wno-empty-rule} was specified.
@item @anchor{Wmidrule-values}midrule-values
@item midrule-values
@anchor{Wmidrule-values}
Warn about midrule values that are set but not used within any of the actions
of the parent rule.
For example, warn about unused @code{$2} in:
@@ -11634,7 +11747,8 @@ These warnings are not enabled by default since they sometimes prove to
be false alarms in existing grammars employing the Yacc constructs
@code{$0} or @code{$-@var{n}} (where @var{n} is some positive integer).
@item @anchor{Wprecedence}precedence
@item precedence
@anchor{Wprecedence}
Useless precedence and associativity directives. Disabled by default.
Consider for instance the following grammar:
@@ -11695,21 +11809,24 @@ One would get the exact same parser with the following directives instead:
@end group
@end example
@item @anchor{Wyacc}yacc
@item yacc
@anchor{Wyacc}
Incompatibilities with POSIX Yacc.
@item @anchor{Wother}other
@item other
@anchor{Wother}
All warnings not categorized above. These warnings are enabled by default.
This category is provided merely for the sake of completeness. Future
releases of Bison may move warnings from this category to new, more specific
categories.
@item @anchor{Wall}all
@item all
All the warnings except @code{counterexamples}, @code{dangling-alias} and
@code{yacc}.
@item @anchor{Wnone}none
@item none
@anchor{Wnone}
Turn off all the warnings.
@item error
@@ -11720,7 +11837,8 @@ A category can be turned off by prefixing its name with @samp{no-}. For
instance, @option{-Wno-yacc} will hide the warnings about
POSIX Yacc incompatibilities.
@item @anchor{Werror}-Werror
@item -Werror
@anchor{Werror}
Turn enabled warnings for every @var{category} into errors, unless they are
explicitly disabled by @option{-Wno-error=@var{category}}.
@@ -11868,7 +11986,8 @@ This is similar to how most shells resolve commands.
Pretend that @code{%token-table} was specified. @xref{Decl Summary}.
@item -y
@itemx @anchor{option-yacc} --yacc
@itemx --yacc
@anchor{option-yacc}
Act more like the traditional @command{yacc} command:
@itemize
@item
@@ -12115,7 +12234,8 @@ generate C++.
@example
/* Simple variant-based parser. -*- C++ -*-
Copyright (C) 2018-2021 Free Software Foundation, Inc.
Copyright (C) 1988--1993, 1995, 1998--2015, 2018--2021, 2025--2026
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -13206,7 +13326,8 @@ library components, and the declaration of the parser class.
@example
/* Driver for calc++. -*- C++ -*-
Copyright (C) 2005-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 1988--1993, 1995, 1998--2015, 2018--2021, 2025--2026
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -13302,7 +13423,8 @@ The implementation of the driver (@file{driver.cc}) is straightforward.
@example
/* Driver for calc++. -*- C++ -*-
Copyright (C) 2005-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 1988--1993, 1995, 1998--2015, 2018--2021, 2025--2026
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -13369,7 +13491,8 @@ designed the grammar for.
@example
/* Parser for calc++. -*- C++ -*-
Copyright (C) 2005-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 1988--1993, 1995, 1998--2015, 2018--2021, 2025--2026
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -13581,7 +13704,8 @@ then the parser's to get the set of defined tokens.
@example
/* Scanner for calc++. -*- C++ -*-
Copyright (C) 2005-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 1988--1993, 1995, 1998--2015, 2018--2021, 2025--2026
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -13735,8 +13859,14 @@ the blanks preceding tokens. Comments would be treated equally.
@example
@group
%@{
// Take 8-space tabulations into account.
void add_columns (yy::location& loc, const char *buf, int bufsize)
@{
for (int i = 0; i < bufsize; ++i)
loc.columns (buf[i] == '\t' ? 8 - ((loc.end.column - 1) & 7) : 1);
@}
// Code run each time a pattern is matched.
# define YY_USER_ACTION loc.columns (yyleng);
#define YY_USER_ACTION add_columns (loc, yytext, yyleng);
%@}
@end group
%%
@@ -13836,7 +13966,8 @@ The top level file, @file{calc++.cc}, poses no problem.
@example
/* Main for calc++. -*- C++ -*-
Copyright (C) 2005-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 1988--1993, 1995, 1998--2015, 2018--2021, 2025--2026
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+29 -28
View File
@@ -2,48 +2,49 @@
bison \- GNU Project parser generator (yacc replacement)
[description]
.I Bison
is a parser generator in the style of
.IR yacc (1).
It should be upwardly compatible with input files designed
for
.IR yacc .
The
.B bison
parser generator inputs grammars in the style of
.BR yacc (1)
and outputs parsers for those grammers.
.PP
Input files should follow the
.I yacc
.B yacc
convention of ending in
.BR .y .
.IR .y .
Unlike
.IR yacc ,
.BR yacc ,
the generated files do not have fixed names, but instead use the prefix
of the input file.
Moreover, if you need to put
.I C++
code in the input file, you can end his name by a C++-like extension
(.ypp or .y++), then bison will follow your extension to name the
output file (.cpp or .c++).
Moreover, if you need to put C++
code in the input file, you can end its name by a C++-like extension
.RI ( .ypp
or
.IR .y++ ),
and then
.B bison
will follow your extension to name the
output file
.RI ( .cpp
or
.IR .c++ ).
For instance, a grammar description file named
.B parse.yxx
.I parse.yxx
would produce the generated parser in a file named
.BR parse.tab.cxx ,
.IR parse.tab.cxx ,
instead of
.IR yacc 's
.B y.tab.c
or old
.I Bison
version's
.BR parse.tab.c .
.BR yacc 's
.IR y.tab.c .
.PP
This description of the options that can be given to
.I bison
.B bison
is adapted from the node
.B Invocation
in the
.B bison.texi
manual, which should be taken as authoritative.
in the Bison manual, which should be taken as authoritative.
.PP
.I Bison
supports both traditional single-letter options and mnemonic long
The
.B bison
command supports both traditional single-letter options and mnemonic long
option names. Long option names are indicated with
.B \-\-
instead of
+505
View File
@@ -0,0 +1,505 @@
@c The GNU Free Documentation License.
@center Version 1.3, 3 November 2008
@c This file is intended to be included within another document,
@c hence no sectioning command or @node.
@display
Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
@uref{https://fsf.org/}
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@end display
@enumerate 0
@item
PREAMBLE
The purpose of this License is to make a manual, textbook, or other
functional and useful document @dfn{free} in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of ``copyleft'', which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
@item
APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The ``Document'', below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as ``you''. You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A ``Modified Version'' of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A ``Secondary Section'' is a named appendix or a front-matter section
of the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall
subject (or to related matters) and contains nothing that could fall
directly within that overall subject. (Thus, if the Document is in
part a textbook of mathematics, a Secondary Section may not explain
any mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The ``Invariant Sections'' are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The ``Cover Texts'' are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A ``Transparent'' copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not ``Transparent'' is called ``Opaque''.
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, La@TeX{} input
format, SGML or XML using a publicly available
DTD, and standard-conforming simple HTML,
PostScript or PDF designed for human modification. Examples
of transparent image formats include PNG, XCF and
JPG@. Opaque formats include proprietary formats that can be
read and edited only by proprietary word processors, SGML or
XML for which the DTD and/or processing tools are
not generally available, and the machine-generated HTML,
PostScript or PDF produced by some word processors for
output purposes only.
The ``Title Page'' means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, ``Title Page'' means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
The ``publisher'' means any person or entity that distributes copies
of the Document to the public.
A section ``Entitled XYZ'' means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as ``Acknowledgements'',
``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
of such a section when you modify the Document means that it remains a
section ``Entitled XYZ'' according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
@item
VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
@item
COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
@item
MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
@enumerate A
@item
Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
@item
List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
@item
State on the Title page the name of the publisher of the
Modified Version, as the publisher.
@item
Preserve all the copyright notices of the Document.
@item
Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
@item
Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
@item
Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
@item
Include an unaltered copy of this License.
@item
Preserve the section Entitled ``History'', Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled ``History'' in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
@item
Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the ``History'' section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
@item
For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
the Title of the section, and preserve in the section all the
substance and tone of each of the contributor acknowledgements and/or
dedications given therein.
@item
Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
@item
Delete any section Entitled ``Endorsements''. Such a section
may not be included in the Modified Version.
@item
Do not retitle any existing section to be Entitled ``Endorsements'' or
to conflict in title with any Invariant Section.
@item
Preserve any Warranty Disclaimers.
@end enumerate
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled ``Endorsements'', provided it contains
nothing but endorsements of your Modified Version by various
parties---for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
@item
COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled ``History''
in the various original documents, forming one section Entitled
``History''; likewise combine any sections Entitled ``Acknowledgements'',
and any sections Entitled ``Dedications''. You must delete all
sections Entitled ``Endorsements.''
@item
COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
@item
AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an ``aggregate'' if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
@item
TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled ``Acknowledgements'',
``Dedications'', or ``History'', the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
@item
TERMINATION
You may not copy, modify, sublicense, or distribute the Document
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense, or distribute it is void, and
will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, receipt of a copy of some or all of the same material does
not give you any rights to use it.
@item
FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
@uref{https://www.gnu.org/licenses/}.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License ``or any later version'' applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation. If the Document
specifies that a proxy can decide which future versions of this
License can be used, that proxy's public statement of acceptance of a
version permanently authorizes you to choose that version for the
Document.
@item
RELICENSING
``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any
World Wide Web server that publishes copyrightable works and also
provides prominent facilities for anybody to edit those works. A
public wiki that anybody can edit is an example of such a server. A
``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the
site means any set of copyrightable works thus published on the MMC
site.
``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0
license published by Creative Commons Corporation, a not-for-profit
corporation with a principal place of business in San Francisco,
California, as well as future copyleft versions of that license
published by that same organization.
``Incorporate'' means to publish or republish a Document, in whole or
in part, as part of another Document.
An MMC is ``eligible for relicensing'' if it is licensed under this
License, and if all works that were first published under this License
somewhere other than this MMC, and subsequently incorporated in whole
or in part into the MMC, (1) had no cover texts or invariant sections,
and (2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site
under CC-BY-SA on the same site at any time before August 1, 2009,
provided the MMC is eligible for relicensing.
@end enumerate
@page
@heading ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
@smallexample
@group
Copyright (C) @var{year} @var{your name}.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts. A copy of the license is included in the section entitled ``GNU
Free Documentation License''.
@end group
@end smallexample
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the ``with@dots{}Texts.''@: line with this:
@smallexample
@group
with the Invariant Sections being @var{list their titles}, with
the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
being @var{list}.
@end group
@end smallexample
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.
@c Local Variables:
@c ispell-local-pdict: "ispell-dict"
@c End:
+3 -3
View File
@@ -1,5 +1,5 @@
## Copyright (C) 2001-2003, 2005-2015, 2018-2021 Free Software
## Foundation, Inc.
## Copyright (C) 2001-2003, 2005-2015, 2018-2022, 2025-2026 Free
## Software Foundation, Inc.
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -114,7 +114,7 @@ $(top_srcdir)/%D%/bison.help: src/bison$(EXEEXT)
$(AM_V_at) LC_ALL=C tests/bison --version >%D%/bison.help.tmp
$(AM_V_at) LC_ALL=C tests/bison --help | \
## Avoid depending on the path to Bison.
sed -e 's,^Usage: .*/bison \[OPTION\],Usage: bison [OPTION],g' \
sed -e 's,^Usage: .*/bison \[OPTION],Usage: bison [OPTION],g' \
## Avoid variations in the output depending on whether we are
## on a glibc system.
-e '/translation bugs/d' >>%D%/bison.help.tmp
+2 -2
View File
@@ -19,8 +19,8 @@
\def\finalout{\overfullrule=0pt}
%\finalout
% Copyright (c) 1998, 2001, 2009--2015, 2018--2021 Free Software
% Foundation, Inc.
% Copyright (c) 1998, 2001, 2009--2015, 2018--2022, 2025--2026 Free
% Software Foundation, Inc.
%
% This file is part of Bison.
%
+4 -3
View File
@@ -5,14 +5,15 @@ yacc \- GNU Project parser generator
.B yacc
[\fIOPTION\fR]... \fIFILE\fR
.SH DESCRIPTION
.I Yacc
The program
.B yacc
(Yet Another Compiler Compiler) is a parser generator. This
version is a simple wrapper around
.IR bison (1).
.BR bison (1).
It passes option
\fB\-y\fR, \fB\-\-yacc\fR
to activate the upward compatibility mode. See
.IR bison (1)
.BR bison (1)
for more information.
.SH AUTHOR
Written by Paul Eggert.
+2 -1
View File
@@ -22,7 +22,8 @@ fill-column: 76
ispell-dictionary: "american"
End:
Copyright (C) 2006, 2009-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 2006, 2009-2015, 2018-2022, 2025-2026 Free Software
Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+2 -2
View File
@@ -1,7 +1,7 @@
#! /usr/bin/perl -w
# Copyright (C) 2006, 2008-2015, 2018-2021 Free Software Foundation,
# Inc.
# Copyright (C) 2006, 2008-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
#
# This file is part of Bison, the GNU Compiler Compiler.
#
+2 -2
View File
@@ -1,5 +1,5 @@
## Copyright (C) 2006, 2008-2015, 2018-2021 Free Software Foundation,
## Inc.
## Copyright (C) 2006, 2008-2015, 2018-2022, 2025-2026 Free Software
## Foundation, Inc.
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
+13
View File
@@ -0,0 +1,13 @@
*.c
*.cc
*.class
*.h
*.hh
!/c++/glr/ast.hh
*.java
*.ll
/c/bistromathic/bistromathic
/c/calc/calc
/c/glr/c++-types
/c/lexcalc/lexcalc
/c/pushcalc/calc
+1 -1
View File
@@ -17,7 +17,7 @@ fill-column: 76
ispell-dictionary: "american"
End:
Copyright (C) 2018-2021 Free Software Foundation, Inc.
Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
+4
View File
@@ -1 +1,5 @@
/glr/c++-types
/simple
/simple.yy
/variant
/variant-11
+1 -1
View File
@@ -55,7 +55,7 @@ fill-column: 76
ispell-dictionary: "american"
End:
Copyright (C) 2018-2021 Free Software Foundation, Inc.
Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
-17
View File
@@ -1,19 +1,2 @@
/*.o
/*.tmp
/.deps
/calc++
/calc++.cc
/calc++.exe
/calc.stamp
/driver.cc
/driver.hh
/location.hh
/parser.cc
/parser.hh
/parser.output
/parser.stamp
/parser.yy
/position.hh
/scanner.cc
/scanner.ll
/stack.hh
+1 -1
View File
@@ -36,7 +36,7 @@ fill-column: 76
ispell-dictionary: "american"
End:
Copyright (C) 2018-2021 Free Software Foundation, Inc.
Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
+17 -1
View File
@@ -1,6 +1,7 @@
#! /bin/sh
# Copyright (C) 2005-2015, 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2005-2015, 2018-2022, 2025-2026 Free Software
# Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -50,6 +51,21 @@ EOF
run 1 'err: -:2.1: syntax error, unexpected end of file, expecting ( or identifier or number'
# Check handling of tabs.
cat >input <<EOF
*1
EOF
run 1 'err: -:1.9: syntax error, unexpected *, expecting ( or identifier or number'
cat >input <<EOF
*2
EOF
run 1 'err: -:1.9: syntax error, unexpected *, expecting ( or identifier or number'
cat >input <<EOF
*3
EOF
run 1 'err: -:1.9: syntax error, unexpected *, expecting ( or identifier or number'
# LAC finds many more tokens.
cat >input <<EOF
a := 1
+2 -2
View File
@@ -1,5 +1,5 @@
## Copyright (C) 2005-2006, 2008-2015, 2018-2021 Free Software
## Foundation, Inc.
## Copyright (C) 2005-2006, 2008-2015, 2018-2022, 2025-2026 Free
## Software Foundation, Inc.
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -13,7 +13,7 @@ fill-column: 76
ispell-dictionary: "american"
End:
Copyright (C) 2020-2021 Free Software Foundation, Inc.
Copyright (C) 2020-2022, 2025-2026 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -1,5 +1,5 @@
/*
Copyright (C) 2020-2021 Free Software Foundation, Inc.
Copyright (C) 2020-2022, 2025-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Copyright (C) 2020-2021 Free Software Foundation, Inc.
# Copyright (C) 2020-2022, 2025-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,5 +1,5 @@
/* -*- C++ -*-
Copyright (C) 2020-2021 Free Software Foundation, Inc.
Copyright (C) 2020-2022, 2025-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2020-2021 Free Software Foundation, Inc.
## Copyright (C) 2020-2022, 2025-2026 Free Software Foundation, Inc.
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2018-2021 Free Software Foundation, Inc.
## Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Copyright (C) 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+2 -1
View File
@@ -1,5 +1,6 @@
/*
Copyright (C) 2008-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 2008-2015, 2018-2022, 2025-2026 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Copyright (C) 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+2 -1
View File
@@ -1,5 +1,6 @@
/*
Copyright (C) 2008-2015, 2018-2021 Free Software Foundation, Inc.
Copyright (C) 2008-2015, 2018-2022, 2025-2026 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -81,7 +81,7 @@ fill-column: 76
ispell-dictionary: "american"
End:
Copyright (C) 2018-2021 Free Software Foundation, Inc.
Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
This file is part of GNU bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -32,7 +32,7 @@ fill-column: 76
ispell-dictionary: "american"
End:
Copyright (C) 2020-2021 Free Software Foundation, Inc.
Copyright (C) 2020-2022, 2025-2026 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+24 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Copyright (C) 2020-2021 Free Software Foundation, Inc.
# Copyright (C) 2020-2022, 2025-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -366,3 +366,26 @@ err: 1.15: syntax error: expected - or ( or number or function or variable befor
err: 1 | (1++2) + 3 + ''
err: | ^
'
# Check handling of literal tabs. "Escape" them with a C-v, so that
# they are not processed as completion requests.
cat >input<<EOF
*1
 *2
 *3
EOF
# readline processes the tabs itself, and replaces then with spaces.
run -n 0 '> *1
> *2
> *3
> ''
err: 1.9: syntax error: expected end of file or - or ( or exit or number or function etc., before *
err: 1 | *1
err: | ^
err: 2.9: syntax error: expected end of file or - or ( or exit or number or function etc., before *
err: 2 | *2
err: | ^
err: 3.9: syntax error: expected end of file or - or ( or exit or number or function etc., before *
err: 3 | *3
err: | ^
'
+1 -1
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2020-2021 Free Software Foundation, Inc.
## Copyright (C) 2020-2022, 2025-2026 Free Software Foundation, Inc.
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
+11 -5
View File
@@ -1,6 +1,6 @@
/* Parser and scanner for bistromathic. -*- C -*-
Copyright (C) 2019-2021 Free Software Foundation, Inc.
Copyright (C) 2019-2022, 2025-2026 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -21,6 +21,11 @@
// Emitted on top of the implementation file.
%code top {
/* Portability issues for strdup. */
#ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE 600
#endif
#include <ctype.h> // isdigit
#include <locale.h> // LC_ALL
#include <math.h> // cos, sin, etc.
@@ -244,7 +249,7 @@ init_table (void)
symrec *
putsym (char const *name, int sym_type)
{
symrec *res = (symrec *) malloc (sizeof (symrec));
symrec *res = malloc (sizeof *res);
res->name = strdup (name);
res->type = sym_type;
res->value.var = 0; // Set value to 0 even if fun.
@@ -303,14 +308,15 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc,
{
int c;
// Ignore white space, get first nonwhite character.
// Get next character, ignore white spaces.
do {
// Move the first position onto the last.
yylloc->first_line = yylloc->last_line;
yylloc->first_column = yylloc->last_column;
yylloc->last_column += 1;
c = *((*line)++);
// Tab characters go to the next column multiple of 8.
yylloc->last_column +=
c == '\t' ? 8 - ((yylloc->last_column - 1) & 7) : 1;
} while (c == ' ' || c == '\t');
switch (c)
+1 -1
View File
@@ -9,7 +9,7 @@ fill-column: 76
ispell-dictionary: "american"
End:
Copyright (C) 2019-2021 Free Software Foundation, Inc.
Copyright (C) 2019-2022, 2025-2026 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Copyright (C) 2019-2021 Free Software Foundation, Inc.
# Copyright (C) 2019-2022, 2025-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2019-2021 Free Software Foundation, Inc.
## Copyright (C) 2019-2022, 2025-2026 Free Software Foundation, Inc.
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -10,7 +10,7 @@ fill-column: 76
ispell-dictionary: "american"
End:
Copyright (C) 2020-2021 Free Software Foundation, Inc.
Copyright (C) 2020-2022, 2025-2026 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+27 -12
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Copyright (C) 2020-2021 Free Software Foundation, Inc.
# Copyright (C) 2020-2022, 2025-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,31 +17,46 @@
cat >input <<EOF
z + q;
EOF
run 0 "1.0-5: +(z, q)"
cat >input <<EOF
T x;
EOF
run 0 "1.0-3: <declare>(T, x)"
cat >input <<EOF
T x = y;
EOF
run 0 "1.0-7: <init-declare>(T, x, y)"
cat >input <<EOF
x = y;
EOF
run 0 "1.0-5: =(x, y)"
cat >input <<EOF
T (x) + y;
EOF
run 0 "1.0-9: +(<cast>(x, T), y)"
cat >input <<EOF
T (x);
EOF
run 0 "1.0-5: <OR>(<declare>(T, x), <cast>(x, T))"
cat >input <<EOF
T (y) = z + q;
EOF
run 0 "1.0-13: <OR>(<init-declare>(T, y, +(z, q)), =(<cast>(y, T), +(z, q)))"
cat >input <<EOF
T (y y) = z + q;
EOF
run 0 "1.0-15: <error>
err: 1.5: syntax error, unexpected identifier, expecting '=' or '+' or ')'"
cat >input <<EOF
z + q;
EOF
run 0 "\
1.0-5: +(z, q)
3.0-3: <declare>(T, x)
5.0-7: <init-declare>(T, x, y)
7.0-5: =(x, y)
9.0-9: +(<cast>(x, T), y)
11.0-5: <OR>(<declare>(T, x), <cast>(x, T))
13.0-13: <OR>(<init-declare>(T, y, +(z, q)), =(<cast>(y, T), +(z, q)))
15.0-15: <error>
17.0-5: +(z, q)
err: 15.5: syntax error, unexpected identifier, expecting '=' or '+' or ')'"
run 0 "1.0-5: +(z, q)"
+53 -52
View File
@@ -1,5 +1,5 @@
/* -*- C -*-
Copyright (C) 2020-2021 Free Software Foundation, Inc.
Copyright (C) 2020-2022, 2025-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,30 +29,34 @@
%code requires
{
union Node {
union node {
struct {
int isNterm;
int is_nterm;
int parents;
} nodeInfo;
} node_info;
struct {
int isNterm; /* 1 */
int is_nterm; /* 1 */
int parents;
char const *form;
union Node *children[3];
union node *children[3];
} nterm;
struct {
int isNterm; /* 0 */
int is_nterm; /* 0 */
int parents;
char *text;
} term;
};
typedef union Node Node;
typedef union node node_t;
}
%define api.value.type union
%code
{
/* Portability issues for strdup. */
#ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE 600
#endif
#include <assert.h>
#include <ctype.h>
@@ -61,12 +65,12 @@
#include <stdlib.h>
#include <string.h>
static Node *new_nterm (char const *, Node *, Node *, Node *);
static Node *new_term (char *);
static void free_node (Node *);
static char *node_to_string (const Node *);
static void node_print (FILE *, const Node *);
static Node *stmt_merge (YYSTYPE x0, YYSTYPE x1);
static node_t *new_nterm (char const *, node_t *, node_t *, node_t *);
static node_t *new_term (char *);
static void free_node (node_t *);
static char *node_to_string (const node_t *);
static void node_print (FILE *, const node_t *);
static node_t *stmt_merge (YYSTYPE x0, YYSTYPE x1);
static void yyerror (YYLTYPE const * const loc, const char *msg);
static yytoken_kind_t yylex (YYSTYPE *lval, YYLTYPE *lloc);
@@ -83,9 +87,9 @@
%glr-parser
%type <Node *> stmt expr decl declarator TYPENAME ID
%destructor { free_node ($$); } <Node *>
%printer { node_print (yyo, $$); } <Node *>
%type <node_t *> stmt expr decl declarator TYPENAME ID
%destructor { free_node ($$); } <node_t *>
%printer { node_print (yyo, $$); } <node_t *>
%%
@@ -140,8 +144,8 @@ FILE * input = NULL;
yytoken_kind_t
yylex (YYSTYPE *lval, YYLTYPE *lloc)
{
static int lineNum = 1;
static int colNum = 0;
static int line_num = 1;
static int col_num = 0;
while (1)
{
@@ -153,20 +157,20 @@ yylex (YYSTYPE *lval, YYLTYPE *lloc)
case EOF:
return 0;
case '\t':
colNum = (colNum + 7) & ~7;
col_num = (col_num + 7) & ~7;
break;
case ' ': case '\f':
colNum += 1;
col_num += 1;
break;
case '\n':
lineNum += 1;
colNum = 0;
line_num += 1;
col_num = 0;
break;
default:
{
yytoken_kind_t tok;
lloc->first_line = lloc->last_line = lineNum;
lloc->first_column = colNum;
lloc->first_line = lloc->last_line = line_num;
lloc->first_column = col_num;
if (isalpha (c))
{
char buffer[256];
@@ -175,7 +179,7 @@ yylex (YYSTYPE *lval, YYLTYPE *lloc)
do
{
buffer[i++] = (char) c;
colNum += 1;
col_num += 1;
assert (i != sizeof buffer - 1);
c = getc (input);
}
@@ -186,65 +190,65 @@ yylex (YYSTYPE *lval, YYLTYPE *lloc)
if (isupper ((unsigned char) buffer[0]))
{
tok = TYPENAME;
lval->TYPENAME = new_term (strcpy (malloc (i), buffer));
lval->TYPENAME = new_term (strdup (buffer));
}
else
{
tok = ID;
lval->ID = new_term (strcpy (malloc (i), buffer));
lval->ID = new_term (strdup (buffer));
}
}
else
{
colNum += 1;
col_num += 1;
tok = c;
}
lloc->last_column = colNum;
lloc->last_column = col_num;
return tok;
}
}
}
}
static Node *
new_nterm (char const *form, Node *child0, Node *child1, Node *child2)
static node_t *
new_nterm (char const *form, node_t *child0, node_t *child1, node_t *child2)
{
Node *res = malloc (sizeof *res);
res->nterm.isNterm = 1;
node_t *res = malloc (sizeof *res);
res->nterm.is_nterm = 1;
res->nterm.parents = 0;
res->nterm.form = form;
res->nterm.children[0] = child0;
if (child0)
child0->nodeInfo.parents += 1;
child0->node_info.parents += 1;
res->nterm.children[1] = child1;
if (child1)
child1->nodeInfo.parents += 1;
child1->node_info.parents += 1;
res->nterm.children[2] = child2;
if (child2)
child2->nodeInfo.parents += 1;
child2->node_info.parents += 1;
return res;
}
static Node *
static node_t *
new_term (char *text)
{
Node *res = malloc (sizeof *res);
res->term.isNterm = 0;
node_t *res = malloc (sizeof *res);
res->term.is_nterm = 0;
res->term.parents = 0;
res->term.text = text;
return res;
}
static void
free_node (Node *node)
free_node (node_t *node)
{
if (!node)
return;
node->nodeInfo.parents -= 1;
node->node_info.parents -= 1;
/* Free only if 0 (last parent) or -1 (no parents). */
if (node->nodeInfo.parents > 0)
if (node->node_info.parents > 0)
return;
if (node->nodeInfo.isNterm == 1)
if (node->node_info.is_nterm == 1)
{
free_node (node->nterm.children[0]);
free_node (node->nterm.children[1]);
@@ -256,15 +260,12 @@ free_node (Node *node)
}
static char *
node_to_string (const Node *node)
node_to_string (const node_t *node)
{
char *res;
if (!node)
{
res = malloc (1);
res[0] = 0;
}
else if (node->nodeInfo.isNterm == 1)
res = strdup ("");
else if (node->node_info.is_nterm)
{
char *child0 = node_to_string (node->nterm.children[0]);
char *child1 = node_to_string (node->nterm.children[1]);
@@ -282,7 +283,7 @@ node_to_string (const Node *node)
}
static void
node_print (FILE *out, const Node *n)
node_print (FILE *out, const node_t *n)
{
char *str = node_to_string (n);
fputs (str, out);
@@ -290,7 +291,7 @@ node_print (FILE *out, const Node *n)
}
static Node *
static node_t *
stmt_merge (YYSTYPE x0, YYSTYPE x1)
{
return new_nterm ("<OR>(%s, %s)", x0.stmt, x1.stmt, NULL);
+1 -1
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2020-2021 Free Software Foundation, Inc.
## Copyright (C) 2020-2022, 2025-2026 Free Software Foundation, Inc.
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -11,7 +11,7 @@ fill-column: 76
ispell-dictionary: "american"
End:
Copyright (C) 2018-2021 Free Software Foundation, Inc.
Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
+1 -1
View File
@@ -1,6 +1,6 @@
#! /bin/sh
# Copyright (C) 2018-2021 Free Software Foundation, Inc.
# Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,4 +1,4 @@
## Copyright (C) 2018-2021 Free Software Foundation, Inc.
## Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/* Parser for lexcalc. -*- C -*-
Copyright (C) 2018-2021 Free Software Foundation, Inc.
Copyright (C) 2018-2022, 2025-2026 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.

Some files were not shown because too many files have changed in this diff Show More