在 Windows 上运行 bison 时出错“冲突:1 个移位/减少,1 个减少/减少 C:\GnuWin32 in ison.exe: m4: 无效参数”

问题描述 投票:0回答:1

第一次学习 lex yacc。 但 bison 中没有代码正在运行 错误:ison.exe 中的 C:\GnuWin32:m4:参数无效 我重新安装了野牛检查了路径,但错误仍然没有消失。 m4 文件有问题

PS C:\Users\Vishwajeet\Desktop\lab\Compiler\D2> bison -dy gm2.y 冲突:1 个移位/归约,1 个归约/归约 ison.exe 中的 C:\GnuWin32: m4: 参数无效

路径:C:\GnuWin32 路径中不带空格

%{
   #include<stdio.h>
   #include<stdlib.h>
   int yylex();
%}

%token A B C NL

%%

stmt: S NL  { printf("valid string\n");
              exit(0); }
;
S: X Y | W
;
X: A X B |
;
Y: C Y |
;
W: A W C | Z
;
Z: B Z |
;
%%

int yyerror(char *msg)
 {strong text
  printf("invalid string\n");
  exit(0);
 }
bison yacc lex
1个回答
-1
投票

很可能,您的路径中还有另一台 m4 gnuwin32 之前的环境变量 伴随着野牛。仔细检查一下。 您可以在环境路径变量列表的顶部设置路径 C:\GnuWin32。 Just move up this path on the top

© www.soinside.com 2019 - 2024. All rights reserved.