srhickma / padd

Fast and Automatic Formatting of Context-Free Languages
Apache License 2.0
2 stars 2 forks source link

Optimize Right Recursion in Earley Parser #20

Open srhickma opened 6 years ago

srhickma commented 6 years ago

Right recursion runs in quadratic time with the Earley parser on grammars that can be parsed in linear time by LR(k) parsers. Ideally we should optimize the parser, but for the time being, grammars should be rewritten to use left-recursion instead.

Take a look at: http://loup-vaillant.fr/tutorials/earley-parsing/right-recursion https://github.com/jeffreykegler/kollos/blob/master/notes/misc/leo2.md

srhickma commented 5 years ago

The urgency of this has been dwarfed by other improvements in #12, and this should be moved to the backlog.