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,
use Interp;
let mut interp = new;
let four = interp.eval?;
assert_eq!;
A new command is defined like so:
use check_args;
use MoltResult;
use Value;
use Interp;
use molt_ok;
/// # square *x*
///
/// Computes the square of a value
and installed like so:
use Interp;
let mut interp = new;
interp.add_command;
let num = interp.eval?;
assert_eq!;
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.