pkgsrc/devel/bison/Makefile

43 lines
1.1 KiB
Makefile
Raw Normal View History

Update to 2.7: * Noteworthy changes in release 2.7 (2012-12-12) [stable] ** Bug fixes Warnings about uninitialized yylloc in yyparse have been fixed. Restored C90 compliance (yet no report was ever made). ** Diagnostics are improved *** Changes in the format of error messages This used to be the format of many error reports: input.y:2.7-12: %type redeclaration for exp input.y:1.7-12: previous declaration It is now: input.y:2.7-12: error: %type redeclaration for exp input.y:1.7-12: previous declaration *** New format for error reports: carets Caret errors have been added to Bison: input.y:2.7-12: error: %type redeclaration for exp %type <sval> exp ^^^^^^ input.y:1.7-12: previous declaration %type <ival> exp ^^^^^^ or input.y:3.20-23: error: ambiguous reference: '$exp' exp: exp '+' exp { $exp = $1 + $3; }; ^^^^ input.y:3.1-3: refers to: $exp at $$ exp: exp '+' exp { $exp = $1 + $3; }; ^^^ input.y:3.6-8: refers to: $exp at $1 exp: exp '+' exp { $exp = $1 + $3; }; ^^^ input.y:3.14-16: refers to: $exp at $3 exp: exp '+' exp { $exp = $1 + $3; }; ^^^ The default behaviour for now is still not to display these unless explictly asked with -fcaret (or -fall). However, in a later release, it will be made the default behavior (but may still be deactivated with -fno-caret). ** New value for %define variable: api.pure full The %define variable api.pure requests a pure (reentrant) parser. However, for historical reasons, using it in a location-tracking Yacc parser resulted in a yyerror function that did not take a location as a parameter. With this new value, the user may request a better pure parser, where yyerror does take a location as a parameter (in location-tracking parsers). The use of "%define api.pure true" is deprecated in favor of this new "%define api.pure full". ** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java) The %define variable api.location.type defines the name of the type to use for locations. When defined, Bison no longer generates the position.hh and location.hh files, nor does the parser will include them: the user is then responsible to define her type. This can be used in programs with several parsers to factor their location and position files: let one of them generate them, and the others just use them. This feature was actually introduced, but not documented, in Bison 2.5, under the name "location_type" (which is maintained for backward compatibility). For consistency, lalr1.java's %define variables location_type and position_type are deprecated in favor of api.location.type and api.position.type. ** Exception safety (lalr1.cc) The parse function now catches exceptions, uses the %destructors to release memory (the lookahead symbol and the symbols pushed on the stack) before re-throwing the exception. This feature is somewhat experimental. User feedback would be appreciated. ** Graph improvements in DOT and XSLT The graphical presentation of the states is more readable: their shape is now rectangular, the state number is clearly displayed, and the items are numbered and left-justified. The reductions are now explicitly represented as transitions to other diamond shaped nodes. These changes are present in both --graph output and xml2dot.xsl XSLT processing, with minor (documented) differences. ** %language is no longer an experimental feature. The introduction of this feature, in 2.4, was four years ago. The --language option and the %language directive are no longer experimental. ** Documentation The sections about shift/reduce and reduce/reduce conflicts resolution have been fixed and extended. Although introduced more than four years ago, XML and Graphviz reports were not properly documented. The translation of mid-rule actions is now described.
2012-12-16 11:46:17 +01:00
# $NetBSD: Makefile,v 1.89 2012/12/16 10:46:17 wiz Exp $
1998-03-20 23:45:15 +01:00
Update to 2.7: * Noteworthy changes in release 2.7 (2012-12-12) [stable] ** Bug fixes Warnings about uninitialized yylloc in yyparse have been fixed. Restored C90 compliance (yet no report was ever made). ** Diagnostics are improved *** Changes in the format of error messages This used to be the format of many error reports: input.y:2.7-12: %type redeclaration for exp input.y:1.7-12: previous declaration It is now: input.y:2.7-12: error: %type redeclaration for exp input.y:1.7-12: previous declaration *** New format for error reports: carets Caret errors have been added to Bison: input.y:2.7-12: error: %type redeclaration for exp %type <sval> exp ^^^^^^ input.y:1.7-12: previous declaration %type <ival> exp ^^^^^^ or input.y:3.20-23: error: ambiguous reference: '$exp' exp: exp '+' exp { $exp = $1 + $3; }; ^^^^ input.y:3.1-3: refers to: $exp at $$ exp: exp '+' exp { $exp = $1 + $3; }; ^^^ input.y:3.6-8: refers to: $exp at $1 exp: exp '+' exp { $exp = $1 + $3; }; ^^^ input.y:3.14-16: refers to: $exp at $3 exp: exp '+' exp { $exp = $1 + $3; }; ^^^ The default behaviour for now is still not to display these unless explictly asked with -fcaret (or -fall). However, in a later release, it will be made the default behavior (but may still be deactivated with -fno-caret). ** New value for %define variable: api.pure full The %define variable api.pure requests a pure (reentrant) parser. However, for historical reasons, using it in a location-tracking Yacc parser resulted in a yyerror function that did not take a location as a parameter. With this new value, the user may request a better pure parser, where yyerror does take a location as a parameter (in location-tracking parsers). The use of "%define api.pure true" is deprecated in favor of this new "%define api.pure full". ** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java) The %define variable api.location.type defines the name of the type to use for locations. When defined, Bison no longer generates the position.hh and location.hh files, nor does the parser will include them: the user is then responsible to define her type. This can be used in programs with several parsers to factor their location and position files: let one of them generate them, and the others just use them. This feature was actually introduced, but not documented, in Bison 2.5, under the name "location_type" (which is maintained for backward compatibility). For consistency, lalr1.java's %define variables location_type and position_type are deprecated in favor of api.location.type and api.position.type. ** Exception safety (lalr1.cc) The parse function now catches exceptions, uses the %destructors to release memory (the lookahead symbol and the symbols pushed on the stack) before re-throwing the exception. This feature is somewhat experimental. User feedback would be appreciated. ** Graph improvements in DOT and XSLT The graphical presentation of the states is more readable: their shape is now rectangular, the state number is clearly displayed, and the items are numbered and left-justified. The reductions are now explicitly represented as transitions to other diamond shaped nodes. These changes are present in both --graph output and xml2dot.xsl XSLT processing, with minor (documented) differences. ** %language is no longer an experimental feature. The introduction of this feature, in 2.4, was four years ago. The --language option and the %language directive are no longer experimental. ** Documentation The sections about shift/reduce and reduce/reduce conflicts resolution have been fixed and extended. Although introduced more than four years ago, XML and Graphviz reports were not properly documented. The translation of mid-rule actions is now described.
2012-12-16 11:46:17 +01:00
DISTNAME= bison-2.7
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GNU:=bison/}
EXTRACT_SUFX= .tar.xz
1998-03-20 23:45:15 +01:00
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://www.gnu.org/software/bison/bison.html
COMMENT= GNU yacc(1) replacement
LICENSE= gnu-gpl-v3
1998-03-20 23:45:15 +01:00
2004-01-20 23:24:35 +01:00
PKG_INSTALLATION_TYPES= overwrite pkgviews
USE_LANGUAGES= c c++
2006-12-07 15:21:33 +01:00
USE_PKGLOCALEDIR= yes
USE_TOOLS+= grep gm4:run msgfmt flex
GNU_CONFIGURE= yes
CONFIGURE_ENV+= gt_cv_func_gnugettext1_libintl=yes
CONFIGURE_ENV+= ac_cv_prog_M4=${TOOLS_PATH.gm4}
INFO_FILES= yes
2003-08-09 09:33:27 +02:00
TEST_TARGET= check
# Avoid rebuilding manpage
pre-build:
${TOUCH} ${WRKSRC}/doc/bison.1
Update to 2.5: * Changes in version 2.5 (2011-05-14): ** Grammar symbol names can now contain non-initial dashes: Consistently with directives (such as %error-verbose) and with %define variables (e.g. push-pull), grammar symbol names may contain dashes in any position except the beginning. This is a GNU extension over POSIX Yacc. Thus, use of this extension is reported by -Wyacc and rejected in Yacc mode (--yacc). ** Named references: Historically, Yacc and Bison have supported positional references ($n, $$) to allow access to symbol values from inside of semantic actions code. Starting from this version, Bison can also accept named references. When no ambiguity is possible, original symbol names may be used as named references: if_stmt : "if" cond_expr "then" then_stmt ';' { $if_stmt = mk_if_stmt($cond_expr, $then_stmt); } In the more common case, explicit names may be declared: stmt[res] : "if" expr[cond] "then" stmt[then] "else" stmt[else] ';' { $res = mk_if_stmt($cond, $then, $else); } Location information is also accessible using @name syntax. When accessing symbol names containing dots or dashes, explicit bracketing ($[sym.1]) must be used. These features are experimental in this version. More user feedback will help to stabilize them. ** IELR(1) and canonical LR(1): IELR(1) is a minimal LR(1) parser table generation algorithm. That is, given any context-free grammar, IELR(1) generates parser tables with the full language-recognition power of canonical LR(1) but with nearly the same number of parser states as LALR(1). This reduction in parser states is often an order of magnitude. More importantly, because canonical LR(1)'s extra parser states may contain duplicate conflicts in the case of non-LR(1) grammars, the number of conflicts for IELR(1) is often an order of magnitude less as well. This can significantly reduce the complexity of developing of a grammar. Bison can now generate IELR(1) and canonical LR(1) parser tables in place of its traditional LALR(1) parser tables, which remain the default. You can specify the type of parser tables in the grammar file with these directives: %define lr.type lalr %define lr.type ielr %define lr.type canonical-lr The default-reduction optimization in the parser tables can also be adjusted using `%define lr.default-reductions'. For details on both of these features, see the new section `Tuning LR' in the Bison manual. These features are experimental. More user feedback will help to stabilize them. ** LAC (Lookahead Correction) for syntax error handling: Canonical LR, IELR, and LALR can suffer from a couple of problems upon encountering a syntax error. First, the parser might perform additional parser stack reductions before discovering the syntax error. Such reductions can perform user semantic actions that are unexpected because they are based on an invalid token, and they cause error recovery to begin in a different syntactic context than the one in which the invalid token was encountered. Second, when verbose error messages are enabled (with %error-verbose or the obsolete `#define YYERROR_VERBOSE'), the expected token list in the syntax error message can both contain invalid tokens and omit valid tokens. The culprits for the above problems are %nonassoc, default reductions in inconsistent states, and parser state merging. Thus, IELR and LALR suffer the most. Canonical LR can suffer only if %nonassoc is used or if default reductions are enabled for inconsistent states. LAC is a new mechanism within the parsing algorithm that solves these problems for canonical LR, IELR, and LALR without sacrificing %nonassoc, default reductions, or state merging. When LAC is in use, canonical LR and IELR behave almost exactly the same for both syntactically acceptable and syntactically unacceptable input. While LALR still does not support the full language-recognition power of canonical LR and IELR, LAC at least enables LALR's syntax error handling to correctly reflect LALR's language-recognition power. Currently, LAC is only supported for deterministic parsers in C. You can enable LAC with the following directive: %define parse.lac full See the new section `LAC' in the Bison manual for additional details including a few caveats. LAC is an experimental feature. More user feedback will help to stabilize it. ** %define improvements: *** Can now be invoked via the command line: Each of these command-line options -D NAME[=VALUE] --define=NAME[=VALUE] -F NAME[=VALUE] --force-define=NAME[=VALUE] is equivalent to this grammar file declaration %define NAME ["VALUE"] except that the manner in which Bison processes multiple definitions for the same NAME differs. Most importantly, -F and --force-define quietly override %define, but -D and --define do not. For further details, see the section `Bison Options' in the Bison manual. *** Variables renamed: The following %define variables api.push_pull lr.keep_unreachable_states have been renamed to api.push-pull lr.keep-unreachable-states The old names are now deprecated but will be maintained indefinitely for backward compatibility. *** Values no longer need to be quoted in the grammar file: If a %define value is an identifier, it no longer needs to be placed within quotations marks. For example, %define api.push-pull "push" can be rewritten as %define api.push-pull push *** Unrecognized variables are now errors not warnings. *** Multiple invocations for any variable is now an error not a warning. ** Unrecognized %code qualifiers are now errors not warnings. ** Character literals not of length one: Previously, Bison quietly converted all character literals to length one. For example, without warning, Bison interpreted the operators in the following grammar to be the same token: exp: exp '++' | exp '+' exp ; Bison now warns when a character literal is not of length one. In some future release, Bison will start reporting an error instead. ** Destructor calls fixed for lookaheads altered in semantic actions: Previously for deterministic parsers in C, if a user semantic action altered yychar, the parser in some cases used the old yychar value to determine which destructor to call for the lookahead upon a syntax error or upon parser return. This bug has been fixed. ** C++ parsers use YYRHSLOC: Similarly to the C parsers, the C++ parsers now define the YYRHSLOC macro and use it in the default YYLLOC_DEFAULT. You are encouraged to use it. If, for instance, your location structure has `first' and `last' members, instead of # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (N) \ { \ (Current).first = (Rhs)[1].location.first; \ (Current).last = (Rhs)[N].location.last; \ } \ else \ { \ (Current).first = (Current).last = (Rhs)[0].location.last; \ } \ while (false) use: # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (N) \ { \ (Current).first = YYRHSLOC (Rhs, 1).first; \ (Current).last = YYRHSLOC (Rhs, N).last; \ } \ else \ { \ (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last; \ } \ while (false) ** YYLLOC_DEFAULT in C++: The default implementation of YYLLOC_DEFAULT used to be issued in the header file. It is now output in the implementation file, after the user %code sections so that its #ifndef guard does not try to override the user's YYLLOC_DEFAULT if provided. ** YYFAIL now produces warnings and Java parsers no longer implement it: YYFAIL has existed for many years as an undocumented feature of deterministic parsers in C generated by Bison. More recently, it was a documented feature of Bison's experimental Java parsers. As promised in Bison 2.4.2's NEWS entry, any appearance of YYFAIL in a semantic action now produces a deprecation warning, and Java parsers no longer implement YYFAIL at all. For further details, including a discussion of how to suppress C preprocessor warnings about YYFAIL being unused, see the Bison 2.4.2 NEWS entry. ** Temporary hack for adding a semicolon to the user action: Previously, Bison appended a semicolon to every user action for reductions when the output language defaulted to C (specifically, when neither %yacc, %language, %skeleton, or equivalent command-line options were specified). This allowed actions such as exp: exp "+" exp { $$ = $1 + $3 }; instead of exp: exp "+" exp { $$ = $1 + $3; }; As a first step in removing this misfeature, Bison now issues a warning when it appends a semicolon. Moreover, in cases where Bison cannot easily determine whether a semicolon is needed (for example, an action ending with a cpp directive or a braced compound initializer), it no longer appends one. Thus, the C compiler might now complain about a missing semicolon where it did not before. Future releases of Bison will cease to append semicolons entirely. ** Verbose syntax error message fixes: When %error-verbose or the obsolete `#define YYERROR_VERBOSE' is specified, syntax error messages produced by the generated parser include the unexpected token as well as a list of expected tokens. The effect of %nonassoc on these verbose messages has been corrected in two ways, but a more complete fix requires LAC, described above: *** When %nonassoc is used, there can exist parser states that accept no tokens, and so the parser does not always require a lookahead token in order to detect a syntax error. Because no unexpected token or expected tokens can then be reported, the verbose syntax error message described above is suppressed, and the parser instead reports the simpler message, `syntax error'. Previously, this suppression was sometimes erroneously triggered by %nonassoc when a lookahead was actually required. Now verbose messages are suppressed only when all previous lookaheads have already been shifted or discarded. *** Previously, the list of expected tokens erroneously included tokens that would actually induce a syntax error because conflicts for them were resolved with %nonassoc in the current parser state. Such tokens are now properly omitted from the list. *** Expected token lists are still often wrong due to state merging (from LALR or IELR) and default reductions, which can both add invalid tokens and subtract valid tokens. Canonical LR almost completely fixes this problem by eliminating state merging and default reductions. However, there is one minor problem left even when using canonical LR and even after the fixes above. That is, if the resolution of a conflict with %nonassoc appears in a later parser state than the one at which some syntax error is discovered, the conflicted token is still erroneously included in the expected token list. Bison's new LAC implementation, described above, eliminates this problem and the need for canonical LR. However, LAC is still experimental and is disabled by default. ** Java skeleton fixes: *** A location handling bug has been fixed. *** The top element of each of the value stack and location stack is now cleared when popped so that it can be garbage collected. *** Parser traces now print the top element of the stack. ** -W/--warnings fixes: *** Bison now properly recognizes the `no-' versions of categories: For example, given the following command line, Bison now enables all warnings except warnings for incompatibilities with POSIX Yacc: bison -Wall,no-yacc gram.y *** Bison now treats S/R and R/R conflicts like other warnings: Previously, conflict reports were independent of Bison's normal warning system. Now, Bison recognizes the warning categories `conflicts-sr' and `conflicts-rr'. This change has important consequences for the -W and --warnings command-line options. For example: bison -Wno-conflicts-sr gram.y # S/R conflicts not reported bison -Wno-conflicts-rr gram.y # R/R conflicts not reported bison -Wnone gram.y # no conflicts are reported bison -Werror gram.y # any conflict is an error However, as before, if the %expect or %expect-rr directive is specified, an unexpected number of conflicts is an error, and an expected number of conflicts is not reported, so -W and --warning then have no effect on the conflict report. *** The `none' category no longer disables a preceding `error': For example, for the following command line, Bison now reports errors instead of warnings for incompatibilities with POSIX Yacc: bison -Werror,none,yacc gram.y *** The `none' category now disables all Bison warnings: Previously, the `none' category disabled only Bison warnings for which there existed a specific -W/--warning category. However, given the following command line, Bison is now guaranteed to suppress all warnings: bison -Wnone gram.y ** Precedence directives can now assign token number 0: Since Bison 2.3b, which restored the ability of precedence directives to assign token numbers, doing so for token number 0 has produced an assertion failure. For example: %left END 0 This bug has been fixed.
2011-07-12 16:12:13 +02:00
# "bison" wants a recent version of "gettext" which at least some
# NetBSD versions don't provide. Figure out whether it will install
# the locale files or not.
PLIST_SRC= ${WRKDIR}/PLIST
post-configure:
if grep -q '^POSUB = po$$' ${WRKSRC}/Makefile; then \
${CP} ${PKGDIR}/PLIST ${PLIST_SRC}; \
else \
${GREP} -v '^share/locale/' ${PKGDIR}/PLIST >${PLIST_SRC}; \
fi
.include "../../devel/gettext-lib/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"