Skip to main content

Crate seq_runtime

Crate seq_runtime 

Source
Expand description

Seq Runtime: A clean concatenative language foundation

Key design principles:

  • Value: What the language talks about (Int, Bool, Variant, etc.)
  • StackValue: 8-byte tagged pointer (Int/Bool inline, heap types Arc-wrapped)
  • Stack: Contiguous array of StackValue entries for efficient operations

Re-exports§

pub use serialize::SerializeError;
pub use serialize::TypedMapKey;
pub use serialize::TypedValue;
pub use serialize::ValueSerialize;
pub use arithmetic::patch_seq_add as add;
pub use arithmetic::patch_seq_divide as divide;
pub use arithmetic::patch_seq_eq as eq;
pub use arithmetic::patch_seq_gt as gt;
pub use arithmetic::patch_seq_gte as gte;
pub use arithmetic::patch_seq_lt as lt;
pub use arithmetic::patch_seq_lte as lte;
pub use arithmetic::patch_seq_multiply as multiply;
pub use arithmetic::patch_seq_neq as neq;
pub use arithmetic::patch_seq_push_bool as push_bool;
pub use arithmetic::patch_seq_push_int as push_int;
pub use arithmetic::patch_seq_subtract as subtract;
pub use float_ops::patch_seq_f_add as f_add;
pub use float_ops::patch_seq_f_divide as f_divide;
pub use float_ops::patch_seq_f_eq as f_eq;
pub use float_ops::patch_seq_f_gt as f_gt;
pub use float_ops::patch_seq_f_gte as f_gte;
pub use float_ops::patch_seq_f_lt as f_lt;
pub use float_ops::patch_seq_f_lte as f_lte;
pub use float_ops::patch_seq_f_multiply as f_multiply;
pub use float_ops::patch_seq_f_neq as f_neq;
pub use float_ops::patch_seq_f_subtract as f_subtract;
pub use float_ops::patch_seq_float_to_int as float_to_int;
pub use float_ops::patch_seq_float_to_string as float_to_string;
pub use float_ops::patch_seq_int_to_float as int_to_float;
pub use float_ops::patch_seq_push_float as push_float;
pub use io::patch_seq_exit_op as exit_op;
pub use io::patch_seq_push_interned_symbol as push_interned_symbol;
pub use io::patch_seq_push_string as push_string;
pub use io::patch_seq_push_string_bytes as push_string_bytes;
pub use io::patch_seq_push_symbol as push_symbol;
pub use io::patch_seq_read_line as read_line;
pub use io::patch_seq_read_line_plus as read_line_plus;
pub use io::patch_seq_read_n as read_n;
pub use io::patch_seq_string_to_symbol as string_to_symbol;
pub use io::patch_seq_symbol_to_string as symbol_to_string;
pub use io::patch_seq_write_line as write_line;
pub use scheduler::patch_seq_maybe_yield as maybe_yield;
pub use scheduler::patch_seq_scheduler_init as scheduler_init;
pub use scheduler::patch_seq_scheduler_run as scheduler_run;
pub use scheduler::patch_seq_scheduler_shutdown as scheduler_shutdown;
pub use scheduler::patch_seq_spawn_strand as spawn_strand;
pub use scheduler::patch_seq_strand_spawn as strand_spawn;
pub use scheduler::patch_seq_wait_all_strands as wait_all_strands;
pub use scheduler::patch_seq_yield_strand as yield_strand;
pub use channel::patch_seq_chan_receive as receive;
pub use channel::patch_seq_chan_send as send;
pub use channel::patch_seq_close_channel as close_channel;
pub use channel::patch_seq_make_channel as make_channel;
pub use weave::patch_seq_resume as weave_resume;
pub use weave::patch_seq_weave as weave_make;
pub use weave::patch_seq_weave_cancel as weave_cancel;
pub use weave::patch_seq_yield as weave_yield;
pub use io::patch_seq_int_to_string as int_to_string;
pub use string_ops::patch_seq_json_escape as json_escape;
pub use string_ops::patch_seq_string_chomp as string_chomp;
pub use string_ops::patch_seq_string_concat as string_concat;
pub use string_ops::patch_seq_string_contains as string_contains;
pub use string_ops::patch_seq_string_empty as string_empty;
pub use string_ops::patch_seq_string_join as string_join;
pub use string_ops::patch_seq_string_length as string_length;
pub use string_ops::patch_seq_string_split as string_split;
pub use string_ops::patch_seq_string_starts_with as string_starts_with;
pub use string_ops::patch_seq_string_to_int as string_to_int;
pub use string_ops::patch_seq_string_to_lower as string_to_lower;
pub use string_ops::patch_seq_string_to_upper as string_to_upper;
pub use string_ops::patch_seq_string_trim as string_trim;
pub use bytes_ops::patch_seq_float_to_bytes_f32_be as float_to_bytes_f32_be;
pub use bytes_ops::patch_seq_int_to_bytes_i32_be as int_to_bytes_i32_be;
pub use encoding::patch_seq_base64_decode as base64_decode;
pub use encoding::patch_seq_base64_encode as base64_encode;
pub use encoding::patch_seq_base64url_decode as base64url_decode;
pub use encoding::patch_seq_base64url_encode as base64url_encode;
pub use encoding::patch_seq_hex_decode as hex_decode;
pub use encoding::patch_seq_hex_encode as hex_encode;
pub use crypto::patch_seq_constant_time_eq as constant_time_eq;
pub use crypto::patch_seq_crypto_aes_gcm_decrypt as crypto_aes_gcm_decrypt;
pub use crypto::patch_seq_crypto_aes_gcm_encrypt as crypto_aes_gcm_encrypt;
pub use crypto::patch_seq_crypto_ed25519_keypair as crypto_ed25519_keypair;
pub use crypto::patch_seq_crypto_ed25519_sign as crypto_ed25519_sign;
pub use crypto::patch_seq_crypto_ed25519_verify as crypto_ed25519_verify;
pub use crypto::patch_seq_crypto_pbkdf2_sha256 as crypto_pbkdf2_sha256;
pub use crypto::patch_seq_hmac_sha256 as hmac_sha256;
pub use crypto::patch_seq_random_bytes as random_bytes;
pub use crypto::patch_seq_random_int as random_int;
pub use crypto::patch_seq_sha256 as sha256;
pub use crypto::patch_seq_uuid4 as uuid4;
pub use regex::patch_seq_regex_captures as regex_captures;
pub use regex::patch_seq_regex_find as regex_find;
pub use regex::patch_seq_regex_find_all as regex_find_all;
pub use regex::patch_seq_regex_match as regex_match;
pub use regex::patch_seq_regex_replace as regex_replace;
pub use regex::patch_seq_regex_replace_all as regex_replace_all;
pub use regex::patch_seq_regex_split as regex_split;
pub use regex::patch_seq_regex_valid as regex_valid;
pub use compress::patch_seq_compress_gunzip as compress_gunzip;
pub use compress::patch_seq_compress_gzip as compress_gzip;
pub use compress::patch_seq_compress_gzip_level as compress_gzip_level;
pub use compress::patch_seq_compress_unzstd as compress_unzstd;
pub use compress::patch_seq_compress_zstd as compress_zstd;
pub use compress::patch_seq_compress_zstd_level as compress_zstd_level;
pub use quotations::patch_seq_call as call;
pub use quotations::patch_seq_peek_is_quotation as peek_is_quotation;
pub use quotations::patch_seq_peek_quotation_fn_ptr as peek_quotation_fn_ptr;
pub use quotations::patch_seq_push_quotation as push_quotation;
pub use quotations::patch_seq_spawn as spawn;
pub use closures::patch_seq_create_env as create_env;
pub use closures::patch_seq_env_get as env_get;
pub use closures::patch_seq_env_get_int as env_get_int;
pub use closures::patch_seq_env_set as env_set;
pub use closures::patch_seq_make_closure as make_closure;
pub use closures::patch_seq_push_closure as push_closure;
pub use combinators::bi;
pub use combinators::dip;
pub use combinators::if_combinator;
pub use combinators::keep;
pub use cond::patch_seq_cond as cond;
pub use exit_code::patch_seq_get_exit_code as get_exit_code;
pub use exit_code::patch_seq_set_exit_code as set_exit_code;
pub use tcp::patch_seq_tcp_accept as tcp_accept;
pub use tcp::patch_seq_tcp_close as tcp_close;
pub use tcp::patch_seq_tcp_listen as tcp_listen;
pub use tcp::patch_seq_tcp_read as tcp_read;
pub use tcp::patch_seq_tcp_write as tcp_write;
pub use udp::patch_seq_udp_bind as udp_bind;
pub use udp::patch_seq_udp_close as udp_close;
pub use udp::patch_seq_udp_receive_from as udp_receive_from;
pub use udp::patch_seq_udp_send_to as udp_send_to;
pub use os::patch_seq_current_dir as current_dir;
pub use os::patch_seq_exit as exit;
pub use os::patch_seq_getenv as getenv;
pub use os::patch_seq_home_dir as home_dir;
pub use os::patch_seq_os_arch as os_arch;
pub use os::patch_seq_os_name as os_name;
pub use os::patch_seq_path_exists as path_exists;
pub use os::patch_seq_path_filename as path_filename;
pub use os::patch_seq_path_is_dir as path_is_dir;
pub use os::patch_seq_path_is_file as path_is_file;
pub use os::patch_seq_path_join as path_join;
pub use os::patch_seq_path_parent as path_parent;
pub use variant_ops::patch_seq_make_variant_0 as make_variant_0;
pub use variant_ops::patch_seq_make_variant_1 as make_variant_1;
pub use variant_ops::patch_seq_make_variant_2 as make_variant_2;
pub use variant_ops::patch_seq_make_variant_3 as make_variant_3;
pub use variant_ops::patch_seq_make_variant_4 as make_variant_4;
pub use variant_ops::patch_seq_make_variant_5 as make_variant_5;
pub use variant_ops::patch_seq_make_variant_6 as make_variant_6;
pub use variant_ops::patch_seq_make_variant_7 as make_variant_7;
pub use variant_ops::patch_seq_make_variant_8 as make_variant_8;
pub use variant_ops::patch_seq_make_variant_9 as make_variant_9;
pub use variant_ops::patch_seq_make_variant_10 as make_variant_10;
pub use variant_ops::patch_seq_make_variant_11 as make_variant_11;
pub use variant_ops::patch_seq_make_variant_12 as make_variant_12;
pub use variant_ops::patch_seq_unpack_variant as unpack_variant;
pub use variant_ops::patch_seq_variant_field_at as variant_field_at;
pub use variant_ops::patch_seq_variant_field_count as variant_field_count;
pub use variant_ops::patch_seq_variant_tag as variant_tag;
pub use args::patch_seq_arg_at as arg_at;
pub use args::patch_seq_arg_count as arg_count;
pub use args::patch_seq_args_init as args_init;
pub use file::patch_seq_file_exists as file_exists;
pub use file::patch_seq_file_for_each_line_plus as file_for_each_line_plus;
pub use file::patch_seq_file_slurp as file_slurp;
pub use list_ops::patch_seq_list_each as list_each;
pub use list_ops::patch_seq_list_empty as list_empty;
pub use list_ops::patch_seq_list_filter as list_filter;
pub use list_ops::patch_seq_list_fold as list_fold;
pub use list_ops::patch_seq_list_get as list_get;
pub use list_ops::patch_seq_list_length as list_length;
pub use list_ops::patch_seq_list_make as list_make;
pub use list_ops::patch_seq_list_map as list_map;
pub use list_ops::patch_seq_list_push as list_push;
pub use list_ops::patch_seq_list_reverse as list_reverse;
pub use list_ops::patch_seq_list_set as list_set;
pub use map_ops::patch_seq_make_map as make_map;
pub use map_ops::patch_seq_map_each as map_each;
pub use map_ops::patch_seq_map_empty as map_empty;
pub use map_ops::patch_seq_map_fold as map_fold;
pub use map_ops::patch_seq_map_get as map_get;
pub use map_ops::patch_seq_map_has as map_has;
pub use map_ops::patch_seq_map_keys as map_keys;
pub use map_ops::patch_seq_map_remove as map_remove;
pub use map_ops::patch_seq_map_set as map_set;
pub use map_ops::patch_seq_map_size as map_size;
pub use map_ops::patch_seq_map_values as map_values;
pub use test::patch_seq_test_assert as test_assert;
pub use test::patch_seq_test_assert_eq as test_assert_eq;
pub use test::patch_seq_test_assert_eq_str as test_assert_eq_str;
pub use test::patch_seq_test_assert_not as test_assert_not;
pub use test::patch_seq_test_fail as test_fail;
pub use test::patch_seq_test_fail_count as test_fail_count;
pub use test::patch_seq_test_finish as test_finish;
pub use test::patch_seq_test_has_failures as test_has_failures;
pub use test::patch_seq_test_init as test_init;
pub use test::patch_seq_test_pass_count as test_pass_count;
pub use test::patch_seq_test_set_line as test_set_line;
pub use test::patch_seq_test_set_name as test_set_name;
pub use time_ops::patch_seq_time_nanos as time_nanos;
pub use time_ops::patch_seq_time_now as time_now;
pub use time_ops::patch_seq_time_sleep_ms as time_sleep_ms;
pub use terminal::patch_seq_terminal_flush as terminal_flush;
pub use terminal::patch_seq_terminal_height as terminal_height;
pub use terminal::patch_seq_terminal_raw_mode as terminal_raw_mode;
pub use terminal::patch_seq_terminal_read_char as terminal_read_char;
pub use terminal::patch_seq_terminal_read_char_nonblock as terminal_read_char_nonblock;
pub use terminal::patch_seq_terminal_width as terminal_width;
pub use http_client::patch_seq_http_delete as http_delete;
pub use http_client::patch_seq_http_get as http_get;
pub use http_client::patch_seq_http_post as http_post;
pub use http_client::patch_seq_http_put as http_put;

Modules§

arena
Arena Allocator - Thread-local bump allocation for Values
args
Command-line argument handling for Seq
arithmetic
Arithmetic operations for Seq
bytes_ops
Byte construction primitives.
channel
Channel operations for CSP-style concurrency
closures
Closure support for Seq
combinators
Dataflow combinators for Seq
compress
Compression operations for Seq
cond
Conditional combinator for multi-way branching
crypto
Cryptographic operations for Seq
diagnostics
Runtime diagnostics for production debugging
encoding
Encoding operations for Seq (Base64, Hex)
error
Runtime Error Handling
exit_code
Process exit code handling
file
File I/O Operations for Seq
float_ops
Float operations for Seq
http_client
HTTP client operations for Seq
io
I/O Operations for Seq
list_ops
List operations for Seq
map_ops
Map operations for Seq
memory_stats
Cross-thread memory statistics registry
os
OS operations for Seq
quotations
Quotation operations for Seq
regex
Regular expression operations for Seq
report
At-exit report for compiled Seq programs
scheduler
Scheduler - Green Thread Management with May
seqstring
SeqString - Arena or Globally Allocated Byte String
serialize
Serialization of Seq Values
signal
Signal handling API for Seq
son
SON (Seq Object Notation) Serialization
stack
Stack operations for the concatenative runtime.
string_ops
String operations for Seq
tagged_stack
Tagged Stack Implementation
tcp
TCP Socket Operations for Seq
tcp_test
Minimal May TCP test to verify the library works
terminal
Terminal Operations for Seq
test
Test framework support for Seq
time_ops
Time operations for Seq
udp
UDP Socket Operations for Seq
value
The Value type — the datum a Seq program talks about — plus the supporting types it embeds or composes with:
variant_ops
Variant operations for Seq
watchdog
Watchdog timer for detecting stuck strands
weave
Weave operations for generator/coroutine-style concurrency

Structs§

ChannelData
Channel data: holds sender and receiver for direct handle passing
VariantData
VariantData: Composite values (sum types)
WeaveChannelData
Channel data specifically for weave communication.

Enums§

MapKey
MapKey: Hashable subset of Value for use as map keys
Value
Value: What the language talks about
WeaveMessage
Message type for weave channels.

Constants§

DISC_BOOL
DISC_CHANNEL
DISC_CLOSURE
DISC_FLOAT
DISC_INT
Discriminant constants — retained for API compatibility with codegen and runtime code that switches on type. In tagged-ptr mode, these values are NOT stored in the StackValue itself (the tag is in the pointer bits). They are used only when the runtime unpacks a Value (via pop()) and needs to identify its type. Phase 2 codegen will use bit-level tag checks instead of loading these discriminants from memory.
DISC_MAP
DISC_QUOTATION
DISC_STRING
DISC_SYMBOL
DISC_VARIANT
DISC_WEAVECTX

Functions§

alloc_stack
Allocate a fresh stack buffer and return its base pointer.
alloc_test_stack
Allocate a fresh stack and register it as the current strand’s base.
clear_error
Clear any pending error (FFI-safe)
clear_runtime_error
Clear any pending runtime error
clone_stack
Safety
clone_stack_value
Clone a tagged StackValue, handling heap types.
clone_value
Clone a StackValue from LLVM IR.
drop_op
Safety
drop_stack_value
Drop a tagged StackValue, freeing heap types.
drop_top
Pop the top value and drop it (decrement Arc refcount for heap types).
dup
Duplicate the top value: ( a – a a )
get_error
Get the last error message as a C string pointer (FFI-safe)
has_error
Check if there’s a pending runtime error (FFI-safe)
has_runtime_error
Check if there’s a pending runtime error
nip
Remove the second value: ( a b – b )
over
Copy the second value to the top: ( a b – a b a )
peek
Peek at the top value without removing it.
peek_sv
Peek at the raw StackValue without removing it.
pick_op
Pick: Copy the nth value to the top.
pop
Pop a value from the stack.
pop_sv
Pop a StackValue directly from the stack.
push
Push a value onto the stack.
push_sv
Push a StackValue directly onto the stack.
push_value
Safety
roll
Roll: Rotate n+1 items, bringing the item at depth n to the top.
rot
Rotate the top three values: ( a b c – b c a )
set_runtime_error
Set the last runtime error message
set_stack_base
Safety
son_dump
son.dump: Serialize top of stack to SON string (compact) Stack effect: ( Value – String )
son_dump_pretty
son.dump-pretty: Serialize top of stack to SON string (pretty-printed) Stack effect: ( Value – String )
stack_dump
Dump all values on the stack (for REPL debugging).
stack_value_to_value
Convert a tagged StackValue back to a Value (takes ownership)
swap
Swap the top two values: ( a b – b a )
take_error
Take (and clear) the last error, returning it as a C string (FFI-safe)
take_runtime_error
Take (and clear) the last runtime error message
tuck
Copy top value below second: ( a b – b a b )
two_dup
Duplicate top two values: ( a b – a b a b )
value_to_stack_value
Convert a Value to a tagged StackValue

Type Aliases§

Stack
Stack: A pointer to the current position in a contiguous array of u64.