1 unstable release
0.1.0 | Mar 13, 2020 |
---|
#597 in Programming languages
53KB
1K
SLoC
litto
Lightweight building blocks for implementing interpreters in Rust. Ideally for DSL use-cases.
Exmaple Languages
- tinylang: A tiny language with S-exp syntax. It basically only implements
lambda
without even primitive types like bools, ints, or lists. Note those types can be built usinglambda
. - minilang: Extends tinylang with a richer standard library and types. Run
cd examples/minilang-repl; cargo run
to try it in an REPL.
Goals
- Simple. The code should be simple to reason about.
- Powerful. Use simple concepts to express powerful features. For example, lambda can be easily implemented and it is pretty powerful.
- Easy-to-use.
- Sharing data and functions between Rust and the DSL is easy and safe.
- The DSL can easily opt-in a garbage colletor to make memory management easier.
- Flexible. Things like syntax, AST internal representation, standard library functions, types, how to resolve a name, what is a function, and how to call a function, are all customizable.
- Rust. This library is written in Rust and solves Rust problems. Not intened to be used in other languages via FFI.
Non-goals
- Performance. Performance is a best-effort within the simplicity constraint. Practically, performance-critical code should be in native Rust.
- Features. Feature-complete is not a goal, especially when it conflicts with simplicity.
- Stackless. The Rust language natively uses the native stack when calling a function. Therefore a stackless is not simple in Rust. This means things like co-routine and
call/cc
are not out-of-box. - Multi-Thread. Right now it's not a goal because the gc library does not support it.
- Stackless. The Rust language natively uses the native stack when calling a function. Therefore a stackless is not simple in Rust. This means things like co-routine and
Dependencies
~100–650KB
~13K SLoC