Skip to main content

tatara_lisp_eval/
lib.rs

1//! tatara-lisp-eval — runtime evaluator for the tatara-lisp authoring surface.
2//!
3//! See `docs/eval-design.md` in the tatara-lisp repo for scope, FFI surface,
4//! error model, and the boundary with the plain tatara-lisp compile pipeline.
5//!
6//! This crate extends tatara-lisp; it does not replace it. The plain `Sexp`
7//! AST and `compile_typed` flow remain the fast, committed, cacheable path
8//! for typed infrastructure DSLs. `tatara-lisp-eval` is for the runtime /
9//! REPL / ad-hoc path — live orchestration, rule evaluation, hot-reloaded
10//! diagnostic bundles.
11//!
12//! # Phase progress (Phase 2.2 scaffold)
13//!
14//! This commit establishes shape: module layout, public types, stub
15//! interpreter that evaluates only literal atoms. Subsequent phases
16//! (2.3-2.7) fill in special forms, FFI, REPL, errors, tests.
17
18pub mod build_check;
19pub mod channel;
20pub mod code;
21pub mod env;
22pub mod error;
23pub mod eval;
24pub mod ffi;
25pub mod fiber;
26pub mod hof;
27pub mod interner;
28pub mod lisp_stdlib;
29pub mod map;
30pub mod module;
31pub mod primitive;
32pub mod repl;
33pub mod special;
34pub mod type_check;
35pub mod value;
36pub mod vm;
37
38pub use env::Env;
39pub use error::{EvalError, Result};
40pub use eval::Interpreter;
41pub use ffi::{Arity, Caller, FromValue, HigherOrderCallable, IntoValue, NativeCallable};
42pub use hof::install_hof;
43pub use lisp_stdlib::install_lisp_stdlib_with;
44pub use map::install_map;
45pub use module::{
46    FilesystemLoader, Loader, MapLoader, Module, ModuleError, ModuleRegistry, NoLoader,
47};
48pub use primitive::install_primitives;
49pub use repl::ReplSession;
50pub use value::{ErrorObj, MapKey, Value};
51
52/// One-stop installer: registers the full battery — Rust primitives
53/// (arithmetic, comparison, list, string, IO), higher-order Rust
54/// primitives (apply, map, filter, foldl, foldr, reduce, find, ...),
55/// and the pure-Lisp standard library (compose, pipe, ->, ->>, defflow,
56/// dotimes, range, distinct, group-by helpers, etc.).
57///
58/// This is the recommended entry point for embedders. If you want to
59/// install only a subset (e.g. primitives + hof, no Lisp stdlib),
60/// call the individual installers in order: `install_primitives`,
61/// `install_hof`, `install_lisp_stdlib_with`.
62pub fn install_full_stdlib_with<H: 'static>(interp: &mut Interpreter<H>, host: &mut H) {
63    install_primitives(interp);
64    install_hof(interp);
65    install_map(interp);
66    channel::install_channels(interp);
67    fiber::install_fibers(interp);
68    type_check::install_type_check(interp);
69    install_lisp_stdlib_with(interp, host);
70}
71
72// Re-export the tatara-lisp items every embedder will need.
73pub use tatara_lisp::{read, read_spanned, Sexp, Span, Spanned, SpannedExpander, SpannedForm};