mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 13:53:03 +00:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -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
|
||||
]])
|
||||
|
||||
@@ -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[] =
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user