Home

Awesome

Molt -- More Or Less TCL

Rust Crates.io

MoltLogo.png

Molt is a minimal implementation of the TCL language for embedding in Rust apps and for scripting Rust libraries. See The Molt Book for details and user documentation, and docs.rs/molt for the Rust API.

Mazegen: An Example

See Mazegen as an example of using Molt to provide a TCL interface for real Rust APIs. Mazegen is a collection of maze generation code and related infrastructure, with a Molt interface as an aid for debugging and experimentation. Among other things, Mazegen includes:

New in Molt 0.3.1

See the Annotated Change Log in the Molt Book for the complete list of new features by version.

Coming Attractions

At this point Molt is capable and robust enough for real work, though the Rust-level API is not yet completely stable. Standard Rust 0.y.z semantic versioning applies: ".y" changes can break the Rust-level API, ".z" changes will not.

Why Molt Exists

Using Molt, you can:

See the molt-sample repo for a sample Molt client skeleton.

Molt and Standard TCL

Molt is intended to be lightweight and require minimal dependencies, so that it can be added to any project without greatly increasing its footprint. (At present, the core language is a single library create with no dependencies at all!) As such, it does not provide all of the features of Standard TCL (e.g., TCL 8.6).

At the same time, Molt's implementation of TCL should be consistent with TCL 8.6 so far as it goes. Some archaic commands and command features are omitted; some changes are made so Molt works better in the Rust ecosystem. (E.g., Molt's notion of whitespace is the same as Rust's.) All liens against Standard TCL are documented in the The Molt Book.

No effort has been made to make the Rust-level API for extending Molt in Rust look like Standard TCL's C API; rather, the goal is to make the Rust-level API as simple and ergonomic as possible. Note: A big part of this effort is defining and refining the Rust API used to interact with and extend the interpreter. If you have comments or suggestions for improvement, please contact me or write an issue!

Building and Installation

The easiest approach is to get the latest Molt through crates.io. Look for the molt, molt-shell, and molt-app crates, or add them to your dependencies list in cargo.toml.

To build Molt:

$ cd .../molt
$ cargo build
$ cargo run shell
$ cargo run test molt/tests/all.tcl

Since Molt 0.2.0 the language tests are also run by cargo test; however, it's much easier to see the output of the individual tests using the above command.

Dependencies

At present, the only dependency required by the Molt core is indexmap.

Acknowledgements

I've gotten help from many people in this endeavor; here's a (necessarily partial) list.