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!
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.