⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bison++.1

📁 C++版 词法分析、语法分析器
💻 1
字号:
.TH BISON++ 1 "3/3/93" "GNU and RDT" "COMMANDS" 
.SH "NAME" 
bison++ \- generate a parser in c or c++\.
.SH "SYNOPSIS" 
\fBbison++\fP [\fB\-dltvyVu\fP] [\fB\-b\fP \fIfile\-prefix\fP] [\fB\-p\fP \fIname\-prefix\fP] [\fB\-o\fP \fIoutfile\fP] [\fB\-h\fP \fIheaderfile\fP] [\fB\-S\fP \fIskeleton\fP] [\fB\-H\fP \fIheader\-skeleton\fP] [\fB\-\-debug\fP] [\fB\-\-defines\fP] [\fB\-\-fixed\-output\-files\fP] [\fB\-\-no\-lines\fP] [\fB\-\-verbose\fP] [\fB\-\-version\fP] [\fB\-\-yacc\fP] [\fB\-\-usage\fP] [\fB\-\-help\fP] [\fB\-\-file\-prefix=\fP\fIprefix\fP] [\fB\-\-name\-prefix=\fP\fIprefix\fP] [\fB\-\-skeleton=\fP\fIskeletonfile\fP] [\fB\-\-headerskeleton=\fP\fIheaderskeletonfile\fP] [\fB\-\-output=\fP\fIoutfile\fP] [\fB\-\-header\-name=\fP\fIheader\fP] \fIgrammar\-file\fP
.SH "DESCRIPTION" 
Generate a parser\. Based on \fBbison\fP version 1\.19\. See \fBbison\fP(1) for details of main functionality\. Only changes are reported here\.
.PP
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\.
.PP
In plain C, the \fBbison++\fP is compatible with standard \fBbison\fP\.
.SH "OPTIONS" 
.\"bloc1[
.IP "\\fB\\-\\-name\\-prefix=\\fP\\fIprefix\\fP"
.IP "\\fB\\-p\\fP \\fIprefix\\fP"
Set prefix of names of yylex,yyerror\. keeped for compatibility, but you should prefer \fB%define LEX \fP\fInewname\fP, and similar\.
.IP "\\fB\\-\\-skeleton=\\fP\\fIskeleton\\fP"
.IP "\\fB\\-S\\fP \\fIskeleton\\fP"
Set filename of code skeleton\. Default is \fBbison\.cc\fP\.
.IP "\\fB\\-\\-headerskeleton=\\fP\\fIheader\\-skeleton\\fP"
.IP "\\fB\\-H\\fP \\fIheader\\-skeleton\\fP"
Set filename of header skeleton\. Default is \fBbison\.h\fP\.
.IP "\\fB\\-\\-header\\-name=\\fP\\fIheader\\fP"
.IP "\\fB\\-h\\fP \\fIheader\\fP"
Set filename of header skeleton\. Default is \fBy\.tab\.h\fP, or \fIprefix\fP\.h if option \fB\-b\fP is used or \fIc_basename\fP\.h if \fB\-o\fP is used\. \fB\.c\fP, \fB\.cc\fP, \fB\.C\fP, \fB\.cpp\fP, \fB\.cxx\fP options for output files are replaced by \fB\.h\fP for header name\.
.\"bloc1]
.SH "DECLARATIONS" 
These are new declarations to put in the declaration section :
.\"bloc1[
.IP "\\fB%name\\fP \\fIparser_name\\fP"
Declare the name of this parser\. User for C++ class name, and to render many names unique\. default is \fBparse\fP\. Must be given before \fB%union\fP and \fB%define\fP, or never\.
.IP "\\fB%define\\fP \\fIdefine_name\\fP \\fIcontent\\.\\.\\.\\fP"
Declare a macro symbol in header and code\. The name of the symbol is \fBYY_\fP'\fIparser_name\fP'\fB_\fP'\fIdefine_name\fP'\. The content if given after, as with #define\. Newline can be escaped as with #define\. Many symbols are proposed for customisation\.
.IP "\\fB%union\\fP"
as with bison generate a union for semantic type\. The difference is that the union is named \fByy_\fP'\fIparser_name\fP'\fB_stype\fP\.
.IP "\\fB%pure_parser\\fP"
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\.
.IP "\\fB%header{\\fP"
Like \fB%{\fP, but include this text both in the header, and in the code\. End with \fB%}\fP\. 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\.
.\"bloc1]
.PP
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 \fB%name\fP before any \fB%define\fP, since the name is needed to compose the name of the define symbols\. Order of \fB%header\fP and \fB%union\fP is important, since type may be undefined\.
.SH "DECLARATION DEFINE SYMBOLS" 
These are the symbols you can define with \fB%define\fP in declaration section, or that are already defined\. Remind that they are replaced by a preprocessor \fB#define YY_\fP'\fIparser_name\fP'\fB_\fP'\fIname\fP\.
.\"bloc1[
.IP "\\fBBISON\\fP"
defined to \fB1\fP in the code\. used for conditional code\. Don't redefine it\.
.IP "\\fBh_included\\fP"
defined in the code, and in the header\. used for include anti\-reload\. Don't redefine it\.
.IP "\\fBCOMPATIBILITY\\fP"
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\.
.IP "\\fBUSE_GOTO\\fP"
Indicates (if defined as 1) that \fBgoto\fP are to be used (for backward compatibility) in the parser function\. By default \fBgoto\fP are replaced with a \fBswitch\fP construction, to avoid problems with some compiler that don't support \fBgoto\fP and destructor in the same function block\. If \fBCOMPATIBILITY\fP is 1, and \fBUSE_GOTO\fP is not defined, then \fBUSE_GOTO\fP is defined to 1, to be compatible with older bison\.
.IP "\\fBUSE_CONST_TOKEN\\fP"
Indicate (if defined as 1) that \fBstatic const int\fP are to be used in C++, for token IDs\. By default an enum is used to define the token IDs instead of const\.
.IP "\\fBENUM_TOKEN\\fP"
When \fBenum\fP are used instead of \fBstatic const int\fP for token IDs, this symbol define the name of the enum type\. Defined to \fByy_\fP'\fIparser_name\fP'\fB_enum_token\fP by default\.
.IP "\\fBPURE\\fP"
Indicate that \fB%pure_parser\fP is asked\.\.\. Don't redefine it\.
.IP "\\fBLSP_NEEDED\\fP"
if defined indicate that @ construct is used, so \fBLLOC\fP stack is needed\. Can be defined to force use of location stack\.
.IP "\\fBDEBUG\\fP"
if defined to non\-0 activate debugging code\. See\fB YYDEBUG\fP in bison\.
.IP "\\fBERROR_VERBOSE\\fP"
if defined activate dump parser stack when error append\.
.IP "\\fBSTYPE\\fP"
the type of the semantic value of token\. defined by \fB%union\fP\. default is \fBint\fP\. See \fBYYSTYPE\fP in bison\. Don't redefine it, if you use a \fB%union\fP\.
.IP "\\fBLTYPE\\fP"
The token location type\. If needed default is \fByyltype\fP\. See \fBYYLTYPE\fP in bison\. default \fByyltype\fP is a typedef and struct defined as in old bison\.
.IP "\\fBLLOC\\fP"
The token location variable name\. If needed, default is \fByylloc\fP\. See \fByylloc\fP in bison\.
.IP "\\fBLVAL\\fP"
The token semantic value variable name\. Default \fByylval\fP\. See \fByylval\fP in bison\.
.IP "\\fBCHAR\\fP"
The lookahead token value variable name\. Default \fByychar\fP\. See \fByychar\fP in bison\.
.IP "\\fBLEX\\fP"
The scanner function name\. Default \fByylex\fP\. See \fByylex\fP in bison\.
.IP "\\fBPARSE\\fP"
The parser function name\. Default \fByyparse\fP\. See \fByyparse\fP in bison\.
.IP "\\fBPARSE_PARAM\\fP"
The parser function parameters declaration\. Default \fBvoid\fP 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\.
.IP "\\fBPARSE_PARAM_DEF\\fP"
The parser function parameters definition, for old style C\. Default nothing\. For example to use an \fBint\fP parameter called \fBx\fP, PARSE_PARAM is \fBx\fP, and PARSE_PARAM_DEF is \fBint x;\fP\. In ANSIC or C++ it is unuseful and ignored\.
.IP "\\fBERROR\\fP"
The error function name\. Default \fByyerror\fP\. See \fByyerror\fP in bison\.
.IP "\\fBNERRS\\fP"
The error count name\. Default \fByynerrs\fP\. See \fByynerrs\fP in bison\.
.IP "\\fBDEBUG_FLAG\\fP"
The runtime debug flag\. Default \fByydebug\fP\. See \fByydebug\fP in bison\.
.\"bloc1]
.PP
These are only used if class is generated\.
.\"bloc1[
.IP "\\fBCLASS\\fP"
The class name\. default is the parser name\.
.IP "\\fBINHERIT\\fP"
The inheritance list\. Don't forget the \fB:\fP before, if not empty list\.
.IP "\\fBMEMBERS\\fP"
List of members to add to the class definition, before ending it\.
.IP "\\fBLEX_BODY\\fP"
The scanner member function boby\. May be defined to \fB=0\fP for pure function, or to an inline body\.
.IP "\\fBERROR_BODY\\fP"
The error member function boby\. May be defined to \fB=0\fP for pure function, or to an inline body\.
.IP "\\fBCONSTRUCTOR_PARAM\\fP"
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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -