Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Python (http://www.programmingforums.org/forum43.html)
-   -   Thinking of programming in Python but I need some advice... (http://www.programmingforums.org/showthread.php?t=13725)

Soulstorm Aug 8th, 2007 3:23 AM

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?

dr.p Aug 8th, 2007 4:51 AM

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.

lectricpharaoh Aug 8th, 2007 6:47 AM

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.

DaWei Aug 8th, 2007 7:26 AM

Check out Boost. It has a regex library and a parser library (Spirit). OS X is supported.

Arevos Aug 8th, 2007 7:55 AM

Quote:

Originally Posted by Soulstorm (Post 131861)
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.

Soulstorm Aug 8th, 2007 1:20 PM

Quote:

Originally Posted by DaWei (Post 131870)
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.

Game_Ender Aug 9th, 2007 8:28 PM

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.


All times are GMT -5. The time now is 3:07 AM.

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