Thread: A quick parser

  1. #16
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    The problem here is not so much one of parsing, but one of storing. Haskell has great support for discriminated unions. In C++, that support is there, but at considerably greater syntactical expense.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  2. #17
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    Will '*anychar_p' not just eat everything? Shouldn't it at least be '*(anychar_p - '=')'?

    I haven't used Boost::Spirit in a while; I may be wrong.

    Soma

  3. #18
    Registered User
    Join Date
    Apr 2007
    Posts
    141
    I'm definitely going to have to take a look at this in my 'copious' spare time. I've got the libraries and documentation downloaded somewhere......

    I've been programming in Haskell for a while, in part due to the hype. The fact is, it isn't that much more productive than C++ for the kind of stuff I do and somewhat less so due to the fact that the library support is not as great. C++ has a larger base and has been active for longer.

    It's just too bad Python is so darn slow for number crunching (though numpy can be faster than Matlab I'm told).

  4. #19
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by phantomotap View Post
    O_o

    Will '*anychar_p' not just eat everything? Shouldn't it at least be '*(anychar_p - '=')'?

    I haven't used Boost::Spirit in a while; I may be wrong.

    Soma
    No -- remember that spirit has a "skip parser" which discards whitespace by default. To force anychar_p to actually "eat everything" you would specify:

    Code:
    lexeme_d[*anychar_p]

  5. #20
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    I was referring to cases such as one other post offered-namely 'var1=3.3' or similar.

    Soma

  6. #21
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by phantomotap View Post
    I was referring to cases such as one other post offered-namely 'var1=3.3' or similar.

    Soma
    Well, the grammar was never formally defined, so who knows.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. strcmp returning 1...
    By Axel in forum C Programming
    Replies: 12
    Last Post: 09-08-2006, 07:48 PM
  2. Do you know...
    By davejigsaw in forum C++ Programming
    Replies: 1
    Last Post: 05-10-2005, 10:33 AM
  3. Problem with a file parser.
    By Hulag in forum C++ Programming
    Replies: 7
    Last Post: 03-17-2005, 09:54 AM
  4. recursive quick sort - stack overflow
    By Micko in forum C Programming
    Replies: 9
    Last Post: 01-01-2005, 05:51 PM
  5. Parser - need help!
    By thelma in forum C Programming
    Replies: 2
    Last Post: 04-05-2004, 08:06 PM