Re: Splitting strings....
Re: Splitting strings....
- Subject: Re: Splitting strings....
- From: Allan Odgaard <email@hidden>
- Date: Sat, 28 Feb 2004 17:12:53 +0100
On 28. Feb 2004, at 15:46, Public Look wrote:
Scanning and parsing strings are two of the most mature disciplines in
Computer Science and there is no reason to ever write this type of
code the hard way again IMHO.
Although parsing is a mature theoretic discipline, I can think of a few
practical reasons why the OP would not want to do as you suggest:
flex generate switch/case-code rather than parser-tables, leading to
larger executables.
flex is for ASCII, not unicode, so at best the NSString should be
converted to UTF8.
flex, by default, reads from a FILE* (stdin), the OP needs to work on a
string (although flex actually use a macro to get the next byte, which
can be re-defined to something else).
flex generate code rather than data, so only one grammar can be used
pr. program (unless pre-processing the flex source to add
namespace-prefixes or similar).
flex generate code which use global variables, so the program would not
be re-entrant.
flex generate a parser for regular languages, so the OP would also need
to use bison to solve his task -- now writing a grammar for both flex
and bison and setting it up to solve his task starts to be more
complicated than the task itself.
etc.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.