0

I want to use c++ to write a flex/bison parser, but the flex/bison I installed can only use and generate c code. I looked for a day yesterday and there are projects like flexc++ / bisonc++ in gitlab. But this corresponds to the linux system, I need a Windows version

qianqian
  • 25
  • 4
  • Which flex/bison did you install? Bison has been capable of producing C++ code for a long time. – rici Mar 15 '21 at 16:35
  • @rici GNU Bison 2.4.1 – qianqian Mar 15 '21 at 16:50
  • That's very outdated. What about https://chocolatey.org/packages/winflexbison3 – rici Mar 15 '21 at 16:52
  • @rici Thank you in advance for telling me such great things about choco, and thank you for telling me how to install the latest version of win flex/bison. I will try to solve the problem, thank you! – qianqian Mar 15 '21 at 17:44
  • @rici Unfortunately, although it is the latest version of flex/bison, it still cannot solve the problem. Because the root cause of the problem is because I cannot use C++ code to write the description of bison rules, including bison generates program.tab.c instead of program.tab.cc or program.tab.cpp – qianqian Mar 15 '21 at 18:14
  • did you tell bison to generate a c++ parser (`%language "c++"`)? Please read this tutorial from the bison manual: https://www.gnu.org/software/bison/manual/html_node/A-Simple-C_002b_002b-Example.html – rici Mar 15 '21 at 20:12
  • @rici No . I didn't know there was such a usage. – qianqian Mar 17 '21 at 18:23
  • @rici Thank You. I think we can work it out. Unfortunately, my mother confiscated my computer. – qianqian Mar 17 '21 at 18:24
  • I don't think StackOverflow can help you with that problem. Good luck :-) – rici Mar 17 '21 at 20:25

0 Answers0