Welcome to PyCep’s documentation!

PyCep (Python Inception) is a Python 2.7 interpreter written in Python 2.7, with the goal to be fully compatible with CPython 2.7.

PyCep was created as study project to teach myself about writing interpreters. PyCep’s externally exported methods are modelled after the Python standard library, thus have identical method signatures and return the same data structures as those offered by Python itself, while being entirely written in Python.

Try it out!

def fib(n): a, b = 0, 1 while a < n: print a a, b = b, a+b fib(1000)

Implementation Status

Module Status Comments
Tokenizer 0% Forwarding calls to tokenize.generate_tokens().
Parser 98% Very good coverage (except handling of encodings)
Analyzer 14% Analyzing a handful of example programs.
Interpreter 3% Interpreting very few example programs.

Design Goals

  • External methods have the same signatures and produce the same results as those provided by the standard Python library
  • Each of the interpreter’s phases is built upon the previous phase, can be intercepted and studied independently of the other parts of the system


Get the sources from https://github.com/dlorch/pycep/

Indices and tables

comments powered by Disqus