Skip to main content

Crate tatara_lisp_script

Crate tatara_lisp_script 

Source
Expand description

tatara-lisp-script — scripting surface for tatara-lisp.

Wraps tatara-lisp-eval::Interpreter<ScriptCtx> with a batteries-included stdlib (http, json, yaml, sops, file I/O, env, sha256, string ops) so a .tlisp file can replace a bash script. The binary (tatara-script) parses a .tlisp file, expands macros via tatara-lisp, and evaluates each form against this stdlib.

§Usage from nix-run

apps.tatara-script = {
  type = "app";
  program = "${tataraScript}/bin/tatara-script path/to/script.tlisp";
};

§Library surface

Embedders that want to add domain-specific FFI on top of the stdlib can:

use tatara_lisp_script::{Interpreter, ScriptCtx, install_stdlib};

let mut interp: Interpreter<ScriptCtx> = Interpreter::new();
let mut ctx = ScriptCtx::default();
install_stdlib(&mut interp, &mut ctx);
// Register more fns before eval_program.

Re-exports§

pub use script_ctx::ScriptCtx;
pub use stdlib::install_stdlib;

Modules§

script_ctx
ScriptCtx — the host context passed to every stdlib FFI call.
stdlib
The tatara-script stdlib. Each module registers a family of FFI primitives on Interpreter<ScriptCtx>; install_stdlib is the single entry point — call after Interpreter::new().

Structs§

Interpreter
An embedded tatara-lisp evaluator, parameterized over the host context H that registered functions read/write.
Spanned
An S-expression node with source position.

Enums§

Arity
How many arguments a registered function accepts.
EvalError
Value
An evaluated runtime value.

Functions§

eval_str
Convenience: read + evaluate a tatara-lisp source string against a fresh interpreter with the full stdlib installed.
read_spanned
Read a full program into Vec<Spanned>, where every subtree carries a Span pointing back into src. Equivalent to read in grammar and error reporting; strictly additive.