A fully tree-walking Python interpreter built on top of Foundation and ARC.
Supports a rich subset of Python 3 — functions, classes, closures, recursion,
built-ins, and more — compiled with a single make.
Getting Started
Install the Xcode Command Line Tools if you haven't already, then clone or unzip and build.
#Install Xcode CLT (skip if already installed)
$xcode-select --install
#Clone from GitHub
$git clone https://github.com/llv03/pyinterp
$cd pyinterp
#Or unzip the archive
$unzip pyinterp.zip && cd pyinterp
$make
✓ Build succeeded
$./pyinterp tests/fibonacci.py
0 1 1 2 3 5 8 13 21 34 55 89 144
Keyboard Shortcuts
| Action | Command |
| Build | make |
| Run a script | ./pyinterp <file.py> |
| Run test suite | make test |
| Benchmark vs CPython | bash bench.sh |
Features
- Tree-walking interpreter — no bytecode, no JIT
- Types: int, float, str, bool, None, list, dict, tuple
- Control flow: if / elif / else, while, for…in, break, continue
- Functions with default args, keyword args, closures, and recursion
- Classes with
__init__, instance attributes, methods, and self
- 20+ built-ins: print, len, range, sorted, enumerate, zip, isinstance…
- String, list, and dict methods
- Math module: sqrt, pow, floor, ceil, pi, e
- Benchmark suite comparing PyInterp vs system CPython
Requirements
Toolchain
Xcode CLT + clang
Benchmark
Python 3 (optional)
No CocoaPods, no Swift Package Manager, no Xcode project file. Just the system compiler and Foundation.