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!