Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 4, 2007, 12:31 AM   #1
Soulstorm
macrumors 68000
 
Soulstorm's Avatar
 
Join Date: Feb 2005
Writting a C++ Parser

Well, that may sound too vague, but I am trying to improve my skills in writing parsers. So far for C++ I haven't tried to look at any other type of parser other than recursive descent.

All I would like is to have some resources to get started with writing recursive descent parsers. Examples, tutorials, etc.

PS. If the resources are for Cocoa, I still want them
Soulstorm is offline   0 Reply With Quote
Old Aug 4, 2007, 01:08 AM   #2
kpua
macrumors 6502
 
Join Date: Jul 2006
http://en.wikipedia.org/wiki/Recursive_descent_parser
kpua is offline   0 Reply With Quote
Old Aug 11, 2007, 08:44 PM   #3
ChrisA
macrumors G4
 
Join Date: Jan 2006
Location: Redondo Beach, California
Quote:
Originally Posted by Soulstorm View Post
Well, that may sound too vague, but I am trying to improve my skills in writing parsers. So far for C++ I haven't tried to look at any other type of parser other than recursive descent.

All I would like is to have some resources to get started with writing recursive descent parsers. Examples, tutorials, etc.

PS. If the resources are for Cocoa, I still want them
Theoretical question: Can you write a recursive descent parser for C++?
I don't know I forgot if C++ is context sensitive or not

I would only do a recurcive decent parser for a simple language. The
last two I wrote I simply used LEX/YACC. It is so much easier and
you can be done in an hour.

But RD is easy, just write some functions that return "true" on a match.
Google found this. Looks good
http://teaching.idallen.com/cst8152/...t_parsing.html
ChrisA is offline   0 Reply With Quote
Old Aug 12, 2007, 03:39 AM   #4
Catfish_Man
macrumors 68030
 
Catfish_Man's Avatar
 
Join Date: Sep 2001
Location: Portland, OR
Send a message via AIM to Catfish_Man
C or Objective-C would likely be a better choice. C++ is horrifyingly complex to parse correctly.
Catfish_Man is offline   0 Reply With Quote
Old Aug 12, 2007, 06:32 AM   #5
Norton Disney
macrumors newbie
 
Join Date: Aug 2007
Flex/Bison are alternatives to Lex/Yacc, that I've personally used.

Probably the best resource that you can have for writing a compiler is the Dragon book. There's quite a lot of theory to wade through before you get to the juicy bits. For example, you're going to need to have a good understanding of BNF.

If I recall correctly, there are a lot of ambiguities in the C++ grammar that make writing a compiler for it difficult. That contrasts with C, which has only one ambiguity, the 'dangling else'.
Norton Disney is offline   0 Reply With Quote
Old Aug 12, 2007, 10:23 AM   #6
devman
macrumors 65816
 
devman's Avatar
 
Join Date: Apr 2004
Location: AU
good luck! A C++ parser is a tough task.
devman is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
writting a proper mpkg BruisedGhost Mac Programming 2 Sep 29, 2008 12:46 PM
powermac superdrive writting speed questions flyin3d Macintosh Computers 2 Sep 23, 2005 08:15 PM
Help writting a basic Java app mgiddy911 Mac Programming 11 Oct 15, 2004 11:52 AM
Writting app with 17" PowerBook? Wano Mac Applications and Mac App Store 2 Mar 30, 2003 06:37 PM


All times are GMT -5. The time now is 05:18 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC