2017-10-18 3 views
1

들소에서 변종을 만드는 데 문제가 있습니다. 나는들소에서 변종 활성화

%{ 
    ... 
%} 

%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. 

답변

0

"yacc.c"에 대한 오류 메시지는 C 언어의 "yacc"스켈레톤을 나타냅니다. 변형은 C++ 기능입니다. %language "c++"을 사용하여 언어를 C++로 설정하면 제대로 작동합니다.