LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-21-2006, 08:38 AM   #1
ankit4u1
Member
 
Registered: Apr 2006
Distribution: Red Hat, Fedora
Posts: 97

Rep: Reputation: 15
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
 
Old 05-22-2006, 06:18 AM   #2
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 34
See:

http://tldp.org/HOWTO/Lex-YACC-HOWTO-5.html
 
Old 05-23-2006, 01:52 PM   #3
ankit4u1
Member
 
Registered: Apr 2006
Distribution: Red Hat, Fedora
Posts: 97

Original Poster
Rep: Reputation: 15
thanks for the info..i'll try according to the info given on the webpage...
 
Old 05-24-2006, 01:43 PM   #4
ankit4u1
Member
 
Registered: Apr 2006
Distribution: Red Hat, Fedora
Posts: 97

Original Poster
Rep: Reputation: 15
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.
 
Old 05-24-2006, 01:57 PM   #5
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 34
flex++ accepts C++ code.

Try info flex++
 
Old 05-24-2006, 02:26 PM   #6
ankit4u1
Member
 
Registered: Apr 2006
Distribution: Red Hat, Fedora
Posts: 97

Original Poster
Rep: Reputation: 15
ok. so i just need to write flex++ while compilation right?
I'll try that. Thanks for the info.
 
Old 05-16-2008, 12:17 PM   #7
friendship7
LQ Newbie
 
Registered: Oct 2004
Posts: 15

Rep: Reputation: 0
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.
 
Old 08-08-2011, 05:56 PM   #8
bozziebear
LQ Newbie
 
Registered: Mar 2007
Distribution: openSUSE
Posts: 3

Rep: Reputation: 0
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/
 
  


Reply

Tags
lex, programming, yacc


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
installing bison and flex rameshsena Linux - Software 10 06-21-2010 12:33 PM
bison / flex zaman Programming 1 08-16-2005 11:19 AM
Problem with binutils first pass / bison & flex installation peristaltic Linux From Scratch 3 03-20-2005 11:17 AM
[flex & bison] Why does my rule fail from line 2? chuanyung Programming 0 07-30-2004 05:21 AM
bison, flex and make problem ChimpFace9000 Programming 4 05-19-2002 08:49 PM


All times are GMT -5. The time now is 07:36 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration