Warm tip: This article is reproduced from serverfault.com, please click

bison-无法运行yacc或flex命令VS代码

(bison - Cant run yacc nor flex commands VS Code)

发布于 2019-09-09 22:33:54

我已经在Visual Studio Code中安装了Lex Flex Yacc Bison扩展,创建了一个示例项目,导航到终端中的文件夹,但是当我运行时yacc -d syntax.y,终端无法识别该yacc命令。第1行以开头%{似乎唯一有效的命令是ls列出当前目录中的文件。

yacc : The term 'yacc' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was 
included, verify that the path is correct and try again.
At line:1 char:1
+ yacc -d syntax.y
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (Yacc:String) [], 
      CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Questioner
user868935
Viewed
22
Scott McPeak 2019-09-10 12:12:20

莱克斯的Flex Yacc的野牛扩展只提供了输入文件到这些工具的语法高亮显示; 它不包括工具本身。

在Windows上,获取它们的最简单方法可能是安装CygwinCygwin的有flexyaccbisonCygwin没有端口lex我建议使用flex的词法分析和bison对语法分析,这是因为它们的积极编程和维持接班人lexyacc