++ed by:

1 PAUSE user
5 non-PAUSE users.

Wilson Snyder


bisonpre - Bison wrapper with pre and post processing


  bisonpre --yacc bison --debug --verbose --defines X.h -k $< -pX -o X.c


Bisonpre is a wrapper for the Bison YACC replacement. Input to Bison is preprocessed with substitution as described below under EXTENSIONS. Output from Bison is checked for additional errors, and corrected to work around various compile warnings.



This is expanded into %type declarations.


Any text matching ~[a-z]+~ is removed. This allows optional text to be used only when the rule containing the ~~ is used in a BISONPRE_COPY.


This allows the label declaring a rule to also specify the type of the rule. The type will be inserted where /*BISONPRE_TYPES*/ is encountered.

BISONPRE_COPY(rule, {code})

Copy the rules and productions from the specified rule, filter through the Perl code provided in the {} and insert here into the output file.

BISONPRE_COPY_ONCE(rule, {code})

As with BISONPRE_COPY, but if called from underneath another BISONPRE_COPY rule, ignore it.

BISONPRE_NOT(token[, token...])

Create a rule that matches every token except for those specified.


If the bison version is >= the specified version, include the given command.


-b file-prefix =item --file-prefix=file-prefix

Passed to bison.

Specify a prefix to use for all bison output file names. The names are chosen as if the input file were named file-prefix.c.


Passed to bison.

Write an extra output file containing macro definitions for the token type names defined in the grammar and the semantic value type YYSTYPE, as well as a few extern variable declarations. If the parser output file is named name.c then this file is named name.h. This output file is essential if you wish to put the definition of yylex in a separate source file, because yylex needs to be able to refer to token type codes and the variable yylval.


Displays this message and program version and exits.

-k =item --token-table

Passed to bison.

This switch causes the name.tab.c output to include a list of token names in order by their token numbers; this is defined in the array yytname. Also generated are #defines for YYNTOKENS, YYNNTS, YYNRULES, and YYNSTATES.

==item -t ==item --debug

Passed to bison.

In the parser file, define the macro YYDEBUG to 1 if it is not already defined, so that the debugging facilities are compiled.

==item -v ==item --verbose

Passed to bison.

Write an extra output file containing verbose descriptions of the parser states and what is done for each type of look-ahead token in that state. This file also describes all the conflicts, both those resolved by operator precedence and the unresolved ones. The file's name is made by removing .tab.c or .c from the parser output file name, and adding .output instead. Therefore, if the input file is foo.y, then the parser file is called foo.tab.c by default. As a consequence, the verbose output file is called foo.output.


Print the version number and exit.


Specify the name of the bison executable, defaults to "bison."


This is part of the http://www.veripool.org/ free Verilog EDA software tool suite. The latest version is available from CPAN and from http://www.veripool.org/.

Copyright 2008-2010 by Wilson Snyder. This package is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


Wilson Snyder <wsnyder@wsnyder.org>