Crate seq_core

Crate seq_core 

Source
Expand description

Seq Core: A clean foundation for stack-based concatenative languages

This crate provides the language-agnostic runtime primitives that can be shared across multiple stack-based languages (Seq, actor languages, etc.)

Key design principles:

  • Value: What the language talks about (Int, Bool, Variant, etc.)
  • StackValue: 40-byte tagged stack entry (discriminant + 4 payload slots)
  • Stack: Contiguous array of StackValue entries for efficient operations

§Modules

  • error: Thread-local error handling for FFI safety
  • memory_stats: Cross-thread memory statistics registry
  • arena: Thread-local bump allocation for fast value creation
  • seqstring: Arena or globally-allocated strings
  • tagged_stack: Low-level 40-byte stack value layout
  • value: Core Value enum (Int, Float, Bool, String, Variant, Map, etc.)
  • stack: Stack operations and value conversion
  • son: Seq Object Notation serialization

Re-exports§

pub use stack::DISC_BOOL;
pub use stack::DISC_CHANNEL;
pub use stack::DISC_CLOSURE;
pub use stack::DISC_FLOAT;
pub use stack::DISC_INT;
pub use stack::DISC_MAP;
pub use stack::DISC_QUOTATION;
pub use stack::DISC_STRING;
pub use stack::DISC_SYMBOL;
pub use stack::DISC_VARIANT;
pub use stack::DISC_WEAVECTX;
pub use stack::Stack;
pub use stack::alloc_stack;
pub use stack::alloc_test_stack;
pub use stack::clone_stack;
pub use stack::clone_stack_segment;
pub use stack::clone_stack_value;
pub use stack::drop_stack_value;
pub use stack::drop_top;
pub use stack::is_empty;
pub use stack::patch_seq_2dup as two_dup;
pub use stack::patch_seq_3drop as three_drop;
pub use stack::patch_seq_clone_value as clone_value;
pub use stack::patch_seq_drop_op as drop_op;
pub use stack::patch_seq_dup as dup;
pub use stack::patch_seq_nip as nip;
pub use stack::patch_seq_over as over;
pub use stack::patch_seq_pick_op as pick_op;
pub use stack::patch_seq_push_value as push_value;
pub use stack::patch_seq_roll as roll;
pub use stack::patch_seq_rot as rot;
pub use stack::patch_seq_set_stack_base as set_stack_base;
pub use stack::patch_seq_stack_dump as stack_dump;
pub use stack::patch_seq_swap as swap;
pub use stack::patch_seq_tuck as tuck;
pub use stack::peek;
pub use stack::peek_sv;
pub use stack::pop;
pub use stack::pop_sv;
pub use stack::push;
pub use stack::push_sv;
pub use stack::stack_value_to_value;
pub use stack::value_to_stack_value;
pub use value::ChannelData;
pub use value::MapKey;
pub use value::Value;
pub use value::VariantData;
pub use value::WeaveChannelData;
pub use value::WeaveMessage;
pub use son::patch_seq_son_dump as son_dump;
pub use son::patch_seq_son_dump_pretty as son_dump_pretty;
pub use error::clear_runtime_error;
pub use error::has_runtime_error;
pub use error::patch_seq_clear_error as clear_error;
pub use error::patch_seq_get_error as get_error;
pub use error::patch_seq_has_error as has_error;
pub use error::patch_seq_take_error as take_error;
pub use error::set_runtime_error;
pub use error::take_runtime_error;

Modules§

arena
Arena Allocator - Thread-local bump allocation for Values
error
Runtime Error Handling
memory_stats
Cross-thread memory statistics registry
seqstring
SeqString - Arena or Globally Allocated String
son
SON (Seq Object Notation) Serialization
stack
Tagged Stack Implementation
tagged_stack
Tagged Stack Implementation
value

Macros§

test_stack
Macro to create a test stack