locked
Flex and Bison on Visual Studio 2010

    Question

  • Hello , i want to use c++ with a lexicographic and syntactic analysis tool.

    Is there any way to use flex and bison in Visual studio?

     

    Sunday, March 28, 2010 11:03 AM

All replies

  • From what I understand, flex and bison tools are associated with specific extension types, the output of Flex and Bison will also need to be passed to CL. If that is correct, you can create custom build rules for flex and bison and associate the custom build rules with the specific file types. We can go into more details if this is what you expect. 

    In VS2008, there is UI available to help you create the custom build rule, although in VS2010, there will not be UI available to create the custom build rules.  You can take a look of the MASM and LC custom build rule files under %ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations or %ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations on x64 machine to see how the custom build rule looks like in VS2010.

    Li Shao, MSFT


    Li Shao
    Sunday, March 28, 2010 5:43 PM
  • Hello, You did not say which version of visual studio, nor which language. It is possible to integrate Flex and Bison with Visual Studio 8 express - that is the one I have tried. It is a matter of downloading and installing the Binaries of the latest versions and then defining the necessary build rules. I retrieved a copy of the build rules from the internet. There is a full description of the process here http://msdn.microsoft.com/en-us/library/aa730877(VS.80).aspx. I then had to modify the rules in order to access the executables from the correct location. However, the standard versions of Bison and Flex do not generate managed code and I have been unable to find versions that do. I managed to develop a modified set of skeleton and macro files for Bison in order to generate the managed c++ code, and, if you are interested I can let you have them. I am currently looking at generating managed c++ code from Flex, but at first glance this is going to involve more than just replacing the skeleton. I hope this helps. Regards, Tony
    Sunday, April 04, 2010 9:17 AM