Expand description
TextWrite — the Fast Text scripting language.
TextWrite is a small, hand-written, dependency-free scripting language with
Rust-style braces and English operators (is, and, not, repeat 3 times).
This crate contains the whole pipeline:
lexerturns source text into tokens,parserbuilds anast,interpwalks the tree, andstdlibprovides the built-in functions.
use textwrite::Interpreter;
let mut tw = Interpreter::new();
let value = tw.eval_expression("2 + 3 * 4").unwrap();
assert_eq!(value.to_display(), "14");Re-exports§
pub use error::Error;pub use error::ErrorKind;pub use error::Pos;pub use error::Result;pub use error::Span;pub use host::Host;pub use host::HostRef;pub use interp::Interpreter;pub use value::Value;
Modules§
- ast
- The TextWrite abstract syntax tree.
- cli
- The
textwrite/twcommand-line interface: run files, evaluate snippets, and a small REPL. - error
- Source positions and the single error type used across TextWrite.
- host
- Embedding hook: let a host program expose native functions to a script.
- interp
- The TextWrite tree-walking interpreter.
- lexer
- The TextWrite lexer: source text in, tokens out.
- parser
- Recursive-descent parser turning tokens into an
crate::ast. - stdlib
- TextWrite’s built-in functions.
- value
- Runtime values for TextWrite.
Constants§
- VERSION
- The TextWrite language version.