3 ms·
I’m curious if anyone knows why they didn’t use Antlr for the new parser. My (limited) experience using it has been nothing short of fantastic.
by xrisk 6y ago
I’m curious if anyone knows why they didn’t use Antlr for the new parser. My (limited) experience using it has been nothing short of fantastic.
- pansa2 6y agoApparently they didn’t even consider it: “We did not seriously consider alternative ways to implement the new parser, but here's a brief discussion of LALR(1). [...] Other variants of LR were not considered, nor was LL (e.g. ANTLR).” [https://www.python.org/dev/peps/pep-0617/ https://www.python.org/dev/peps/pep-0617/]
- xrisk 6y agoYes, that sentence is what prompted my question :D
- pansa2 6y agoSounds like the thought process was along the lines of: “LL(1) makes it too hard to add complex new features to the language, we must change to something else; PEG is something else; therefore we must change to PEG”.
- lgauss 6y agoAlso, the PEG parser's inability to point out unintended ambiguities fits well into the general anti-formalism of Python.
- pansa2 6y agoIt’s interesting that the old parser had the same problem. Although it did the parsing using an LL(1) algorithm, it never actually verified that the grammar was LL(1) before doing so. [https://discuss.python.org/t/should-there-be-a-check-whether-grammar-is-ll-1/5192 https://discuss.python.org/t/should-there-be-a-check-whether...]
- wrmsr 6y agoI'm a fellow fan of antlr but it's not really an option for the base interpreter. They're (rightfully) very stingy about deps. cpython supports a wide range of platforms and has its own very permissive license - it's a pretty self-contained codebase and they prefer to keep it that way.