PYRS logo PYRS

AST and Bytecode Tools

Edit this page

Inspect parser and compiler output using AST and bytecode CLI tools.

PYRS includes built-in inspection modes for parser and compiler debugging.

Inspection Flags

Flag Output
—ast path.pyParses source and prints the module AST structure.
—bytecode path.pyCompiles source and prints disassembly of emitted code objects.
PYRS_BYTECODE_SHOW_TABLES=1Includes names/constants tables in disassembly output.

Common Commands

Shell
$ pyrs --ast path/to/script.py $ pyrs --bytecode path/to/script.py $ PYRS_BYTECODE_SHOW_TABLES=1 pyrs --bytecode path/to/script.py

When To Use Each Tool

Use case Recommended mode
Validate parser behavior and syntax lowering—ast
Debug opcode emission and nested code-object structure—bytecode
Inspect compiler constant/name indexing details—bytecode + PYRS_BYTECODE_SHOW_TABLES=1