我很难让变体在野牛中工作。我放进去
%{
...
%}
%define api.value.type variant
...
%%
...但我得到
bison -d -t -o parser.cpp parser.ypp
parser.ypp:16.9-22: error: '"yacc.c"' does not support '%define api.value.type variant'
%define api.value.type variant
^^^^^^^^^^^^^^我的版本应该支持变体。
bison --version
bison (GNU Bison) 3.0.2
Written by Robert Corbett and Richard Stallman.
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.发布于 2017-10-18 17:24:05
当错误消息谈到"yacc.c“时,它指的是C语言的"yacc”框架。变体是C++特性。使用%language "c++"将语言设置为C++,它将工作。
https://stackoverflow.com/questions/46815288
复制相似问题