The Prologue section contains macro definitions and
declarations of functions and variables that are used in the actions in the
grammar rules. These are copied to the beginning of the parser file so
that they precede the definition of yyparse. You can use
`#include' to get the declarations from a header file. If you don't
need any C declarations, you may omit the `%{' and `%}'
delimiters that bracket this section.
You may have more than one Prologue section, intermixed with the
Bison declarations. This allows you to have C and Bison
declarations that refer to each other. For example, the %union
declaration may use types defined in a header file, and you may wish to
prototype functions that take arguments of type YYSTYPE. This
can be done with two Prologue blocks, one before and one after the
%union declaration.
%{
#include <stdio.h>
#include "ptypes.h"
%}
%union {
long n;
tree t; /* tree is defined in `ptypes.h'. */
}
%{
static void print_token_value (FILE *, int, YYSTYPE);
#define YYPRINT(F, N, L) print_token_value (F, N, L)
%}
...
Please take a moment to fill out
this visitor survey You can help support this site by
visiting the advertisers that sponsor it! (only once each, though)