Compare commits

...
10 Commits
Author SHA1 Message Date
Akim Demaille 2d90916067 version 3.6.91
* NEWS: Record release date.
2020-07-09 21:10:23 +02:00
Akim Demaille 91e5a23ff2 news: update 2020-07-09 20:29:24 +02:00
Akim Demaille d4ae66c371 gnulib: update 2020-07-09 20:26:16 +02:00
Akim Demaille 70fb574717 examples: add license headers
Prompted by Rici Lake.
https://stackoverflow.com/questions/62658368/#comment110853985_62661621
Discussed with Paul Eggert.

* doc/bison.texi, examples/c/bistromathic/parse.y,
* examples/c/lexcalc/parse.y, examples/c/lexcalc/scan.l,
* examples/c/pushcalc/calc.y, examples/c/reccalc/parse.y,
* examples/c/reccalc/scan.l, examples/d/calc.y,
* examples/java/calc/Calc.y, examples/java/simple/Calc.y:
Install the GPL3+ header.
2020-07-08 22:19:37 +02:00
Akim Demaille 0820f16ca8 style: update comments
* src/reader.c: action_obstack was removed in 2002...
* src/parse-gram.y: Better names.
* src/scan-code.h: More comments.
2020-07-05 09:59:45 +02:00
Akim Demaille 49f1e5f428 style: update comments in the skeletons
* data/skeletons/c++.m4, data/skeletons/glr.c, data/skeletons/lalr1.d,
* data/skeletons/lalr1.java, data/skeletons/yacc.c:
Be more accurate about yychar and yytoken.
Don't name local variables as if they were members.
2020-07-05 09:59:25 +02:00
Akim Demaille 238692ad77 doc: more details about symbols in m4
* data/README.md: here.
* README-hacking.md (Vocabulary): More.
2020-07-05 09:18:27 +02:00
Akim Demaille 5f95583da7 regen 2020-07-05 08:18:51 +02:00
Akim Demaille 964fb2aa6f examples: include the generated header
* examples/c/bistromathic/parse.y, examples/c/lexcalc/parse.y,
* examples/c/reccalc/parse.y: here.
Add some comments.

* src/parse-gram.y (api_version): Pull out of handle_require.
Bump to 3.7.
2020-07-05 08:18:51 +02:00
Akim Demaille 7c0d36b760 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2020-07-04 12:37:45 +02:00
27 changed files with 501 additions and 57 deletions
+1 -1
View File
@@ -1 +1 @@
3.6.4
3.6.90
+16 -1
View File
@@ -1,5 +1,12 @@
GNU Bison NEWS
* Noteworthy changes in release 3.6.91 (2020-07-09) [beta]
** Bug fixes
Portability issues.
* Noteworthy changes in release 3.6.90 (2020-07-04) [beta]
** Deprecated features
@@ -27,8 +34,11 @@ GNU Bison NEWS
First derivation exp ::=[ exp ::=[ exp '+' exp • ] '/' exp ]
Second derivation exp ::=[ exp '+' exp ::=[ exp • '/' exp ] ]
When Bison is installed with text styling enabled, the example is actually
shown twice, with colors highlighting the ambiguity.
This is a shift/reduce conflict caused by none of the operators having
precedence, so the example can be parsed in the two ways shown. When
precedence, so the example can be parsed in the two ways shown. When
bison cannot find an example that can be derived in two ways, it instead
generates two examples that are the same up until the dot:
@@ -40,6 +50,11 @@ GNU Bison NEWS
In these cases, the parser usually doesn't have enough lookahead to
differentiate the two given examples.
The counterexamples are "focused": in two different ways. First, they do
not clutter the output with all the derivations from the start symbol,
rather they start on the "conflicted nonterminal". They go straight to the
point. Second, they don't "expand" nonterminal symbols uselessly.
*** File prefix mapping
Contributed by Joshua Watt.
+2
View File
@@ -211,6 +211,8 @@ assert/abort), and all the --trace output which is meant for the maintainers
only.
## Vocabulary
- "lookahead", not "look-ahead".
- "midrule", not "mid-rule".
- "nonterminal", not "variable" or "non-terminal" or "non terminal".
Abbreviated as "nterm".
- "shift/reduce" and "reduce/reduce", not "shift-reduce" or "shift reduce",
+3 -3
View File
@@ -86,7 +86,7 @@ The macro `b4_symbol(NUM, FIELD)` gives access to the following FIELDS:
- `has_id`: 0 or 1
Whether the symbol has an `id`.
- `id`: string
- `id`: string (e.g., `exp`, `NUM`, or `TOK_NUM` with api.token.prefix)
If `has_id`, the name of the token kind (prefixed by api.token.prefix if
defined), otherwise empty. Guaranteed to be usable as a C identifier.
This is used to define the token kind (i.e., the enum used by the return
@@ -105,9 +105,9 @@ The macro `b4_symbol(NUM, FIELD)` gives access to the following FIELDS:
- `is_token`: 0 or 1
Whether this is a terminal symbol.
- `kind_base`: string
- `kind_base`: string (e.g., `YYSYMBOL_exp`, `YYSYMBOL_NUM`)
The base of the symbol kind, i.e., the enumerator of this symbol (token or
nonterminal) which is mapping to its `number`.
nonterminal) which is mapped to its `number`.
- `kind`: string
Same as `kind_base`, but possibly with a prefix in some languages. E.g.,
+3 -2
View File
@@ -594,11 +594,12 @@ m4_define([b4_yytranslate_define],
{
]b4_translate[
};
const int code_max_ = ]b4_code_max[;
// Last valid token kind.
const int code_max = ]b4_code_max[;
if (t <= 0)
return symbol_kind::]b4_symbol_prefix[YYEOF;
else if (t <= code_max_)
else if (t <= code_max)
return YY_CAST (symbol_kind_type, translate_table[t]);
else
return symbol_kind::]b4_symbol_prefix[YYUNDEF;]])[
+1 -1
View File
@@ -333,7 +333,7 @@ static YYLTYPE yyloc_default][]b4_yyloc_default;])[
accessed by $0, $-1, etc., in any rule. */
#define YYMAXLEFT ]b4_max_left_semantic_context[
/* YYMAXUTOK -- Last valid token number (for yychar). */
/* YYMAXUTOK -- Last valid token kind. */
#define YYMAXUTOK ]b4_code_max[
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+5 -3
View File
@@ -428,8 +428,9 @@ b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
*/
public bool parse ()
{
/// Lookahead and lookahead in internal form.
// Lookahead token kind.
int yychar = TokenKind.YYEMPTY;
// Lookahead symbol kind.
SymbolKind yytoken = ]b4_symbol(-2, kind)[;
/* State. */
@@ -841,11 +842,12 @@ m4_popdef([b4_at_dollar])])dnl
]b4_translate[
@};
immutable int code_max_ = ]b4_code_max[;
// Last valid token kind.
immutable int code_max = ]b4_code_max[;
if (t <= 0)
return ]b4_symbol(0, kind)[;
else if (t <= code_max_)
else if (t <= code_max)
{
import std.conv : to;
return to!SymbolKind (translate_table[t]);
+6 -4
View File
@@ -53,8 +53,9 @@ b4_use_push_for_pull_if([
# allows them to be defined either in parse() when doing pull parsing,
# or as class instance variable when doing push parsing.
m4_define([b4_define_state],[[
/* Lookahead and lookahead in internal form. */
/* Lookahead token kind. */
int yychar = YYEMPTY_;
/* Lookahead symbol kind. */
SymbolKind yytoken = null;
/* State. */
@@ -1078,17 +1079,18 @@ b4_dollar_popdef[]dnl
/* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, with out-of-bounds checking. */
private static final SymbolKind yytranslate_ (int t)
private static final SymbolKind yytranslate_(int t)
]b4_api_token_raw_if(dnl
[[ {
return SymbolKind.get(t);
}
]],
[[ {
int code_max_ = ]b4_code_max[;
// Last valid token kind.
int code_max = ]b4_code_max[;
if (t <= 0)
return ]b4_symbol(0, kind)[;
else if (t <= code_max_)
else if (t <= code_max)
return SymbolKind.get(yytranslate_table_[t]);
else
return ]b4_symbol(2, kind)[;
+7 -2
View File
@@ -48,6 +48,10 @@ m4_define([b4_pure_if],
## api.push-pull. ##
## --------------- ##
# b4_pull_if, b4_push_if
# ----------------------
# Whether the pull/push APIs are needed. Both can be enabled.
b4_percent_define_default([[api.push-pull]], [[pull]])
b4_percent_define_check_values([[[[api.push-pull]],
[[pull]], [[push]], [[both]]]])
@@ -155,7 +159,7 @@ m4_define([b4_rhs_location],
# Declare the variables that are global, or local to YYPARSE if
# pure-parser.
m4_define([b4_declare_scanner_communication_variables], [[
/* The lookahead symbol. */
/* Lookahead token kind. */
int yychar;
]b4_pure_if([[
@@ -571,6 +575,7 @@ union yyalloc
/* YYNSTATES -- Number of states. */
#define YYNSTATES ]b4_states_number[
/* YYMAXUTOK -- Last valid token kind. */
#define YYMAXUTOK ]b4_code_max[
@@ -1544,7 +1549,7 @@ yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)]])[
int yyn;
/* The return value of yyparse. */
int yyresult;
/* Lookahead token as an internal (translated) token number. */
/* Lookahead symbol kind. */
yysymbol_kind_t yytoken = ]b4_symbol(-2, kind)[;
/* The variables used to return semantic value and location from the
action routines. */
+221 -2
View File
@@ -1677,6 +1677,31 @@ Here are the C and Bison declarations for the Reverse Polish Notation
calculator. As in C, comments are placed between @samp{/*@dots{}*/} or
after @samp{//}.
@ignore
@comment file: rpcalc.y
@example
/* Parser for rpcalc. -*- C -*-
Copyright (C) 1988-1993, 1995, 1998-2015, 2018-2020 Free Software
Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@end example
@end ignore
@comment file: rpcalc.y
@example
/* Reverse Polish Notation calculator. */
@@ -2538,6 +2563,31 @@ Note that multiple assignment and nested function calls are permitted.
Here are the C and Bison declarations for the multi-function calculator.
@ignore
@comment file: mfcalc.y
@example
/* Parser for mfcalc. -*- C -*-
Copyright (C) 1988-1993, 1995, 1998-2015, 2018-2020 Free Software
Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@end example
@end ignore
@comment file: mfcalc.y: 1
@example
@group
@@ -2642,6 +2692,31 @@ The symbol table itself consists of a linked list of records. Its
definition, which is kept in the header @file{calc.h}, is as follows. It
provides for either functions or variables to be placed in the table.
@ignore
@comment file: calc.h
@example
/* Functions for mfcalc. -*- C -*-
Copyright (C) 1988-1993, 1995, 1998-2015, 2018-2020 Free Software
Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@end example
@end ignore
@comment file: calc.h
@example
@group
@@ -11745,6 +11820,30 @@ A Bison file has three parts. In the first part, the prologue, we start by
making sure we run a version of Bison which is recent enough, and that we
generate C++.
@ignore
@comment file: c++/simple.yy: 1
@example
/* Simple variant-based parser. -*- C++ -*-
Copyright (C) 2018-2020 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@end example
@end ignore
@comment file: c++/simple.yy: 1
@example
%require "3.2"
@@ -12817,6 +12916,30 @@ The declaration of this driver class, in @file{driver.hh}, is as follows.
The first part includes the CPP guard and imports the required standard
library components, and the declaration of the parser class.
@ignore
@comment file: calc++/driver.hh
@example
/* Driver for calc++. -*- C++ -*-
Copyright (C) 2005--2015, 2018--2020 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@end example
@end ignore
@comment file: calc++/driver.hh
@example
#ifndef DRIVER_HH
@@ -12889,6 +13012,30 @@ member functions to open and close the scanning phase.
The implementation of the driver (@file{driver.cc}) is straightforward.
@ignore
@comment file: calc++/driver.cc
@example
/* Driver for calc++. -*- C++ -*-
Copyright (C) 2005--2015, 2018--2020 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@end example
@end ignore
@comment file: calc++/driver.cc
@example
#include "driver.hh"
@@ -12932,6 +13079,30 @@ parser skeleton, the creation of the parser header file. Because the C++
skeleton changed several times, it is safer to require the version you
designed the grammar for.
@ignore
@comment file: calc++/parser.yy
@example
/* Parser for calc++. -*- C++ -*-
Copyright (C) 2005--2015, 2018--2020 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@end example
@end ignore
@comment file: calc++/parser.yy
@example
%skeleton "lalr1.cc" // -*- C++ -*-
@@ -13120,6 +13291,30 @@ yy::parser::error (const location_type& l, const std::string& m)
In addition to standard headers, the Flex scanner includes the driver's,
then the parser's to get the set of defined tokens.
@ignore
@comment file: calc++/scanner.ll
@example
/* Scanner for calc++. -*- C++ -*-
Copyright (C) 2005--2015, 2018--2020 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@end example
@end ignore
@comment file: calc++/scanner.ll
@example
%@{ /* -*- C++ -*- */
@@ -13293,7 +13488,7 @@ The rules are simple. The driver is used to report errors.
You should keep your rules simple, both in the parser and in the scanner.
Throwing from the auxiliary functions is then very handy to report errors.
@comment file: scanner.ll
@comment file: calc++/scanner.ll
@example
@group
yy::parser::symbol_type
@@ -13343,7 +13538,31 @@ driver::scan_end ()
The top level file, @file{calc++.cc}, poses no problem.
@comment file: calc++.cc
@ignore
@comment file: calc++/calc++.cc
@example
/* Main for calc++. -*- C++ -*-
Copyright (C) 2005--2015, 2018--2020 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@end example
@end ignore
@comment file: calc++/calc++.cc
@example
#include <iostream>
#include "driver.hh"
+27 -1
View File
@@ -1,5 +1,25 @@
%require "3.6"
/* Parser and scanner for bistromathic. -*- C -*-
Copyright (C) 2019-2020 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
%require "3.7"
// Emitted on top of the implementation file.
%code top {
#include <ctype.h> // isdigit
#include <locale.h> // LC_ALL
@@ -24,6 +44,7 @@
#endif
}
// Emitted in the header file, before the definition of YYSTYPE.
%code requires {
// Function type.
typedef double (func_t) (double);
@@ -46,6 +67,7 @@
symrec *getsym (char const *name);
}
// Emitted in the header file, after the definition of YYSTYPE.
%code provides {
# ifndef __attribute__
# ifndef __GNUC__
@@ -57,6 +79,7 @@
__attribute__ ((__format__ (__printf__, 2, 3)));
}
// Emitted in the implementation file.
%code {
#if defined ENABLE_NLS && ENABLE_NLS
# define _(Msgid) gettext (Msgid)
@@ -68,6 +91,9 @@
int done = 0;
}
// Include the header in the implementation rather than duplicating it.
%define api.header.include {"parse.h"}
// Don't share global variables between the scanner and the parser.
%define api.pure full
+22
View File
@@ -1,3 +1,22 @@
/* Parser for lexcalc. -*- C -*-
Copyright (C) 2018-2020 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
// Prologue (directives).
%expect 0
@@ -19,6 +38,9 @@
#include <stdlib.h> // getenv.
}
// Include the header in the implementation rather than duplicating it.
%define api.header.include {"parse.h"}
// Don't share global variables between the scanner and the parser.
%define api.pure full
+20 -1
View File
@@ -1,4 +1,23 @@
/* Prologue (directives). -*- C -*- */
/* Scanner for lexcalc. -*- C -*-
Copyright (C) 2018-2020 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Prologue (directives). */
/* Disable Flex features we don't need, to avoid warnings. */
%option nodefault noinput nounput noyywrap
+19
View File
@@ -1,3 +1,22 @@
/* Parser and scanner for pushcalc. -*- C -*-
Copyright (C) 2020 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
%code top {
#include <ctype.h> /* isdigit. */
#include <stdio.h> /* printf. */
+36 -2
View File
@@ -1,3 +1,22 @@
/* Parser for reccalc. -*- C -*-
Copyright (C) 2019-2020 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
// Prologue (directives).
%expect 0
@@ -46,14 +65,29 @@
result parse (void);
}
// Include the header in the implementation rather than duplicating it.
%define api.header.include {"parse.h"}
// Don't share global variables between the scanner and the parser.
%define api.pure full
// To avoid name clashes (e.g., with C's EOF) prefix token definitions
// with TOK_ (e.g., TOK_EOF).
%define api.token.prefix {TOK_}
// Generate YYSTYPE from the types assigned to symbols.
%define api.value.type union
%define parse.error verbose
// Error messages with "unexpected XXX, expected XXX...".
%define parse.error detailed
// Enable run-time traces (yydebug).
%define parse.trace
// Generate the parser description file (parse.output).
%verbose
// Scanner and error count are exchanged between main, yyparse and yylex.
// Scanner and error count are exchanged between main, yyparse and yylex.
%param {yyscan_t scanner}{result *res}
%token
+19
View File
@@ -1,3 +1,22 @@
/* Scanner for reccalc. -*- C -*-
Copyright (C) 2019-2020 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Prologue (directives). -*- C -*- */
/* Disable Flex features we don't need, to avoid warnings. */
+19
View File
@@ -1,3 +1,22 @@
/* Parser and scanner for calc in D. -*- D -*-
Copyright (C) 2018-2020 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
%language "D"
%define api.parser.class {Calc}
+19
View File
@@ -1,3 +1,22 @@
/* Parser and scanner for calc in Java. -*- Java -*-
Copyright (C) 2018-2020 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
%language "Java"
%define api.parser.class {Calc}
+19
View File
@@ -1,3 +1,22 @@
/* Simple parser and scanner in Java. -*- Java -*-
Copyright (C) 2018-2020 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
%language "Java"
%define api.parser.class {Calc}
+1 -1
Submodule gnulib updated: 845d69187a...12c89745e3
+1
View File
@@ -20,6 +20,7 @@
/assure.h
/attribute.h
/basename-lgpl.c
/basename-lgpl.h
/basename.c
/binary-io.c
/binary-io.h
-1
View File
@@ -13,7 +13,6 @@
/codeset.m4
/config-h.m4
/configmake.m4
/dirname.m4
/double-slash-root.m4
/dup2.m4
/eealloc.m4
+22 -20
View File
@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.6.4.130-76c4d. */
/* A Bison parser, made by GNU Bison 3.6.90. */
/* Bison implementation for Yacc-like parsers in C
@@ -49,7 +49,7 @@
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "3.6.4.130-76c4d"
#define YYBISON_VERSION "3.6.90"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -234,6 +234,10 @@ typedef enum yysymbol_kind_t yysymbol_kind_t;
#include "scan-code.h"
#include "scan-gram.h"
/* Pretend to be at least that version, to check features published
in that version while developping it. */
static const char* api_version = "3.7";
static int current_prec = 0;
static location current_lhs_loc;
static named_ref *current_lhs_named_ref;
@@ -623,6 +627,7 @@ union yyalloc
/* YYNSTATES -- Number of states. */
#define YYNSTATES 167
/* YYMAXUTOK -- Last valid token kind. */
#define YYMAXUTOK 315
@@ -634,19 +639,19 @@ union yyalloc
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_int16 yyrline[] =
{
0, 308, 308, 317, 318, 322, 323, 329, 333, 338,
339, 340, 341, 342, 343, 344, 349, 354, 355, 356,
357, 358, 359, 359, 360, 361, 362, 363, 364, 365,
366, 367, 371, 372, 381, 382, 386, 397, 401, 405,
413, 423, 424, 434, 435, 441, 454, 454, 459, 459,
464, 468, 478, 479, 480, 481, 485, 486, 491, 492,
496, 497, 501, 502, 503, 516, 525, 529, 533, 541,
542, 546, 559, 560, 565, 566, 567, 585, 589, 593,
601, 603, 608, 615, 625, 629, 633, 641, 646, 658,
659, 665, 666, 667, 674, 674, 682, 683, 684, 689,
692, 694, 696, 698, 700, 702, 704, 706, 708, 713,
714, 723, 747, 748, 749, 750, 762, 764, 788, 793,
794, 799, 807, 808
0, 312, 312, 321, 322, 326, 327, 333, 337, 342,
343, 344, 345, 346, 347, 348, 353, 358, 359, 360,
361, 362, 363, 363, 364, 365, 366, 367, 368, 369,
370, 371, 375, 376, 385, 386, 390, 401, 405, 409,
417, 427, 428, 438, 439, 445, 458, 458, 463, 463,
468, 472, 482, 483, 484, 485, 489, 490, 495, 496,
500, 501, 505, 506, 507, 520, 529, 533, 537, 545,
546, 550, 563, 564, 569, 570, 571, 589, 593, 597,
605, 607, 612, 619, 629, 633, 637, 645, 650, 662,
663, 669, 670, 671, 678, 678, 686, 687, 688, 693,
696, 698, 700, 702, 704, 706, 708, 710, 712, 717,
718, 727, 751, 752, 753, 754, 766, 768, 792, 797,
798, 803, 811, 812
};
#endif
@@ -1748,7 +1753,7 @@ yydestruct (const char *yymsg,
int
yyparse (void)
{
/* The lookahead symbol. */
/* Lookahead token kind. */
int yychar;
@@ -1803,7 +1808,7 @@ YYLTYPE yylloc = yyloc_default;
int yyn;
/* The return value of yyparse. */
int yyresult;
/* Lookahead token as an internal (translated) token number. */
/* Lookahead symbol kind. */
yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
/* The variables used to return semantic value and location from the
action routines. */
@@ -3070,9 +3075,6 @@ handle_require (location const *loc, char const *version_quoted)
}
else
{
/* Pretend to be at least that version, to check features published
in that version while developping it. */
const char* api_version = "3.6";
const char* package_version =
0 < strverscmp (api_version, PACKAGE_VERSION)
? api_version : PACKAGE_VERSION;
+1 -1
View File
@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.6.4.130-76c4d. */
/* A Bison parser, made by GNU Bison 3.6.90. */
/* Bison interface for Yacc-like parsers in C
+6 -5
View File
@@ -58,6 +58,10 @@
#include "scan-code.h"
#include "scan-gram.h"
/* Pretend to be at least that version, to check features published
in that version while developping it. */
static const char* api_version = "3.7";
static int current_prec = 0;
static location current_lhs_loc;
static named_ref *current_lhs_named_ref;
@@ -691,8 +695,8 @@ rhs:
current_lhs_named_ref); }
| rhs symbol named_ref.opt
{ grammar_current_rule_symbol_append ($2, @2, $3); }
| rhs tag.opt "{...}"[act] named_ref.opt[name]
{ grammar_current_rule_action_append ($act, @act, $name, $[tag.opt]); }
| rhs tag.opt "{...}"[action] named_ref.opt[name]
{ grammar_current_rule_action_append ($action, @action, $name, $[tag.opt]); }
| rhs "%?{...}"
{ grammar_current_rule_predicate_append ($2, @2); }
| rhs "%empty"
@@ -1082,9 +1086,6 @@ handle_require (location const *loc, char const *version_quoted)
}
else
{
/* Pretend to be at least that version, to check features published
in that version while developping it. */
const char* api_version = "3.6";
const char* package_version =
0 < strverscmp (api_version, PACKAGE_VERSION)
? api_version : PACKAGE_VERSION;
+4 -6
View File
@@ -695,12 +695,10 @@ packgram (void)
}
/*------------------------------------------------------------------.
| Read in the grammar specification and record it in the format |
| described in gram.h. All actions are copied into ACTION_OBSTACK, |
| in each case forming the body of a C function (YYACTION) which |
| contains a switch statement to decide which action to execute. |
`------------------------------------------------------------------*/
/*--------------------------------------------------------------.
| Read in the grammar specification and record it in the format |
| described in gram.h. |
`--------------------------------------------------------------*/
void
reader (const char *gram)
+1
View File
@@ -145,6 +145,7 @@ void code_props_symbol_action_init (code_props *self, char const *code,
location code_loc);
/**
* \param type type for midrule actions
* \pre
* - <tt>self != NULL</tt>.
* - <tt>code != NULL</tt>.