Where can I get flex & bison?

One of the most common requests I see on the VS extensibility newsgroup (and in my Inbox) is "where can I get a version of flex and bison that will work with the VSIP Language Wizard"? Here is how I recommend you set up your machine if you plan on writing a language service for Visual Studio using the VSIP Language Wizard:

  1.  Install Cygwin. Make sure you get flex & bison when selecting the packages to install. (Just re-run setup if you miss them the first time around.) I recommend installing everything to C:\cygwin.
  2. Create a new project via the Language Wizard.
  3. On the "Language Specification" page, uncheck "Use default lexer & parser".
  4. Change the "Command Line" fields on both tabs to point to the flex.exe and bison.exe files installed with Cygwin. They should be in the bin subdirectory of your Cygwin installation. Make sure to also change the "set INIT" line for the parser.
  5. On the Parser tab, change the –d flag in the bison command to
    "--defines=parser.cpp.h" (without the quotes).
  6.  Load & set the token settings to what you want and finish the wizard.
  7.  Build the solution.
  8. Open the "Microsoft Visual Studio .NET 2003 Exp" shortcut from the Start menu.
  9. Open a file with the extension you specified in the wizard

 

That should be enough to compile and test the "default" language service (a stripped down version of C). You can change the .lex/.y files in the wizard to compile your own language service. See the Babel package & documentation for more information. Hopefully this will get you well on your way to hooking your own language into Visual Studio!

Comments

  • Anonymous
    October 31, 2004
    Thanks for your help!
  • Anonymous
    May 12, 2011
    Perhaps some manager at Microsoft decided to retire the alloca() function thus causing this enormous problem heremsdn.microsoft.com/.../aa730877%28vs.80%29.aspxmsdn.microsoft.com/.../aa730877%28vs.80%29.aspxThe TinyMath function put forth by Microsoft above now will not compile:www.codeguru.com/.../showthread.phpSo nobody I know of can use FLEX and BISON with Visual Studio 2005.  The TinyMath files must be updated by Microsoft to replace with the new safer version of the old alloca() now please.  This is what happens when development environments are not backward compatible and examples get out of synch when managers retire some function.  Please help for many of us wish to use LEX and YACC within Developer Studio.  Thank you.