logo       

Re: further thoughts on adaptive parse algorithms: msg#00029

parsers.spirit.devel

Subject: Re: further thoughts on adaptive parse algorithms

Hi!

Tobias Schwinger wrote:
> Another interesting idea is to apply "loop unrolling" to Kleene if many
> matches are expected: Instead of
>
> *a
>
> we could write
>
> *(a >> a >> a >> a >> a >> a >> a >> a)
> >> !(a >> a >> a >> a)
> >> !(a >> a)
> >> ! a
>
> and if "a" is a parser that doesn't have to save the iterator position
> per se, we'd reduce iterator copying down to asymptotically 1/8th in
> this case.

To me it looks like the 'a' parser could probably be invoked
4 times failing before the whole thing is done. Is this worth the
trouble? Let's see.

If 'a' was a primitive, then you would not need much optimizing. The
standard '*a' would give a nice tight loop.

If 'a' was a complex parser then you would trade some iterator copying
for retrying this complex parser a few times.

To me the unrolling approach doesn't look promising. Did I miss something?

Frank



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise