Reinventing the Parser Generator
summary
Describes a modernization that rewrites PLY into SLY, replacing docstring hacks with real lexer+LALR(1) grammar classes that abuses modern metaclasses and uses guaranteed dictionary ordering, class decorators and type hints. Shows concrete fixes: a 15‑year bug where negative 3 minus 4 parsed wrong, examples of token‑type remapping and on‑the‑fly int conversion, and cleaner no-cache deployment. Works under Python 3.6+ but intentionally bends language internals and breaks IDEs and some tooling.
AI-written summary · about
chapters (13)
- 0:00Start
- 0:27Reinventing the Parser Generator
- 0:49Parser Generators
- 1:38Python Magic Methods
- 2:10Linguistic Abstraction
- 6:05C Python Distribution
- 13:14Ignore Warning Messages
- 13:54Error Function
- 19:55Assignment Statement
- 20:14Print Statement
- 31:00Types
- 38:04Precedence Rules
- 39:12Downsides
related talks
34mLrparsing, when regular expressions aren't enough
59mWriting Domain Specific Languages with Python
27mPython is Weird
34mCompiling Pythons with Custom Grammar for the sake of a joke
35mInterview
28mPipe-ifying Python: The how and why of interpreter hacking
22mLearning Parseltongue: Wizardry in Python
50mPerformance tricks learned from low level developers
