Contribute Media
A thank you to everyone who makes this possible: Read More

Learn from LL(1) to PEG parser the hard way – Kir Chou (PyCon Taiwan 2021)


Day 2, 13:00-13:45


Do you know Python parser? Do you know CPython changed its LL(1) parser to PEG parser from Python 3.9 (PEP 617)? Do you know the difference between parsing technologies, including traditional top-down parser, bottom-parser parser, and Packrat parser? Do you know why Python chose PEG parser instead of others? In this talk, you will get the answer and the idea behind all the above questions.


In late 2019, Guido van Rossum wrote a series of articles about PEG parser on medium and gave the talk "Writing a PEG parser for fun and profit" in a couple of conferences, such as North Bay Python, mentioned the motivation of his research and prototype of PEG parser. In late 2020, other authors of PEP 617, Pablo Galindo and Lysandros Nikolaou, (created around mid of 2020) were interviewed on Podcast.__init__ to talk about the result of the new PEG parser in CPython.

Above contents assume the audience with solid compiler fundamental knowledge, but the fact is most People, including this talk's speaker, are not specialized in compiler. And another fact is most of the compiler class in school around the world only covers traditional top-down and bottom-up parsing techniques, not to mention PEG parser that appeared in the early 2000s.

For the above reasons, the speaker will stand on the shoulders of giants and share his hard way after a few months of study. He will talk about the fundamentals of Parser (part of compiler frontend), including CFG, traditional parsing techniques, PEG, Packrat parser, and PEG parser in CPython.

Slides: HackMD:

Speaker: Kir Chou

A code monkey works at Google with some experience in building search services in Amazon jungle before. This will be the 5th year of his presence in PyCon TW. 科高菜鳥碼猴,過去曾在亞馬遜做搜索服務,今年將會是它出現在PyCon台灣的第五年。(過去演講:


Improve this page