Buy the book!
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
Most programs that use Bison parse only one language and therefore contain
only one Bison parser. But what if you want to parse more than one
language with the same program? Then you need to avoid a name conflict
between different definitions of
yylval, and so on.
The easy way to do this is to use the option `-p prefix' (see section Invoking Bison). This renames the interface functions and variables of the Bison parser to start with prefix instead of `yy'. You can use this to give each parser distinct names that do not conflict.
The precise list of symbols renamed is
yydebug. For example, if you use `-p c',
the names become
clex, and so on.
All the other variables and macros associated with Bison are not
renamed. These others are not global; there is no conflict if the same
name is used in different parsers. For example,
YYSTYPE is not
renamed, but defining this in different ways in different parsers causes
no trouble (see section Data Types of Semantic Values).
The `-p' option works by adding macro definitions to the beginning
of the parser source file, defining
prefixparse, and so on. This effectively substitutes one
name for the other in the entire parser file.
|webmaster donations bookstore||delorie software privacy|
|Copyright © 2003 by The Free Software Foundation||Updated Jun 2003|