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
Dedentneed to be tokens
- Writing a Recursive Descent parser
- Parsing literals: ints, strings, lists, dictionaries
- Parsing expressions
- Parsing function calls -
- Semantic analysis: removing invalid code
- A tree-walk interpreter
- File I/O: implementing