LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Do flex and bison support C++? (http://www.linuxquestions.org/questions/programming-9/do-flex-and-bison-support-c-446968/)

ankit4u1 05-21-2006 07:38 AM

Do flex and bison support C++?
 
I want to write my action for rules and grammar in lex and yacc in c++. But I am not sure, whether flex and bison supports this. In case it does not support, what do i need to do, if i want to write my actions in c++ and C code. Do i need to change the source code in lex and yacc or just the the way and procedure of compilation like suppose i need to use flex++ instead of flex, do i need to just write flex++ during compilation instead of flex or do i need to change the coding in source files also(lex and yacc) ?

I read from man pages that there's flex++ also available for c++. But din't understand much as there was not much information given about that. So, I have posted this thread here.

I am using fedora core 2. So what should i do?

Hope to get a reply from you soon. Thank you.

Cheers
Ankit Parikh:Pengy:

jim mcnamara 05-22-2006 05:18 AM

See:

http://tldp.org/HOWTO/Lex-YACC-HOWTO-5.html

ankit4u1 05-23-2006 12:52 PM

thanks for the info..i'll try according to the info given on the webpage...

ankit4u1 05-24-2006 12:43 PM

I welcome more suggestions, because i read that for lex only C code can be used in action while in yacc, C++ can be used. And i am using flex not lex.

Also I want to use only C++ , as I am using STL (standard template library). So hope to get help regarding this.

Thank you.

jim mcnamara 05-24-2006 12:57 PM

flex++ accepts C++ code.

Try info flex++

ankit4u1 05-24-2006 01:26 PM

ok. so i just need to write flex++ while compilation right?
I'll try that. Thanks for the info.

friendship7 05-16-2008 11:17 AM

Hi all,

A little bit late reply, but I just discovered flex and bison a couple of months ago, and I am now in the way of my 2nd assembler with flex and bison. For me these tools are great.

Have a look here for flex and bison c++ support:

http://idlebox.net/2007/flex-bison-cpp-example/

Enjoy.

bozziebear 08-08-2011 04:56 PM

flex++ and bison++ support writing actions in c++ and also support encapsulating the parser and scanner within a class definition.

I believe Ubuntu offers flex++ and bison++ packages. For other distributions and also for flex++/bison++ code examples, download here:
http://code.google.com/p/flexpp-bisonpp/


All times are GMT -5. The time now is 09:14 PM.