1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! Interpreter module for kaish.
//!
//! This module provides expression evaluation, variable scope management,
//! and the structured result type (`$?`) that every command returns.
//!
//! # Architecture
//!
//! The interpreter is built in layers:
//!
//! - **ExecResult**: The structured result of every command, accessible as `$?`
//! - **Scope**: Variable bindings with nested frames and path resolution
//! - **Evaluator**: Reduces expressions to values
//!
//! # Command Substitution
//!
//! `$(pipeline)` expressions are executed by the async evaluator in the kernel
//! (`kernel.rs`), which resolves them to literal values before any synchronous
//! expression evaluation runs. The sync [`eval_expr`] evaluator therefore never
//! sees a `CommandSubst` node; encountering one is a loud error, not a silent
//! empty string.
//!
//! # Example
//!
//! ```
//! use kaish_kernel::interpreter::{Scope, eval_expr};
//! use kaish_kernel::ast::{Expr, Value};
//!
//! let mut scope = Scope::new();
//! scope.set("X", Value::Int(42));
//!
//! let expr = Expr::VarRef(kaish_kernel::ast::VarPath::simple("X"));
//! let result = eval_expr(&expr, &mut scope).unwrap();
//! assert_eq!(result, Value::Int(42));
//! ```
pub use ControlFlow;
pub use ;
pub use ;
pub use ;
// Crate-internal: the reduced sync evaluator (scheduler/pipeline.rs) reuses the
// resolver error-message shape without widening the public API.
pub use format_path;