molt -- An Embeddable Tcl Interpreter for Rust

Molt is an embeddable TCL interpreter for Rust. Applications can define new TCL commands in Rust and execute TCL scripts and strings. For example,

```rust use molt::Interp; let mut interp = Interp::new();

let four = interp.eval("expr {2 + 2}")?; asserteq!(four.asint(), 4); ```

A new command is defined like so:

```rust use molt::checkargs; use molt::MoltResult; use molt::Value; use molt::Interp; use molt::moltok;

/// # square x /// /// Computes the square of a value pub fn cmdsquare(interp: &mut Interp, : ContextID, argv: &[Value]) -> MoltResult { // Correct number of arguments? checkargs(1, argv, 2, 2, "x")?;

// Get x, if it's an integer
let x = argv[1].as_int()?;

// Return the result.
molt_ok!(x * x)

} ```

and installed like so:

```rust use molt::Interp; let mut interp = Interp::new(); interp.addcommand("square", cmdsquare);

let num = interp.eval("square 5")?; asserteq!(num.asint(), 25); ```

Values are represented by the Value type, which can be converted to and from any type consistent with the value's string representation: integers, floats, lists, and any type that defines the MoltAny trait.

Molt is still a work in progress. The basic TCL language is in place, but many TCL commands remain to be implemented. See the Molt Book for details.

The molt-sample repo contains a sample Molt extension, including a shell application and a library create, both of which define new Molt commands.

See my blog for news, The Molt Book for details, and the GitHub Repo for issue tracking, etc.