Why Strings as Classes?

Benji Smith dlanguage at benjismith.net
Tue Aug 26 14:31:55 PDT 2008


>>> superdan wrote:
>> well since you was gloating about handling a csv file as "parsing" i
>> thot i'd lower my definition accordingly :)

I don't know about "gloating". I mentioned it, because it was relevant 
to the conversation about places where streaming parsers are useful. But 
I can't see how it was gloating. Geez.

Why is everything a challenge to you? Why can't you just have a 
conversation, without getting all argumentative?

BCS wrote:
> A CVS parser can be interesting if you have high enough performance 
> demands (e.g. total memory footprint smaller than a single field might be)

It's also interesting from the perspective that you can write a basic 
parser, using a dirt-simple grammar, that performs no backtracking.

In the word of parsers, it's about as simple and braindead as you get, 
but it's damn handy nevertheless.

It's possible to do the same thing with a regular expression, but it's 
very tricky to correctly handle all the weird newline issues, and it's 
even harder to avoid backtracking. I've done it both ways, and the regex 
solution sucks, compared to using a real parser generator.

--benji



More information about the Digitalmars-d mailing list