pczarn / gearley

An Earley parser engine in Rust.
http://pczarn.github.io/gearley/gearley/index.html
Apache License 2.0
31 stars 2 forks source link

Parse right-recursive rules in linear time #5

Open pczarn opened 8 years ago

pczarn commented 8 years ago

Rewrite right-recursive rules into left-recursive ones. Rotate the parse forest to undo that rewrite.

It remains to be seen if all right-recursive rules can be rewritten in a simple way.

I'm sure Joop Leo's optimization is no longer possible. The recognizer went too far from a certain kind of approach. That is, it takes an integrated approach, instead of a Buildtree approach with linked items as described in Elizabeth Scott's paper[1]. Anyway, here are descriptions of Leo's optimization:

This complexity improvement is currently the most important one possible.

[1]: Elizabeth Scott. SPPF-Style Parsing From Earley Recognizers

pczarn commented 3 months ago

Mr Jeffrey Kegler said that rewrite is basically impossible. I believe Leo's is still an option.

Leo remains to be prototyped.