Why Strings as Classes?

Benji Smith dlanguage at benjismith.net
Tue Aug 26 13:06:12 PDT 2008


superdan wrote:
>> Noooooooobody uses backtracking to parse.
> 
> guess that makes perl regexes et al noooooooobody.

I suppose it depends on your definition of "parse".

>> 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.

I've used ANTLR a few times. It's nice. I didn't realize it supported 
backtracking, though. (In my experience writing parsers, backtracking is 
one of those things you work overtime to eliminate, because it usually 
destroys performance.)

It's funny you should mention ANTLR, actually, in this discussion. A 
year or so ago, I was considering porting the ANTLR runtime to D. The 
original runtime is written in Java, and makes full use of the robust 
string handling capabilities of the Java standard library.

Based on the available text processing functionality in D at that time, 
I quickly gave up on the project as being not worth the effort.

--benji



More information about the Digitalmars-d mailing list