我已经在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
该莱克斯的Flex Yacc的野牛扩展只提供了输入文件到这些工具的语法高亮显示; 它不包括工具本身。
在Windows上,获取它们的最简单方法可能是安装Cygwin。Cygwin的有flex
,yacc
和bison
。Cygwin没有端口lex
。我建议使用flex
的词法分析和bison
对语法分析,这是因为它们的积极编程和维持接班人lex
和yacc
。