2023-07-19 –, PyCharm (Forum Hall)
You use the Python interpreter every single day. It does a lot of things for you: checks that your code has valid syntax and is properly indented, imports modules from various locations, and runs your code instruction-by-instruction.
But if you've ever wondered how exactly it happens, this talk will teach you the entire process, by building a working python interpreter from scratch.
The plan is to write a really simple, but working Python interpreter that can run Python code, from scratch.
The topics we'll be going through to build this interpreter:
- Lexing an indentation based language
- Why Indent
and Dedent
need to be tokens
- Writing a Recursive Descent parser
- Parsing literals: ints, strings, lists, dictionaries
- Parsing expressions
- Parsing function calls - print("Hello world!")
- Semantic analysis: removing invalid code
- A tree-walk interpreter
- Interpreting print()
statements
- Running import
statements
- File I/O: implementing open()
calls
- Running json.loads()
and json.dumps()
from scratch
intermediate