플렉스와 들소를 사용하여 true nor true nor (false nor false)
과 같은 표현식이없는 계산기를 구현하려고하지만 오류 메시지가 계속해서 나타납니다.플렉스 및 들소 계산기
%{
#include <stdlib.h>
#include "y.tab.h"
%}
%%
("true"|"false") {return BOOLEAN;}
.|\n {yyerror();}
%%
int main(void)
{
yyparse();
return 0;
}
int yywrap(void)
{
return 0;
}
int yyerror(void)
{
printf("Error\n");
}
여기 내 .Y 파일입니다 : 여기 내 .L 파일입니다
/* Bison declarations. */
%token BOOLEAN
%left 'nor'
%% /* The grammar follows. */
input:
/* empty */
| input line
;
line:
'\n'
| exp '\n' { printf ("%s",$1); }
;
exp:
BOOLEAN { $$ = $1; }
| exp 'nor' exp { $$ = !($1 || $3); }
| '(' exp ')' { $$ = $2; }
;
%%
사람이 문제를 볼 수 있습니까는?