Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 8th, 2007, 2:23 AM   #1
Soulstorm
Hobbyist Programmer
 
Soulstorm's Avatar
 
Join Date: Jan 2006
Location: Menidi, Athens, Greece
Posts: 234
Rep Power: 3 Soulstorm is on a distinguished road
Thinking of programming in Python but I need some advice...

Learning programming, I stumbled upon some problems I have.

I am fairly proficient with C++, and Objective C with Cocoa, and I have developed programs that many people use with Cocoa. But lately, I had the idea of writing my own parser in C++ (I think that for this task I should avoid Objective C).

However, I found that C++ can be very frustrating when writing a parser, even a recursive descent one. So, I decided to learn another language.

So, what I want is a language that can be used in conjunction with C++. I want to be able to write parsers in it, and then use the results with C++. And I want to write it on OS X.

I was thinking of learning Python, but I thought I should ask someone first. Your ideas?
__________________
Project::Soulstorm (personal homepage)
Soulstorm is offline   Reply With Quote
Old Aug 8th, 2007, 3:51 AM   #2
dr.p
Programmer
 
dr.p's Avatar
 
Join Date: Feb 2006
Location: Ohio
Posts: 93
Rep Power: 3 dr.p is on a distinguished road
I've thought about using Perl/C++ for such things, because of Perl's regular expressions. Could be worth a look. There are probably some good regular expression C++ libraries out there, tho.
__________________
Neeley.org
dr.p is offline   Reply With Quote
Old Aug 8th, 2007, 5:47 AM   #3
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 927
Rep Power: 4 lectricpharaoh will become famous soon enough
I agree with dr.p's advice, in particular the bit about looking for a regex library for C++. These problems have been encountered before, and as you're already comfortable with C++, it makes sense to see how others have approached them. One possible idea is to check out the source for gcc or some such; any compiler will have to do non-trivial parsing.
__________________
A man's knowledge is like an expanding sphere, the surface corresponding to the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all. - L. Sprague de Camp
lectricpharaoh is offline   Reply With Quote
Old Aug 8th, 2007, 6:26 AM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Check out Boost. It has a regex library and a parser library (Spirit). OS X is supported.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Aug 8th, 2007, 6:55 AM   #5
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4 Arevos is on a distinguished road
Quote:
Originally Posted by Soulstorm View Post
However, I found that C++ can be very frustrating when writing a parser, even a recursive descent one. So, I decided to learn another language.

So, what I want is a language that can be used in conjunction with C++. I want to be able to write parsers in it, and then use the results with C++. And I want to write it on OS X.

I was thinking of learning Python, but I thought I should ask someone first. Your ideas?
I wouldn't have said Python was a very good choice for writing a parser in. You may just need a better C++ library, but I'm not too clued up on C++ parsing systems so I can't give you advice on that.

Otherwise, functional languages like Haskell and OCaml are generally considered good choices for writing parsers in, if you're willing to spend the time learning them.
Arevos is offline   Reply With Quote
Old Aug 8th, 2007, 12:20 PM   #6
Soulstorm
Hobbyist Programmer
 
Soulstorm's Avatar
 
Join Date: Jan 2006
Location: Menidi, Athens, Greece
Posts: 234
Rep Power: 3 Soulstorm is on a distinguished road
Quote:
Originally Posted by DaWei View Post
Check out Boost. It has a regex library and a parser library (Spirit). OS X is supported.
OS X is supported... only in documentation. When building with the standard build method (configure, make install) all I get is a long compile time, just to show in the end that some files were not compiled. Why? I don't know.
__________________
Project::Soulstorm (personal homepage)
Soulstorm is offline   Reply With Quote
Old Aug 9th, 2007, 7:28 PM   #7
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
Maybe you shouldn't spread FUD? You do realize libraries like boost are used by C++ heavy weights like Adobe on OS X every day right? I work with boost on OS X everyday. Darwin ports works out of the box and we have compiled it by hand as well.

So in summary: Just because you can't get the library to work doesn't mean it doesn't.
__________________
Robotics @ Maryland AUV Team - Software Lead
Game_Ender is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Thinking about moving to USA to work in software - advice please! funkey_monkey Coder's Corner Lounge 3 Jan 23rd, 2007 7:56 AM
26 Year Old, Considering Programming (advice plz) Zephirus C++ 23 May 25th, 2006 3:01 AM
Python programming game? commodore Python 7 Feb 7th, 2006 6:26 PM
[tutorial] Python for programming beginners coldDeath Python 30 Dec 14th, 2005 11:35 AM
Python - A Programmers Introduction coldDeath Python 17 Aug 19th, 2005 12:41 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:31 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC