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

Cant run yacc nor flex commands VS Code

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

I've installed Lex Flex Yacc Bison extension in Visual Studio Code, created a sample project, navigated to folder in the terminal, but when I run yacc -d syntax.y, the terminal doesn't recognize the yacc command. line 1 begins with %{. The only command that seems to work is ls to list the files in the current directory.

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
0
Scott McPeak 2019-09-10 12:12:20

The Lex Flex Yacc Bison extension only provides syntax highlighting for the input files to these tools; it does not include the tools themselves.

On Windows, probably the easiest way to get them is to install Cygwin. Cygwin has flex, yacc, and bison. Cygwin does not have a port of lex. I recommend using flex for lexical analysis and bison for grammatical analysis, since those are the actively mantained successors of lex and yacc.