运行 严格的 Bison POSIX YACC 模式
Running Bison in strict POSIX YACC mode
我想写一个符合POSIX YACC 的YACC 文法。我尝试使用 Bison 选项 -y
和 -Wyacc
,但是,以下包含 Bison 特定指令 %code
的测试程序编译时没有警告:
%code {}
%%
dummy:;
有什么线索吗?
Bison 的 documentation 否认它符合 POSIX 的概念:
11.6 Secure? Conform?
Is Bison secure? Does it conform to POSIX?
If you’re looking for a guarantee or certification, we don’t provide it. However, Bison is intended to be a reliable program that conforms to the POSIX specification for Yacc. If you run into problems, please send us a bug report.
虽然它确实有 -Wyacc
选项,但这并不能涵盖所有内容。如前所述(在 2003 中):
Bison has a Yacc compatibility mode which is supposed to be POSIX
compliant, but that is all. Things that go beyond POSIX are extras.
如果您阅读源代码,请查找符号 Wyacc
。它仅在少数地方使用,这是唯一发出的消息:
POSIX 合规性
Thomas Dickey 对 Bison 文档的解读不正确。
Bison's documentation disclaims the notion that it complies with POSIX
只是错误的,引用的段落完美地说明了这一点。它甚至声明问题应报告为错误。
但是,文档的那部分肯定需要一些改进。之所以这样写,是因为以前有人问有没有“合规证书”,这个是不存在的。它来自 older documentation.
之前
Is Bison Y2K compliant?
If you're looking for a guarantee or certification, I can't
provide it. With a little thought you can answer this one for
yourself, though. (Hint: does a parser generator rely on the
date or time for anything?) If you're still confused, see
http://www.gnu.org/software/year2000.html for more information.
之后
Is Bison secure? Does it conform to POSIX?
If you're looking for a guarantee or certification, we don't
provide it. However, Bison is intended to be a reliable program
that conforms to the POSIX specification for Yacc. If you run
into problems, please send us a bug report.
Yacc 警告
过去,用户对选项的准确性兴趣不大 -Wyacc
。事实上,在 Bison 错误报告列表中并没有问到 Whosebug 上的这个问题。
然而,从那以后 -Wyacc
更加完整,特别是手头的案例得到了处理。
$ bison -Wyacc q.y
q.y:1.1-5: warning: POSIX Yacc does not support %code [-Wyacc]
1 | %code {}
| ^~~~~
我想写一个符合POSIX YACC 的YACC 文法。我尝试使用 Bison 选项 -y
和 -Wyacc
,但是,以下包含 Bison 特定指令 %code
的测试程序编译时没有警告:
%code {}
%%
dummy:;
有什么线索吗?
Bison 的 documentation 否认它符合 POSIX 的概念:
11.6 Secure? Conform?
Is Bison secure? Does it conform to POSIX?
If you’re looking for a guarantee or certification, we don’t provide it. However, Bison is intended to be a reliable program that conforms to the POSIX specification for Yacc. If you run into problems, please send us a bug report.
虽然它确实有 -Wyacc
选项,但这并不能涵盖所有内容。如前所述(在 2003 中):
Bison has a Yacc compatibility mode which is supposed to be POSIX compliant, but that is all. Things that go beyond POSIX are extras.
如果您阅读源代码,请查找符号 Wyacc
。它仅在少数地方使用,这是唯一发出的消息:
POSIX 合规性
Thomas Dickey 对 Bison 文档的解读不正确。
Bison's documentation disclaims the notion that it complies with POSIX
只是错误的,引用的段落完美地说明了这一点。它甚至声明问题应报告为错误。
但是,文档的那部分肯定需要一些改进。之所以这样写,是因为以前有人问有没有“合规证书”,这个是不存在的。它来自 older documentation.
之前
Is Bison Y2K compliant?
If you're looking for a guarantee or certification, I can't
provide it. With a little thought you can answer this one for
yourself, though. (Hint: does a parser generator rely on the
date or time for anything?) If you're still confused, see
http://www.gnu.org/software/year2000.html for more information.
之后
Is Bison secure? Does it conform to POSIX?
If you're looking for a guarantee or certification, we don't
provide it. However, Bison is intended to be a reliable program
that conforms to the POSIX specification for Yacc. If you run
into problems, please send us a bug report.
Yacc 警告
过去,用户对选项的准确性兴趣不大 -Wyacc
。事实上,在 Bison 错误报告列表中并没有问到 Whosebug 上的这个问题。
然而,从那以后 -Wyacc
更加完整,特别是手头的案例得到了处理。
$ bison -Wyacc q.y
q.y:1.1-5: warning: POSIX Yacc does not support %code [-Wyacc]
1 | %code {}
| ^~~~~