Guido documented his work on the construction of the new PEG parser for Python, and the algorithms have several reusable optimizations. https://medium.com/@gvanrossum_83706/left-recursive-peg-grammars-65dab3c580e1