Overview
Dive into CPython's internals by implementing a new pipe operator in this PyCon US talk. Explore the CPython source code, learning about Python's grammar, syntax trees, and core language features. Follow along as the speaker obtains the source code, regenerates parser and token files, and compiles a modified version of CPython. Gain insights into writing and running tests for implementation changes. Suitable for those interested in exploring CPython internals, with some Python knowledge helpful but not required. Basic C programming is used, but prior experience is unnecessary. Acquire a mental framework to aid in understanding more comprehensive resources like the Python Developer's Guide.
Syllabus
Intro
Sebastiaan Zeeff
From source code to execution
Adding a new binary operator: A pipe operator
Tokenization: from raw text to a stream of tokens
Tokenization: Add a token for the operator
Python's Grammar & the PEG Parser
Implementing our new grammar rule
Regenerate the parser based on the new grammar
Part 2: From Abstract Syntax Tree to Magic (Execution) Part 2
Making the compiler use the new 'opcode File: Python/compilec
Part 2: We've got Bytecode!
Recap & Remarks
Taught by
PyCon US