oxur_repl/
lib.rs

1//! Oxur REPL
2//!
3//! Provides a Read-Eval-Print-Loop with three-tier execution:
4//! - Tier 1: Calculator mode (interpret simple arithmetic only) - <1ms
5//! - Tier 2: Cached & loaded (execute from already-loaded library) - ~1-5ms
6//! - Tier 3: Just-in-time (compile, cache, and load) - ~50-300ms
7//!
8//! Based on ODD-0018: Oxur Remote REPL Protocol Design
9//! and ODD-0026 v2.0: Oxur REPL Evaluation Strategy
10
11pub mod cache;
12pub mod compiler;
13pub mod eval;
14pub mod executor;
15pub mod metadata;
16pub mod metrics;
17pub mod protocol;
18pub mod server;
19pub mod session;
20pub mod subprocess;
21pub mod transport;
22pub mod type_inference;
23pub mod wrapper;
24
25// Stub client for backwards compatibility with oxur-cli
26mod client;
27pub use client::ReplClient;
28
29// Re-export oxur-smap types for convenience
30pub use oxur_smap::{new_node_id, NodeId, SourceMap, SourcePos};
31
32/// Result type for REPL operations
33pub type Result<T> = std::result::Result<T, Error>;
34
35/// Error types for REPL
36#[derive(Debug, thiserror::Error)]
37pub enum Error {
38    #[error("Evaluation error: {0}")]
39    Eval(String),
40
41    #[error("Protocol error: {0}")]
42    Protocol(String),
43
44    #[error("Codec error: {0}")]
45    Codec(#[from] protocol::CodecError),
46
47    #[error("Language error: {0}")]
48    Language(#[from] oxur_lang::Error),
49
50    #[error("Compilation error: {0}")]
51    Compile(#[from] oxur_comp::Error),
52}