Compare commits

...
18 Commits
Author SHA1 Message Date
Joel E. Denny 41930e7ad8 Version 2.4.1.
* NEWS: Set version and date.
* lib/Makefile.am: Update copyright year.
* tests/atlocal.in: Update copyright year.
2008-12-11 16:07:47 -05:00
Joel E. Denny d07932ef3d Semicolon feature removal is not about future language support.
* NEWS: The semicolon feature is no longer active for newer languages,
so don't claim that it causes trouble for them.
2008-12-11 15:37:24 -05:00
Joel E. Denny 0364b3344f * gnulib: Update submodule to HEAD. 2008-12-11 15:14:35 -05:00
Akim Demaille 876fd8357a Update data/README.
* data/README: Document glr.cc, lalr1.java, m4sugar and xslt.
2008-12-09 13:24:18 +01:00
Akim Demaille 1eb0b14659 Spelling fixes.
* NEWS: s/than/that/.
2008-12-09 13:19:44 +01:00
Eric Blake bee1df15b2 Build testsuite with newer autoconf.
* tests/output.at (m4_expand): Don't override in newer autoconf,
where the underlying implementation changed.
* tests/cxx-type.at (_AT_RESOLVED_GLR_OUTPUT)
(_AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_AMBIG_GLR_OUTPUT)
(_AT_AMBIG_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR)
(_AT_VERBOSE_GLR_STDERR): Expand to double-quoted strings,
since some of them contain unbalanced ')'.

Signed-off-by: Eric Blake <[email protected]>
2008-12-05 09:27:19 -07:00
Joel E. Denny 7e6d1e2296 * NEWS: Clarify a little. 2008-11-19 12:14:37 -05:00
Joel E. Denny a957d06cef * NEWS: Update for recent changes. 2008-11-19 12:06:34 -05:00
Joel E. Denny 462503f825 Fix unexpanded macros in GLR defines file.
Reported by Csaba Raduly at
<http://lists.gnu.org/archive/html/bug-bison/2008-11/msg00048.html>.
* THANKS (Csaba Raduly): Add.
* data/glr.c: Fix overquoting on b4_prefix for yylval and yylloc.
* tests/calc.at (_AT_DATA_CALC_Y): If %defines is specified, generate
lexer in a separate module that includes the defines file.
(AT_CHECK_CALC): Use AT_FULL_COMPILE and request compilation of lexer
source.
* tests/local.at (_AT_BISON_OPTION_PUSHDEFS): Push AT_DEFINES_IF.
Adjust AT_LOC and AT_VAL to use AT_NAME_PREFIX.
(AT_BISON_OPTION_POPDEFS): Pop AT_DEFINES_IF.
(AT_DATA_SOURCE_PROLOGUE): New.
(AT_DATA_GRAMMAR_PROLOGUE): Use AT_DATA_SOURCE_PROLOGUE.
(AT_DATA_SOURCE): New.
(AT_FULL_COMPILE): New, copied from master branch and extended to
support an additional output file.
2008-11-19 00:38:14 -05:00
Joel E. Denny bf151b75ff Don't let maintainer-*-check targets force a version update.
* cfg.mk (_is-dist-target): Implement.  maintainer-check* was already
handled.
2008-11-17 09:44:04 -05:00
Di-an JanandPaolo Bonzini f56274a8f9 Fix formatting and content of bison.texinfo menus
* doc/bison.texinfo: Synchronize ``Detail Node Listing''.
Align menus.  Adjust word wrapping.  Use node names for menu names.
(Examples): Don't abbreviate node names.
(LocalWords): Remove abbreviations.
(Copying): Make description a sentence.
(Java Action Features): Remove period to match the rest of menu.
2008-11-17 11:08:09 +01:00
Paolo Bonzini b5775a81c1 Replace m4/warning.m4 with warnings module.
* bootstrap.conf: Replace m4/warning.m4 with warnings module.
* configure.ac: Adjust usage.
* lib/Makefile.am: Replace $(WARNING_CFLAGS) with $(WARN_CFLAGS).
* src/Makefile.am: Replace $(WARNING_CFLAGS) with $(WARN_CFLAGS).
* tests/atlocal.in: Replace $(WARNING_*FLAGS) with $(WARN_*FLAGS).
2008-11-12 15:55:01 +01:00
Joel E. Denny 7ed73f82ad Don't add a semicolon to actions for %skeleton or %language.
It breaks Java test cases as reported by Akim Demaille.
* src/scan-code.l: Implement.
2008-11-07 16:48:57 -05:00
Joel E. Denny 4b1ebc495b Clean up %skeleton and %language priority implementation.
* src/getargs.c (skeleton_prio): Use default_prio rather than 2, and
remove static qualifier because others will soon need to see it.
(language_prio): Likewise.
(getargs): Use command_line_prio rather than 0.
* src/getargs.h (command_line_prio, grammar_prio, default_prio): New
enum fields.
(skeleton_prio): Extern it.
(language_prio): Extern it.
* src/parse-gram.y: Use grammar_prio rather than 1.
2008-11-07 16:48:31 -05:00
Akim Demaille 738cde3e93 Mention the trailing semicolon in action.
* NEWS: Mention the trailing semicolon in action.
2008-11-04 22:26:39 +01:00
Akim Demaille d6fb461dd8 Reformat NEWS.
* NEWS: Use more outline-mode markup.
	Suggested by Jim Meyering.
2008-11-04 22:19:33 +01:00
Joel E. Denny 14da0cdd07 Fix user actions without a trailing semicolon.
Reported by Sergei Steshenko at
<http://lists.gnu.org/archive/html/bug-bison/2008-11/msg00001.html>.
* THANKS (Sergei Steshenko): Add.
* src/scan-code.l (SC_RULE_ACTION): Fix it.
* tests/regression.at (Fix user actions without a trailing semicolon):
New test case.
2008-11-04 13:30:38 -05:00
Joel E. Denny c9ba9e5978 Initiate further development.
* NEWS: Create an empty section for new entries.
* gnulib: Update submodule to HEAD.
2008-11-02 18:16:13 -05:00
26 changed files with 862 additions and 606 deletions
+135 -6
View File
@@ -1,3 +1,132 @@
2008-12-11 Joel E. Denny <[email protected]>
Version 2.4.1.
* NEWS: Set version and date.
* lib/Makefile.am: Update copyright year.
* tests/atlocal.in: Update copyright year.
2008-12-11 Joel E. Denny <[email protected]>
Semicolon feature removal is not about future language support.
* NEWS: The semicolon feature is no longer active for newer languages,
so don't claim that it causes trouble for them.
2008-12-11 Joel E. Denny <[email protected]>
* gnulib: Update submodule to HEAD.
2008-12-09 Akim Demaille <[email protected]>
Update data/README.
* data/README: Document glr.cc, lalr1.java, m4sugar and xslt.
2008-12-05 Eric Blake <[email protected]>
Build testsuite with newer autoconf.
* tests/output.at (m4_expand): Don't override in newer autoconf,
where the underlying implementation changed.
* tests/cxx-type.at (_AT_RESOLVED_GLR_OUTPUT)
(_AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_AMBIG_GLR_OUTPUT)
(_AT_AMBIG_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR)
(_AT_VERBOSE_GLR_STDERR): Expand to double-quoted strings,
since some of them contain unbalanced ')'.
2008-11-19 Joel E. Denny <[email protected]>
* NEWS: Clarify a little.
2008-11-19 Joel E. Denny <[email protected]>
* NEWS: Update for recent changes.
2008-11-18 Joel E. Denny <[email protected]>
Fix unexpanded macros in GLR defines file.
Reported by Csaba Raduly at
<http://lists.gnu.org/archive/html/bug-bison/2008-11/msg00048.html>.
* THANKS (Csaba Raduly): Add.
* data/glr.c: Fix overquoting on b4_prefix for yylval and yylloc.
* tests/calc.at (_AT_DATA_CALC_Y): If %defines is specified, generate
lexer in a separate module that includes the defines file.
(AT_CHECK_CALC): Use AT_FULL_COMPILE and request compilation of lexer
source.
* tests/local.at (_AT_BISON_OPTION_PUSHDEFS): Push AT_DEFINES_IF.
Adjust AT_LOC and AT_VAL to use AT_NAME_PREFIX.
(AT_BISON_OPTION_POPDEFS): Pop AT_DEFINES_IF.
(AT_DATA_SOURCE_PROLOGUE): New.
(AT_DATA_GRAMMAR_PROLOGUE): Use AT_DATA_SOURCE_PROLOGUE.
(AT_DATA_SOURCE): New.
(AT_FULL_COMPILE): New, copied from master branch and extended to
support an additional source file.
2008-11-17 Joel E. Denny <[email protected]>
Don't let maintainer-*-check targets force a version update.
* cfg.mk (_is-dist-target): Implement. maintainer-check* was already
handled.
2008-11-17 Di-an Jan <[email protected]>
* doc/bison.texinfo: Synchronize ``Detail Node Listing''.
Align menus. Adjust word wrapping. Use node names for menu names.
(Examples): Don't abbreviate node names.
(LocalWords): Remove abbreviations.
(Copying): Make description a sentence.
(Java Action Features): Remove period to match the rest of menu.
2008-11-11 Paolo Bonzini <[email protected]>
* bootstrap.conf: Replace m4/warning.m4 with warnings module.
* configure.ac: Adjust usage.
* lib/Makefile.am: Replace $(WARNING_CFLAGS) with $(WARN_CFLAGS).
* src/Makefile.am: Replace $(WARNING_CFLAGS) with $(WARN_CFLAGS).
* tests/atlocal.in: Replace $(WARNING_*FLAGS) with $(WARN_*FLAGS).
2008-11-07 Joel E. Denny <[email protected]>
Don't add a semicolon to actions for %skeleton or %language.
It breaks Java test cases as reported by Akim Demaille.
* src/scan-code.l: Implement.
2008-11-07 Joel E. Denny <[email protected]>
Clean up %skeleton and %language priority implementation.
* src/getargs.c (skeleton_prio): Use default_prio rather than 2, and
remove static qualifier because others will soon need to see it.
(language_prio): Likewise.
(getargs): Use command_line_prio rather than 0.
* src/getargs.h (command_line_prio, grammar_prio, default_prio): New
enum fields.
(skeleton_prio): Extern it.
(language_prio): Extern it.
* src/parse-gram.y: Use grammar_prio rather than 1.
2008-11-04 Akim Demaille <[email protected]>
* NEWS: Mention the trailing semicolon in action.
2008-11-04 Akim Demaille <[email protected]>
Reformat NEWS.
* NEWS: Use more outline-mode markup.
Suggested by Jim Meyering.
2008-11-04 Joel E. Denny <[email protected]>
Fix user actions without a trailing semicolon.
Reported by Sergei Steshenko at
<http://lists.gnu.org/archive/html/bug-bison/2008-11/msg00001.html>.
* THANKS (Sergei Steshenko): Add.
* src/scan-code.l (SC_RULE_ACTION): Fix it.
* tests/regression.at (Fix user actions without a trailing semicolon):
New test case.
2008-11-02 Joel E. Denny <[email protected]>
Initiate further development.
* NEWS: Create an empty section for new entries.
* gnulib: Update submodule to HEAD.
2008-11-02 Joel E. Denny <[email protected]>
* NEWS: Version 2.4.
@@ -184,9 +313,9 @@
2008-08-29 Akim Demaille <[email protected]>
Clarify UPDATED use.
* doc/bison.texinfo: It refers to the last edition of this file,
* doc/bison.texinfo: It refers to the last edition of this file,
not to the release date of Bison.
Reported by Joel E. Denny.
Reported by Joel E. Denny.
2008-08-29 Akim Demaille <[email protected]>
@@ -206,15 +335,15 @@
2008-08-27 Akim Demaille <[email protected]>
Check yyerrok in calc.at.
* tests/calc.at (calc.y): Use yyerrok on "( error )".
(AT_CHECK_CALC): Add a check that ensures that yyerrok works as
expected.
* tests/calc.at (calc.y): Use yyerrok on "( error )".
(AT_CHECK_CALC): Add a check that ensures that yyerrok works as
expected.
2008-08-27 Akim Demaille <[email protected]>
Support yyerrok in lalr1.cc.
YYBACKUP is still to import back into lalr1.cc.
* data/lalr1.cc (yyerrork, yyclearin, YYRECOVERING): Define.
* data/lalr1.cc (yyerrork, yyclearin, YYRECOVERING): Define.
2008-08-26 Joel E. Denny <[email protected]>
+209 -184
View File
@@ -1,9 +1,34 @@
Bison News
----------
Changes in version 2.4 (2008-11-02):
* Changes in version 2.4.1 (2008-12-11):
* %language is an experimental feature.
** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
declarations have been fixed.
** Temporary hack for adding a semicolon to the user action.
Bison used to prepend a trailing semicolon at the end of the user
action for reductions. This allowed actions such as
exp: exp "+" exp { $$ = $1 + $3 };
instead of
exp: exp "+" exp { $$ = $1 + $3; };
Some grammars still depend on this `feature'. Bison 2.4.1 restores
the previous behavior in the case of C output (specifically, when
neither %language or %skeleton or equivalent command-line options
are used) to leave more time for grammars depending on the old
behavior to be adjusted. Future releases of Bison will disable this
feature.
** A few minor improvements to the Bison manual.
* Changes in version 2.4 (2008-11-02):
** %language is an experimental feature.
We first introduced this feature in test release 2.3b as a cleaner
alternative to %skeleton. Since then, we have discussed the possibility of
@@ -11,26 +36,26 @@ Changes in version 2.4 (2008-11-02):
we consider %language to be an experimental feature that will likely evolve
in future releases.
* Forward compatibility with GNU M4 has been improved.
** Forward compatibility with GNU M4 has been improved.
* Several bugs in the C++ skeleton and the experimental Java skeleton have been
** Several bugs in the C++ skeleton and the experimental Java skeleton have been
fixed.
Changes in version 2.3b (2008-05-27):
* Changes in version 2.3b (2008-05-27):
* The quotes around NAME that used to be required in the following directive
** The quotes around NAME that used to be required in the following directive
are now deprecated:
%define NAME "VALUE"
* The directive `%pure-parser' is now deprecated in favor of:
** The directive `%pure-parser' is now deprecated in favor of:
%define api.pure
which has the same effect except that Bison is more careful to warn about
unreasonable usage in the latter case.
* Push Parsing
** Push Parsing
Bison can now generate an LALR(1) parser in C with a push interface. That
is, instead of invoking `yyparse', which pulls tokens from `yylex', you can
@@ -46,11 +71,11 @@ Changes in version 2.3b (2008-05-27):
The current push parsing interface is experimental and may evolve. More user
feedback will help to stabilize it.
* The -g and --graph options now output graphs in Graphviz DOT format,
** The -g and --graph options now output graphs in Graphviz DOT format,
not VCG format. Like --graph, -g now also takes an optional FILE argument
and thus cannot be bundled with other short options.
* Java
** Java
Bison can now generate an LALR(1) parser in Java. The skeleton is
`data/lalr1.java'. Consider using the new %language directive instead of
@@ -61,30 +86,30 @@ Changes in version 2.3b (2008-05-27):
The current Java interface is experimental and may evolve. More user
feedback will help to stabilize it.
* %language
** %language
This new directive specifies the programming language of the generated
parser, which can be C (the default), C++, or Java. Besides the skeleton
that Bison uses, the directive affects the names of the generated files if
the grammar file's name ends in ".y".
* XML Automaton Report
** XML Automaton Report
Bison can now generate an XML report of the LALR(1) automaton using the new
`--xml' option. The current XML schema is experimental and may evolve. More
user feedback will help to stabilize it.
* The grammar file may now specify the name of the parser header file using
** The grammar file may now specify the name of the parser header file using
%defines. For example:
%defines "parser.h"
* When reporting useless rules, useless nonterminals, and unused terminals,
** When reporting useless rules, useless nonterminals, and unused terminals,
Bison now employs the terms "useless in grammar" instead of "useless",
"useless in parser" instead of "never reduced", and "unused in grammar"
instead of "unused".
* Unreachable State Removal
** Unreachable State Removal
Previously, Bison sometimes generated parser tables containing unreachable
states. A state can become unreachable during conflict resolution if Bison
@@ -106,7 +131,7 @@ Changes in version 2.3b (2008-05-27):
See the %define entry in the `Bison Declaration Summary' in the Bison manual
for further discussion.
* Lookahead Set Correction in the `.output' Report
** Lookahead Set Correction in the `.output' Report
When instructed to generate a `.output' file including lookahead sets
(using `--report=lookahead', for example), Bison now prints each reduction's
@@ -117,17 +142,17 @@ Changes in version 2.3b (2008-05-27):
bug affected only the `.output' file and not the generated parser source
code.
* --report-file=FILE is a new option to override the default `.output' file
** --report-file=FILE is a new option to override the default `.output' file
name.
* The `=' that used to be required in the following directives is now
** The `=' that used to be required in the following directives is now
deprecated:
%file-prefix "parser"
%name-prefix "c_"
%output "parser.c"
* An Alternative to `%{...%}' -- `%code QUALIFIER {CODE}'
** An Alternative to `%{...%}' -- `%code QUALIFIER {CODE}'
Bison 2.3a provided a new set of directives as a more flexible alternative to
the traditional Yacc prologue blocks. Those have now been consolidated into
@@ -148,7 +173,7 @@ Changes in version 2.3b (2008-05-27):
The prologue alternatives are experimental. More user feedback will help to
determine whether they should become permanent features.
* Revised warning: unset or unused mid-rule values
** Revised warning: unset or unused mid-rule values
Since Bison 2.2, Bison has warned about mid-rule values that are set but not
used within any of the actions of the parent rule. For example, Bison warns
@@ -168,7 +193,7 @@ Changes in version 2.3b (2008-05-27):
To enable these warnings, specify the option `--warnings=midrule-values' or
`-W', which is a synonym for `--warnings=all'.
* Default %destructor or %printer with `<*>' or `<>'
** Default %destructor or %printer with `<*>' or `<>'
Bison now recognizes two separate kinds of default %destructor's and
%printer's:
@@ -193,25 +218,25 @@ Changes in version 2.3b (2008-05-27):
See the section `Freeing Discarded Symbols' in the Bison manual for further
details.
* %left, %right, and %nonassoc can now declare token numbers. This is required
** %left, %right, and %nonassoc can now declare token numbers. This is required
by POSIX. However, see the end of section `Operator Precedence' in the Bison
manual for a caveat concerning the treatment of literal strings.
* The nonfunctional --no-parser, -n, and %no-parser options have been
** The nonfunctional --no-parser, -n, and %no-parser options have been
completely removed from Bison.
Changes in version 2.3a, 2006-09-13:
* Changes in version 2.3a, 2006-09-13:
* Instead of %union, you can define and use your own union type
** Instead of %union, you can define and use your own union type
YYSTYPE if your grammar contains at least one <type> tag.
Your YYSTYPE need not be a macro; it can be a typedef.
This change is for compatibility with other Yacc implementations,
and is required by POSIX.
* Locations columns and lines start at 1.
** Locations columns and lines start at 1.
In accordance with the GNU Coding Standards and Emacs.
* You may now declare per-type and default %destructor's and %printer's:
** You may now declare per-type and default %destructor's and %printer's:
For example:
@@ -237,13 +262,13 @@ Changes in version 2.3a, 2006-09-13:
%destructor's and %printer's were experimental, and they were rewritten in
future versions.]
* Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with `-y',
** Except for LALR(1) parsers in C with POSIX Yacc emulation enabled (with `-y',
`--yacc', or `%yacc'), Bison no longer generates #define statements for
associating token numbers with token names. Removing the #define statements
helps to sanitize the global namespace during preprocessing, but POSIX Yacc
requires them. Bison still generates an enum for token names in all cases.
* Handling of traditional Yacc prologue blocks is now more consistent but
** Handling of traditional Yacc prologue blocks is now more consistent but
potentially incompatible with previous releases of Bison.
As before, you declare prologue blocks in your grammar file with the
@@ -262,7 +287,7 @@ Changes in version 2.3a, 2006-09-13:
Now, Bison never inserts the pre-prologue into the header file. In the code
file, it always inserts it before the token definitions.
* Bison now provides a more flexible alternative to the traditional Yacc
** Bison now provides a more flexible alternative to the traditional Yacc
prologue blocks: %before-header, %start-header, %end-header, and
%after-header.
@@ -310,32 +335,32 @@ Changes in version 2.3a, 2006-09-13:
[Although we failed to mention this here in the 2.3a release, the prologue
alternatives were experimental, and they were rewritten in future versions.]
* The option `--report=look-ahead' has been changed to `--report=lookahead'.
** The option `--report=look-ahead' has been changed to `--report=lookahead'.
The old spelling still works, but is not documented and may be removed
in a future release.
Changes in version 2.3, 2006-06-05:
* Changes in version 2.3, 2006-06-05:
* GLR grammars should now use `YYRECOVERING ()' instead of `YYRECOVERING',
** GLR grammars should now use `YYRECOVERING ()' instead of `YYRECOVERING',
for compatibility with LALR(1) grammars.
* It is now documented that any definition of YYSTYPE or YYLTYPE should
** It is now documented that any definition of YYSTYPE or YYLTYPE should
be to a type name that does not contain parentheses or brackets.
Changes in version 2.2, 2006-05-19:
* Changes in version 2.2, 2006-05-19:
* The distribution terms for all Bison-generated parsers now permit
** The distribution terms for all Bison-generated parsers now permit
using the parsers in nonfree programs. Previously, this permission
was granted only for Bison-generated LALR(1) parsers in C.
* %name-prefix changes the namespace name in C++ outputs.
** %name-prefix changes the namespace name in C++ outputs.
* The C++ parsers export their token_type.
** The C++ parsers export their token_type.
* Bison now allows multiple %union declarations, and concatenates
** Bison now allows multiple %union declarations, and concatenates
their contents together.
* New warning: unused values
** New warning: unused values
Right-hand side symbols whose values are not used are reported,
if the symbols have destructors. For instance:
@@ -369,26 +394,26 @@ Changes in version 2.2, 2006-05-19:
The warning is intended to help catching lost values and memory leaks.
If a value is ignored, its associated memory typically is not reclaimed.
* %destructor vs. YYABORT, YYACCEPT, and YYERROR.
** %destructor vs. YYABORT, YYACCEPT, and YYERROR.
Destructors are now called when user code invokes YYABORT, YYACCEPT,
and YYERROR, for all objects on the stack, other than objects
corresponding to the right-hand side of the current rule.
* %expect, %expect-rr
** %expect, %expect-rr
Incorrect numbers of expected conflicts are now actual errors,
instead of warnings.
* GLR, YACC parsers.
** GLR, YACC parsers.
The %parse-params are available in the destructors (and the
experimental printers) as per the documentation.
* Bison now warns if it finds a stray `$' or `@' in an action.
** Bison now warns if it finds a stray `$' or `@' in an action.
* %require "VERSION"
** %require "VERSION"
This specifies that the grammar file depends on features implemented
in Bison version VERSION or higher.
* lalr1.cc: The token and value types are now class members.
** lalr1.cc: The token and value types are now class members.
The tokens were defined as free form enums and cpp macros. YYSTYPE
was defined as a free form union. They are now class members:
tokens are enumerations of the `yy::parser::token' struct, and the
@@ -402,37 +427,37 @@ Changes in version 2.2, 2006-05-19:
If you wish to update, then make sure older version of Bison will
fail using `%require "2.2"'.
* DJGPP support added.
** DJGPP support added.
Changes in version 2.1, 2005-09-16:
* Changes in version 2.1, 2005-09-16:
* The C++ lalr1.cc skeleton supports %lex-param.
** The C++ lalr1.cc skeleton supports %lex-param.
* Bison-generated parsers now support the translation of diagnostics like
** Bison-generated parsers now support the translation of diagnostics like
"syntax error" into languages other than English. The default
language is still English. For details, please see the new
Internationalization section of the Bison manual. Software
distributors should also see the new PACKAGING file. Thanks to
Bruno Haible for this new feature.
* Wording in the Bison-generated parsers has been changed slightly to
** Wording in the Bison-generated parsers has been changed slightly to
simplify translation. In particular, the message "memory exhausted"
has replaced "parser stack overflow", as the old message was not
always accurate for modern Bison-generated parsers.
* Destructors are now called when the parser aborts, for all symbols left
** Destructors are now called when the parser aborts, for all symbols left
behind on the stack. Also, the start symbol is now destroyed after a
successful parse. In both cases, the behavior was formerly inconsistent.
* When generating verbose diagnostics, Bison-generated parsers no longer
** When generating verbose diagnostics, Bison-generated parsers no longer
quote the literal strings associated with tokens. For example, for
a syntax error associated with '%token NUM "number"' they might
print 'syntax error, unexpected number' instead of 'syntax error,
unexpected "number"'.
Changes in version 2.0, 2004-12-25:
* Changes in version 2.0, 2004-12-25:
* Possibly-incompatible changes
** Possibly-incompatible changes
- Bison-generated parsers no longer default to using the alloca function
(when available) to extend the parser stack, due to widespread
@@ -457,7 +482,7 @@ Changes in version 2.0, 2004-12-25:
- NUL bytes are no longer allowed in Bison string literals, unfortunately.
* New features
** New features
- GLR grammars now support locations.
@@ -479,7 +504,7 @@ Changes in version 2.0, 2004-12-25:
- New configure option --disable-yacc, to disable installation of the
yacc command and -ly library introduced in 1.875 for POSIX conformance.
* Bug fixes
** Bug fixes
- For now, %expect-count violations are now just warnings, not errors.
This is for compatibility with Bison 1.75 and earlier (when there are
@@ -493,12 +518,12 @@ Changes in version 2.0, 2004-12-25:
- Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
Changes in version 1.875, 2003-01-01:
* Changes in version 1.875, 2003-01-01:
* The documentation license has been upgraded to version 1.2
** The documentation license has been upgraded to version 1.2
of the GNU Free Documentation License.
* syntax error processing
** syntax error processing
- In Yacc-style parsers YYLLOC_DEFAULT is now used to compute error
locations too. This fixes bugs in error-location computation.
@@ -513,7 +538,7 @@ Changes in version 1.875, 2003-01-01:
- #defining yyerror to steal internal variables is discouraged.
It is not guaranteed to work forever.
* POSIX conformance
** POSIX conformance
- Semicolons are once again optional at the end of grammar rules.
This reverts to the behavior of Bison 1.33 and earlier, and improves
@@ -546,7 +571,7 @@ Changes in version 1.875, 2003-01-01:
using typedef instead of defining it as a macro.
For consistency, YYLTYPE is also declared instead of defined.
* Other compatibility issues
** Other compatibility issues
- %union directives can now have a tag before the `{', e.g., the
directive `%union foo {...}' now generates the C code
@@ -565,7 +590,7 @@ Changes in version 1.875, 2003-01-01:
typedefs or tags; they are no longer documented and are planned to be
withdrawn in a future release.
* GLR parser notes
** GLR parser notes
- GLR and inline
Users of Bison have to decide how they handle the portability of the
@@ -574,32 +599,32 @@ Changes in version 1.875, 2003-01-01:
- `parsing stack overflow...' -> `parser stack overflow'
GLR parsers now report `parser stack overflow' as per the Bison manual.
* Bison now warns if it detects conflicting outputs to the same file,
** Bison now warns if it detects conflicting outputs to the same file,
e.g., it generates a warning for `bison -d -o foo.h foo.y' since
that command outputs both code and header to foo.h.
* #line in output files
** #line in output files
- --no-line works properly.
* Bison can no longer be built by a K&R C compiler; it requires C89 or
** Bison can no longer be built by a K&R C compiler; it requires C89 or
later to be built. This change originally took place a few versions
ago, but nobody noticed until we recently asked someone to try
building Bison with a K&R C compiler.
Changes in version 1.75, 2002-10-14:
* Changes in version 1.75, 2002-10-14:
* Bison should now work on 64-bit hosts.
** Bison should now work on 64-bit hosts.
* Indonesian translation thanks to Tedi Heriyanto.
** Indonesian translation thanks to Tedi Heriyanto.
* GLR parsers
** GLR parsers
Fix spurious parse errors.
* Pure parsers
** Pure parsers
Some people redefine yyerror to steal yyparse' private variables.
Reenable this trick until an official feature replaces it.
* Type Clashes
** Type Clashes
In agreement with POSIX and with other Yaccs, leaving a default
action is valid when $$ is untyped, and $1 typed:
@@ -609,7 +634,7 @@ Changes in version 1.75, 2002-10-14:
typed: ... untyped;
* Values of mid-rule actions
** Values of mid-rule actions
The following code:
foo: { ... } { $$ = $1; } ...
@@ -617,9 +642,9 @@ Changes in version 1.75, 2002-10-14:
was incorrectly rejected: $1 is defined in the second mid-rule
action, and is equal to the $$ of the first mid-rule action.
Changes in version 1.50, 2002-10-04:
* Changes in version 1.50, 2002-10-04:
* GLR parsing
** GLR parsing
The declaration
%glr-parser
causes Bison to produce a Generalized LR (GLR) parser, capable of handling
@@ -630,33 +655,33 @@ Changes in version 1.50, 2002-10-04:
Unfortunately Bison 1.50 does not work properly on 64-bit hosts
like the Alpha, so please stick to 32-bit hosts for now.
* Output Directory
** Output Directory
When not in Yacc compatibility mode, when the output file was not
specified, running `bison foo/bar.y' created `foo/bar.c'. It
now creates `bar.c'.
* Undefined token
** Undefined token
The undefined token was systematically mapped to 2 which prevented
the use of 2 by the user. This is no longer the case.
* Unknown token numbers
** Unknown token numbers
If yylex returned an out of range value, yyparse could die. This is
no longer the case.
* Error token
** Error token
According to POSIX, the error token must be 256.
Bison extends this requirement by making it a preference: *if* the
user specified that one of her tokens is numbered 256, then error
will be mapped onto another number.
* Verbose error messages
** Verbose error messages
They no longer report `..., expecting error or...' for states where
error recovery is possible.
* End token
** End token
Defaults to `$end' instead of `$'.
* Error recovery now conforms to documentation and to POSIX
** Error recovery now conforms to documentation and to POSIX
When a Bison-generated parser encounters a syntax error, it now pops
the stack until it finds a state that allows shifting the error
token. Formerly, it popped the stack until it found a state that
@@ -666,32 +691,32 @@ Changes in version 1.50, 2002-10-04:
Paul Eggert, "Reductions during Bison error handling" (2002-05-20)
<http://lists.gnu.org/archive/html/bug-bison/2002-05/msg00038.html>.
* Traces
** Traces
Popped tokens and nonterminals are now reported.
* Larger grammars
** Larger grammars
Larger grammars are now supported (larger token numbers, larger grammar
size (= sum of the LHS and RHS lengths), larger LALR tables).
Formerly, many of these numbers ran afoul of 16-bit limits;
now these limits are 32 bits on most hosts.
* Explicit initial rule
** Explicit initial rule
Bison used to play hacks with the initial rule, which the user does
not write. It is now explicit, and visible in the reports and
graphs as rule 0.
* Useless rules
** Useless rules
Before, Bison reported the useless rules, but, although not used,
included them in the parsers. They are now actually removed.
* Useless rules, useless nonterminals
** Useless rules, useless nonterminals
They are now reported, as a warning, with their locations.
* Rules never reduced
** Rules never reduced
Rules that can never be reduced because of conflicts are now
reported.
* Incorrect `Token not used'
** Incorrect `Token not used'
On a grammar such as
%token useless useful
@@ -701,16 +726,16 @@ Changes in version 1.50, 2002-10-04:
where a token was used to set the precedence of the last rule,
bison reported both `useful' and `useless' as useless tokens.
* Revert the C++ namespace changes introduced in 1.31
** Revert the C++ namespace changes introduced in 1.31
as they caused too many portability hassles.
* Default locations
** Default locations
By an accident of design, the default computation of @$ was
performed after another default computation was performed: @$ = @1.
The latter is now removed: YYLLOC_DEFAULT is fully responsible of
the computation of @$.
* Token end-of-file
** Token end-of-file
The token end of file may be specified by the user, in which case,
the user symbol is used in the reports, the graphs, and the verbose
error messages instead of `$end', which remains being the default.
@@ -719,22 +744,22 @@ Changes in version 1.50, 2002-10-04:
or
%token MYEOF 0 "end of file"
* Semantic parser
** Semantic parser
This old option, which has been broken for ages, is removed.
* New translations
** New translations
Brazilian Portuguese, thanks to Alexandre Folle de Menezes.
Croatian, thanks to Denis Lackovic.
* Incorrect token definitions
** Incorrect token definitions
When given `%token 'a' "A"', Bison used to output `#define 'a' 65'.
* Token definitions as enums
** Token definitions as enums
Tokens are output both as the traditional #define's, and, provided
the compiler supports ANSI C or is a C++ compiler, as enums.
This lets debuggers display names instead of integers.
* Reports
** Reports
In addition to --verbose, bison supports --report=THINGS, which
produces additional information:
- itemset
@@ -746,7 +771,7 @@ Changes in version 1.50, 2002-10-04:
Bison used to systematically output this information on top of
the report. Solved conflicts are now attached to their states.
* Type clashes
** Type clashes
Previous versions don't complain when there is a type clash on
the default action if the rule has a mid-rule action, such as in:
@@ -756,11 +781,11 @@ Changes in version 1.50, 2002-10-04:
This is fixed.
* GNU M4 is now required when using Bison.
** GNU M4 is now required when using Bison.
Changes in version 1.35, 2002-03-25:
* Changes in version 1.35, 2002-03-25:
* C Skeleton
** C Skeleton
Some projects use Bison's C parser with C++ compilers, and define
YYSTYPE as a class. The recent adjustment of C parsers for data
alignment and 64 bit architectures made this impossible.
@@ -773,234 +798,234 @@ Changes in version 1.35, 2002-03-25:
This kludge also addresses some C++ problems when the stack was
extended.
Changes in version 1.34, 2002-03-12:
* Changes in version 1.34, 2002-03-12:
* File name clashes are detected
** File name clashes are detected
$ bison foo.y -d -o foo.x
fatal error: header and parser would both be named `foo.x'
* A missing `;' at the end of a rule triggers a warning
** A missing `;' at the end of a rule triggers a warning
In accordance with POSIX, and in agreement with other
Yacc implementations, Bison will mandate this semicolon in the near
future. This eases the implementation of a Bison parser of Bison
grammars by making this grammar LALR(1) instead of LR(2). To
facilitate the transition, this release introduces a warning.
* Revert the C++ namespace changes introduced in 1.31, as they caused too
** Revert the C++ namespace changes introduced in 1.31, as they caused too
many portability hassles.
* DJGPP support added.
** DJGPP support added.
* Fix test suite portability problems.
** Fix test suite portability problems.
Changes in version 1.33, 2002-02-07:
* Changes in version 1.33, 2002-02-07:
* Fix C++ issues
** Fix C++ issues
Groff could not be compiled for the definition of size_t was lacking
under some conditions.
* Catch invalid @n
** Catch invalid @n
As is done with $n.
Changes in version 1.32, 2002-01-23:
* Changes in version 1.32, 2002-01-23:
* Fix Yacc output file names
** Fix Yacc output file names
* Portability fixes
** Portability fixes
* Italian, Dutch translations
** Italian, Dutch translations
Changes in version 1.31, 2002-01-14:
* Changes in version 1.31, 2002-01-14:
* Many Bug Fixes
** Many Bug Fixes
* GNU Gettext and %expect
** GNU Gettext and %expect
GNU Gettext asserts 10 s/r conflicts, but there are 7. Now that
Bison dies on incorrect %expectations, we fear there will be
too many bug reports for Gettext, so _for the time being_, %expect
does not trigger an error when the input file is named `plural.y'.
* Use of alloca in parsers
** Use of alloca in parsers
If YYSTACK_USE_ALLOCA is defined to 0, then the parsers will use
malloc exclusively. Since 1.29, but was not NEWS'ed.
alloca is used only when compiled with GCC, to avoid portability
problems as on AIX.
* yyparse now returns 2 if memory is exhausted; formerly it dumped core.
** yyparse now returns 2 if memory is exhausted; formerly it dumped core.
* When the generated parser lacks debugging code, YYDEBUG is now 0
** When the generated parser lacks debugging code, YYDEBUG is now 0
(as POSIX requires) instead of being undefined.
* User Actions
** User Actions
Bison has always permitted actions such as { $$ = $1 }: it adds the
ending semicolon. Now if in Yacc compatibility mode, the semicolon
is no longer output: one has to write { $$ = $1; }.
* Better C++ compliance
** Better C++ compliance
The output parsers try to respect C++ namespaces.
[This turned out to be a failed experiment, and it was reverted later.]
* Reduced Grammars
** Reduced Grammars
Fixed bugs when reporting useless nonterminals.
* 64 bit hosts
** 64 bit hosts
The parsers work properly on 64 bit hosts.
* Error messages
** Error messages
Some calls to strerror resulted in scrambled or missing error messages.
* %expect
** %expect
When the number of shift/reduce conflicts is correct, don't issue
any warning.
* The verbose report includes the rule line numbers.
** The verbose report includes the rule line numbers.
* Rule line numbers are fixed in traces.
** Rule line numbers are fixed in traces.
* Swedish translation
** Swedish translation
* Parse errors
** Parse errors
Verbose parse error messages from the parsers are better looking.
Before: parse error: unexpected `'/'', expecting `"number"' or `'-'' or `'(''
Now: parse error: unexpected '/', expecting "number" or '-' or '('
* Fixed parser memory leaks.
** Fixed parser memory leaks.
When the generated parser was using malloc to extend its stacks, the
previous allocations were not freed.
* Fixed verbose output file.
** Fixed verbose output file.
Some newlines were missing.
Some conflicts in state descriptions were missing.
* Fixed conflict report.
** Fixed conflict report.
Option -v was needed to get the result.
* %expect
** %expect
Was not used.
Mismatches are errors, not warnings.
* Fixed incorrect processing of some invalid input.
** Fixed incorrect processing of some invalid input.
* Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
** Fixed CPP guards: 9foo.h uses BISON_9FOO_H instead of 9FOO_H.
* Fixed some typos in the documentation.
** Fixed some typos in the documentation.
* %token MY_EOF 0 is supported.
** %token MY_EOF 0 is supported.
Before, MY_EOF was silently renumbered as 257.
* doc/refcard.tex is updated.
** doc/refcard.tex is updated.
* %output, %file-prefix, %name-prefix.
** %output, %file-prefix, %name-prefix.
New.
* --output
** --output
New, aliasing `--output-file'.
Changes in version 1.30, 2001-10-26:
* Changes in version 1.30, 2001-10-26:
* `--defines' and `--graph' have now an optional argument which is the
** `--defines' and `--graph' have now an optional argument which is the
output file name. `-d' and `-g' do not change; they do not take any
argument.
* `%source_extension' and `%header_extension' are removed, failed
** `%source_extension' and `%header_extension' are removed, failed
experiment.
* Portability fixes.
** Portability fixes.
Changes in version 1.29, 2001-09-07:
* Changes in version 1.29, 2001-09-07:
* The output file does not define const, as this caused problems when used
** The output file does not define const, as this caused problems when used
with common autoconfiguration schemes. If you still use ancient compilers
that lack const, compile with the equivalent of the C compiler option
`-Dconst='. autoconf's AC_C_CONST macro provides one way to do this.
* Added `-g' and `--graph'.
** Added `-g' and `--graph'.
* The Bison manual is now distributed under the terms of the GNU FDL.
** The Bison manual is now distributed under the terms of the GNU FDL.
* The input and the output files has automatically a similar extension.
** The input and the output files has automatically a similar extension.
* Russian translation added.
** Russian translation added.
* NLS support updated; should hopefully be less troublesome.
** NLS support updated; should hopefully be less troublesome.
* Added the old Bison reference card.
** Added the old Bison reference card.
* Added `--locations' and `%locations'.
** Added `--locations' and `%locations'.
* Added `-S' and `--skeleton'.
** Added `-S' and `--skeleton'.
* `%raw', `-r', `--raw' is disabled.
** `%raw', `-r', `--raw' is disabled.
* Special characters are escaped when output. This solves the problems
** Special characters are escaped when output. This solves the problems
of the #line lines with path names including backslashes.
* New directives.
** New directives.
`%yacc', `%fixed_output_files', `%defines', `%no_parser', `%verbose',
`%debug', `%source_extension' and `%header_extension'.
* @$
** @$
Automatic location tracking.
Changes in version 1.28, 1999-07-06:
* Changes in version 1.28, 1999-07-06:
* Should compile better now with K&R compilers.
** Should compile better now with K&R compilers.
* Added NLS.
** Added NLS.
* Fixed a problem with escaping the double quote character.
** Fixed a problem with escaping the double quote character.
* There is now a FAQ.
** There is now a FAQ.
Changes in version 1.27:
* Changes in version 1.27:
* The make rule which prevented bison.simple from being created on
** The make rule which prevented bison.simple from being created on
some systems has been fixed.
Changes in version 1.26:
* Changes in version 1.26:
* Bison now uses automake.
** Bison now uses automake.
* New mailing lists: <[email protected]> and <[email protected]>.
** New mailing lists: <[email protected]> and <[email protected]>.
* Token numbers now start at 257 as previously documented, not 258.
** Token numbers now start at 257 as previously documented, not 258.
* Bison honors the TMPDIR environment variable.
** Bison honors the TMPDIR environment variable.
* A couple of buffer overruns have been fixed.
** A couple of buffer overruns have been fixed.
* Problems when closing files should now be reported.
** Problems when closing files should now be reported.
* Generated parsers should now work even on operating systems which do
** Generated parsers should now work even on operating systems which do
not provide alloca().
Changes in version 1.25, 1995-10-16:
* Changes in version 1.25, 1995-10-16:
* Errors in the input grammar are not fatal; Bison keeps reading
** Errors in the input grammar are not fatal; Bison keeps reading
the grammar file, and reports all the errors found in it.
* Tokens can now be specified as multiple-character strings: for
** Tokens can now be specified as multiple-character strings: for
example, you could use "<=" for a token which looks like <=, instead
of chosing a name like LESSEQ.
* The %token_table declaration says to write a table of tokens (names
** The %token_table declaration says to write a table of tokens (names
and numbers) into the parser file. The yylex function can use this
table to recognize multiple-character string tokens, or for other
purposes.
* The %no_lines declaration says not to generate any #line preprocessor
** The %no_lines declaration says not to generate any #line preprocessor
directives in the parser file.
* The %raw declaration says to use internal Bison token numbers, not
** The %raw declaration says to use internal Bison token numbers, not
Yacc-compatible token numbers, when token names are defined as macros.
* The --no-parser option produces the parser tables without including
** The --no-parser option produces the parser tables without including
the parser engine; a project can now use its own parser engine.
The actions go into a separate file called NAME.act, in the form of
a switch statement body.
Changes in version 1.23:
* Changes in version 1.23:
The user can define YYPARSE_PARAM as the name of an argument to be
passed into yyparse. The argument should have type void *. It should
@@ -1009,11 +1034,11 @@ by casting it to the proper pointer type.
Line numbers in output file corrected.
Changes in version 1.22:
* Changes in version 1.22:
--help option added.
Changes in version 1.20:
* Changes in version 1.20:
Output file does not redefine const for C++.
+2
View File
@@ -22,6 +22,7 @@ Charles-Henri de Boysson [email protected]
Christian Burger [email protected]
Cris Bailiff [email protected]
Cris van Pelt [email protected]
Csaba Raduly [email protected]
Daniel Hagerty [email protected]
David J. MacKenzie [email protected]
Derek M. Jones [email protected]
@@ -79,6 +80,7 @@ Robert Anisko [email protected]
Satya Kiran Popuri [email protected]
Sebastien Fricker [email protected]
Sebastian Setzer [email protected]
Sergei Steshenko [email protected]
Shura [email protected]
Steve Murphy [email protected]
Tim Josling [email protected]
+2 -7
View File
@@ -21,13 +21,8 @@ gnulib_modules='
dirname error extensions fopen-safer getopt gettext git-version-gen
gnumakefile hash inttypes javacomp-script javaexec-script malloc
mbswidth obstack quote quotearg stdbool stpcpy strerror strtoul
strverscmp unistd unistd-safer unlocked-io unsetenv verify xalloc
xalloc-die xstrndup
'
# Any gnulib files needed that are not in modules.
gnulib_files='
m4/warning.m4
strverscmp unistd unistd-safer unlocked-io unsetenv verify
warnings xalloc xalloc-die xstrndup
'
# Additional xgettext options to use. Use "\\\newline" to break lines.
+4 -4
View File
@@ -14,11 +14,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# It's useful to run maintainer-check* targets during development, but we don't
# want to wait on a recompile because of an update to $(VERSION). Thus,
# override the _is-dist-target from GNUmakefile so that maintainer-check*
# It's useful to run maintainer-*check* targets during development, but we
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
# override the _is-dist-target from GNUmakefile so that maintainer-*check*
# targets are filtered out.
_is-dist-target = $(filter-out %clean maintainer-check%, \
_is-dist-target = $(filter-out %clean maintainer-check% maintainer-%-check, \
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
# Use alpha.gnu.org for alpha and beta releases.
+16 -16
View File
@@ -51,23 +51,23 @@ AC_ARG_ENABLE(gcc-warnings,
esac],
[enableval=no])
if test "${enableval}" = yes; then
gl_WARNING_CFLAGS([-Werror])
AC_SUBST([WERROR_CFLAGS], [$WARNING_CFLAGS])
WARNING_CFLAGS=
gl_WARNING_CFLAGS([-Wall])
gl_WARNING_CFLAGS([-Wextra -Wno-sign-compare])
gl_WARNING_CFLAGS([-Wcast-align])
gl_WARNING_CFLAGS([-Wcast-qual])
gl_WARNING_CFLAGS([-Wformat])
gl_WARNING_CFLAGS([-Wpointer-arith])
gl_WARNING_CFLAGS([-Wwrite-strings])
AC_SUBST([WARNING_CXXFLAGS], [$WARNING_CFLAGS])
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
AC_SUBST([WERROR_CFLAGS])
gl_WARN_ADD([-Wall])
gl_WARN_ADD([-Wextra -Wno-sign-compare])
gl_WARN_ADD([-Wcast-align])
gl_WARN_ADD([-Wcast-qual])
gl_WARN_ADD([-Wformat])
gl_WARN_ADD([-Wpointer-arith])
gl_WARN_ADD([-Wwrite-strings])
AC_SUBST([WARN_CXXFLAGS], [$WARN_CFLAGS])
# The following warnings are not suitable for C++.
gl_WARNING_CFLAGS([-Wbad-function-cast])
gl_WARNING_CFLAGS([-Wmissing-declarations])
gl_WARNING_CFLAGS([-Wmissing-prototypes])
gl_WARNING_CFLAGS([-Wshadow])
gl_WARNING_CFLAGS([-Wstrict-prototypes])
gl_WARN_ADD([-Wbad-function-cast])
gl_WARN_ADD([-Wmissing-declarations])
gl_WARN_ADD([-Wmissing-prototypes])
gl_WARN_ADD([-Wshadow])
gl_WARN_ADD([-Wstrict-prototypes])
AC_SUBST([WARN_CFLAGS])
AC_DEFINE([lint], 1, [Define to 1 if the compiler is checking for lint.])
fi
+34 -7
View File
@@ -1,31 +1,58 @@
-*- outline -*-
This directory contains Bison skeletons: the general shapes of the
different parser kinds, that are specialized for specific grammars by
the bison program.
This directory contains data needed by Bison.
Currently, there are only three supported skeletons:
* Skeletons
Bison skeletons: the general shapes of the different parser kinds,
that are specialized for specific grammars by the bison program.
Currently, the supported skeletons are:
- yacc.c
It used to be named bison.simple: it corresponds to C Yacc
compatible LALR(1) parsers.
- lalr1.cc
Produces a C++ parser class. It is still very experimental, and not
yet supported. Please, subscribe to [email protected].
Produces a C++ parser class.
- lalr1.java
Produces a Java parser class.
- glr.c
A Generalized LR C parser based on Bison's LALR(1) tables.
- glr.cc
A Generalized LR C++ parser. Actually a C++ wrapper around glr.c.
These skeletons are the only ones supported by the Bison team.
Because the interface between skeletons and the bison program is not
finished, *we are not bound to it*. In particular, Bison is not
mature enough for us to consider that ``foreign skeletons'' are
supported.
* m4sugar
This directory contains M4sugar, sort of an extended library for M4,
which is used by Bison to instantiate the skeletons.
* xslt
This directory contains XSLT programs that transform Bison's XML output
into various formats.
- bison.xsl
A library of routines used by the other XSLT programs.
- xml2dot.xsl
Conversion into GraphViz's dot format.
- xml2text.xsl
Conversion into text.
- xml2xhtml.xsl
Conversion into XHTML.
-----
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2008 Free Software Foundation, Inc.
This file is part of GNU Bison.
+4 -4
View File
@@ -1,8 +1,8 @@
-*- C -*-
# GLR skeleton for Bison
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
# Inc.
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 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
@@ -2644,10 +2644,10 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C],
b4_shared_declarations
b4_pure_if([],
[[extern YYSTYPE b4_prefix][lval;]])
[[extern YYSTYPE ]b4_prefix[lval;]])
b4_locations_if([b4_pure_if([],
[extern YYLTYPE b4_prefix[]lloc;])
[extern YYLTYPE ]b4_prefix[lloc;])
])
])])
m4_divert_pop(0)
+174 -172
View File
@@ -89,76 +89,76 @@ Cover art by Etienne Suvasa.
@menu
* Introduction::
* Conditions::
* Copying:: The @acronym{GNU} General Public License says
how you can copy and share Bison
* Copying:: The @acronym{GNU} General Public License says
how you can copy and share Bison.
Tutorial sections:
* Concepts:: Basic concepts for understanding Bison.
* Examples:: Three simple explained examples of using Bison.
* Concepts:: Basic concepts for understanding Bison.
* Examples:: Three simple explained examples of using Bison.
Reference sections:
* Grammar File:: Writing Bison declarations and rules.
* Interface:: C-language interface to the parser function @code{yyparse}.
* Algorithm:: How the Bison parser works at run-time.
* Error Recovery:: Writing rules for error recovery.
* Grammar File:: Writing Bison declarations and rules.
* Interface:: C-language interface to the parser function @code{yyparse}.
* Algorithm:: How the Bison parser works at run-time.
* Error Recovery:: Writing rules for error recovery.
* Context Dependency:: What to do if your language syntax is too
messy for Bison to handle straightforwardly.
* Debugging:: Understanding or debugging Bison parsers.
* Invocation:: How to run Bison (to produce the parser source file).
* Other Languages:: Creating C++ and Java parsers.
* FAQ:: Frequently Asked Questions
* Table of Symbols:: All the keywords of the Bison language are explained.
* Glossary:: Basic concepts are explained.
* Copying This Manual:: License for copying this manual.
* Index:: Cross-references to the text.
messy for Bison to handle straightforwardly.
* Debugging:: Understanding or debugging Bison parsers.
* Invocation:: How to run Bison (to produce the parser source file).
* Other Languages:: Creating C++ and Java parsers.
* FAQ:: Frequently Asked Questions
* Table of Symbols:: All the keywords of the Bison language are explained.
* Glossary:: Basic concepts are explained.
* Copying This Manual:: License for copying this manual.
* Index:: Cross-references to the text.
@detailmenu
--- The Detailed Node Listing ---
The Concepts of Bison
* Language and Grammar:: Languages and context-free grammars,
as mathematical ideas.
* Grammar in Bison:: How we represent grammars for Bison's sake.
* Semantic Values:: Each token or syntactic grouping can have
a semantic value (the value of an integer,
the name of an identifier, etc.).
* Semantic Actions:: Each rule can have an action containing C code.
* GLR Parsers:: Writing parsers for general context-free languages.
* Locations Overview:: Tracking Locations.
* Bison Parser:: What are Bison's input and output,
how is the output used?
* Stages:: Stages in writing and running Bison grammars.
* Grammar Layout:: Overall structure of a Bison grammar file.
* Language and Grammar:: Languages and context-free grammars,
as mathematical ideas.
* Grammar in Bison:: How we represent grammars for Bison's sake.
* Semantic Values:: Each token or syntactic grouping can have
a semantic value (the value of an integer,
the name of an identifier, etc.).
* Semantic Actions:: Each rule can have an action containing C code.
* GLR Parsers:: Writing parsers for general context-free languages.
* Locations Overview:: Tracking Locations.
* Bison Parser:: What are Bison's input and output,
how is the output used?
* Stages:: Stages in writing and running Bison grammars.
* Grammar Layout:: Overall structure of a Bison grammar file.
Writing @acronym{GLR} Parsers
* Simple GLR Parsers:: Using @acronym{GLR} parsers on unambiguous grammars.
* Merging GLR Parses:: Using @acronym{GLR} parsers to resolve ambiguities.
* GLR Semantic Actions:: Deferred semantic actions have special concerns.
* Compiler Requirements:: @acronym{GLR} parsers require a modern C compiler.
* Simple GLR Parsers:: Using @acronym{GLR} parsers on unambiguous grammars.
* Merging GLR Parses:: Using @acronym{GLR} parsers to resolve ambiguities.
* GLR Semantic Actions:: Deferred semantic actions have special concerns.
* Compiler Requirements:: @acronym{GLR} parsers require a modern C compiler.
Examples
* RPN Calc:: Reverse polish notation calculator;
a first example with no operator precedence.
* Infix Calc:: Infix (algebraic) notation calculator.
Operator precedence is introduced.
* RPN Calc:: Reverse polish notation calculator;
a first example with no operator precedence.
* Infix Calc:: Infix (algebraic) notation calculator.
Operator precedence is introduced.
* Simple Error Recovery:: Continuing after syntax errors.
* Location Tracking Calc:: Demonstrating the use of @@@var{n} and @@$.
* Multi-function Calc:: Calculator with memory and trig functions.
It uses multiple data-types for semantic values.
* Exercises:: Ideas for improving the multi-function calculator.
* Multi-function Calc:: Calculator with memory and trig functions.
It uses multiple data-types for semantic values.
* Exercises:: Ideas for improving the multi-function calculator.
Reverse Polish Notation Calculator
* Decls: Rpcalc Decls. Prologue (declarations) for rpcalc.
* Rules: Rpcalc Rules. Grammar Rules for rpcalc, with explanation.
* Lexer: Rpcalc Lexer. The lexical analyzer.
* Main: Rpcalc Main. The controlling function.
* Error: Rpcalc Error. The error reporting function.
* Gen: Rpcalc Gen. Running Bison on the grammar file.
* Comp: Rpcalc Compile. Run the C compiler on the output code.
* Rpcalc Declarations:: Prologue (declarations) for rpcalc.
* Rpcalc Rules:: Grammar Rules for rpcalc, with explanation.
* Rpcalc Lexer:: The lexical analyzer.
* Rpcalc Main:: The controlling function.
* Rpcalc Error:: The error reporting function.
* Rpcalc Generate:: Running Bison on the grammar file.
* Rpcalc Compile:: Run the C compiler on the output code.
Grammar Rules for @code{rpcalc}
@@ -168,15 +168,15 @@ Grammar Rules for @code{rpcalc}
Location Tracking Calculator: @code{ltcalc}
* Decls: Ltcalc Decls. Bison and C declarations for ltcalc.
* Rules: Ltcalc Rules. Grammar rules for ltcalc, with explanations.
* Lexer: Ltcalc Lexer. The lexical analyzer.
* Ltcalc Declarations:: Bison and C declarations for ltcalc.
* Ltcalc Rules:: Grammar rules for ltcalc, with explanations.
* Ltcalc Lexer:: The lexical analyzer.
Multi-Function Calculator: @code{mfcalc}
* Decl: Mfcalc Decl. Bison declarations for multi-function calculator.
* Rules: Mfcalc Rules. Grammar rules for the calculator.
* Symtab: Mfcalc Symtab. Symbol table management subroutines.
* Mfcalc Declarations:: Bison declarations for multi-function calculator.
* Mfcalc Rules:: Grammar rules for the calculator.
* Mfcalc Symbol Table:: Symbol table management subroutines.
Bison Grammar Files
@@ -191,11 +191,11 @@ Bison Grammar Files
Outline of a Bison Grammar
* Prologue:: Syntax and usage of the prologue.
* Prologue:: Syntax and usage of the prologue.
* Prologue Alternatives:: Syntax and usage of alternatives to the prologue.
* Bison Declarations:: Syntax and usage of the Bison declarations section.
* Grammar Rules:: Syntax and usage of the grammar rules section.
* Epilogue:: Syntax and usage of the epilogue.
* Bison Declarations:: Syntax and usage of the Bison declarations section.
* Grammar Rules:: Syntax and usage of the grammar rules section.
* Epilogue:: Syntax and usage of the epilogue.
Defining Language Semantics
@@ -230,24 +230,28 @@ Bison Declarations
Parser C-Language Interface
* Parser Function:: How to call @code{yyparse} and what it returns.
* Lexical:: You must supply a function @code{yylex}
which reads tokens.
* Error Reporting:: You must supply a function @code{yyerror}.
* Action Features:: Special features for use in actions.
* Internationalization:: How to let the parser speak in the user's
native language.
* Parser Function:: How to call @code{yyparse} and what it returns.
* Push Parser Function:: How to call @code{yypush_parse} and what it returns.
* Pull Parser Function:: How to call @code{yypull_parse} and what it returns.
* Parser Create Function:: How to call @code{yypstate_new} and what it returns.
* Parser Delete Function:: How to call @code{yypstate_delete} and what it returns.
* Lexical:: You must supply a function @code{yylex}
which reads tokens.
* Error Reporting:: You must supply a function @code{yyerror}.
* Action Features:: Special features for use in actions.
* Internationalization:: How to let the parser speak in the user's
native language.
The Lexical Analyzer Function @code{yylex}
* Calling Convention:: How @code{yyparse} calls @code{yylex}.
* Token Values:: How @code{yylex} must return the semantic value
of the token it has read.
* Token Locations:: How @code{yylex} must return the text location
(line number, etc.) of the token, if the
actions want that.
* Pure Calling:: How the calling convention differs
in a pure parser (@pxref{Pure Decl, ,A Pure (Reentrant) Parser}).
* Token Values:: How @code{yylex} must return the semantic value
of the token it has read.
* Token Locations:: How @code{yylex} must return the text location
(line number, etc.) of the token, if the
actions want that.
* Pure Calling:: How the calling convention differs in a pure parser
(@pxref{Pure Decl, ,A Pure (Reentrant) Parser}).
The Bison Parser Algorithm
@@ -257,7 +261,7 @@ The Bison Parser Algorithm
* Contextual Precedence:: When an operator's precedence depends on context.
* Parser States:: The parser is a finite-state-machine with stack.
* Reduce/Reduce:: When two rules are applicable in the same situation.
* Mystery Conflicts:: Reduce/reduce conflicts that look unjustified.
* Mystery Conflicts:: Reduce/reduce conflicts that look unjustified.
* Generalized LR Parsing:: Parsing arbitrary context-free grammars.
* Memory Management:: What happens when memory is exhausted. How to avoid it.
@@ -311,33 +315,33 @@ A Complete C++ Example
Java Parsers
* Java Bison Interface:: Asking for Java parser generation
* Java Semantic Values:: %type and %token vs. Java
* Java Location Values:: The position and location classes
* Java Parser Interface:: Instantiating and running the parser
* Java Scanner Interface:: Specifying the scanner for the parser
* Java Action Features:: Special features for use in actions.
* Java Differences:: Differences between C/C++ and Java Grammars
* Java Declarations Summary:: List of Bison declarations used with Java
* Java Bison Interface:: Asking for Java parser generation
* Java Semantic Values:: %type and %token vs. Java
* Java Location Values:: The position and location classes
* Java Parser Interface:: Instantiating and running the parser
* Java Scanner Interface:: Specifying the scanner for the parser
* Java Action Features:: Special features for use in actions
* Java Differences:: Differences between C/C++ and Java Grammars
* Java Declarations Summary:: List of Bison declarations used with Java
Frequently Asked Questions
* Memory Exhausted:: Breaking the Stack Limits
* How Can I Reset the Parser:: @code{yyparse} Keeps some State
* Strings are Destroyed:: @code{yylval} Loses Track of Strings
* Implementing Gotos/Loops:: Control Flow in the Calculator
* Multiple start-symbols:: Factoring closely related grammars
* Secure? Conform?:: Is Bison @acronym{POSIX} safe?
* I can't build Bison:: Troubleshooting
* Where can I find help?:: Troubleshouting
* Bug Reports:: Troublereporting
* Other Languages:: Parsers in Java and others
* Beta Testing:: Experimenting development versions
* Mailing Lists:: Meeting other Bison users
* Memory Exhausted:: Breaking the Stack Limits
* How Can I Reset the Parser:: @code{yyparse} Keeps some State
* Strings are Destroyed:: @code{yylval} Loses Track of Strings
* Implementing Gotos/Loops:: Control Flow in the Calculator
* Multiple start-symbols:: Factoring closely related grammars
* Secure? Conform?:: Is Bison @acronym{POSIX} safe?
* I can't build Bison:: Troubleshooting
* Where can I find help?:: Troubleshouting
* Bug Reports:: Troublereporting
* More Languages:: Parsers in C++, Java, and so on
* Beta Testing:: Experimenting development versions
* Mailing Lists:: Meeting other Bison users
Copying This Manual
* Copying This Manual:: License for copying this manual.
* Copying This Manual:: License for copying this manual.
@end detailmenu
@end menu
@@ -417,19 +421,19 @@ details of Bison will not make sense. If you do not already know how to
use Bison or Yacc, we suggest you start by reading this chapter carefully.
@menu
* Language and Grammar:: Languages and context-free grammars,
as mathematical ideas.
* Grammar in Bison:: How we represent grammars for Bison's sake.
* Semantic Values:: Each token or syntactic grouping can have
a semantic value (the value of an integer,
the name of an identifier, etc.).
* Semantic Actions:: Each rule can have an action containing C code.
* GLR Parsers:: Writing parsers for general context-free languages.
* Locations Overview:: Tracking Locations.
* Bison Parser:: What are Bison's input and output,
how is the output used?
* Stages:: Stages in writing and running Bison grammars.
* Grammar Layout:: Overall structure of a Bison grammar file.
* Language and Grammar:: Languages and context-free grammars,
as mathematical ideas.
* Grammar in Bison:: How we represent grammars for Bison's sake.
* Semantic Values:: Each token or syntactic grouping can have
a semantic value (the value of an integer,
the name of an identifier, etc.).
* Semantic Actions:: Each rule can have an action containing C code.
* GLR Parsers:: Writing parsers for general context-free languages.
* Locations Overview:: Tracking Locations.
* Bison Parser:: What are Bison's input and output,
how is the output used?
* Stages:: Stages in writing and running Bison grammars.
* Grammar Layout:: Overall structure of a Bison grammar file.
@end menu
@node Language and Grammar
@@ -745,10 +749,10 @@ user-defined function on the resulting values to produce an arbitrary
merged result.
@menu
* Simple GLR Parsers:: Using @acronym{GLR} parsers on unambiguous grammars.
* Merging GLR Parses:: Using @acronym{GLR} parsers to resolve ambiguities.
* GLR Semantic Actions:: Deferred semantic actions have special concerns.
* Compiler Requirements:: @acronym{GLR} parsers require a modern C compiler.
* Simple GLR Parsers:: Using @acronym{GLR} parsers on unambiguous grammars.
* Merging GLR Parses:: Using @acronym{GLR} parsers to resolve ambiguities.
* GLR Semantic Actions:: Deferred semantic actions have special concerns.
* Compiler Requirements:: @acronym{GLR} parsers require a modern C compiler.
@end menu
@node Simple GLR Parsers
@@ -1376,15 +1380,15 @@ languages are written the same way. You can copy these examples into a
source file to try them.
@menu
* RPN Calc:: Reverse polish notation calculator;
a first example with no operator precedence.
* Infix Calc:: Infix (algebraic) notation calculator.
Operator precedence is introduced.
* RPN Calc:: Reverse polish notation calculator;
a first example with no operator precedence.
* Infix Calc:: Infix (algebraic) notation calculator.
Operator precedence is introduced.
* Simple Error Recovery:: Continuing after syntax errors.
* Location Tracking Calc:: Demonstrating the use of @@@var{n} and @@$.
* Multi-function Calc:: Calculator with memory and trig functions.
It uses multiple data-types for semantic values.
* Exercises:: Ideas for improving the multi-function calculator.
* Multi-function Calc:: Calculator with memory and trig functions.
It uses multiple data-types for semantic values.
* Exercises:: Ideas for improving the multi-function calculator.
@end menu
@node RPN Calc
@@ -1403,16 +1407,16 @@ The source code for this calculator is named @file{rpcalc.y}. The
@samp{.y} extension is a convention used for Bison input files.
@menu
* Decls: Rpcalc Decls. Prologue (declarations) for rpcalc.
* Rules: Rpcalc Rules. Grammar Rules for rpcalc, with explanation.
* Lexer: Rpcalc Lexer. The lexical analyzer.
* Main: Rpcalc Main. The controlling function.
* Error: Rpcalc Error. The error reporting function.
* Gen: Rpcalc Gen. Running Bison on the grammar file.
* Comp: Rpcalc Compile. Run the C compiler on the output code.
* Rpcalc Declarations:: Prologue (declarations) for rpcalc.
* Rpcalc Rules:: Grammar Rules for rpcalc, with explanation.
* Rpcalc Lexer:: The lexical analyzer.
* Rpcalc Main:: The controlling function.
* Rpcalc Error:: The error reporting function.
* Rpcalc Generate:: Running Bison on the grammar file.
* Rpcalc Compile:: Run the C compiler on the output code.
@end menu
@node Rpcalc Decls
@node Rpcalc Declarations
@subsection Declarations for @code{rpcalc}
Here are the C and Bison declarations for the reverse polish notation
@@ -1662,7 +1666,7 @@ therefore, @code{NUM} becomes a macro for @code{yylex} to use.
The semantic value of the token (if it has one) is stored into the
global variable @code{yylval}, which is where the Bison parser will look
for it. (The C data type of @code{yylval} is @code{YYSTYPE}, which was
defined at the beginning of the grammar; @pxref{Rpcalc Decls,
defined at the beginning of the grammar; @pxref{Rpcalc Declarations,
,Declarations for @code{rpcalc}}.)
A token type code of zero is returned if the end-of-input is encountered.
@@ -1758,7 +1762,7 @@ have not written any error rules in this example, so any invalid input will
cause the calculator program to exit. This is not clean behavior for a
real calculator, but it is adequate for the first example.
@node Rpcalc Gen
@node Rpcalc Generate
@subsection Running Bison to Make the Parser
@cindex running Bison (introduction)
@@ -1977,12 +1981,12 @@ most of the work needed to use locations will be done in the lexical
analyzer.
@menu
* Decls: Ltcalc Decls. Bison and C declarations for ltcalc.
* Rules: Ltcalc Rules. Grammar rules for ltcalc, with explanations.
* Lexer: Ltcalc Lexer. The lexical analyzer.
* Ltcalc Declarations:: Bison and C declarations for ltcalc.
* Ltcalc Rules:: Grammar rules for ltcalc, with explanations.
* Ltcalc Lexer:: The lexical analyzer.
@end menu
@node Ltcalc Decls
@node Ltcalc Declarations
@subsection Declarations for @code{ltcalc}
The C and Bison declarations for the location tracking calculator are
@@ -2218,12 +2222,12 @@ $
Note that multiple assignment and nested function calls are permitted.
@menu
* Decl: Mfcalc Decl. Bison declarations for multi-function calculator.
* Rules: Mfcalc Rules. Grammar rules for the calculator.
* Symtab: Mfcalc Symtab. Symbol table management subroutines.
* Mfcalc Declarations:: Bison declarations for multi-function calculator.
* Mfcalc Rules:: Grammar rules for the calculator.
* Mfcalc Symbol Table:: Symbol table management subroutines.
@end menu
@node Mfcalc Decl
@node Mfcalc Declarations
@subsection Declarations for @code{mfcalc}
Here are the C and Bison declarations for the multi-function calculator.
@@ -2319,7 +2323,7 @@ exp: NUM @{ $$ = $1; @}
%%
@end smallexample
@node Mfcalc Symtab
@node Mfcalc Symbol Table
@subsection The @code{mfcalc} Symbol Table
@cindex symbol table example
@@ -2632,11 +2636,11 @@ As a @acronym{GNU} extension, @samp{//} introduces a comment that
continues until end of line.
@menu
* Prologue:: Syntax and usage of the prologue.
* Prologue:: Syntax and usage of the prologue.
* Prologue Alternatives:: Syntax and usage of alternatives to the prologue.
* Bison Declarations:: Syntax and usage of the Bison declarations section.
* Grammar Rules:: Syntax and usage of the grammar rules section.
* Epilogue:: Syntax and usage of the epilogue.
* Bison Declarations:: Syntax and usage of the Bison declarations section.
* Grammar Rules:: Syntax and usage of the grammar rules section.
* Epilogue:: Syntax and usage of the epilogue.
@end menu
@node Prologue
@@ -5221,19 +5225,17 @@ identifier (aside from those in this manual) in an action or in epilogue
in the grammar file, you are likely to run into trouble.
@menu
* Parser Function:: How to call @code{yyparse} and what it returns.
* Push Parser Function:: How to call @code{yypush_parse} and what it returns.
* Pull Parser Function:: How to call @code{yypull_parse} and what it returns.
* Parser Create Function:: How to call @code{yypstate_new} and what it
returns.
* Parser Delete Function:: How to call @code{yypstate_delete} and what it
returns.
* Lexical:: You must supply a function @code{yylex}
which reads tokens.
* Error Reporting:: You must supply a function @code{yyerror}.
* Action Features:: Special features for use in actions.
* Internationalization:: How to let the parser speak in the user's
native language.
* Parser Function:: How to call @code{yyparse} and what it returns.
* Push Parser Function:: How to call @code{yypush_parse} and what it returns.
* Pull Parser Function:: How to call @code{yypull_parse} and what it returns.
* Parser Create Function:: How to call @code{yypstate_new} and what it returns.
* Parser Delete Function:: How to call @code{yypstate_delete} and what it returns.
* Lexical:: You must supply a function @code{yylex}
which reads tokens.
* Error Reporting:: You must supply a function @code{yyerror}.
* Action Features:: Special features for use in actions.
* Internationalization:: How to let the parser speak in the user's
native language.
@end menu
@node Parser Function
@@ -5400,13 +5402,13 @@ that need it. @xref{Invocation, ,Invoking Bison}.
@menu
* Calling Convention:: How @code{yyparse} calls @code{yylex}.
* Token Values:: How @code{yylex} must return the semantic value
of the token it has read.
* Token Locations:: How @code{yylex} must return the text location
(line number, etc.) of the token, if the
actions want that.
* Pure Calling:: How the calling convention differs
in a pure parser (@pxref{Pure Decl, ,A Pure (Reentrant) Parser}).
* Token Values:: How @code{yylex} must return the semantic value
of the token it has read.
* Token Locations:: How @code{yylex} must return the text location
(line number, etc.) of the token, if the
actions want that.
* Pure Calling:: How the calling convention differs in a pure parser
(@pxref{Pure Decl, ,A Pure (Reentrant) Parser}).
@end menu
@node Calling Convention
@@ -6049,7 +6051,7 @@ This kind of parser is known in the literature as a bottom-up parser.
* Contextual Precedence:: When an operator's precedence depends on context.
* Parser States:: The parser is a finite-state-machine with stack.
* Reduce/Reduce:: When two rules are applicable in the same situation.
* Mystery Conflicts:: Reduce/reduce conflicts that look unjustified.
* Mystery Conflicts:: Reduce/reduce conflicts that look unjustified.
* Generalized LR Parsing:: Parsing arbitrary context-free grammars.
* Memory Management:: What happens when memory is exhausted. How to avoid it.
@end menu
@@ -7653,7 +7655,7 @@ standard I/O stream, the numeric code for the token type, and the token
value (from @code{yylval}).
Here is an example of @code{YYPRINT} suitable for the multi-function
calculator (@pxref{Mfcalc Decl, ,Declarations for @code{mfcalc}}):
calculator (@pxref{Mfcalc Declarations, ,Declarations for @code{mfcalc}}):
@smallexample
%@{
@@ -8728,14 +8730,14 @@ main (int argc, char *argv[])
@section Java Parsers
@menu
* Java Bison Interface:: Asking for Java parser generation
* Java Semantic Values:: %type and %token vs. Java
* Java Location Values:: The position and location classes
* Java Parser Interface:: Instantiating and running the parser
* Java Scanner Interface:: Specifying the scanner for the parser
* Java Action Features:: Special features for use in actions.
* Java Differences:: Differences between C/C++ and Java Grammars
* Java Declarations Summary:: List of Bison declarations used with Java
* Java Bison Interface:: Asking for Java parser generation
* Java Semantic Values:: %type and %token vs. Java
* Java Location Values:: The position and location classes
* Java Parser Interface:: Instantiating and running the parser
* Java Scanner Interface:: Specifying the scanner for the parser
* Java Action Features:: Special features for use in actions
* Java Differences:: Differences between C/C++ and Java Grammars
* Java Declarations Summary:: List of Bison declarations used with Java
@end menu
@node Java Bison Interface
@@ -10357,7 +10359,7 @@ grammatically indivisible. The piece of text it represents is a token.
@c LocalWords: akim fn cp syncodeindex vr tp synindex dircategory direntry
@c LocalWords: ifset vskip pt filll insertcopying sp ISBN Etienne Suvasa
@c LocalWords: ifnottex yyparse detailmenu GLR RPN Calc var Decls Rpcalc
@c LocalWords: rpcalc Lexer Gen Comp Expr ltcalc mfcalc Decl Symtab yylex
@c LocalWords: rpcalc Lexer Expr ltcalc mfcalc yylex
@c LocalWords: yyerror pxref LR yylval cindex dfn LALR samp gpl BNF xref
@c LocalWords: const int paren ifnotinfo AC noindent emph expr stmt findex
@c LocalWords: glr YYSTYPE TYPENAME prog dprec printf decl init stmtMerge
+1 -1
Submodule gnulib updated: cdccece581...58fe6dca7b
+3 -2
View File
@@ -1,6 +1,7 @@
# Make bison/lib.
# Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2008 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,7 +18,7 @@
include gnulib.mk
AM_CFLAGS = $(WARNING_CFLAGS)
AM_CFLAGS = $(WARN_CFLAGS)
# Implementation of bitsets.
bitsets_sources = \
+1
View File
@@ -58,6 +58,7 @@ unistd-safer.m4
unistd_h.m4
unlocked-io.m4
warning.m4
warnings.m4
wchar.m4
wchar_t.m4
wctype.m4
+1
View File
@@ -58,6 +58,7 @@
/unistd_h.m4
/unlocked-io.m4
/warning.m4
/warnings.m4
/wchar.m4
/wchar_t.m4
/wctype.m4
+1 -1
View File
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)/lib
AM_YFLAGS = "-dv"
+4 -4
View File
@@ -70,9 +70,9 @@ static struct bison_language const valid_languages[] = {
{ "", "", "", "", false }
};
static int skeleton_prio = 2;
int skeleton_prio = default_prio;
const char *skeleton = NULL;
static int language_prio = 2;
int language_prio = default_prio;
struct bison_language const *language = &valid_languages[0];
const char *include = NULL;
@@ -520,11 +520,11 @@ getargs (int argc, char *argv[])
break;
case 'L':
language_argmatch (optarg, 0, NULL);
language_argmatch (optarg, command_line_prio, NULL);
break;
case 'S':
skeleton_arg (AS_FILE_NAME (optarg), 0, NULL);
skeleton_arg (AS_FILE_NAME (optarg), command_line_prio, NULL);
break;
case 'T':
+4 -1
View File
@@ -1,7 +1,7 @@
/* Parse command line arguments for bison.
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007 Free Software Foundation, Inc.
2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -24,11 +24,13 @@
#include "location.h"
extern char *program_name;
enum { command_line_prio, grammar_prio, default_prio };
/* flags set by % directives */
/* for -S */
extern char const *skeleton;
extern int skeleton_prio;
/* for -I */
extern char const *include;
@@ -68,6 +70,7 @@ struct bison_language
bool add_tab;
};
extern int language_prio;
extern struct bison_language const *language;
/*-----------.
+4 -4
View File
@@ -1,5 +1,5 @@
/* A Bison parser, made by GNU Bison 2.3b.21-d67c5-dirty. */
/* A Bison parser, made by GNU Bison 2.4.4-738cd. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
@@ -46,7 +46,7 @@
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "2.3b.21-d67c5-dirty"
#define YYBISON_VERSION "2.4.4-738cd"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -1994,7 +1994,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 257 "parse-gram.y"
{ language_argmatch ((yyvsp[(2) - (2)].chars), 1, &(yylsp[(1) - (2)])); }
{ language_argmatch ((yyvsp[(2) - (2)].chars), grammar_prio, &(yylsp[(1) - (2)])); }
break;
case 19:
@@ -2110,7 +2110,7 @@ yyreduce:
skeleton_user = uniqstr_new (skeleton_build);
free (skeleton_build);
}
skeleton_arg (skeleton_user, 1, &(yylsp[(1) - (2)]));
skeleton_arg (skeleton_user, grammar_prio, &(yylsp[(1) - (2)]));
}
break;
+1 -1
View File
@@ -1,5 +1,5 @@
/* A Bison parser, made by GNU Bison 2.3b.21-d67c5-dirty. */
/* A Bison parser, made by GNU Bison 2.4.4-738cd. */
/* Skeleton interface for Bison's Yacc-like parsers in C
+2 -2
View File
@@ -254,7 +254,7 @@ prologue_declaration:
muscle_code_grow ("initial_action", action.code, @2);
code_scanner_last_string_free ();
}
| "%language" STRING { language_argmatch ($2, 1, &@1); }
| "%language" STRING { language_argmatch ($2, grammar_prio, &@1); }
| "%lex-param" "{...}" { add_param ("lex_param", $2, @2); }
| "%locations" { locations_flag = true; }
| "%name-prefix" STRING { spec_name_prefix = $2; }
@@ -300,7 +300,7 @@ prologue_declaration:
skeleton_user = uniqstr_new (skeleton_build);
free (skeleton_build);
}
skeleton_arg (skeleton_user, 1, &@1);
skeleton_arg (skeleton_user, grammar_prio, &@1);
}
| "%token-table" { token_table_flag = true; }
| "%verbose" { report_flag |= report_states; }
+7 -4
View File
@@ -1,6 +1,6 @@
/* Bison Action Scanner -*- C -*-
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -170,12 +170,14 @@ splice (\\[ \f\t\v]*\n)*
"{" STRING_GROW; ++braces_level;
"}" {
bool outer_brace = --braces_level < 0;
bool outer_brace = --braces_level == 0;
/* As an undocumented Bison extension, append `;' before the last
brace in braced code, so that the user code can omit trailing
`;'. But do not append `;' if emulating Yacc, since Yacc does
not append one.
not append one. Also, some output languages (like Java) do not
accept an extra semicolon, so don't append if the user specified
a skeleton or language.
FIXME: Bison should warn if a semicolon seems to be necessary
here, and should omit the semicolon if it seems unnecessary
@@ -186,7 +188,8 @@ splice (\\[ \f\t\v]*\n)*
should also diagnose other Bison extensions like %yacc.
Perhaps there should also be a GCC-style --pedantic-errors
option, so that such warnings are diagnosed as errors. */
if (outer_brace && ! yacc_flag)
if (outer_brace && !yacc_flag && language_prio == default_prio
&& skeleton_prio == default_prio)
obstack_1grow (&obstack_for_string, ';');
STRING_GROW;
+4 -4
View File
@@ -1,14 +1,14 @@
# @configure_input@ -*- shell-script -*-
# Configurable variable values for Bison test suite.
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
# Foundation, Inc.
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free
# Software Foundation, Inc.
# We need a C compiler.
CC='@CC@'
# We want no optimization.
CFLAGS='@O0CFLAGS@ @WARNING_CFLAGS@ @WERROR_CFLAGS@'
CFLAGS='@O0CFLAGS@ @WARN_CFLAGS@ @WERROR_CFLAGS@'
# We need `config.h'.
CPPFLAGS="-I$abs_top_builddir/lib @CPPFLAGS@"
@@ -23,7 +23,7 @@ CXX='@CXX@'
BISON_CXX_WORKS='@BISON_CXX_WORKS@'
# We want no optimization with C++, too.
CXXFLAGS='@O0CXXFLAGS@ @WARNING_CXXFLAGS@ @WERROR_CFLAGS@'
CXXFLAGS='@O0CXXFLAGS@ @WARN_CXXFLAGS@ @WERROR_CFLAGS@'
# Are special link options needed?
LDFLAGS='@LDFLAGS@'
+162 -154
View File
@@ -1,7 +1,7 @@
# Simple calculator. -*- Autotest -*-
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
# Foundation, Inc.
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 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
@@ -28,21 +28,162 @@
# _AT_DATA_CALC_Y($1, $2, $3, [BISON-DIRECTIVES])
# -----------------------------------------------
# Produce `calc.y'. Don't call this macro directly, because it contains
# some occurrences of `$1' etc. which will be interpreted by m4. So
# you should call it with $1, $2, and $3 as arguments, which is what
# AT_DATA_CALC_Y does.
# Produce `calc.y' and, if %defines was specified, `calc-lex.c' or
# `calc-lex.cc'.
#
# Don't call this macro directly, because it contains some occurrences
# of `$1' etc. which will be interpreted by m4. So you should call it
# with $1, $2, and $3 as arguments, which is what AT_DATA_CALC_Y does.
m4_define([_AT_DATA_CALC_Y],
[m4_if([$1$2$3], $[1]$[2]$[3], [],
[m4_fatal([$0: Invalid arguments: $@])])dnl
m4_pushdef([AT_CALC_LEX],
[[#include <ctype.h>
int ]AT_NAME_PREFIX[lex (]AT_LEX_FORMALS[);
static int get_char (]AT_LEX_FORMALS[);
static void unget_char (]AT_LEX_PRE_FORMALS[ int c);
]AT_LOCATION_IF([
static YYLTYPE last_yylloc;
])[
static int
get_char (]AT_LEX_FORMALS[)
{
int res = getc (input);
]AT_USE_LEX_ARGS[;
]AT_LOCATION_IF([
last_yylloc = AT_LOC;
if (res == '\n')
{
AT_LOC.last_line++;
AT_LOC.last_column = 1;
}
else
AT_LOC.last_column++;
])[
return res;
}
static void
unget_char (]AT_LEX_PRE_FORMALS[ int c)
{
]AT_USE_LEX_ARGS[;
]AT_LOCATION_IF([
/* Wrong when C == `\n'. */
AT_LOC = last_yylloc;
])[
ungetc (c, input);
}
static int
read_signed_integer (]AT_LEX_FORMALS[)
{
int c = get_char (]AT_LEX_ARGS[);
int sign = 1;
int n = 0;
]AT_USE_LEX_ARGS[;
if (c == '-')
{
c = get_char (]AT_LEX_ARGS[);
sign = -1;
}
while (isdigit (c))
{
n = 10 * n + (c - '0');
c = get_char (]AT_LEX_ARGS[);
}
unget_char (]AT_LEX_PRE_ARGS[ c);
return sign * n;
}
/*---------------------------------------------------------------.
| Lexical analyzer returns an integer on the stack and the token |
| NUM, or the ASCII character read if not a number. Skips all |
| blanks and tabs, returns 0 for EOF. |
`---------------------------------------------------------------*/
int
]AT_NAME_PREFIX[lex (]AT_LEX_FORMALS[)
{
static int init = 1;
int c;
if (init)
{
init = 0;
]AT_LOCATION_IF([
AT_LOC.last_column = 1;
AT_LOC.last_line = 1;
])[
}
]AT_LOCATION_IF([
AT_LOC.first_column = AT_LOC.last_column;
AT_LOC.first_line = AT_LOC.last_line;
])[
/* Skip white space. */
while ((c = get_char (]AT_LEX_ARGS[)) == ' ' || c == '\t')
{
]AT_LOCATION_IF(
[ AT_LOC.first_column = AT_LOC.last_column;
AT_LOC.first_line = AT_LOC.last_line;
])[
}
/* process numbers */
if (c == '.' || isdigit (c))
{
unget_char (]AT_LEX_PRE_ARGS[ c);
]AT_VAL[.ival = read_signed_integer (]AT_LEX_ARGS[);
return NUM;
}
/* Return end-of-file. */
if (c == EOF)
return CALC_EOF;
/* Return single chars. */
return c;
}
]])
AT_DATA_GRAMMAR([calc.y],
[[/* Infix notation calculator--calc */
]$4
AT_SKEL_CC_IF(
[%define global_tokens_and_yystype])[
%{
#include <stdio.h>
%code requires {
/* Exercise pre-prologue dependency to %union. */
typedef int semantic_value;
}
/* Exercise %union. */
%union
{
semantic_value ival;
};
%code provides {
#include <stdio.h>
/* The input. */
extern FILE *input;]AT_SKEL_CC_IF([[
#ifndef YYLTYPE
# define YYLTYPE ]AT_NAME_PREFIX[::location
#endif
#define first_line begin.line
#define first_column begin.column
#define last_line end.line
#define last_column end.column]])[
}
%code {
#include <stdlib.h>
#include <string.h>
#if HAVE_UNISTD_H
@@ -51,33 +192,13 @@ AT_SKEL_CC_IF(
# undef alarm
# define alarm(seconds) /* empty */
#endif
#include <ctype.h>
#define USE(Var)
/* Exercise pre-prologue dependency to %union. */
typedef int semantic_value;
FILE *input;
static semantic_value global_result = 0;
static int global_count = 0;
%}
/* Exercise %union. */
%union
{
semantic_value ival;
};
%{
static int power (int base, int exponent);
]AT_SKEL_CC_IF(
[#ifndef YYLTYPE
[#] define YYLTYPE AT_NAME_PREFIX::location
#endif
#define first_line begin.line
#define first_column begin.column
#define last_line end.line
#define last_column end.column
],
]AT_SKEL_CC_IF(,
[/* yyerror receives the location if:
- %location & %pure & %glr
- %location & %pure & %yacc & %parse-param. */
@@ -85,10 +206,8 @@ static void yyerror (AT_YYERROR_ARG_LOC_IF([YYLTYPE *llocp, ])
AT_PARAM_IF([semantic_value *result, int *count, ])
const char *s
);])[
static int yylex (]AT_LEX_FORMALS[);
static int get_char (]AT_LEX_FORMALS[);
static void unget_char (]AT_LEX_PRE_FORMALS[ int c);
%}
int yylex (]AT_LEX_FORMALS[);
}
]AT_SKEL_CC_IF(
[/* The lalr1.cc skeleton, for backward compatibility, defines
@@ -144,8 +263,6 @@ exp:
| '-' error { $$ = 0; YYERROR; }
;
%%
/* The input. */
static FILE *input;
]AT_SKEL_CC_IF(
[/* A C++ error reporting function. */
@@ -185,117 +302,7 @@ AT_YYERROR_SEES_LOC_IF([
fprintf (stderr, "%s\n", s);
}])[
]AT_LOCATION_IF([
static YYLTYPE last_yylloc;
])[
static int
get_char (]AT_LEX_FORMALS[)
{
int res = getc (input);
]AT_USE_LEX_ARGS[;
]AT_LOCATION_IF([
last_yylloc = AT_LOC;
if (res == '\n')
{
AT_LOC.last_line++;
AT_LOC.last_column = 1;
}
else
AT_LOC.last_column++;
])[
return res;
}
static void
unget_char (]AT_LEX_PRE_FORMALS[ int c)
{
]AT_USE_LEX_ARGS[;
]AT_LOCATION_IF([
/* Wrong when C == `\n'. */
AT_LOC = last_yylloc;
])[
ungetc (c, input);
}
static int
read_signed_integer (]AT_LEX_FORMALS[)
{
int c = get_char (]AT_LEX_ARGS[);
int sign = 1;
int n = 0;
]AT_USE_LEX_ARGS[;
if (c == '-')
{
c = get_char (]AT_LEX_ARGS[);
sign = -1;
}
while (isdigit (c))
{
n = 10 * n + (c - '0');
c = get_char (]AT_LEX_ARGS[);
}
unget_char (]AT_LEX_PRE_ARGS[ c);
return sign * n;
}
/*---------------------------------------------------------------.
| Lexical analyzer returns an integer on the stack and the token |
| NUM, or the ASCII character read if not a number. Skips all |
| blanks and tabs, returns 0 for EOF. |
`---------------------------------------------------------------*/
static int
yylex (]AT_LEX_FORMALS[)
{
static int init = 1;
int c;
if (init)
{
init = 0;
]AT_LOCATION_IF([
AT_LOC.last_column = 1;
AT_LOC.last_line = 1;
])[
}
]AT_LOCATION_IF([
AT_LOC.first_column = AT_LOC.last_column;
AT_LOC.first_line = AT_LOC.last_line;
])[
/* Skip white space. */
while ((c = get_char (]AT_LEX_ARGS[)) == ' ' || c == '\t')
{
]AT_LOCATION_IF(
[ AT_LOC.first_column = AT_LOC.last_column;
AT_LOC.first_line = AT_LOC.last_line;
])[
}
/* process numbers */
if (c == '.' || isdigit (c))
{
unget_char (]AT_LEX_PRE_ARGS[ c);
]AT_VAL[.ival = read_signed_integer (]AT_LEX_ARGS[);
return NUM;
}
/* Return end-of-file. */
if (c == EOF)
return CALC_EOF;
/* Return single chars. */
return c;
}
]AT_DEFINES_IF(, [AT_CALC_LEX])[
static int
power (int base, int exponent)
@@ -343,12 +350,18 @@ main (int argc, const char **argv)
return status;
}
]])
AT_DEFINES_IF([AT_DATA_SOURCE([[calc-lex.c]AT_SKEL_CC_IF([[c]])],
[[#include "calc.h]AT_SKEL_CC_IF([[h]])["
]AT_CALC_LEX])])
m4_popdef([AT_CALC_LEX])
])# _AT_DATA_CALC_Y
# AT_DATA_CALC_Y([BISON-OPTIONS])
# -------------------------------
# Produce `calc.y'.
# Produce `calc.y' and, if %defines was specified, `calc-lex.c' or
# `calc-lex.cc'.
m4_define([AT_DATA_CALC_Y],
[_AT_DATA_CALC_Y($[1], $[2], $[3], [$1])
])
@@ -453,12 +466,7 @@ m4_ifval([$2], [AT_CHECK([exit 77])])
AT_BISON_OPTION_PUSHDEFS([$1])
AT_DATA_CALC_Y([$1])
AT_SKEL_CC_IF(
[AT_BISON_CHECK([-o calc.cc calc.y])
AT_COMPILE_CXX([calc])],
[AT_BISON_CHECK([-o calc.c calc.y])
AT_COMPILE([calc])])
AT_FULL_COMPILE([calc], [AT_DEFINES_IF([[lex]])])
# Test the priorities.
_AT_CHECK_CALC([$1],
+14 -14
View File
@@ -1,6 +1,6 @@
# Checking GLR Parsing. -*- Autotest -*-
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
# Inc.
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 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
@@ -351,7 +351,7 @@ AT_BISON_OPTION_POPDEFS
])
m4_define([_AT_RESOLVED_GLR_OUTPUT],
[[+(z,q)
[[[+(z,q)
<declare>(T,x)
<init-declare>(T,x,y)
=(x,y)
@@ -360,10 +360,10 @@ m4_define([_AT_RESOLVED_GLR_OUTPUT],
<init-declare>(T,y,+(z,q))
<error>
+(z,q)
]])
]]])
m4_define([_AT_RESOLVED_GLR_OUTPUT_WITH_LOC],
[[3.0-3.5: +(z,q)
[[[3.0-3.5: +(z,q)
5.0-5.3: <declare>(T,x)
7.0-7.7: <init-declare>(T,x,y)
9.0-9.5: =(x,y)
@@ -372,10 +372,10 @@ m4_define([_AT_RESOLVED_GLR_OUTPUT_WITH_LOC],
15.0-15.13: <init-declare>(T,y,+(z,q))
17.0-17.15: <error>
19.0-19.5: +(z,q)
]])
]]])
m4_define([_AT_AMBIG_GLR_OUTPUT],
[[+(z,q)
[[[+(z,q)
<declare>(T,x)
<init-declare>(T,x,y)
=(x,y)
@@ -384,10 +384,10 @@ m4_define([_AT_AMBIG_GLR_OUTPUT],
<OR>(<init-declare>(T,y,+(z,q)),=(<cast>(y,T),+(z,q)))
<error>
+(z,q)
]])
]]])
m4_define([_AT_AMBIG_GLR_OUTPUT_WITH_LOC],
[[3.0-3.5: +(z,q)
[[[3.0-3.5: +(z,q)
5.0-5.3: <declare>(T,x)
7.0-7.7: <init-declare>(T,x,y)
9.0-9.5: =(x,y)
@@ -396,15 +396,15 @@ m4_define([_AT_AMBIG_GLR_OUTPUT_WITH_LOC],
15.0-15.13: <OR>(<init-declare>(T,y,+(z,q)),=(<cast>(y,T),+(z,q)))
17.0-17.15: <error>
19.0-19.5: +(z,q)
]])
]]])
m4_define([_AT_GLR_STDERR],
[[syntax error
]])
[[[syntax error
]]])
m4_define([_AT_VERBOSE_GLR_STDERR],
[[syntax error, unexpected ID, expecting '=' or '+' or ')'
]])
[[[syntax error, unexpected ID, expecting '=' or '+' or ')'
]]])
## ---------------------------------------------------- ##
## Compile the grammar described in the documentation. ##
+45 -11
View File
@@ -1,7 +1,8 @@
# Process this -*- Autotest -*- file with autom4te.
# Macros for the GNU Bison Test suite.
# Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 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
@@ -39,6 +40,8 @@ m4_define([AT_BISON_OPTION_PUSHDEFS],
m4_define([_AT_BISON_OPTION_PUSHDEFS],
[m4_if([$1$2], $[1]$[2], [],
[m4_fatal([$0: Invalid arguments: $@])])dnl
m4_pushdef([AT_DEFINES_IF],
[m4_bmatch([$3], [%defines], [$1], [$2])])
m4_pushdef([AT_SKEL_CC_IF],
[m4_bmatch([$3], [%language "[Cc]\+\+"\|%skeleton "[a-z0-9]+\.cc"], [$1], [$2])])
m4_pushdef([AT_GLR_IF],
@@ -100,8 +103,8 @@ AT_PURE_LEX_IF(
m4_pushdef([AT_LEX_PRE_ARGS],
[AT_LEX_ARGS, ])
],
[m4_pushdef([AT_LOC], [(yylloc)])
m4_pushdef([AT_VAL], [(yylval)])
[m4_pushdef([AT_LOC], [[(]AT_NAME_PREFIX[lloc)]])
m4_pushdef([AT_VAL], [[(]AT_NAME_PREFIX[lval)]])
m4_pushdef([AT_LEX_FORMALS], [void])
m4_pushdef([AT_LEX_ARGS], [])
m4_pushdef([AT_USE_LEX_ARGS], [])
@@ -135,6 +138,7 @@ m4_popdef([AT_GLR_IF])
m4_popdef([AT_SKEL_CC_IF])
m4_popdef([AT_GLR_CC_IF])
m4_popdef([AT_LALR1_CC_IF])
m4_popdef([AT_DEFINES_IF])
])# AT_BISON_OPTION_POPDEFS
@@ -143,21 +147,37 @@ m4_popdef([AT_LALR1_CC_IF])
## Generating Grammar Files. ##
## -------------------------- ##
# AT_DATA_SOURCE_PROLOGUE
# ------------------------
# The prologue that should be included in any source code that is
# meant to be compiled.
m4_define([AT_DATA_SOURCE_PROLOGUE],
[[#include <config.h>
/* We don't need perfect functions for these tests. */
#undef malloc
#undef memcmp
#undef realloc
]])
# AT_DATA_GRAMMAR_PROLOGUE
# ------------------------
# The prologue that should be included in any grammar which parser is
# meant to be compiled.
m4_define([AT_DATA_GRAMMAR_PROLOGUE],
[[%{
#include <config.h>
/* We don't need perfect functions for these tests. */
#undef malloc
#undef memcmp
#undef realloc
%}]
])
[[%code top {
]AT_DATA_SOURCE_PROLOGUE[]dnl
[}
]])
# AT_DATA_SOURCE(NAME, CONTENT)
# -----------------------------
# Generate the file NAME, which CONTENT is preceded by
# AT_DATA_SOURCE_PROLOGUE.
m4_define([AT_DATA_SOURCE],
[AT_DATA([$1],
[AT_DATA_SOURCE_PROLOGUE
$2])
])
# AT_DATA_GRAMMAR(NAME, CONTENT)
# ------------------------------
@@ -268,6 +288,20 @@ AT_CHECK([$CXX $CXXFLAGS $CPPFLAGS m4_bmatch([$1], [[.]], [], [$LDFLAGS ])-o $1
0, [ignore], [ignore])])
# AT_FULL_COMPILE(OUTPUT, [OTHER])
# --------------------------------
# Compile OUTPUT.y to OUTPUT.c or OUTPUT.cc, and compile it to OUTPUT.
# If OTHER is specified, compile OUTPUT-OTHER.c or OUTPUT-OTHER.cc to OUTPUT
# along with it.
# Relies on AT_SKEL_CC_IF.
m4_define([AT_FULL_COMPILE],
[AT_SKEL_CC_IF(
[AT_BISON_CHECK([-o $1.cc $1.y])
AT_COMPILE_CXX([$1]m4_ifval($2, [, [$1.cc $1-$2.cc]]))],
[AT_BISON_CHECK([-o $1.c $1.y])
AT_COMPILE([$1]m4_ifval($2, [, [$1.c $1-$2.c]]))])
])
## ---------------------------- ##
## Running a generated parser. ##
+3 -2
View File
@@ -200,9 +200,10 @@ AT_CLEANUP
AT_CHECK_OUTPUT_FILE_NAME([[`~!@#$%^&*()-=_+{}[]|\:;<>, .']])
dnl Work around a bug in m4_expand that broke AT_SETUP in autoconf 2.62,
dnl by using the definition from 2.63.
m4_define([m4_expand], [_$0(-=<{($1)}>=-)])
m4_version_prereq([2.63], [],
[m4_define([m4_expand], [_$0(-=<{($1)}>=-)])
m4_define([_m4_expand],
[m4_changequote([-=<{(], [)}>=-])$1m4_changequote([, ])])
[m4_changequote([-=<{(], [)}>=-])$1m4_changequote([, ])])])
AT_CHECK_OUTPUT_FILE_NAME([[(]])
AT_CHECK_OUTPUT_FILE_NAME([[)]])
AT_CHECK_OUTPUT_FILE_NAME([[#]])
+25 -1
View File
@@ -1201,7 +1201,7 @@ AT_CLEANUP
## Token number in precedence declaration. ##
## ---------------------------------------- ##
AT_SETUP([[Token number in precedence declaration.]])
AT_SETUP([[Token number in precedence declaration]])
# POSIX says token numbers can be declared in %left, %right, and %nonassoc, but
# we lost this in Bison 1.50.
@@ -1255,3 +1255,27 @@ AT_COMPILE([[input]])
AT_PARSER_CHECK([[./input]])
AT_CLEANUP
## ----------------------------------------------- ##
## Fix user actions without a trailing semicolon. ##
## ----------------------------------------------- ##
AT_SETUP([[Fix user actions without a trailing semicolon]])
# This feature is undocumented, but we accidentally broke it in 2.3a, and there
# was a complaint at:
# <http://lists.gnu.org/archive/html/bug-bison/2008-11/msg00001.html>.
AT_DATA([input.y],
[[%%
start: {asdffdsa} ;
]])
AT_BISON_CHECK([[-o input.c input.y]])
AT_CHECK([[sed -n '/asdffdsa/s/^ *//p' input.c]], [[0]],
[[{asdffdsa;}
]])
AT_CLEANUP