Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Parsing C

Name: Anonymous 2009-08-18 6:28

I want to write a parser in C (for some text files with my own layout), but I have no idea how do I start. Say, for each line not terminated by a full stop, I want to read from that line a list of items separated by a comma and put the results on a list, how do I do that?

Name: Anonymous 2009-08-18 6:38

http://compilers.iecc.com/crenshaw/

Crenshaw uses Turbo Pascal, but the principle is the same.

Name: Anonymous 2009-08-18 7:13

http://www.cs.man.ac.uk/~pjj/bnf/c_syntax.bnf

Here you go. You can pretty much translate this verbatim to a parser. I might do one for you on the weekend if I have time.

Name: Anonymous 2009-08-18 8:42

Soo... CSV?

Name: Anonymous 2009-08-18 8:51

>>4
Parsing CSV in C is probably the only thing null-terminated strings are good for. Just replace the commas with \0 and you're done.

Name: Anonymous 2009-08-18 10:37

>>1
Give it up, it's NP-complete.

Name: Anonymous 2011-02-04 12:50

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List