BISON++

Section: COMMANDS (1)
Updated: 3/3/93
Index Return to Main Contents
 

NAME

bison++ - generate a parser in c or c++.  

SYNOPSIS

bison++ [-dltvyVu] [-b file-prefix] [-p name-prefix] [-o outfile] [-h headerfile] [-S skeleton] [-H header-skeleton] [--debug] [--defines] [--fixed-output-files] [--no-lines] [--verbose] [--version] [--yacc] [--usage] [--help] [--file-prefix=prefix] [--name-prefix=prefix] [--skeleton=skeletonfile] [--headerskeleton=headerskeletonfile] [--output=outfile] [--header-name=header] grammar-file  

DESCRIPTION

Generate a parser. Based on bison version 1.19. See bison(1) for details of main functionality. Only changes are reported here.

You now generate a C++ class if you are compiling with a C++ compiler. The generated header is far more rich than before, and is made from a skeleton-header. The code skeleton is also richer, and the generated code is less important compared to the skeletons. It permit you to modify much things only by changing the two skeletons.

In plain C, the bison++ is compatible with standard bison.  

OPTIONS

--name-prefix=prefix
-p prefix
Set prefix of names of yylex,yyerror. keeped for compatibility, but you should prefer %define LEX newname, and similar.
--skeleton=skeleton
-S skeleton
Set filename of code skeleton. Default is bison.cc.
--headerskeleton=header-skeleton
-H header-skeleton
Set filename of header skeleton. Default is bison.h.
--header-name=header
-h header
Set filename of header skeleton. Default is y.tab.h, or prefix.h if option -b is used or c_basename.h if -o is used. .c, .cc, .C, .cpp, .cxx options for output files are replaced by .h for header name.
 

DECLARATIONS

These are new declarations to put in the declaration section :
%name parser_name
Declare the name of this parser. User for C++ class name, and to render many names unique. default is parse. Must be given before %union and %define, or never.
%define define_name \fIcontent\.\.\.\fP
Declare a macro symbol in header and code. The name of the symbol is YY_'parser_name'_'define_name'. The content if given after, as with #define. Newline can be escaped as with #define. Many symbols are proposed for customisation.
%union
as with bison generate a union for semantic type. The difference is that the union is named yy_'parser_name'_stype.
%pure_parser
As with bison in C. In C++ generate a parser where yylval, and yylloc (if needed) are passed as parameter to yylex, and where some instance variable are local to yyparse (like yydebug...). Not very useful, since you can create multiple instances for reentering another parser.
%header{
Like %{, but include this text both in the header, and in the code. End with %}. When put in declaration section, the text is added before the definitions. It can be put in the last section so that the text is added after all definition in the header, and in the last section at the current position in the code.

Note that the order of these declaration is important, since they are translated into preprocessor sympols, typedef or code depending on their type. For example use %name before any %define, since the name is needed to compose the name of the define symbols. Order of %header and %union is important, since type may be undefined.  

DECLARATION DEFINE SYMBOLS

These are the symbols you can define with %define in declaration section, or that are already defined. Remind that they are replaced by a preprocessor #define YY_'parser_name'_'name.
BISON
defined to 1 in the code. used for conditional code. Don't redefine it.
h_included
defined in the code, and in the header. used for include anti-reload. Don't redefine it.
COMPATIBILITY
Indicate if obsoleted defines are to be used and produced. If defined to 0, indicate no compatibility needed, else if defined to non-0, generate it. If it is undefined, default is to be compatible if classes are not used.
USE_GOTO
Indicates (if defined as 1) that goto are to be used (for backward compatibility) in the parser function. By default goto are replaced with a switch construction, to avoid problems with some compiler that don't support goto and destructor in the same function block. If COMPATIBILITY is 1, and USE_GOTO is not defined, then USE_GOTO is defined to 1, to be compatible with older bison.
USE_CONST_TOKEN
Indicate (if defined as 1) that static const int are to be used in C++, for token IDs. By default an enum is used to define the token IDs instead of const.
ENUM_TOKEN
When enum are used instead of static const int for token IDs, this symbol define the name of the enum type. Defined to yy_'parser_name'_enum_token by default.
PURE
Indicate that %pure_parser is asked... Don't redefine it.
LSP_NEEDED
if defined indicate that @ construct is used, so LLOC stack is needed. Can be defined to force use of location stack.
DEBUG
if defined to non-0 activate debugging code. See YYDEBUG in bison.
ERROR_VERBOSE
if defined activate dump parser stack when error append.
STYPE
the type of the semantic value of token. defined by %union. default is int. See YYSTYPE in bison. Don't redefine it, if you use a %union.
LTYPE
The token location type. If needed default is yyltype. See YYLTYPE in bison. default yyltype is a typedef and struct defined as in old bison.
LLOC
The token location variable name. If needed, default is yylloc. See yylloc in bison.
LVAL
The token semantic value variable name. Default yylval. See yylval in bison.
CHAR
The lookahead token value variable name. Default yychar. See yychar in bison.
LEX
The scanner function name. Default yylex. See yylex in bison.
PARSE
The parser function name. Default yyparse. See yyparse in bison.
PARSE_PARAM
The parser function parameters declaration. Default void in C++ or ANSIC, nothing if old C. In ANSIC and C++ contain the prototype. In old-C comtaim just the list of parameters name. Don't allows default value.
PARSE_PARAM_DEF
The parser function parameters definition, for old style C. Default nothing. For example to use an int parameter called x, PARSE_PARAM is x, and PARSE_PARAM_DEF is int x;. In ANSIC or C++ it is unuseful and ignored.
ERROR
The error function name. Default yyerror. See yyerror in bison.
NERRS
The error count name. Default yynerrs. See yynerrs in bison.
DEBUG_FLAG
The runtime debug flag. Default yydebug. See yydebug in bison.

These are only used if class is generated.

CLASS
The class name. default is the parser name.
INHERIT
The inheritance list. Don't forget the : before, if not empty list.
MEMBERS
List of members to add to the class definition, before ending it.
LEX_BODY
The scanner member function boby. May be defined to =0 for pure function, or to an inline body.
ERROR_BODY
The error member function boby. May be defined to =0 for pure function, or to an inline body.
CONSTRUCTOR_PARAM
List ompliance can be enforced by not using extensions. If you want to forbide them, there is a good job ! :SECTION "FUTUR WORKS"         tell us !
        Support semantic parser. Is it really used ?
        POSIX compliance. is'nt it good now ?
        Use lex a

 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
DECLARATIONS
DECLARATION DEFINE SYMBOLS

This document was created by man2html, using the manual pages.
Time: GMT, April 13, 2002