682 |
user-defined function on the resulting values to produce an arbitrary |
user-defined function on the resulting values to produce an arbitrary |
683 |
merged result. |
merged result. |
684 |
|
|
685 |
Let's consider an example, vastly simplified from C++. |
Let's consider an example, vastly simplified from a C++ grammar. |
686 |
|
|
687 |
@example |
@example |
688 |
%@{ |
%@{ |
706 |
| decl %dprec 2 |
| decl %dprec 2 |
707 |
; |
; |
708 |
|
|
709 |
expr : ID @{ printf ("%s ", $$); @} |
expr : ID @{ printf ("%s ", $$); @} |
710 |
| TYPENAME '(' expr ')' |
| TYPENAME '(' expr ')' |
711 |
@{ printf ("%s <cast> ", $1); @} |
@{ printf ("%s <cast> ", $1); @} |
712 |
| expr '+' expr @{ printf ("+ "); @} |
| expr '+' expr @{ printf ("+ "); @} |
713 |
| expr '=' expr @{ printf ("= "); @} |
| expr '=' expr @{ printf ("= "); @} |
714 |
; |
; |
715 |
|
|
716 |
decl : TYPENAME declarator ';' |
decl : TYPENAME declarator ';' |
717 |
@{ printf ("%s <declare> ", $1); @} |
@{ printf ("%s <declare> ", $1); @} |
718 |
| TYPENAME declarator '=' expr ';' |
| TYPENAME declarator '=' expr ';' |
719 |
@{ printf ("%s <init-declare> ", $1); @} |
@{ printf ("%s <init-declare> ", $1); @} |
720 |
; |
; |
721 |
|
|
722 |
declarator : ID @{ printf ("\"%s\" ", $1); @} |
declarator : ID @{ printf ("\"%s\" ", $1); @} |
723 |
| '(' declarator ')' |
| '(' declarator ')' |
724 |
; |
; |
725 |
@end example |
@end example |
3559 |
Rename the external symbols used in the parser so that they start with |
Rename the external symbols used in the parser so that they start with |
3560 |
@var{prefix} instead of @samp{yy}. The precise list of symbols renamed |
@var{prefix} instead of @samp{yy}. The precise list of symbols renamed |
3561 |
is @code{yyparse}, @code{yylex}, @code{yyerror}, @code{yynerrs}, |
is @code{yyparse}, @code{yylex}, @code{yyerror}, @code{yynerrs}, |
3562 |
@code{yylval}, @code{yychar}, @code{yydebug}, and possible |
@code{yylval}, @code{yylloc}, @code{yychar}, @code{yydebug}, and |
3563 |
@code{yylloc}. For example, if you use @samp{%name-prefix="c_"}, the |
possible @code{yylloc}. For example, if you use |
3564 |
names become @code{c_parse}, @code{c_lex}, and so on. @xref{Multiple |
@samp{%name-prefix="c_"}, the names become @code{c_parse}, @code{c_lex}, |
3565 |
Parsers, ,Multiple Parsers in the Same Program}. |
and so on. @xref{Multiple Parsers, ,Multiple Parsers in the Same |
3566 |
|
Program}. |
3567 |
|
|
3568 |
@item %no-parser |
@item %no-parser |
3569 |
Do not include any C code in the parser file; generate tables only. The |
Do not include any C code in the parser file; generate tables only. The |
3660 |
names that do not conflict. |
names that do not conflict. |
3661 |
|
|
3662 |
The precise list of symbols renamed is @code{yyparse}, @code{yylex}, |
The precise list of symbols renamed is @code{yyparse}, @code{yylex}, |
3663 |
@code{yyerror}, @code{yynerrs}, @code{yylval}, @code{yychar} and |
@code{yyerror}, @code{yynerrs}, @code{yylval}, @code{yylloc}, |
3664 |
@code{yydebug}. For example, if you use @samp{-p c}, the names become |
@code{yychar} and @code{yydebug}. For example, if you use @samp{-p c}, |
3665 |
@code{cparse}, @code{clex}, and so on. |
the names become @code{cparse}, @code{clex}, and so on. |
3666 |
|
|
3667 |
@strong{All the other variables and macros associated with Bison are not |
@strong{All the other variables and macros associated with Bison are not |
3668 |
renamed.} These others are not global; there is no conflict if the same |
renamed.} These others are not global; there is no conflict if the same |
3707 |
write an action which directs @code{yyparse} to return immediately |
write an action which directs @code{yyparse} to return immediately |
3708 |
without reading further. |
without reading further. |
3709 |
|
|
3710 |
|
|
3711 |
|
@deftypefun int yyparse (void) |
3712 |
The value returned by @code{yyparse} is 0 if parsing was successful (return |
The value returned by @code{yyparse} is 0 if parsing was successful (return |
3713 |
is due to end-of-input). |
is due to end-of-input). |
3714 |
|
|
3715 |
The value is 1 if parsing failed (return is due to a syntax error). |
The value is 1 if parsing failed (return is due to a syntax error). |
3716 |
|
@end deftypefun |
3717 |
|
|
3718 |
In an action, you can cause immediate return from @code{yyparse} by using |
In an action, you can cause immediate return from @code{yyparse} by using |
3719 |
these macros: |
these macros: |
3720 |
|
|
3721 |
@table @code |
@defmac YYACCEPT |
|
@item YYACCEPT |
|
3722 |
@findex YYACCEPT |
@findex YYACCEPT |
3723 |
Return immediately with value 0 (to report success). |
Return immediately with value 0 (to report success). |
3724 |
|
@end defmac |
3725 |
|
|
3726 |
@item YYABORT |
@defmac YYABORT |
3727 |
@findex YYABORT |
@findex YYABORT |
3728 |
Return immediately with value 1 (to report failure). |
Return immediately with value 1 (to report failure). |
3729 |
@end table |
@end defmac |
3730 |
|
|
3731 |
|
If you use a reentrant parser, you can optionally pass additional |
3732 |
|
parameter information to it in a reentrant way. To do so, use the |
3733 |
|
declaration @code{%parse-param}: |
3734 |
|
|
3735 |
|
@deffn {Directive} %parse-param @var{argument-declaration} @var{argument-name} |
3736 |
|
@findex %parse-param |
3737 |
|
Declare that @code{argument-name} is an additional @code{yyparse} |
3738 |
|
argument. This argument is also passed to @code{yyerror}. The |
3739 |
|
@var{argument-declaration} is used when declaring functions or |
3740 |
|
prototypes. |
3741 |
|
@end deffn |
3742 |
|
|
3743 |
|
Here's an example. Write this in the parser: |
3744 |
|
|
3745 |
|
@example |
3746 |
|
%parse-param "int *nastiness" "nastiness" |
3747 |
|
%parse-param "int *randomness" "randomness" |
3748 |
|
@end example |
3749 |
|
|
3750 |
|
@noindent |
3751 |
|
Then call the parser like this: |
3752 |
|
|
3753 |
|
@example |
3754 |
|
@{ |
3755 |
|
int nastiness, randomness; |
3756 |
|
@dots{} /* @r{Store proper data in @code{nastiness} and @code{randomness}.} */ |
3757 |
|
value = yyparse (&nastiness, &randomness); |
3758 |
|
@dots{} |
3759 |
|
@} |
3760 |
|
@end example |
3761 |
|
|
3762 |
|
@noindent |
3763 |
|
In the grammar actions, use expressions like this to refer to the data: |
3764 |
|
|
3765 |
|
@example |
3766 |
|
exp: @dots{} @{ @dots{}; *randomness += 1; @dots{} @} |
3767 |
|
@end example |
3768 |
|
|
3769 |
|
|
3770 |
@node Lexical |
@node Lexical |
3771 |
@section The Lexical Analyzer Function @code{yylex} |
@section The Lexical Analyzer Function @code{yylex} |
3970 |
this case, omit the second argument; @code{yylex} will be called with |
this case, omit the second argument; @code{yylex} will be called with |
3971 |
only one argument. |
only one argument. |
3972 |
|
|
|
@vindex YYPARSE_PARAM |
|
|
If you use a reentrant parser, you can optionally pass additional |
|
|
parameter information to it in a reentrant way. To do so, define the |
|
|
macro @code{YYPARSE_PARAM} as a variable name. This modifies the |
|
|
@code{yyparse} function to accept one argument, of type @code{void *}, |
|
|
with that name. |
|
|
|
|
|
When you call @code{yyparse}, pass the address of an object, casting the |
|
|
address to @code{void *}. The grammar actions can refer to the contents |
|
|
of the object by casting the pointer value back to its proper type and |
|
|
then dereferencing it. Here's an example. Write this in the parser: |
|
3973 |
|
|
3974 |
@example |
If you wish to pass the additional parameter data to @code{yylex}, use |
3975 |
%@{ |
@code{%lex-param} just like @code{%parse-param} (@pxref{Parser |
3976 |
struct parser_control |
Function}). |
|
@{ |
|
|
int nastiness; |
|
|
int randomness; |
|
|
@}; |
|
3977 |
|
|
3978 |
#define YYPARSE_PARAM parm |
@deffn {Directive} lex-param @var{argument-declaration} @var{argument-name} |
3979 |
%@} |
@findex %lex-param |
3980 |
@end example |
Declare that @code{argument-name} is an additional @code{yylex} |
3981 |
|
argument. |
3982 |
|
@end deffn |
3983 |
|
|
3984 |
@noindent |
For instance: |
|
Then call the parser like this: |
|
3985 |
|
|
3986 |
@example |
@example |
3987 |
struct parser_control |
%parse-param "int *nastiness" "nastiness" |
3988 |
@{ |
%lex-param "int *nastiness" "nastiness" |
3989 |
int nastiness; |
%parse-param "int *randomness" "randomness" |
|
int randomness; |
|
|
@}; |
|
|
|
|
|
@dots{} |
|
|
|
|
|
@{ |
|
|
struct parser_control foo; |
|
|
@dots{} /* @r{Store proper data in @code{foo}.} */ |
|
|
value = yyparse ((void *) &foo); |
|
|
@dots{} |
|
|
@} |
|
3990 |
@end example |
@end example |
3991 |
|
|
3992 |
@noindent |
@noindent |
3993 |
In the grammar actions, use expressions like this to refer to the data: |
results in the following signature: |
3994 |
|
|
3995 |
@example |
@example |
3996 |
((struct parser_control *) parm)->randomness |
int yylex (int *nastiness); |
3997 |
|
int yyparse (int *nastiness, int *randomness); |
3998 |
@end example |
@end example |
3999 |
|
|
4000 |
@vindex YYLEX_PARAM |
If @code{%pure-parser} is added: |
|
If you wish to pass the additional parameter data to @code{yylex}, |
|
|
define the macro @code{YYLEX_PARAM} just like @code{YYPARSE_PARAM}, as |
|
|
shown here: |
|
4001 |
|
|
4002 |
@example |
@example |
4003 |
%@{ |
int yylex (YYSTYPE *lvalp, int *nastiness); |
4004 |
struct parser_control |
int yyparse (int *nastiness, int *randomness); |
|
@{ |
|
|
int nastiness; |
|
|
int randomness; |
|
|
@}; |
|
|
|
|
|
#define YYPARSE_PARAM parm |
|
|
#define YYLEX_PARAM parm |
|
|
%@} |
|
4005 |
@end example |
@end example |
4006 |
|
|
4007 |
You should then define @code{yylex} to accept one additional |
@noindent |
4008 |
argument---the value of @code{parm}. (This makes either two or three |
and finally, if both @code{%pure-parser} and @code{%locations} are used: |
4009 |
arguments in total, depending on whether an argument of type |
|
4010 |
@code{YYLTYPE} is passed.) You can declare the argument as a pointer to |
@example |
4011 |
the proper object type, or you can declare it as @code{void *} and |
int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness); |
4012 |
access the contents as shown above. |
int yyparse (int *nastiness, int *randomness); |
4013 |
|
@end example |
|
You can use @samp{%pure-parser} to request a reentrant parser without |
|
|
also using @code{YYPARSE_PARAM}. Then you should call @code{yyparse} |
|
|
with no arguments, as usual. |
|
4014 |
|
|
4015 |
@node Error Reporting |
@node Error Reporting |
4016 |
@section The Error Reporting Function @code{yyerror} |
@section The Error Reporting Function @code{yyerror} |
4031 |
receives one argument. For a parse error, the string is normally |
receives one argument. For a parse error, the string is normally |
4032 |
@w{@code{"parse error"}}. |
@w{@code{"parse error"}}. |
4033 |
|
|
4034 |
@findex YYERROR_VERBOSE |
@findex %error-verbose |
4035 |
If you define the macro @code{YYERROR_VERBOSE} in the Bison declarations |
If you invoke the directive @code{%error-verbose} in the Bison |
4036 |
section (@pxref{Bison Declarations, ,The Bison Declarations Section}), |
declarations section (@pxref{Bison Declarations, ,The Bison Declarations |
4037 |
then Bison provides a more verbose and specific error message string |
Section}), then Bison provides a more verbose and specific error message |
4038 |
instead of just plain @w{@code{"parse error"}}. It doesn't matter what |
string instead of just plain @w{@code{"parse error"}}. |
|
definition you use for @code{YYERROR_VERBOSE}, just whether you define |
|
|
it. |
|
4039 |
|
|
4040 |
The parser can detect one other kind of error: stack overflow. This |
The parser can detect one other kind of error: stack overflow. This |
4041 |
happens when the input contains constructions that are very deeply |
happens when the input contains constructions that are very deeply |
4064 |
(@pxref{Error Recovery}). If recovery is impossible, @code{yyparse} will |
(@pxref{Error Recovery}). If recovery is impossible, @code{yyparse} will |
4065 |
immediately return 1. |
immediately return 1. |
4066 |
|
|
4067 |
|
Oviously, in location tracking pure parsers, @code{yyerror} should have |
4068 |
|
an access to the current location. This is indeed the case for the GLR |
4069 |
|
parsers, but not for the Yacc parser, for historical reasons. I.e., if |
4070 |
|
@samp{%locations %pure-parser} is passed then the prototypes for |
4071 |
|
@code{yyerror} are: |
4072 |
|
|
4073 |
|
@example |
4074 |
|
void yyerror (const char *msg); /* Yacc parsers. */ |
4075 |
|
void yyerror (const char *msg, YYLTYPE *locp); /* GLR parsers. */ |
4076 |
|
@end example |
4077 |
|
|
4078 |
|
If @samp{%parse-param "int *nastiness" "nastiness"} is used, then: |
4079 |
|
|
4080 |
|
@example |
4081 |
|
void yyerror (int *randomness); /* Yacc parsers. */ |
4082 |
|
void yyerror (int *randomness); /* GLR parsers. */ |
4083 |
|
@end example |
4084 |
|
|
4085 |
|
Finally, GLR and Yacc parsers share the same @code{yyerror} calling |
4086 |
|
convention for absolutely pure parsers, i.e., when the calling |
4087 |
|
convention of @code{yylex} @emph{and} the calling convention of |
4088 |
|
@code{%pure-parser} are pure. I.e.: |
4089 |
|
|
4090 |
|
@example |
4091 |
|
/* Location tracking. */ |
4092 |
|
%locations |
4093 |
|
/* Pure yylex. */ |
4094 |
|
%pure-parser |
4095 |
|
%lex-param "int *nastiness" "nastiness" |
4096 |
|
/* Pure yyparse. */ |
4097 |
|
%parse-param "int *nastiness" "nastiness" |
4098 |
|
%parse-param "int *randomness" "randomness" |
4099 |
|
@end example |
4100 |
|
|
4101 |
|
@noindent |
4102 |
|
results in the following signatures for all the parser kinds: |
4103 |
|
|
4104 |
|
@example |
4105 |
|
int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness); |
4106 |
|
int yyparse (int *nastiness, int *randomness); |
4107 |
|
void yyerror (const char *msg, YYLTYPE *locp, |
4108 |
|
int *nastiness, int *randomness); |
4109 |
|
@end example |
4110 |
|
|
4111 |
@vindex yynerrs |
@vindex yynerrs |
4112 |
The variable @code{yynerrs} contains the number of syntax errors |
The variable @code{yynerrs} contains the number of syntax errors |
4113 |
encountered so far. Normally this variable is global; but if you |
encountered so far. Normally this variable is global; but if you |
5497 |
|
|
5498 |
$accept -> . exp $ (rule 0) |
$accept -> . exp $ (rule 0) |
5499 |
|
|
5500 |
NUM shift, and go to state 1 |
NUM shift, and go to state 1 |
5501 |
|
|
5502 |
exp go to state 2 |
exp go to state 2 |
5503 |
@end example |
@end example |
5504 |
|
|
5505 |
This reads as follows: ``state 0 corresponds to being at the very |
This reads as follows: ``state 0 corresponds to being at the very |
5546 |
|
|
5547 |
exp -> NUM . (rule 5) |
exp -> NUM . (rule 5) |
5548 |
|
|
5549 |
$default reduce using rule 5 (exp) |
$default reduce using rule 5 (exp) |
5550 |
@end example |
@end example |
5551 |
|
|
5552 |
@noindent |
@noindent |
5564 |
exp -> exp . '*' exp (rule 3) |
exp -> exp . '*' exp (rule 3) |
5565 |
exp -> exp . '/' exp (rule 4) |
exp -> exp . '/' exp (rule 4) |
5566 |
|
|
5567 |
$ shift, and go to state 3 |
$ shift, and go to state 3 |
5568 |
'+' shift, and go to state 4 |
'+' shift, and go to state 4 |
5569 |
'-' shift, and go to state 5 |
'-' shift, and go to state 5 |
5570 |
'*' shift, and go to state 6 |
'*' shift, and go to state 6 |
5571 |
'/' shift, and go to state 7 |
'/' shift, and go to state 7 |
5572 |
@end example |
@end example |
5573 |
|
|
5574 |
@noindent |
@noindent |
5587 |
|
|
5588 |
$accept -> exp $ . (rule 0) |
$accept -> exp $ . (rule 0) |
5589 |
|
|
5590 |
$default accept |
$default accept |
5591 |
@end example |
@end example |
5592 |
|
|
5593 |
@noindent |
@noindent |
5602 |
|
|
5603 |
exp -> exp '+' . exp (rule 1) |
exp -> exp '+' . exp (rule 1) |
5604 |
|
|
5605 |
NUM shift, and go to state 1 |
NUM shift, and go to state 1 |
5606 |
|
|
5607 |
exp go to state 8 |
exp go to state 8 |
5608 |
|
|
5609 |
state 5 |
state 5 |
5610 |
|
|
5611 |
exp -> exp '-' . exp (rule 2) |
exp -> exp '-' . exp (rule 2) |
5612 |
|
|
5613 |
NUM shift, and go to state 1 |
NUM shift, and go to state 1 |
5614 |
|
|
5615 |
exp go to state 9 |
exp go to state 9 |
5616 |
|
|
5617 |
state 6 |
state 6 |
5618 |
|
|
5619 |
exp -> exp '*' . exp (rule 3) |
exp -> exp '*' . exp (rule 3) |
5620 |
|
|
5621 |
NUM shift, and go to state 1 |
NUM shift, and go to state 1 |
5622 |
|
|
5623 |
exp go to state 10 |
exp go to state 10 |
5624 |
|
|
5625 |
state 7 |
state 7 |
5626 |
|
|
5627 |
exp -> exp '/' . exp (rule 4) |
exp -> exp '/' . exp (rule 4) |
5628 |
|
|
5629 |
NUM shift, and go to state 1 |
NUM shift, and go to state 1 |
5630 |
|
|
5631 |
exp go to state 11 |
exp go to state 11 |
5632 |
@end example |
@end example |
5633 |
|
|
5634 |
As was announced in beginning of the report, @samp{State 8 contains 1 |
As was announced in beginning of the report, @samp{State 8 contains 1 |
5643 |
exp -> exp . '*' exp (rule 3) |
exp -> exp . '*' exp (rule 3) |
5644 |
exp -> exp . '/' exp (rule 4) |
exp -> exp . '/' exp (rule 4) |
5645 |
|
|
5646 |
'*' shift, and go to state 6 |
'*' shift, and go to state 6 |
5647 |
'/' shift, and go to state 7 |
'/' shift, and go to state 7 |
5648 |
|
|
5649 |
'/' [reduce using rule 1 (exp)] |
'/' [reduce using rule 1 (exp)] |
5650 |
$default reduce using rule 1 (exp) |
$default reduce using rule 1 (exp) |
5651 |
@end example |
@end example |
5652 |
|
|
5653 |
Indeed, there are two actions associated to the lookahead @samp{/}: |
Indeed, there are two actions associated to the lookahead @samp{/}: |
5704 |
exp -> exp . '*' exp (rule 3) |
exp -> exp . '*' exp (rule 3) |
5705 |
exp -> exp . '/' exp (rule 4) |
exp -> exp . '/' exp (rule 4) |
5706 |
|
|
5707 |
'*' shift, and go to state 6 |
'*' shift, and go to state 6 |
5708 |
'/' shift, and go to state 7 |
'/' shift, and go to state 7 |
5709 |
|
|
5710 |
'/' [reduce using rule 2 (exp)] |
'/' [reduce using rule 2 (exp)] |
5711 |
$default reduce using rule 2 (exp) |
$default reduce using rule 2 (exp) |
5712 |
|
|
5713 |
state 10 |
state 10 |
5714 |
|
|
5718 |
exp -> exp '*' exp . (rule 3) |
exp -> exp '*' exp . (rule 3) |
5719 |
exp -> exp . '/' exp (rule 4) |
exp -> exp . '/' exp (rule 4) |
5720 |
|
|
5721 |
'/' shift, and go to state 7 |
'/' shift, and go to state 7 |
5722 |
|
|
5723 |
'/' [reduce using rule 3 (exp)] |
'/' [reduce using rule 3 (exp)] |
5724 |
$default reduce using rule 3 (exp) |
$default reduce using rule 3 (exp) |
5725 |
|
|
5726 |
state 11 |
state 11 |
5727 |
|
|
5731 |
exp -> exp . '/' exp (rule 4) |
exp -> exp . '/' exp (rule 4) |
5732 |
exp -> exp '/' exp . (rule 4) |
exp -> exp '/' exp . (rule 4) |
5733 |
|
|
5734 |
'+' shift, and go to state 4 |
'+' shift, and go to state 4 |
5735 |
'-' shift, and go to state 5 |
'-' shift, and go to state 5 |
5736 |
'*' shift, and go to state 6 |
'*' shift, and go to state 6 |
5737 |
'/' shift, and go to state 7 |
'/' shift, and go to state 7 |
5738 |
|
|
5739 |
'+' [reduce using rule 4 (exp)] |
'+' [reduce using rule 4 (exp)] |
5740 |
'-' [reduce using rule 4 (exp)] |
'-' [reduce using rule 4 (exp)] |
5741 |
'*' [reduce using rule 4 (exp)] |
'*' [reduce using rule 4 (exp)] |
5742 |
'/' [reduce using rule 4 (exp)] |
'/' [reduce using rule 4 (exp)] |
5743 |
$default reduce using rule 4 (exp) |
$default reduce using rule 4 (exp) |
5744 |
@end example |
@end example |
5745 |
|
|
5746 |
@noindent |
@noindent |
6218 |
@code{yyparse} return 1. @xref{Error Recovery}. |
@code{yyparse} return 1. @xref{Error Recovery}. |
6219 |
|
|
6220 |
@item YYERROR_VERBOSE |
@item YYERROR_VERBOSE |
6221 |
Macro that you define with @code{#define} in the Bison declarations |
An obsolete macro that you define with @code{#define} in the Bison |
6222 |
section to request verbose, specific error message strings when |
declarations section to request verbose, specific error message strings |
6223 |
@code{yyerror} is called. |
when @code{yyerror} is called. It doesn't matter what definition you |
6224 |
|
use for @code{YYERROR_VERBOSE}, just whether you define it. Using |
6225 |
|
@code{%error-verbose} is preferred. |
6226 |
|
|
6227 |
@item YYINITDEPTH |
@item YYINITDEPTH |
6228 |
Macro for specifying the initial size of the parser stack. |
Macro for specifying the initial size of the parser stack. |
6229 |
@xref{Stack Overflow}. |
@xref{Stack Overflow}. |
6230 |
|
|
6231 |
@item YYLEX_PARAM |
@item YYLEX_PARAM |
6232 |
Macro for specifying an extra argument (or list of extra arguments) for |
An obsolete macro for specifying an extra argument (or list of extra |
6233 |
@code{yyparse} to pass to @code{yylex}. @xref{Pure Calling,, Calling |
arguments) for @code{yyparse} to pass to @code{yylex}. he use of this |
6234 |
Conventions for Pure Parsers}. |
macro is deprecated, and is supported only for Yacc like parsers. |
6235 |
|
@xref{Pure Calling,, Calling Conventions for Pure Parsers}. |
6236 |
|
|
6237 |
@item YYLTYPE |
@item YYLTYPE |
6238 |
Macro for the data type of @code{yylloc}; a structure with four |
Macro for the data type of @code{yylloc}; a structure with four |
6246 |
@xref{Stack Overflow}. |
@xref{Stack Overflow}. |
6247 |
|
|
6248 |
@item YYPARSE_PARAM |
@item YYPARSE_PARAM |
6249 |
Macro for specifying the name of a parameter that @code{yyparse} should |
An obsolete macro for specifying the name of a parameter that |
6250 |
accept. @xref{Pure Calling,, Calling Conventions for Pure Parsers}. |
@code{yyparse} should accept. The use of this macro is deprecated, and |
6251 |
|
is supported only for Yacc like parsers. @xref{Pure Calling,, Calling |
6252 |
|
Conventions for Pure Parsers}. |
6253 |
|
|
6254 |
@item YYRECOVERING |
@item YYRECOVERING |
6255 |
Macro whose value indicates whether the parser is recovering from a |
Macro whose value indicates whether the parser is recovering from a |
6330 |
time to resolve reduce/reduce conflicts. @xref{GLR Parsers, ,Writing |
time to resolve reduce/reduce conflicts. @xref{GLR Parsers, ,Writing |
6331 |
@acronym{GLR} Parsers}. |
@acronym{GLR} Parsers}. |
6332 |
|
|
6333 |
|
@item %error-verbose |
6334 |
|
Bison declaration to request verbose, specific error message strings |
6335 |
|
when @code{yyerror} is called. |
6336 |
|
|
6337 |
@item %file-prefix="@var{prefix}" |
@item %file-prefix="@var{prefix}" |
6338 |
Bison declaration to set the prefix of the output files. @xref{Decl |
Bison declaration to set the prefix of the output files. @xref{Decl |
6339 |
Summary}. |
Summary}. |
6354 |
Bison declaration to assign left associativity to token(s). |
Bison declaration to assign left associativity to token(s). |
6355 |
@xref{Precedence Decl, ,Operator Precedence}. |
@xref{Precedence Decl, ,Operator Precedence}. |
6356 |
|
|
6357 |
|
@item %lex-param "@var{argument-declaration}" "@var{argument-name}" |
6358 |
|
Bison declaration to specifying an additional parameter that |
6359 |
|
@code{yylex} should accept. @xref{Pure Calling,, Calling Conventions |
6360 |
|
for Pure Parsers}. |
6361 |
|
|
6362 |
@item %merge |
@item %merge |
6363 |
Bison declaration to assign a merging function to a rule. If there is a |
Bison declaration to assign a merging function to a rule. If there is a |
6364 |
reduce/reduce conflict with a rule having the same merging function, the |
reduce/reduce conflict with a rule having the same merging function, the |
6380 |
Bison declaration to set the name of the parser file. @xref{Decl |
Bison declaration to set the name of the parser file. @xref{Decl |
6381 |
Summary}. |
Summary}. |
6382 |
|
|
6383 |
|
@item %parse-param "@var{argument-declaration}" "@var{argument-name}" |
6384 |
|
Bison declaration to specifying an additional parameter that |
6385 |
|
@code{yyparse} should accept. @xref{Parser Function,, The Parser |
6386 |
|
Function @code{yyparse}}. |
6387 |
|
|
6388 |
@item %prec |
@item %prec |
6389 |
Bison declaration to assign a precedence to a specific rule. |
Bison declaration to assign a precedence to a specific rule. |
6390 |
@xref{Contextual Precedence, ,Context-Dependent Precedence}. |
@xref{Contextual Precedence, ,Context-Dependent Precedence}. |