PYRS logo PYRS

Contributing: Architecture

Edit this page

High-level architecture map for contributors working on parser, compiler, VM, and extension runtime.

This page summarizes where major interpreter responsibilities live so contributors can place changes in the right subsystem.

Top-Level Flow

Stage Primary modules
Parsingsrc/parser/* (packrat parser entry points and lexer/token handling)
Compilationsrc/compiler/* (AST-to-bytecode lowering and scope analysis)
Runtime/VMsrc/vm/* (execution loop, builtins, import substrate, object-model behavior)
CLI and REPLsrc/cli/mod.rs, src/cli/repl.rs
Native extensionssrc/vm/vm_extensions/* and include/pyrs_capi.h

VM Ownership Rules (Contributor View)

Area Where to change behavior
Bytecode execution flowsrc/vm/vm_execution.rs
Builtin dispatch mappingsrc/vm/vm_native_dispatch.rs
Import/bootstrap wiringsrc/vm/vm_bootstrap_import.rs, src/vm/builtins_import.rs
Core runtime helperssrc/vm/vm_runtime_methods.rs
Native stdlib substratessrc/vm/stdlib/*
C-API/extension runtimesrc/vm/vm_extensions/* (split by API surface family)

Placement Discipline

  • Do not put new domain logic into monolithic orchestrator files when a focused module exists.
  • Keep behavior in the owning subsystem (parser/compiler/vm/extensions) with minimal cross-leakage.
  • Ship behavior changes with tests in the same commit.
  • For CPython-visible behavior, treat CPython semantics as the sole target.