From 88bce5a2ef15e5b508749e75ddad709aca85b019 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 29 Jul 2002 17:30:33 +0000 Subject: [PATCH] Use $accept and $end, as BYacc and BTYacc do, instead of $axiom and $. * src/symtab.h, src/symtab.c (eoftoken, axiom): Rename as... (endtoken, accept): these. * src/reader.c (reader): Set endtoken's default tag to "$end". Set undeftoken's tag to "$undefined" instead of "$undefined.". * doc/bison.texinfo (Table of Symbols): Mention $accept and $end. Adjust. --- ChangeLog | 11 +++++++ TODO | 12 ++++---- doc/bison.texinfo | 55 +++++++++++++++++++++++----------- src/LR0.c | 4 +-- src/gram.h | 16 +++++----- src/reader.c | 28 +++++++++--------- src/reduce.c | 10 +++---- src/state.c | 2 +- src/symtab.c | 16 +++++----- src/symtab.h | 4 +-- tests/actions.at | 2 +- tests/calc.at | 2 +- tests/conflicts.at | 72 ++++++++++++++++++++++----------------------- tests/regression.at | 32 ++++++++++---------- tests/sets.at | 28 +++++++++--------- 15 files changed, 163 insertions(+), 131 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b9c35df..95a4a2e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2002-07-29 Akim Demaille + + Use $accept and $end, as BYacc and BTYacc do, instead of $axiom and $. + + * src/symtab.h, src/symtab.c (eoftoken, axiom): Rename as... + (endtoken, accept): these. + * src/reader.c (reader): Set endtoken's default tag to "$end". + Set undeftoken's tag to "$undefined" instead of "$undefined.". + * doc/bison.texinfo (Table of Symbols): Mention $accept and $end. + Adjust. + 2002-07-29 Akim Demaille * src/reduce.c (reduce_grammar): When the language is empty, diff --git a/TODO b/TODO index 52b2457e..56038fc6 100644 --- a/TODO +++ b/TODO @@ -4,6 +4,11 @@ Write a first documentation for C++ output. +* Documentation +Before releasing, make sure the documentation refers to the current +`output' format. + + * Error messages Some are really funky. For instance @@ -121,13 +126,6 @@ this issue. Does anybody have it? * Documentation -** Vocabulary -Explain $axiom (and maybe change its name: BTYacc names it `goal', -byacc `$accept' probably based on AT&T Yacc, Meta `Start'...). -Complete the glossary (item, axiom, ?). Should we also rename `$'? -BYacc uses `$end'. `$eof' is attracting, but after all we may be -parsing a string, a stream etc. - ** History/Bibliography Some history of Bison and some bibliography would be most welcome. Are there any Texinfo standards for bibliography? diff --git a/doc/bison.texinfo b/doc/bison.texinfo index a4c1a4ba..066213a6 100644 --- a/doc/bison.texinfo +++ b/doc/bison.texinfo @@ -3553,9 +3553,9 @@ Request a pure (reentrant) parser program (@pxref{Pure Decl, ,A Pure Generate an array of token names in the parser file. The name of the array is @code{yytname}; @code{yytname[@var{i}]} is the name of the token whose internal Bison token code number is @var{i}. The first -three elements of @code{yytname} are always @code{"$"}, @code{"error"}, -and @code{"$undefined."}; after these come the symbols defined in the -grammar file. +three elements of @code{yytname} are always @code{"$end"}, +@code{"error"}, and @code{"$undefined"}; after these come the symbols +defined in the grammar file. For single-character literal tokens and literal string tokens, the name in the table includes the single-quote or double-quote characters: for @@ -5276,12 +5276,19 @@ useless: STR; %% @end example -@command{bison} reports that @samp{calc.y contains 1 useless nonterminal -and 1 useless rule} and that @samp{calc.y contains 7 shift/reduce -conflicts}. When given @option{--report=state}, in addition to -@file{calc.tab.c}, it creates a file @file{calc.output} with contents -detailed below. The order of the output and the exact presentation -might vary, but the interpretation is the same. +@command{bison} reports: + +@example +calc.y: warning: 1 useless nonterminal and 1 useless rule +calc.y:11.1-7: warning: useless nonterminal: useless +calc.y:11.8-12: warning: useless rule: useless: STR +calc.y contains 7 shift/reduce conflicts. +@end example + +When given @option{--report=state}, in addition to @file{calc.tab.c}, it +creates a file @file{calc.output} with contents detailed below. The +order of the output and the exact presentation might vary, but the +interpretation is the same. The first section includes details on conflicts that were solved thanks to precedence and/or associativity: @@ -5334,7 +5341,7 @@ The next section reproduces the exact grammar that Bison used: Grammar Number, Line, Rule - 0 5 $axiom -> exp $ + 0 5 $accept -> exp $end 1 5 exp -> exp '+' exp 2 6 exp -> exp '-' exp 3 7 exp -> exp '*' exp @@ -5348,7 +5355,7 @@ and reports the uses of the symbols: @example Terminals, with rules where they appear -$ (0) 0 +$end (0) 0 '*' (42) 3 '+' (43) 1 '-' (45) 2 @@ -5358,7 +5365,7 @@ NUM (258) 5 Nonterminals, with rules where they appear -$axiom (8) +$accept (8) on left: 0 exp (9) on left: 1 2 3 4 5, on right: 0 1 2 3 4 @@ -5376,7 +5383,7 @@ that the input cursor. @example state 0 - $axiom -> . exp $ (rule 0) + $accept -> . exp $ (rule 0) NUM shift, and go to state 1 @@ -5407,7 +5414,7 @@ be derived: @example state 0 - $axiom -> . exp $ (rule 0) + $accept -> . exp $ (rule 0) exp -> . exp '+' exp (rule 1) exp -> . exp '-' exp (rule 2) exp -> . exp '*' exp (rule 3) @@ -5439,7 +5446,7 @@ jump to state 2 (@samp{exp: go to state 2}). @example state 2 - $axiom -> exp . $ (rule 0) + $accept -> exp . $ (rule 0) exp -> exp . '+' exp (rule 1) exp -> exp . '-' exp (rule 2) exp -> exp . '*' exp (rule 3) @@ -5466,7 +5473,7 @@ state}: @example state 3 - $axiom -> exp $ . (rule 0) + $accept -> exp $ . (rule 0) $default accept @end example @@ -6006,7 +6013,7 @@ would instead be named @file{foo_tab.c}. @table @code @item @@$ In an action, the location of the left-hand side of the rule. - @xref{Locations, , Locations Overview}. +@xref{Locations, , Locations Overview}. @item @@@var{n} In an action, the location of the @var{n}-th symbol of the right-hand @@ -6020,6 +6027,20 @@ In an action, the semantic value of the left-hand side of the rule. In an action, the semantic value of the @var{n}-th symbol of the right-hand side of the rule. @xref{Actions}. +@item $accept +The predefined nonterminal whose only rule is @samp{$accept: @var{start} +$end}, where @var{start} is the start symbol. @xref{Start Decl, , The +Start-Symbol}. It cannot be used in the grammar. + +@item $end +The predefined token marking the end of the token stream. It cannot be +used in the grammar. + +@item $undefined +The predefined token onto which all undefined values returned by +@code{yylex} are mapped. It cannot be used in the grammar, rather, use +@code{error}. + @item error A token name reserved for error recovery. This token may be used in grammar rules so as to allow the Bison parser to recognize an error in diff --git a/src/LR0.c b/src/LR0.c index 80f69a9e..fa33906e 100644 --- a/src/LR0.c +++ b/src/LR0.c @@ -63,7 +63,7 @@ state_list_append (symbol_number_t symbol, fprintf (stderr, "state_list_append (state = %d, symbol = %d (%s))\n", nstates, symbol, symbols[symbol]->tag); - /* If this is the eoftoken, and this is not the initial state, then + /* If this is the endtoken, and this is not the initial state, then this is the final state. */ if (symbol == 0 && first_state) final_state = state; @@ -283,7 +283,7 @@ save_reductions (state_t *state) int i; /* If this is the final state, we want it to have no reductions at - all, although it has one for `START_SYMBOL EOF .'. */ + all, although it has one for `START_SYMBOL $end .'. */ if (final_state && state->number == final_state->number) return; diff --git a/src/gram.h b/src/gram.h index fc827ee4..dd5a45f8 100644 --- a/src/gram.h +++ b/src/gram.h @@ -36,16 +36,16 @@ The rules receive rule numbers 1 to NRULES in the order they are written. More precisely Bison augments the grammar with the - initial rule, `$axiom: START-SYMBOL EOF', which is numbered 1, all - the user rules are 2, 3 etc. Each time a rule number is presented - to the user, we subtract 1, so *displayed* rule numbers are 0, 1, - 2... + initial rule, `$accept: START-SYMBOL $end', which is numbered 1, + all the user rules are 2, 3 etc. Each time a rule number is + presented to the user, we subtract 1, so *displayed* rule numbers + are 0, 1, 2... Internally, we cannot use the number 0 for a rule because for instance RITEM stores both symbol (the RHS) and rule numbers: the symbols are shorts >= 0, and rule number are stored negative. Therefore 0 cannot be used, since it would be both the rule number - 0, and the token EOF). + 0, and the token $end). Actions are accessed via the rule number. @@ -68,9 +68,11 @@ RULES[R].assoc -- the associativity of R. - RULES[R].dprec -- the dynamic precedence level of R (for GLR parsing). + RULES[R].dprec -- the dynamic precedence level of R (for GLR + parsing). - RULES[R].merger -- index of merging function for R (for GLR parsing). + RULES[R].merger -- index of merging function for R (for GLR + parsing). RULES[R].line -- the line where R was defined. diff --git a/src/reader.c b/src/reader.c index a029b671..cc3a25a7 100644 --- a/src/reader.c +++ b/src/reader.c @@ -475,10 +475,10 @@ reader (void) /* Initialize the symbol table. */ symbols_new (); - /* Construct the axiom symbol. */ - axiom = symbol_get ("$axiom", empty_location); - axiom->class = nterm_sym; - axiom->number = nvars++; + /* Construct the accept symbol. */ + accept = symbol_get ("$accept", empty_location); + accept->class = nterm_sym; + accept->number = nvars++; /* Construct the error token */ errtoken = symbol_get ("error", empty_location); @@ -487,7 +487,7 @@ reader (void) /* Construct a token that represents all undefined literal tokens. It is always token number 2. */ - undeftoken = symbol_get ("$undefined.", empty_location); + undeftoken = symbol_get ("$undefined", empty_location); undeftoken->class = token_sym; undeftoken->number = ntokens++; @@ -515,25 +515,25 @@ reader (void) /* Report any undefined symbols and consider them nonterminals. */ symbols_check_defined (); - /* If the user did not define her EOFTOKEN, do it now. */ - if (!eoftoken) + /* If the user did not define her ENDTOKEN, do it now. */ + if (!endtoken) { - eoftoken = symbol_get ("$", empty_location); - eoftoken->class = token_sym; - eoftoken->number = 0; + endtoken = symbol_get ("$end", empty_location); + endtoken->class = token_sym; + endtoken->number = 0; /* Value specified by POSIX. */ - eoftoken->user_token_number = 0; + endtoken->user_token_number = 0; } /* Insert the initial rule, which line is that of the first rule (not that of the start symbol): - axiom: %start EOF. */ + accept: %start EOF. */ { - symbol_list_t *p = symbol_list_new (axiom, empty_location); + symbol_list_t *p = symbol_list_new (accept, empty_location); p->location = grammar->location; p->next = symbol_list_new (startsymbol, empty_location); - p->next->next = symbol_list_new (eoftoken, empty_location); + p->next->next = symbol_list_new (endtoken, empty_location); p->next->next->next = symbol_list_new (NULL, empty_location); p->next->next->next->next = grammar; nrules += 1; diff --git a/src/reduce.c b/src/reduce.c index aadf3f88..57a408b6 100644 --- a/src/reduce.c +++ b/src/reduce.c @@ -161,9 +161,9 @@ inaccessable_symbols (void) Pp = bitset_create (nrules, BITSET_FIXED); /* If the start symbol isn't useful, then nothing will be useful. */ - if (bitset_test (N, axiom->number - ntokens)) + if (bitset_test (N, accept->number - ntokens)) { - bitset_set (V, axiom->number); + bitset_set (V, accept->number); while (1) { @@ -194,7 +194,7 @@ inaccessable_symbols (void) V = Vp; /* Tokens 0, 1, and 2 are internal to Bison. Consider them useful. */ - bitset_set (V, eoftoken->number); /* end-of-input token */ + bitset_set (V, endtoken->number); /* end-of-input token */ bitset_set (V, errtoken->number); /* error token */ bitset_set (V, undeftoken->number); /* some undefined token */ @@ -333,7 +333,7 @@ nonterminals_reduce (void) if (ISVAR (*rhsp)) *rhsp = symbol_number_as_item_number (nontermmap[*rhsp]); } - axiom->number = nontermmap[axiom->number]; + accept->number = nontermmap[accept->number]; } nsyms -= nuseless_nonterminals; @@ -438,7 +438,7 @@ reduce_grammar (void) reduce_print (); - if (!bitset_test (N, axiom->number - ntokens)) + if (!bitset_test (N, accept->number - ntokens)) fatal_at (startsymbol_location, _("start symbol %s does not derive any sentence"), startsymbol->tag); diff --git a/src/state.c b/src/state.c index 92180895..bdf2586b 100644 --- a/src/state.c +++ b/src/state.c @@ -122,7 +122,7 @@ reductions_new (int num, rule_number_t *reductions) state_number_t nstates = 0; /* FINAL_STATE is properly set by new_state when it recognizes its - accessing symbol: EOF. */ + accessing symbol: $end. */ state_t *final_state = NULL; #define STATE_ALLOC(Nitems) \ diff --git a/src/symtab.c b/src/symtab.c index ef03b284..9280915e 100644 --- a/src/symtab.c +++ b/src/symtab.c @@ -32,8 +32,8 @@ symbol_t *errtoken = NULL; symbol_t *undeftoken = NULL; -symbol_t *eoftoken = NULL; -symbol_t *axiom = NULL; +symbol_t *endtoken = NULL; +symbol_t *accept = NULL; symbol_t *startsymbol = NULL; location_t startsymbol_location; @@ -181,11 +181,11 @@ symbol_user_token_number_set (symbol_t *symbol, symbol->tag); symbol->user_token_number = user_token_number; - /* User defined EOF token? */ + /* User defined $end token? */ if (user_token_number == 0) { - eoftoken = symbol; - eoftoken->number = 0; + endtoken = symbol; + endtoken->number = 0; /* It is always mapped to 0, so it was already counted in NTOKENS. */ --ntokens; @@ -322,7 +322,7 @@ symbol_pack (symbol_t *this) prec and assoc fields and make both the same */ if (this->number == NUMBER_UNDEFINED) { - if (this == eoftoken || this->alias == eoftoken) + if (this == endtoken || this->alias == endtoken) this->number = this->alias->number = 0; else { @@ -540,8 +540,8 @@ symbols_token_translations_init (void) token_translations = XCALLOC (symbol_number_t, max_user_token_number + 1); /* Initialize all entries for literal tokens to 2, the internal - token number for $undefined., which represents all invalid - inputs. */ + token number for $undefined, which represents all invalid inputs. + */ for (i = 0; i < max_user_token_number + 1; i++) token_translations[i] = undeftoken->number; symbols_do (symbol_translation, NULL); diff --git a/src/symtab.h b/src/symtab.h index 5abe3896..fd029d90 100644 --- a/src/symtab.h +++ b/src/symtab.h @@ -127,8 +127,8 @@ void symbol_user_token_number_set PARAMS ((symbol_t *symbol, */ extern symbol_t *errtoken; extern symbol_t *undeftoken; -extern symbol_t *eoftoken; -extern symbol_t *axiom; +extern symbol_t *endtoken; +extern symbol_t *accept; extern symbol_t *startsymbol; extern location_t startsymbol_location; diff --git a/tests/actions.at b/tests/actions.at index 35562b1e..92412eeb 100644 --- a/tests/actions.at +++ b/tests/actions.at @@ -327,7 +327,7 @@ thing(10): 'x'(10) sending: ';' (value = 11, line 110) line(10): thing(10) ';' sending: 'y' (value = 12, line 120) -120: parse error, unexpected $undefined., expecting $ or error or 'x' +120: parse error, unexpected $undefined, expecting $end or error or 'x' sending: EOF Freeing nterm line (10 from 100) Freeing nterm line (7 from 70) diff --git a/tests/calc.at b/tests/calc.at index 8a8948c3..161ba9c2 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -396,7 +396,7 @@ _AT_CHECK_CALC_ERROR([$1], [0 0], [11], _AT_CHECK_CALC_ERROR([$1], [1//2], [15], [1.3-1.4: parse error, unexpected '/', expecting "number" or '-' or '(']) _AT_CHECK_CALC_ERROR([$1], [error], [4], - [1.1-1.2: parse error, unexpected $undefined., expecting "number" or '-' or '\n' or '(']) + [1.1-1.2: parse error, unexpected $undefined, expecting "number" or '-' or '\n' or '(']) _AT_CHECK_CALC_ERROR([$1], [1 = 2 = 3], [22], [1.7-1.8: parse error, unexpected '=']) _AT_CHECK_CALC_ERROR([$1], diff --git a/tests/conflicts.at b/tests/conflicts.at index 43b37dfc..84b4fcda 100644 --- a/tests/conflicts.at +++ b/tests/conflicts.at @@ -150,7 +150,7 @@ AT_CHECK([cat input.output], [], Grammar - 0 $axiom: exp $ + 0 $accept: exp $end 1 exp: exp OP exp 2 | NUM @@ -158,7 +158,7 @@ Grammar Terminals, with rules where they appear -$ (0) 0 +$end (0) 0 error (256) NUM (258) 2 OP (259) 1 @@ -166,7 +166,7 @@ OP (259) 1 Nonterminals, with rules where they appear -$axiom (5) +$accept (5) on left: 0 exp (6) on left: 1 2, on right: 0 1 @@ -174,7 +174,7 @@ exp (6) state 0 - 0 $axiom: . exp $ + 0 $accept: . exp $end 1 exp: . exp OP exp 2 | . NUM @@ -192,16 +192,16 @@ state 1 state 2 - 0 $axiom: exp . $ + 0 $accept: exp . $end 1 exp: exp . OP exp - $ shift, and go to state 3 - OP shift, and go to state 4 + $end shift, and go to state 3 + OP shift, and go to state 4 state 3 - 0 $axiom: exp $ . + 0 $accept: exp $end . $default accept @@ -219,8 +219,8 @@ state 4 state 5 - 1 exp: exp . OP exp [$, OP] - 1 | exp OP exp . [$, OP] + 1 exp: exp . OP exp [$end, OP] + 1 | exp OP exp . [$end, OP] OP shift, and go to state 4 @@ -253,7 +253,7 @@ AT_CHECK([bison input.y -o input.c --report=all]) AT_CHECK([cat input.output], [], [[Grammar - 0 $axiom: exp $ + 0 $accept: exp $end 1 exp: exp OP exp 2 | NUM @@ -261,7 +261,7 @@ AT_CHECK([cat input.output], [], Terminals, with rules where they appear -$ (0) 0 +$end (0) 0 error (256) NUM (258) 2 OP (259) 1 @@ -269,7 +269,7 @@ OP (259) 1 Nonterminals, with rules where they appear -$axiom (5) +$accept (5) on left: 0 exp (6) on left: 1 2, on right: 0 1 @@ -277,7 +277,7 @@ exp (6) state 0 - 0 $axiom: . exp $ + 0 $accept: . exp $end 1 exp: . exp OP exp 2 | . NUM @@ -295,16 +295,16 @@ state 1 state 2 - 0 $axiom: exp . $ + 0 $accept: exp . $end 1 exp: exp . OP exp - $ shift, and go to state 3 - OP shift, and go to state 4 + $end shift, and go to state 3 + OP shift, and go to state 4 state 3 - 0 $axiom: exp $ . + 0 $accept: exp $end . $default accept @@ -322,8 +322,8 @@ state 4 state 5 - 1 exp: exp . OP exp [$, OP] - 1 | exp OP exp . [$, OP] + 1 exp: exp . OP exp [$end, OP] + 1 | exp OP exp . [$end, OP] $default reduce using rule 1 (exp) Conflict between rule 1 and token OP resolved as reduce (%left OP). @@ -339,19 +339,19 @@ AT_CLEANUP # When there are RR conflicts, some rules are disabled. Usually it is # simply displayed as: # -# $ reduce using rule 3 (num) -# $ [reduce using rule 4 (id)] +# $end reduce using rule 3 (num) +# $end [reduce using rule 4 (id)] # # But when `reduce 3' is the default action, we'd produce: # -# $ [reduce using rule 4 (id)] +# $end [reduce using rule 4 (id)] # $default reduce using rule 3 (num) # # In this precise case (a reduction is masked by the default # reduction), we make the `reduce 3' explicit: # -# $ reduce using rule 3 (num) -# $ [reduce using rule 4 (id)] +# $end reduce using rule 3 (num) +# $end [reduce using rule 4 (id)] # $default reduce using rule 3 (num) # # Maybe that's not the best display, but then, please propose something @@ -379,7 +379,7 @@ AT_CHECK([cat input.output], [], Grammar - 0 $axiom: exp $ + 0 $accept: exp $end 1 exp: num 2 | id @@ -391,14 +391,14 @@ Grammar Terminals, with rules where they appear -$ (0) 0 +$end (0) 0 '0' (48) 3 4 error (256) Nonterminals, with rules where they appear -$axiom (4) +$accept (4) on left: 0 exp (5) on left: 1 2, on right: 0 @@ -410,7 +410,7 @@ id (7) state 0 - 0 $axiom: . exp $ + 0 $accept: . exp $end 1 exp: . num 2 | . id 3 num: . '0' @@ -425,19 +425,19 @@ state 0 state 1 - 3 num: '0' . [$] - 4 id: '0' . [$] + 3 num: '0' . [$end] + 4 id: '0' . [$end] - $ reduce using rule 3 (num) - $ [reduce using rule 4 (id)] + $end reduce using rule 3 (num) + $end [reduce using rule 4 (id)] $default reduce using rule 3 (num) state 2 - 0 $axiom: exp . $ + 0 $accept: exp . $end - $ shift, and go to state 5 + $end shift, and go to state 5 state 3 @@ -456,7 +456,7 @@ state 4 state 5 - 0 $axiom: exp $ . + 0 $accept: exp $end . $default accept ]]) diff --git a/tests/regression.at b/tests/regression.at index d9578a42..ca5c2f97 100644 --- a/tests/regression.at +++ b/tests/regression.at @@ -150,7 +150,7 @@ AT_CHECK([bison input.y -o input.c -v]) AT_CHECK([cat input.output], [], [[Grammar - 0 $axiom: expr $ + 0 $accept: expr $end 1 @1: /* empty */ @@ -163,7 +163,7 @@ AT_CHECK([cat input.output], [], Terminals, with rules where they appear -$ (0) 0 +$end (0) 0 'a' (97) 2 'b' (98) 2 'c' (99) 4 @@ -172,7 +172,7 @@ error (256) Nonterminals, with rules where they appear -$axiom (6) +$accept (6) on left: 0 expr (7) on left: 2 4, on right: 0 @@ -184,7 +184,7 @@ expr (7) state 0 - 0 $axiom: . expr $ + 0 $accept: . expr $end 'a' shift, and go to state 1 @@ -205,9 +205,9 @@ state 1 state 2 - 0 $axiom: expr . $ + 0 $accept: expr . $end - $ shift, and go to state 5 + $end shift, and go to state 5 state 3 @@ -226,7 +226,7 @@ state 4 state 5 - 0 $axiom: expr $ . + 0 $accept: expr $end . $default accept @@ -371,7 +371,7 @@ AT_CHECK([bison -v input.y]) AT_CHECK([cat input.output], 0, [[Grammar - 0 $axiom: CONST_DEC_PART $ + 0 $accept: CONST_DEC_PART $end 1 CONST_DEC_PART: CONST_DEC_LIST @@ -385,7 +385,7 @@ AT_CHECK([cat input.output], 0, Terminals, with rules where they appear -$ (0) 0 +$end (0) 0 ';' (59) 5 '=' (61) 5 error (256) @@ -395,7 +395,7 @@ const_id_tok (259) 5 Nonterminals, with rules where they appear -$axiom (7) +$accept (7) on left: 0 CONST_DEC_PART (8) on left: 1, on right: 0 @@ -409,7 +409,7 @@ CONST_DEC (10) state 0 - 0 $axiom: . CONST_DEC_PART $ + 0 $accept: . CONST_DEC_PART $end $default reduce using rule 4 (@1) @@ -421,9 +421,9 @@ state 0 state 1 - 0 $axiom: CONST_DEC_PART . $ + 0 $accept: CONST_DEC_PART . $end - $ shift, and go to state 5 + $end shift, and go to state 5 state 2 @@ -454,7 +454,7 @@ state 4 state 5 - 0 $axiom: CONST_DEC_PART $ . + 0 $accept: CONST_DEC_PART $end . $default accept @@ -584,8 +584,8 @@ static const unsigned char yyrline[] = }; static const char *const yytname[] = { - "$", "error", "$undefined.", "\"if\"", "\"const\"", "\"then\"", - "\"else\"", "$axiom", "statement", "struct_stat", "if", "else", 0 + "$end", "error", "$undefined", "\"if\"", "\"const\"", "\"then\"", + "\"else\"", "$accept", "statement", "struct_stat", "if", "else", 0 }; static const unsigned short yytoknum[] = { diff --git a/tests/sets.at b/tests/sets.at index 28c58249..bd194ead 100644 --- a/tests/sets.at +++ b/tests/sets.at @@ -82,23 +82,23 @@ AT_CHECK([[bison --trace input.y]], [], [], [stderr]) AT_EXTRACT_SETS([stderr], [sets]) AT_CHECK([[cat sets]], [], [[DERIVES - $axiom derives - 0 e $ + $accept derives + 0 e $end e derives 1 'e' 2 /* empty */ NULLABLE - $axiom: no + $accept: no e: yes FIRSTS - $axiom firsts - $axiom + $accept firsts + $accept e e firsts e FDERIVES - $axiom derives - 0 e $ + $accept derives + 0 e $end 1 'e' 2 /* empty */ e derives @@ -212,8 +212,8 @@ AT_CHECK([[bison --trace input.y]], [], [], [stderr]) AT_EXTRACT_SETS([stderr], [sets]) AT_CHECK([[cat sets]], [], [[DERIVES - $axiom derives - 0 exp $ + $accept derives + 0 exp $end exp derives 1 exp '<' exp 2 exp '>' exp @@ -223,17 +223,17 @@ AT_CHECK([[cat sets]], [], 6 exp '=' exp 7 "exp" NULLABLE - $axiom: no + $accept: no exp: no FIRSTS - $axiom firsts - $axiom + $accept firsts + $accept exp exp firsts exp FDERIVES - $axiom derives - 0 exp $ + $accept derives + 0 exp $end 1 exp '<' exp 2 exp '>' exp 3 exp '+' exp -- 2.47.2