Results 1 to 2 of 2

Thread: Parsing TExt

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2001
    Location
    UK
    Posts
    222

    Parsing TExt

    Hello

    I need some help on a project i don't know how to tackle.

    I will be getting data in various formats lets say a csv. i need to write a c++ program for linux UNIX etc that will let me write a specification that represents the data that a program can read and use to read int he full proper set of data......

    i need to do this in various files of varying size and what the ability to just write a descriptior of the data to enable processing!

    Am i explaining myself properly? i don't know! let me know either way and i'll get back to you

    Cheers

    Andy

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    If you want a general parser consider a table-drven recursive descent parser. This means you feed it data, and give it a table.
    The rules for whatever is done are in the table.

    See:
    http://www.cs.byu.edu/courses/cs236/...Grammars5.html

    I posted one of these as part of snot.c -- in this forum. You can look it up in search.

    The reverse - parsing based on data content is harder.
    This is the way you described what you wanted. And I wouldn't want to try to write a general parser like that. For the same reason, this is why windows uses file extensions to associate .EXE files with data. It is just too difficult to always correctly recognize the data format for a large variety of files.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width