Why Strings as Classes?
superdan
super at dan.org
Tue Aug 26 12:43:20 PDT 2008
Benji Smith Wrote:
> superdan wrote:
> > Benji Smith Wrote:
> >>
> >> I wrote a streaming CSV parser (which takes discipline to do correctly,
> >> since a double-quote enclosed field can legally contain arbitrary
> >> newline characters, and quotes are escaped by doubling). It provides a
> >> field callback and a record callback, so it's very handy for performing
> >> ETL tasks.
> >>
> >> If I had to load the whole CSV files into memory before parsing, it
> >> wouldn't work, because sometimes they can be hundreds of megabytes. But
> >> the streaming parser takes up almost no memory at all.
> >>
> >> --benji
> >
> > sure it takes very little memory. i'll tell u how much memory u need in fact. it's the finite state needed by the fsa. u could do that because csv only needs finite state for parsing. soon as you need to backtrack stream parsing becomes very difficult.
>
> Noooooooobody uses backtracking to parse.
guess that makes perl regexes et al noooooooobody.
> Most of the time LL(k) token lookahead solves the problem. Sometimes you
> need a syntactic predicate or (rarely) a semantic predicate.
>
> I've never even heard of a parser generator framework that supported
> backtracking.
live & learn. keep lookin'. hint: try antlr.
More information about the Digitalmars-d
mailing list