bison -d myfile.y을 실행하면 다음 오류가 발생합니다. bison : m4 : 잘못된 인수. 문제는 운영자 우선 순위라고 생각하지만 여전히 문제를 해결할 수는 없습니다. Make * 함수는 명제 논리 표현식을 만듭니다.명제 논리 구문 분석기
은 yacc 파일 : 내 플랫폼에서
%{
#include "global.h"
#include "PLResolution.h"
%}
%token END
%token LEFT_PAREN RIGHT_PAREN
%token BICOND
%token FORWARD_IMPLIC BACKWARD_IMPLIC
%token OR
%token AND
%token NOT
%token identifier
%left BICOND
%left BACKWARD_IMPLIC
%left FORWARD_IMPLIC
%left OR
%left AND
%left NOT
%start Input
%%
Input:
/* Empty */
| Input Line
;
Line:
END
| Sentence END
;
Sentence:
AtomicSentence
| ComplexSentence
;
AtomicSentence:
identifier {$$=MakeAtomicSentence($1);}
;
ComplexSentence:
LEFT_PAREN Sentence RIGHT_PAREN
| NOT Sentence {$$=MakeNotSentence($1);}
| Sentence AND Sentence {$$=MakeAndSentence($1, $2);}
| Sentence OR Sentence {$$=MakeOrSentence($1, $2);}
| Sentence FORWARD_IMPLIC Sentence {$$=MakeForwardIMPLIC($1, $2);}
| Sentence BACKWARD_IMPLIC Sentence {$$=MakeBackwardIMPLIC($1, $2);}
| Sentence BICOND Sentence {$$=MakeBICOND($1, $2);}
;
%%
int yyerror(char *s) {
printf("%s\n",s);
}
int main(void) {
yyparse()
}
내 컴퓨터에서 정상적으로 작동합니다. bison을 사용중인 플랫폼과 bison의 버전은 무엇입니까? – Gian
@Gian 답장을 보내 주셔서 감사합니다. Windows Vista에서 bison 2.4.1을 실행하고 있습니다. 생성 된 코드를 보내 주시겠습니까? – saadtaame