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

📄 bison.1

📁 Bison语法分析器
💻 1
字号:
.TH BISON 1 local.SH NAMEbison \- GNU Project parser generator (yacc replacement).SH SYNOPSIS.B bison[.BI \-b  " file-prefix"] [.BI \-\-file-prefix= file-prefix] [.B \-d] [.B \-\-defines] [.B \-k] [.B \-\-token-table] [.B \-l] [.B \-\-no-lines] [.B \-n] [.B \-\-no-parser] [.BI \-o " outfile"] [.BI \-\-output-file= outfile] [.BI \-p " prefix"] [.BI \-\-name-prefix= prefix] [.B \-r] [.B \-\-raw] [.B \-t] [.B \-\-debug] [.B \-v] [.B \-\-verbose] [.B \-V] [.B \-\-version] [.B \-y] [.B \-\-yacc] [.B \-h] [.B \-\-help] [.B \-\-fixed-output-files]file.SH DESCRIPTION.I Bisonis a parser generator in the style of.IR yacc (1).It should be upwardly compatible with input files designedfor.IR yacc ..PPInput files should follow the.I yaccconvention of ending in.BR .y .Unlike.IR yacc ,the generated files do not have fixed names, but instead use the prefixof the input file.For instance, a grammar description file named.B parse.ywould produce the generated parser in a file named.BR parse.tab.c ,instead of.IR yacc 's.BR y.tab.c ..PPThis description of the options that can be given to.I bisonis adapted from the node.B Invocationin the.B bison.texinfomanual, which should be taken as authoritative..PP.I Bisonsupports both traditional single-letter options and mnemonic longoption names.  Long option names are indicated with.B \-\-instead of.BR \- .Abbreviations for option names are allowed as long as theyare unique.  When a long option takes an argument, like.BR \-\-file-prefix ,connect the option name and the argument with.BR = ..SS OPTIONS.TP.BI \-b " file-prefix".br.ns.TP.BI \-\-file-prefix= file-prefixSpecify a prefix to use for all.I bisonoutput file names.  The names arechosen as if the input file were named\fIfile-prefix\fB.c\fR..TP.B \-d.br.ns.TP.B \-\-definesWrite an extra output file containing macro definitions for the tokentype names defined in the grammar and the semantic value type.BR YYSTYPE ,as well as a few.B externvariable declarations..spIf the parser output file is named\fIname\fB.c\fRthen this fileis named\fIname\fB.h\fR..spThis output file is essential if you wish to put the definition of.B yylexin a separate source file, because.B yylexneeds to be able to refer to token type codes and the variable.BR yylval ..TP.B \-r.br.ns.TP.B \-\-rawThe token numbers in the \fIname\fB.h\fR file are usually the Yacc compatible translations.  If this switch is specified, Bison token numbersare output instead.  (Yacc numbers start at 257 except for single character tokens;  Bison assigns token numbers sequentially for all tokens starting at 3.).TP.B \-k.br.ns.TP.B \-\-token-tableThis switch causes the \fIname\fB.tab.c\fR output to include a list of token names in order by their token numbers;  this is defined in the array .IR yytname .Also generated are #defines for .IR YYNTOKENS ,.IR YYNNTS ,.IR YYNRULES ,and .IR YYNSTATES ..TP.B \-l.br.ns.TP.B \-\-no-linesDon't put any.B #linepreprocessor commands in the parser file.Ordinarily.I bisonputs them in the parser file so that the C compilerand debuggers will associate errors with your source file, thegrammar file.  This option causes them to associate errors with theparser file, treating it an independent source file in its own right..TP.B \-n.br.ns.TP.B \-\-no-parserDo not generate the parser code into the output;  generate onlydeclarations.  The generated \fIname\fB.tab.c\fR file will have only constant declarations.  In addition, a \fIname\fB.act\fR file isgenerated containing a switch statement body containing all thetranslated actions. .TP.BI \-o " outfile".br.ns.TP.BI \-\-output-file= outfileSpecify the name.I outfilefor the parser file..spThe other output files' names are constructed from.I outfileas described under the.B \-vand.B \-dswitches..TP.BI \-p " prefix".br.ns.TP.BI \-\-name-prefix= prefixRename the external symbols used in the parser so that they start with.I prefixinstead of.BR yy .The precise list of symbols renamed is.BR yyparse ,.BR yylex ,.BR yyerror ,.BR yylval ,.BR yychar , and.BR yydebug ..spFor example, if you use.BR "\-p c" ,the names become.BR cparse ,.BR clex ,and so on..TP.B \-t.br.ns.TP.B \-\-debugOutput a definition of the macro.B YYDEBUG into the parser file,so that the debugging facilities are compiled..TP.B \-v.br.ns.TP.B \-\-verboseWrite an extra output file containing verbose descriptions of theparser states and what is done for each type of look-ahead token inthat state..spThis file also describes all the conflicts, both those resolved byoperator precedence and the unresolved ones..spThe file's name is made by removing.B .tab.cor.B .cfrom the parser output file name, and adding.B .outputinstead..spTherefore, if the input file is.BR foo.y ,then the parser file is called.B foo.tab.cby default.  As a consequence, the verboseoutput file is called.BR foo.output ..TP.B \-V.br.ns.TP.B \-\-versionPrint the version number of.I bisonand exit..TP.B \-h.br.ns.TP.B \-\-helpPrint a summary of the options to.I bisonand exit..TP.B \-y.br.ns.TP.B \-\-yacc.br.ns.TP.B \-\-fixed-output-filesEquivalent to.BR "\-o y.tab.c" ;the parser output file is called.BR y.tab.c ,and the other outputs are called.B y.outputand.BR y.tab.h .The purpose of this switch is to imitate.IR yacc 'soutput file name conventions.Thus, the following shell script can substitute for.IR yacc :.sp.RS.ft Bbison \-y $*.ft R.sp.RE.PPThe long-named options can be introduced with `+' as well as `\-\-',for compatibility with previous releases.  Eventually support for `+'will be removed, because it is incompatible with the POSIX.2 standard..SH FILES/usr/local/lib/bison.simple	simple parser.br/usr/local/lib/bison.hairy	complicated parser.SH "ENVIRONMENT VARIABLES".TP.SM BISON_SIMPLEIf this is set, it specifies the location in which the.B bison.simpleparser can be found..TP.SM BISON_HAIRYIf this is set, it specifies the location in which the.B bison.hairyparser can be found..SH SEE ALSO.IR yacc (1).brThe.IR "Bison Reference Manual" ,included as the file.B bison.texinfoin the.I bisonsource distribution..SH DIAGNOSTICSSelf explanatory.

⌨️ 快捷键说明

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