Crate litto

Source
Expand description

litto provides some building blocks for building scripting languages that can be embedded in a Rust application or library.

The name comes from little and ditto (A Pokémon name).

litto does not define a scripting language in a concrete way. For example, syntax, types, stdlib can all be customized. Refer to Interpreter for the abstraction.

Although the Interpreter is abstract, this crate does provide some building blocks to make it easier to implement Interpreter. For example:

  • env::KvEnv: A nested environment that can be used to resolve variables from string name to value.
  • value::Value: An abstract value that is tracked by a cyclic garbage collector, and supports function calls.
  • expr::Sexp: S-expression, commonly seen in Lisp-like languages.

§Example Languages

  • tinylang: A tiny language with Lisp-like syntax. It basically only implements lambda but is already powerful. See its tests for details.
  • minilang: Extends tinylang with more stdlib functions and types. It has a test REPL in examples/minilang-repl.

Re-exports§

pub use gcmodule;

Modules§

env
Example implementations about environment.
expr
Example implementations about expression.
lang
Example languages.
value
Example implementations about value.

Macros§

sexp
Macro for creating S-expression.

Traits§

Interpreter
A lightweight interpreter interface.