Skip to main content

Crate sim_kernel

Crate sim_kernel 

Source
Expand description

sim-kernel is the small protocol kernel of the SIM Rust runtime.

The kernel defines contracts; libraries supply behavior. This crate holds the protocol and contract types – forms, values, stores, registry and callable surfaces, the shape protocol, evaluation policy, and the ABI transport – while concrete behavior (parsers, number domains, the standard distribution, and server/agent/browse implementations) lives in separate library crates loaded against these contracts. SIM is a Rust runtime, not a Lisp runtime; Lisp is one codec surface among several.

The one deliberate exception is the pair of built-in reference backends: list::VecList (a list::ListValue) and table::AssocTable (a table::Table). These are the kernel’s bootstrap list and table implementations – minimal, correct, and self-annotated sim-non-citizen – so the runtime can stand up collections before any library loads. They are reference implementations, not the only backends: alternatives load as libs against the list::ListBackend/table::TableBackend contracts. (Future cleanup: move even these into a default-loaded distribution lib so the kernel ships pure contracts; tracked against the constellation reorg.)

The kernel data flow is:

tokens -> checked forms -> objects -> checked calls -> objects -> encoded forms

§Module map

Core forms and values: value, expr, term, encode, error, id, ref_id.

Data substrate: datum, datum_store, fact_store, claim, card, catalog, handle_store, hint, ref_resolver.

Registry and behavior contracts: library, op, capability, env, standard, factory.

Callable, object, control, ledgers: callable, class, object, control, event, event_ledger, effect, effect_ledger, rank.

Shape protocol: shape, shape_report, pratt.

Evaluation: eval, realize.

ABI, stream transport, collections: native_abi, stream, stream_surface, list, seq, table, number_domain.

Re-exports§

pub use callable::Callable;
pub use capability::CapabilityName;
pub use capability::CapabilitySet;
pub use capability::ReadPolicy;
pub use capability::TrustLevel;
pub use capability::browse_internal_capability;
pub use capability::browse_read_capability;
pub use capability::browse_run_tests_capability;
pub use capability::config_list_impl_capability;
pub use capability::config_table_impl_capability;
pub use capability::eval_fabric_capability;
pub use capability::eval_remote_capability;
pub use capability::fact_private_capability;
pub use capability::list_force_unbounded_capability;
pub use capability::logic_consult_file_capability;
pub use capability::logic_db_write_capability;
pub use capability::logic_tool_call_capability;
pub use capability::macro_expand_capability;
pub use capability::macro_expand_compile_capability;
pub use capability::macro_expand_eval_capability;
pub use capability::macro_expand_read_capability;
pub use capability::native_dynamic_load_capability;
pub use capability::read_construct_capability;
pub use capability::read_eval_capability;
pub use capability::registry_catalog_read_capability;
pub use capability::table_remote_capability;
pub use claim::Claim;
pub use claim::ClaimKind;
pub use claim::ClaimPattern;
pub use claim::Visibility;
pub use class::Class;
pub use class::class_is_subclass_of;
pub use datum::DATUM_CONTENT_ALGORITHM_NAME;
pub use datum::DATUM_CONTENT_ALGORITHM_NAMESPACE;
pub use datum::Datum;
pub use datum::datum_content_algorithm;
pub use datum_store::BTreeDatumStore;
pub use datum_store::DatumStore;
pub use effect::Effect;
pub use effect::effect_abort_op_key;
pub use effect::effect_resume_op_key;
pub use effect::effect_test_run_kind;
pub use encode::CanonicalPolicy;
pub use encode::ConstructorSurface;
pub use encode::EncodeOptions;
pub use encode::EncodePosition;
pub use encode::ObjectEncode;
pub use encode::ObjectEncoding;
pub use encode::ReadConstructEncodePolicy;
pub use encode::ReadConstructor;
pub use encode::ReadEvalEncodePolicy;
pub use encode::WriteCx;
pub use env::Capabilities;
pub use env::Cx;
pub use env::Diagnostics;
pub use env::Env;
pub use error::Diagnostic;
pub use error::Error;
pub use error::Result;
pub use error::Severity;
pub use eval::Consistency;
pub use eval::Demand;
pub use eval::EagerPolicy;
pub use eval::EvalFabric;
pub use eval::EvalFabricRef;
pub use eval::EvalMode;
pub use eval::EvalPolicy;
pub use eval::EvalPolicyRef;
pub use eval::EvalReply;
pub use eval::EvalRequest;
pub use eval::HybridPolicy;
pub use eval::LazyPolicy;
pub use eval::LazyThunkObject;
pub use eval::MacroExpander;
pub use eval::MacroExpanderRef;
pub use eval::NeedPolicy;
pub use eval::NoopEvalPolicy;
pub use eval::Phase;
pub use eval::PreparedArgs;
pub use eval::StrictByShapePolicy;
pub use eval::StrictNames;
pub use eval::Thunk;
pub use eval::ThunkObject;
pub use eval::eval_expr_default;
pub use eval::force_default;
pub use event::Event;
pub use event::EventKind;
pub use event::EventSource;
pub use event::Tick;
pub use event::validate_ticks;
pub use event_ledger::EventLedger;
pub use expr::CanonicalKey;
pub use expr::Expr;
pub use expr::LocatedExpr;
pub use expr::LocatedExprTree;
pub use expr::NumberLiteral;
pub use expr::Origin;
pub use expr::QuoteMode;
pub use expr::SourceId;
pub use expr::SourceRegistry;
pub use expr::Span;
pub use expr::Trivia;
pub use fact_store::BTreeFactStore;
pub use fact_store::FactStore;
pub use factory::DefaultFactory;
pub use factory::Factory;
pub use handle_store::BTreeHandleStore;
pub use handle_store::HandleStore;
pub use hint::HintMetadata;
pub use id::CORE_BOOL_CLASS_ID;
pub use id::CORE_BYTES_CLASS_ID;
pub use id::CORE_CARD_CLASS_ID;
pub use id::CORE_CLASS_CLASS_ID;
pub use id::CORE_CODEC_CLASS_ID;
pub use id::CORE_EVAL_REPLY_CLASS_ID;
pub use id::CORE_EVAL_REQUEST_CLASS_ID;
pub use id::CORE_EXPR_CLASS_ID;
pub use id::CORE_FUNCTION_CLASS_ID;
pub use id::CORE_HELP_CLASS_ID;
pub use id::CORE_LIST_CLASS_ID;
pub use id::CORE_LOCAL_EVAL_FABRIC_CLASS_ID;
pub use id::CORE_MACRO_CLASS_ID;
pub use id::CORE_NIL_CLASS_ID;
pub use id::CORE_NUMBER_CLASS_ID;
pub use id::CORE_NUMBER_DOMAIN_CLASS_ID;
pub use id::CORE_SEQUENCE_CLASS_ID;
pub use id::CORE_SHAPE_CLASS_ID;
pub use id::CORE_SHAPE_MATCH_CLASS_ID;
pub use id::CORE_STRING_CLASS_ID;
pub use id::CORE_SYMBOL_CLASS_ID;
pub use id::CORE_TABLE_CLASS_ID;
pub use id::CORE_TEST_CLASS_ID;
pub use id::CORE_THUNK_CLASS_ID;
pub use id::CaseId;
pub use id::ClassId;
pub use id::CodecId;
pub use id::FunctionId;
pub use id::LibId;
pub use id::MacroId;
pub use id::NumberDomainId;
pub use id::RuntimeId;
pub use id::ShapeId;
pub use id::SiteId;
pub use id::Symbol;
pub use id::ValueId;
pub use library::AbiVersion;
pub use library::CatalogSource;
pub use library::Dependency;
pub use library::Export;
pub use library::ExportKind;
pub use library::ExportRecord;
pub use library::ExportState;
pub use library::Lib;
pub use library::LibBootDependency;
pub use library::LibBootReceipt;
pub use library::LibLoader;
pub use library::LibManifest;
pub use library::LibSource;
pub use library::LibSourceSpec;
pub use library::LibTarget;
pub use library::Linker;
pub use library::LoadCx;
pub use library::LoadedLib;
pub use library::LoaderRegistry;
pub use library::Registry;
pub use library::RegistryBootState;
pub use library::Test;
pub use library::TestReport;
pub use library::Version;
pub use list::DEFAULT_FORCE_BOUND;
pub use list::LengthResult;
pub use list::ListBackend;
pub use list::ListRegistry;
pub use list::ListValue;
pub use list::VecList;
pub use list::force_list_bound;
pub use list::force_list_to_vec;
pub use list::spine_len_cmp;
pub use native_abi::NATIVE_DYLIB_ENTRYPOINT_V1;
pub use native_abi::NATIVE_LIB_ABI_V1_MAJOR;
pub use native_abi::NATIVE_LIB_ABI_V1_MINOR;
pub use native_abi::NativeAbiBorrowedBytes;
pub use native_abi::NativeAbiCall;
pub use native_abi::NativeAbiCallResponse;
pub use native_abi::NativeAbiDestroyBytes;
pub use native_abi::NativeAbiDestroyError;
pub use native_abi::NativeAbiDestroyInstance;
pub use native_abi::NativeAbiError;
pub use native_abi::NativeAbiInstantiate;
pub use native_abi::NativeAbiManifest;
pub use native_abi::NativeAbiOwnedBytes;
pub use native_abi::NativeLibAbiHeaderV1;
pub use native_abi::NativeLibAbiV1;
pub use native_abi::native_abi_owned_bytes;
pub use number_domain::NumberBinaryOp;
pub use number_domain::NumberDomain;
pub use number_domain::NumberReductionOp;
pub use number_domain::NumberUnaryOp;
pub use number_domain::NumberValue;
pub use number_domain::NumberValueRef;
pub use number_domain::PromotionRule;
pub use number_domain::PromotionSearchLimits;
pub use number_domain::ValueNumberBinaryOp;
pub use number_domain::ValueNumberReductionOp;
pub use number_domain::ValueNumberUnaryOp;
pub use number_domain::ValuePromotionRule;
pub use object::Args;
pub use object::ClaimSink;
pub use object::ClassRef;
pub use object::Object;
pub use object::ObjectCompat;
pub use object::ObjectHeader;
pub use object::RawArgs;
pub use object::ReadConstructorRef;
pub use object::ShapeRef;
pub use object::TableRef;
pub use object::default_object_header;
pub use object::is_default_object_header;
pub use op::Op;
pub use op::OpSpec;
pub use op::ResolvedOp;
pub use op::Step;
pub use op::check_shape_if_available;
pub use op::core_any_ref;
pub use op::core_call_op_key;
pub use op::core_class_symbol_op_key;
pub use op::core_dir_is_dir_op_key;
pub use op::core_expr_snapshot_op_key;
pub use op::core_force_op_key;
pub use op::core_list_items_op_key;
pub use op::core_number_domain_symbol_op_key;
pub use op::core_number_value_op_key;
pub use op::core_object_encoding_op_key;
pub use op::core_read_construct_op_key;
pub use op::core_realize_start_op_key;
pub use op::core_seq_close_op_key;
pub use op::core_seq_next_op_key;
pub use op::core_shape_check_term_op_key;
pub use op::core_shape_check_value_op_key;
pub use op::core_shape_describe_op_key;
pub use op::core_table_entries_op_key;
pub use op::invoke_op;
pub use op::resolve_op;
pub use pratt::Fixity;
pub use pratt::PrattOperator;
pub use pratt::PrattResult;
pub use pratt::PrattTable;
pub use pratt::PrattTableObject;
pub use pratt::Token as PrattToken;
pub use pratt::parse_symbol as parse_pratt_symbol;
pub use pratt::pratt_table_value;
pub use realize::BufferedEventSource;
pub use realize::ObserveMode;
pub use realize::RealizeRequest;
pub use realize::drain_events_to_reply;
pub use realize::realize_events;
pub use realize::realize_final;
pub use ref_id::ContentId;
pub use ref_id::Coordinate;
pub use ref_id::HandleId;
pub use ref_id::Ref;
pub use ref_resolver::RefResolver;
pub use ref_resolver::ResolvedRef;
pub use ref_resolver::TemporaryRefResolver;
pub use ref_resolver::value_from_datum;
pub use ref_resolver::value_from_ref;
pub use seq::EventSourceSequence;
pub use seq::ListSequence;
pub use seq::Sequence;
pub use seq::SequenceItem;
pub use seq::seq_close;
pub use seq::seq_close_value;
pub use seq::seq_is_done;
pub use seq::seq_next;
pub use seq::seq_next_value;
pub use seq::seq_peek;
pub use seq::sequence_item_from_event;
pub use seq::sequence_item_value;
pub use shape::ExprKind;
pub use shape::MatchScore;
pub use shape::Shape;
pub use shape::ShapeBindings;
pub use shape::ShapeCallTarget;
pub use shape::ShapeDoc;
pub use shape::ShapeMatch;
pub use shape::ShapeMatchObject;
pub use shape::call_shape;
pub use shape::shape_is_subshape_of;
pub use shape::shape_match_value;
pub use stream::Stream;
pub use table::AssocTable;
pub use table::Dir;
pub use table::Table;
pub use table::TableBackend;
pub use table::TableRegistry;
pub use term::OpKey;
pub use term::Term;
pub use value::RuntimeObject;
pub use value::Value;

Modules§

callable
The callable contract: objects that can be invoked with checked arguments.
capability
Capability names and sets: the contract for gating privileged operations.
card
Card records: the contract for structured metadata about runtime subjects.
catalog
The registry catalog substrate: transactional, Cx-free table storage.
claim
Claims: the contract for asserted facts about runtime subjects.
class
The class contract: callable factories with subclass relationships.
control
Control policy: the contract for delimited prompts, capture, and resume.
datum
The Datum contract: the content-addressable data form of the substrate.
datum_store
The DatumStore contract: interning and resolving content-addressed data.
effect
The effect contract: capability-gated requests resolved by an implementation.
effect_ledger
The effect ledger: the contract for recording and replaying effects.
encode
The encode contract: turning objects back into forms at a known position.
env
The evaluation environment: Cx, Env, capabilities, and diagnostics.
error
The error and diagnostic contract for the kernel.
eval
Evaluation policy and the macro-expander contract.
event
The event contract: timestamped records emitted during evaluation.
event_ledger
The event ledger: the contract for accumulating ordered events by tick.
expr
The Expr graph: the checked-form representation of source.
fact_store
The FactStore contract: storing and querying claims under visibility.
factory
The factory contract: constructing runtime objects from data.
handle_store
The HandleStore contract: interning values behind opaque handle ids.
hint
Open hint metadata for diagnostics, exports, and runtime operations.
id
Stable ids and the Symbol type used across the kernel.
library
The library and registry contracts: loading behavior against the kernel.
list
The list contract: the pluggable ListValue backend protocol.
native_abi
The native ABI: byte-frame and manifest transport types for dynamic libs.
number_domain
The number-domain contract: the pluggable numeric backend protocol.
object
The object contract: the runtime object surface and argument forms.
op
The operation contract: keyed, shape-checked calls dispatched on objects.
pratt
Pratt-parser contracts: operator tables for shape-driven syntax.
rank
Rank metadata: the contract for ordering and navigating ranked spaces.
realize
The realize surface: the location-transparent distributed eval contract.
ref_id
Reference identity: the Ref contract and its content/handle ids.
ref_resolver
The RefResolver contract: turning references back into values.
seq
The Sequence contract: pull-based iteration over runtime values.
shape
The Shape protocol: the one shared engine for matching and binding.
shape_report
Shape reports: the contract for diagnostics from shape checks.
standard
Standard-distribution metadata: the profile and organ claim vocabulary.
stream
The Stream contract: an object that yields values until closed.
stream_surface
Stream metadata and packet events: the contract for stream transport.
table
The table contract: the pluggable Table and Dir backend protocol.
term
The Term contract: the checked form that bridges expressions and data.
testing
Shared test-context constructors.
value
The Value contract: the universal runtime handle for every object.