Skip to main content

Crate stryke

Crate stryke 

Source
Expand description

Crate root — see README.md for overview.

Re-exports§

pub use vm_helper::perl_bracket_version;
pub use vm_helper::FEAT_SAY;
pub use vm_helper::FEAT_STATE;
pub use vm_helper::FEAT_SWITCH;
pub use vm_helper::FEAT_UNICODE_STRINGS;

Modules§

agent
agent submodule. stryke agent — Persistent load testing agent for distributed stress testing.
ai
ai submodule. AI primitives — Phase 0 (“walking skeleton”) of the design in docs/AI_PRIMITIVES.md.
ai_sugar
ai_sugar submodule. Source-level desugar for tool fn and mcp_server syntax.
aop
aop submodule. Aspect-oriented programming primitives for stryke.
aot
aot submodule. Ahead-of-time build: bake a Perl script into a copy of the running stryke binary as a compressed trailer, producing a self-contained executable.
ast
ast submodule. AST node types for the Perl 5 interpreter. Every node carries a line field for error reporting.
banner
banner submodule. Stryke ASCII logo + live-stats box banner. Single source of truth shared by:
builtins
builtins submodule. Builtins dispatched from FuncCall (names not modeled as dedicated ExprKinds). I/O uses Interpreter::io_file_slots for raw read/write/seek alongside buffered handles.
builtins_bio_geom_markov
builtins_bio_geom_markov submodule. Bioinformatics, 3D geometry, sequence alignment, file format header parsers, resampling, Markov chains.
builtins_bits_music_stats
builtins_bits_music_stats submodule. Bit manipulation, music theory, hash functions, text utilities, statistical tests. Pure deterministic functions.
builtins_combin_audio_physics
builtins_combin_audio_physics submodule. Combinatorics, audio synthesis, search algorithms, physics 2D, noise generators, RNG variants, polygonal numbers.
builtins_const
builtins_const submodule. Constants & distribution helpers. HTTP status codes return their numeric value. HTTP method names return their canonical uppercase form. Distribution PDF/quantile/ sampler functions use the statrs crate.
builtins_data
builtins_data submodule. HTML / JSON / XML / CSS primitives. Uses serde_json and scraper (both already deps). XML/CSS ops that don’t have a clean crate-backed implementation use lightweight regex/string parsing — pragmatic, not RFC-perfect.
builtins_games_ml_chem
builtins_games_ml_chem submodule. Game theory, ML inference primitives, operations research, chemistry, language modeling, information-theoretic divergences.
builtins_geom
builtins_geom submodule. Geometric primitives, complex numbers, color-space extras, and trig extras. Pure functions, no external crates.
builtins_github
builtins_github submodule. GitHub REST API primitives — pragmatic wrappers around api.github.com.
builtins_iter
builtins_iter submodule. Iterator combinator + string-distance extras. Pure functions, no external crates.
builtins_linalg_graph_date
builtins_linalg_graph_date submodule. Linear algebra (matrices), graph algorithms, calendar/date helpers, special math. Pure functions only.
builtins_mathx
builtins_mathx submodule. Math / number theory / random extras.
builtins_misc
builtins_misc submodule. Miscellaneous primitives: BigInt ops + game/physics vectors + probabilistic data structures + audio synthesis basics + geo extras. Pure functions where possible; BigInt uses num-bigint.
builtins_misc2
builtins_misc2 submodule. Currency / ML / file-path / locale / channels. Pure functions where possible. Channels honor capacity, oneshot auto-close, and subscriber cursors; timeout args are accepted but no-op in the single-thread VM.
builtins_net
builtins_net submodule. Network / IP / CIDR / MAC primitives — Phase 1 of the 10k-builtin push.
builtins_phonetic_geo_codec
builtins_phonetic_geo_codec submodule. Phonetic algorithms, geo projections, base58/base91, astronomy, CRC variants, color blending, compression primitives.
builtins_quant
builtins_quant submodule. Quantitative builtins: technical indicators, time-series ops, finance, optimization, numerical methods. Pure functions; deliberately compact implementations.
builtins_ratings_geom_units
builtins_ratings_geom_units submodule. Ratings/tournaments, image morphology, computational geometry 2D, crypto primitives, physics constants, case conversions, photography, unit conversions.
builtins_sync
builtins_sync submodule. Synchronization primitives — basic exclusive mutex + counting semaphore.
builtins_validate
builtins_validate submodule. Validation / input-check primitives.
builtins_vision_ir_algorithms
builtins_vision_ir_algorithms submodule. Computer vision / image kernels, information retrieval, distance metrics, Bayesian updates, RL primitives, color spaces, window functions, trie / Fenwick / union-find, network extras.
bytecode
bytecode submodule.
capture
capture submodule. Structured shell output: capture("cmd").
cli_runners
cli_runners submodule. Shared runners for stryke check and stryke test.
cluster
cluster submodule. Persistent SSH worker pool dispatcher for pmap_on.
compiler
compiler submodule.
controller
controller submodule. stryke controller — Interactive REPL for coordinating stress test agents.
convert
convert submodule. Convert standard Perl source to idiomatic stryke syntax.
dap
dap submodule. Debug Adapter Protocol (DAP) server for stryke.
data_section
data_section submodule. Split __DATA__ from program source (line must equal __DATA__ after trim).
debugger
debugger submodule. Interactive debugger for stryke programs.
deconvert
deconvert submodule. Deconvert stryke .stk syntax back to standard Perl .pl syntax.
deparse
deparse submodule. AST-to-source deparser for serializing code refs.
doc_render
doc_render submodule. Render raw hover-doc markdown (from lsp::doc_text_for) into a terminal display string. Same visual surface as the stryke docs interactive browser — bold topic heading, dim rule, cyan inline backticks, green code fences — but without the pager chrome (header/footer banner, page navigation hints), so a single doc page can be returned by the docs(TOPIC) builtin and printed inline at the REPL.
docs
docs submodule. Module-doc generator — produces Markdown documentation from a parsed stryke source file by pairing ## doc comments with the top-level declaration immediately below them.
english
english submodule. English.pm-style scalar aliases (use English).
error
error submodule.
fmt
fmt submodule. Pretty-print parsed Perl back to source (stryke --fmt). Regenerate with python3 tools/gen_fmt.py after ast.rs changes.
format
format submodule. Perl format / write — picture lines and field padding (subset of Perl 5 perlform).
fusevm_bridge
fusevm_bridge submodule: translates strykelang bytecode to the shared fusevm runtime, making strykelang a fusevm frontend (opt-in JIT tier). Bridge between strykelang bytecode (crate::bytecode::Op) and the shared fusevm runtime.
getopts
getopts submodule. getopts — Getopt::Long-style CLI flag parser.
god
god submodule. god EXPR — omniscient runtime introspection.
kvstore
kvstore submodule. rkyv-backed KV store — first-class CRUD store in any scripting language.
lexer
lexer submodule.
list_builtins
list_builtins submodule. Stryke list builtins — native Rust implementations of sum, min, max, uniq, reduce, zip, the pairs family, and friends. Every fn here is a bare-name builtin reachable via [dispatch_by_name]; there is no Perl module emulation layer.
lsp
lsp submodule. Language server protocol (stdio) for editors — stryke --lsp.
lsp_docs_domains
lsp_docs_domains submodule. Hand-written LSP hover descriptions for stryke builtins grouped by domain. Returned via doc_for_label_text fallback — every entry here is concise, signature-typed, and ships a runnable example.
lsp_extras
lsp_extras submodule. Additional LSP capabilities for stryke --lsp:
lsp_symbols
lsp_symbols submodule. Scope-aware symbol table for the LSP server. Powers rename, find-references, and go-to-declaration with proper lexical-scope resolution instead of the textual-occurrence fallback in [crate::lsp::highlights_for_identifier].
mcp
mcp submodule. MCP client (Model Context Protocol) — Phase 2 of AI_PRIMITIVES.md.
minify
minify submodule. Source-code minifier for stryke (stryke minify FILE).
mro
mro submodule. C3 method resolution order (Perl mro / Algorithm::C3 style).
nat_punch
nat_punch submodule. STUN client + UDP hole-punching state machine for stryke’s stun and punch builtins.
native_data
native_data submodule. Native CSV (csv crate), SQLite (rusqlite), and HTTP JSON (ureq + serde_json) helpers.
pack
pack submodule. Subset of Perl pack / unpack for binary I/O. Supported: A a N n V v C Q q Z H x w i I l L s S f d (optional repeat count after each; * for some).
par_lines
par_lines submodule. Memory-mapped parallel line iteration for par_lines PATH, fn { ... }. Splits the file into byte ranges aligned to line starts, then processes each chunk in parallel with rayon (each chunk scans its lines sequentially).
par_pipeline
par_pipeline submodule. par_pipeline — two overloads:
par_walk
par_walk submodule. Parallel recursive directory walk for par_walk PATH, fn { ... }.
parallel_trace
parallel_trace submodule. Optional stderr tracing for mysync mutations under trace { ... } and fan.
parser
parser submodule.
pcache
pcache submodule. Thread-safe memoization for crate::ast::ExprKind::PcacheExpr.
pchannel
pchannel submodule. Typed message channels for parallel blocks (pchannel, send, recv, pselect).
perf_recorder
perf_recorder submodule. Wall-clock recorder for stryke --record. Writes one row per stryke invocation to ~/.stryke/perf.sqlite, queryable via the perfview builtin.
perl_decode
perl_decode submodule. UTF-8 vs Latin-1 octet decoding for Perl-compatible text (no dependency on crate::value). Used by I/O, par_lines, and byte stringification.
perl_fs
perl_fs submodule. Perl-style filesystem helpers (stat, glob, etc.).
perl_inc
perl_inc submodule. Resolve @INC paths from the system perl binary (same directories Perl searches for .pm files).
perl_pty
perl_pty submodule. PTY-driven interactive automation — Phases 1–4 of the Tcl/Expect-style feature. Builtins are bare-name and take the handle hashref as first argument; method-form $h->expect(...) works through the thin PtyHandle class shipped via [PTY_HANDLE_CLASS_STK].
perl_signal
perl_signal submodule. Minimal %SIG delivery for common signals (Unix). Handlers run between statements.
pkg
pkg submodule. stryke package manager — RFC: docs/PACKAGE_REGISTRY.md.
ppool
ppool submodule. Persistent thread pool (ppool) — workers pull jobs from a shared queue and run each task on a fresh VMHelper on an existing OS thread (no rayon task spawn per item; threads stay alive between jobs).
profiler
profiler submodule. Wall-clock profiler for stryke --profile.
provenance
provenance submodule. provenance($val) — value lineage as a first-class builtin.
pwatch
pwatch submodule. Parallel file notifications for pwatch GLOB, fn { ... } (notify + rayon).
remote_wire
remote_wire submodule. Framed bincode over stdin/stdout for stryke --remote-worker (distributed pmap_on).
rust_ffi
rust_ffi submodule. Inline Rust FFI — rust { ... } blocks compiled to a cdylib on first run, dlopened, and registered as Perl-callable subs.
rust_sugar
rust_sugar submodule. Source-level desugaring for rust { ... } FFI blocks.
scope
scope submodule.
script_cache
script_cache submodule. rkyv-backed bytecode cache for scripts.
secrets
secrets submodule. Encrypted secrets — AES-256-GCM authenticated encryption.
serialize_normalize
serialize_normalize submodule. Free-function recursive flatten of stryke ClassInstance / StructInstance values into plain hashref / arrayref trees, for use by serializers (to_json, to_xml, to_yaml, to_toml, to_html, ddump) that take &[StrykeValue] and don’t have a &VMHelper to consult.
shell_exec
exec submodule. Faithful Rust ports of free functions and file-static globals from Src/exec.c. The wordcode-VM dispatch tree (execlist / execpline / execcmd / execsimple etc.) that drives execution in C zsh is NOT replicated here — zshrs runs the fusevm bytecode VM instead (see src/vm_helper.rs + src/fusevm_bridge.rs).
shell_fds
fds submodule. File descriptor utilities for zshrs.
shell_history
history submodule. SQLite-backed command history for zshrs.
shell_jobs
jobs submodule. job control for zshrs
shell_parse
parse submodule. Zsh parser — direct port from zsh/Src/parse.c.
shell_signal
signals submodule. Signal handling for zshrs
shell_zle
zle submodule. ZLE - Zsh Line Editor
shell_zwc
zwc submodule. ZWC (Zsh Word Code) file parser. Direct port of the dump-file family in zsh/Src/parse.c:3077-end.
sketches
sketches submodule. Probabilistic data structures as native stryke builtins.
special_vars
special_vars submodule. Perl 5 ${^NAME} scalars: see perlvar.
static_analysis
static_analysis submodule. Static analysis pass for detecting undefined variables and subroutines.
stego
stego submodule. Polymorphic steganography: hide(CARRIER, SECRET [, KEY]) / reveal(STEGO [, KEY]).
stress
stress submodule. Expanded stress-testing surface. The original stress_cpu / stress_mem / stress_io / stress_test / heat builtins live in builtins.rs; this module adds the rest of the load-axis matrix — float / int / cache / branch / sort compute; sustained-disk + IOPS; TCP / HTTP / DNS network; fork / thread churn; alloc / mmap memory; crypto / compress / regex / json kernels; ramp / burst / oscillate patterns; and per-system telemetry (temp / freq / throttle / load / meminfo).
stryke_log
stryke_log submodule. Stryke long-lived log file at ~/.stryke/stryke.log (or $STRYKE_HOME/stryke.log when that env var is set).
teleport
teleport submodule. teleport($val, @pids) + arrive([$timeout_ms]) — multi-target SHM IPC.
token
token submodule.
turn_client
turn_client submodule. TURN client (RFC 8656 core) for stryke’s relay-fallback path when pure UDP hole-punching fails (symmetric NATs, UDP-blocking firewalls).
turnbuckle
turnbuckle submodule. turnbuckle($peer_pid) — 1:1 peer-pair keepalive over UNIX-domain datagram.
udp_sockets
udp_sockets submodule. Persistent UDP socket pool for stryke’s hole-punching builtins.
value
value submodule.
vm
vm submodule.
vm_helper
vm_helper submodule.
web
web submodule. Web framework runtime — Rails-shaped builtins for stryke.
web_orm
web_orm submodule. Web framework ORM + migrator runtime — PASS 3 + PASS 4.
zsh_lex
lex submodule. Zsh lexical analyzer - Direct port from zsh/Src/lex.c
zsh_parse
parse submodule. Zsh parser — direct port from zsh/Src/parse.c.
zsh_tokens
lex submodule. Zsh lexical analyzer - Direct port from zsh/Src/lex.c

Macros§

slog_debug
slog_error
slog_info
slog_trace
slog_trace!("tag", "fmt {} {}", a, b);
slog_warn

Constants§

ERRFLAG_ERROR
ERRFLAG_ERROR constant.

Statics§

zsh_errflag
Port of int errflag from Src/init.c. Tracks whether an error has been raised (ERRFLAG_ERROR = 1) or break/return is in flight (ERRFLAG_INT = 2).

Functions§

bigint_pragma
Returns true when use bigint; is active in this script.
compat_mode
Returns true when --compat is active.
compile_and_run_prelude
Compile program and run only the prelude (BEGIN/CHECK/INIT phase blocks) via the VM. Stores the compiled chunk on interp.line_mode_chunk for per-line re-execution.
convert_to_stryke
Convert a parsed program to stryke syntax with |> pipes and no semicolons.
convert_to_stryke_with_options
Convert a parsed program to stryke syntax with custom options.
deconvert_to_perl
Deconvert a parsed stryke program back to standard Perl .pl syntax.
deconvert_to_perl_with_options
Deconvert a parsed stryke program back to standard Perl .pl syntax with options.
format_program
Parse a string of Perl code and return the AST. Pretty-print a parsed program as Perl-like source (stryke --fmt).
lint_program
Parse + register top-level subs / use (same as the VM path), then compile to bytecode without running. Also runs static analysis to detect undefined variables and subroutines.
no_interop_mode
Effective no-interop flag for this thread: TLS override if set, else the process-wide default. Hot path — called from parser/lexer.
no_interop_mode_tls
Read the current thread’s no-interop override (without falling back). Used by RAII guards to save/restore.
parse
parse — see implementation.
parse_and_run_module_in_file
Like parse_and_run_string_in_file, but marks parsing as a module load. Allows shadowing stryke builtins (e.g. sub blessed { ... }) unless --no-interop is active.
parse_and_run_string
Parse and execute a string of Perl code within an existing interpreter. Compile and execute via the bytecode VM. Uses VMHelper::file for both parse diagnostics and __FILE__ during this execution.
parse_and_run_string_in_file
Like parse_and_run_string, but parse errors and __FILE__ for this run use file (e.g. a required module path). Restores VMHelper::file after execution.
parse_module_with_file
Like parse_with_file, but marks the parser as loading a module. Modules are allowed to shadow stryke builtins (e.g. sub blessed { ... } in Scalar::Util.pm) unless --no-interop.
parse_with_file
Parse with a source path for lexer/parser diagnostics (… at FILE line N), e.g. a script path or a required .pm absolute path. Use parse for snippets where -e is appropriate.
run
Parse and execute a string of Perl code with a fresh interpreter.
run_line_body
Execute the body portion of a pre-compiled chunk for one input line. Sets $_ to line_str, runs from body_start_ip to Halt, returns $_ for -p output.
run_lsp_stdio
Language server over stdio (stryke --lsp). Returns a process exit code.
set_bigint_pragma
Enable bigint pragma (use bigint;) — integer overflow promotes to BigInt instead of demoting to f64.
set_compat_mode
Enable Perl 5 strict-compatibility mode (disables all stryke extensions).
set_no_interop_mode
Set the process-wide default for no-interop mode. Used by the CLI (--no-interop); threads without a thread-local override inherit it.
set_no_interop_mode_tls
Set the current thread’s no-interop override. None clears it; Some(b) pins this thread to b. Sibling threads are unaffected — the primitive that lets check_no_interop work safely from pmaps.
try_vm_execute
Try to compile and run via bytecode VM. Returns None if compilation fails.
vendor_perl_inc_path
Crate-root vendor/perl (e.g. List/Util.pm). The stryke / stryke driver prepends this to @INC when the directory exists so in-tree pure-Perl modules shadow XS-only core stubs.