Linux command
bison 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Generate
bison [grammar.y]
Example
bison -v [grammar.y]
Specify
bison -o [parser.c] [grammar.y]
Example
bison -d [grammar.y]
说明
bison is a general-purpose parser generator that converts grammar descriptions (in .y files) into C, C++, or Java parsers. It's compatible with yacc and used for building compilers, interpreters, and other language processors. The tool is a GNU replacement for yacc with additional features and better error handling.
参数
- -o, --output=_file_
- Output file name
- -d, --defines
- Generate header file with token definitions
- -v, --verbose
- Create .output file with parser states
- -t, --debug
- Enable debug output in parser
- -g, --graph
- Generate VCG graph of parser
- -r, --report=_things_
- Generate report (state, itemset, lookahead)
- -W, --warnings
- Enable warnings
- -l, --no-lines
- Don't generate #line directives
FAQ
What is the bison command used for?
bison is a general-purpose parser generator that converts grammar descriptions (in .y files) into C, C++, or Java parsers. It's compatible with yacc and used for building compilers, interpreters, and other language processors. The tool is a GNU replacement for yacc with additional features and better error handling.
How do I run a basic bison example?
Run `bison [grammar.y]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -o, --output=_file_ do in bison?
Output file name