Skip to content

spy

Command line interface for the SPy interpreter and compiler

Usage

spy [OPTIONS] COMMAND [ARGS]...

Arguments

No arguments available

Options

No options available

Commands

Name Description
execute Execute the file in the vm (default)
build Generate c code, compile, and optionally...
redshift | rs Perform redshift and dump or execute the...
colorize Output the redshifted code or AST with...
parse Dump the SPy AST
pyparse Dump the Python AST
imports Dump the (recursive) list of imports
symtable Dump the symtables
cleanup Remove .spyc cache files

Subcommands

execute

Execute the file in the vm (default)

Usage

spy execute [OPTIONS] FILENAME [ARGV]...

Arguments

Name Description Required
FILENAME File to operate on Yes
ARGV Arguments passed to the main() function No

Options

Name Description Required Default
--timeit Print execution time No False
--pdb Enter interp-level debugger in case of error No False
--spdb Enter app-level debugger in case of error No False
-E, --error-mode [eager|lazy|warn] Handling strategy for static errors No eager
--no-spyc Disable loading/saving of .spyc cache files No False

build

Generate c code, compile, and optionally execute

Usage

spy build [OPTIONS] FILENAME [ARGV]...

Arguments

Name Description Required
FILENAME File to operate on Yes
ARGV Arguments passed to the main() function No

Options

Name Description Required Default
--timeit Print execution time No False
-x, --execute Execute the given module No False
--no-compile Generate the C code; do not compile No False
--cdump Dump the generated C code to stdout; do not compile No False
-b, --build-dir PATH Directory to store generated files (defaults to build/ next to the .spy file) No -
-O LEVEL Optimization level No 0
--Werror All compiler warnings are treated as errors No False
-g, --debug-symbols Generate debug symbols No False
--release enable release mode No False
-t, --target [native|wasi|emscripten] Compilation target No native
-k, --output-kind [exe|lib|py-cffi] Output kind No exe
--gc [auto|none|bdwgc] GC implementation: auto, none, bdwgc (default: auto, i.e. bdwgc for native, none for wasm targets) No auto
--static Produce a statically-linked executable (requires --target native) No False
--pdb Enter interp-level debugger in case of error No False
--spdb Enter app-level debugger in case of error No False
-E, --error-mode [eager|lazy|warn] Handling strategy for static errors No eager
--no-spyc Disable loading/saving of .spyc cache files No False

redshift | rs

Perform redshift and dump or execute the module

Usage

spy redshift | rs [OPTIONS] FILENAME [ARGV]...

Arguments

Name Description Required
FILENAME File to operate on Yes
ARGV Arguments passed to the main() function No

Options

Name Description Required Default
--timeit Print execution time No False
-x, --execute Execute the given module No False
--full-fqn Show full FQNs in redshifted modules No False
--linearize Apply linearize pass before dumping No False
--format, -f [ast|spy|html] Output format (ast, spy [source], or html) No spy
--spyast-js [cdn|inline] How to include spyast.js in the HTML output No inline
--pdb Enter interp-level debugger in case of error No False
--spdb Enter app-level debugger in case of error No False
-E, --error-mode [eager|lazy|warn] Handling strategy for static errors No eager
--no-spyc Disable loading/saving of .spyc cache files No False
--dump PATH Additional modules to dump No -

colorize

Output the redshifted code or AST with blue / red text colors.

Usage

spy colorize [OPTIONS] FILENAME

Arguments

Name Description Required
FILENAME File to operate on Yes

Options

Name Description Required Default
--format, -f [ast|json|spy|html] Output format for color data (ast, json, spy [source], or html) No spy
--spyast-js [cdn|inline] How to include spyast.js in the HTML output No inline
--pdb Enter interp-level debugger in case of error No False
--spdb Enter app-level debugger in case of error No False
-E, --error-mode [eager|lazy|warn] Handling strategy for static errors No eager
--no-spyc Disable loading/saving of .spyc cache files No False

parse

Dump the SPy AST

Usage

spy parse [OPTIONS] FILENAME

Arguments

Name Description Required
FILENAME File to operate on Yes

Options

Name Description Required Default
--format, -f [ast|html] Output format (ast or html) No ast
--spyast-js [cdn|inline] How to include spyast.js in the HTML output No inline
--pdb Enter interp-level debugger in case of error No False
--spdb Enter app-level debugger in case of error No False
-E, --error-mode [eager|lazy|warn] Handling strategy for static errors No eager
--no-spyc Disable loading/saving of .spyc cache files No False

pyparse

Dump the Python AST

Usage

spy pyparse [OPTIONS] FILENAME

Arguments

Name Description Required
FILENAME File to operate on Yes

Options

Name Description Required Default
--pdb Enter interp-level debugger in case of error No False
--spdb Enter app-level debugger in case of error No False
-E, --error-mode [eager|lazy|warn] Handling strategy for static errors No eager
--no-spyc Disable loading/saving of .spyc cache files No False

imports

Dump the (recursive) list of imports

Usage

spy imports [OPTIONS] FILENAME

Arguments

Name Description Required
FILENAME File to operate on Yes

Options

Name Description Required Default
--pdb Enter interp-level debugger in case of error No False
--spdb Enter app-level debugger in case of error No False
-E, --error-mode [eager|lazy|warn] Handling strategy for static errors No eager
--no-spyc Disable loading/saving of .spyc cache files No False

symtable

Dump the symtables

Usage

spy symtable [OPTIONS] FILENAME

Arguments

Name Description Required
FILENAME File to operate on Yes

Options

Name Description Required Default
--pdb Enter interp-level debugger in case of error No False
--spdb Enter app-level debugger in case of error No False
-E, --error-mode [eager|lazy|warn] Handling strategy for static errors No eager
--no-spyc Disable loading/saving of .spyc cache files No False

cleanup

Remove .spyc cache files

Usage

spy cleanup [OPTIONS] [PATH]

Arguments

Name Description Required
PATH No

Options

Name Description Required Default
--pdb Enter interp-level debugger in case of error No False
--spdb Enter app-level debugger in case of error No False
-E, --error-mode [eager|lazy|warn] Handling strategy for static errors No eager
--no-spyc Disable loading/saving of .spyc cache files No False