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:
- 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.
- Create a new project via the Language Wizard.
- On the "Language Specification" page, uncheck "Use default lexer & parser".
- 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.
- On the Parser tab, change the –d flag in the bison command to
"--defines=parser.cpp.h" (without the quotes).
- Load & set the token settings to what you want and finish the wizard.
- Build the solution.
- Open the "Microsoft Visual Studio .NET 2003 Exp" shortcut from the Start menu.
- 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!